RT-Thread device filesystem interface */
| 413 | |
| 414 | /* RT-Thread device filesystem interface */ |
| 415 | static int char_dev_fopen(struct dfs_file *fd) |
| 416 | { |
| 417 | struct fal_char_device *part = (struct fal_char_device *) fd->vnode->data; |
| 418 | |
| 419 | RT_ASSERT(part != RT_NULL); |
| 420 | |
| 421 | switch (fd->flags & O_ACCMODE) |
| 422 | { |
| 423 | case O_RDONLY: |
| 424 | break; |
| 425 | case O_WRONLY: |
| 426 | case O_RDWR: |
| 427 | /* erase partition when device file open */ |
| 428 | fal_partition_erase_all(part->fal_part); |
| 429 | break; |
| 430 | default: |
| 431 | break; |
| 432 | } |
| 433 | DFS_FILE_POS(fd) = 0; |
| 434 | |
| 435 | return RT_EOK; |
| 436 | } |
| 437 | |
| 438 | static int char_dev_fread(struct dfs_file *fd, void *buf, rt_size_t count) |
| 439 | { |
nothing calls this directly
no test coverage detected