| 456 | } |
| 457 | |
| 458 | static int char_dev_fwrite(struct dfs_file *fd, const void *buf, rt_size_t count) |
| 459 | { |
| 460 | int ret = 0; |
| 461 | struct fal_char_device *part = (struct fal_char_device *) fd->vnode->data; |
| 462 | |
| 463 | RT_ASSERT(part != RT_NULL); |
| 464 | |
| 465 | if (DFS_FILE_POS(fd) + count > part->fal_part->len) |
| 466 | count = part->fal_part->len - DFS_FILE_POS(fd); |
| 467 | |
| 468 | ret = fal_partition_write(part->fal_part, DFS_FILE_POS(fd), buf, count); |
| 469 | |
| 470 | if (ret != (int) count) |
| 471 | return 0; |
| 472 | |
| 473 | DFS_FILE_POS(fd) += ret; |
| 474 | |
| 475 | return ret; |
| 476 | } |
| 477 | |
| 478 | static const struct dfs_file_ops char_dev_fops = |
| 479 | { |
nothing calls this directly
no test coverage detected