* this function will write some specified length data to file system. * * @param fd the file descriptor. * @param buf the data buffer to be written. * @param len the data buffer length * * @return the actual written data length. */
| 537 | * @return the actual written data length. |
| 538 | */ |
| 539 | ssize_t dfs_file_write(struct dfs_file *fd, const void *buf, size_t len) |
| 540 | { |
| 541 | if (fd == NULL) |
| 542 | { |
| 543 | return -EINVAL; |
| 544 | } |
| 545 | |
| 546 | if (fd->vnode->fops->write == NULL) |
| 547 | { |
| 548 | return -ENOSYS; |
| 549 | } |
| 550 | |
| 551 | return fd->vnode->fops->write(fd, buf, len); |
| 552 | } |
| 553 | |
| 554 | /** |
| 555 | * this function will flush buffer on a file descriptor. |