MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / dfs_file_read

Function dfs_file_read

components/dfs/dfs_v1/src/dfs_file.c:425–445  ·  view source on GitHub ↗

* this function will read specified length data from a file descriptor to a * buffer. * * @param fd the file descriptor. * @param buf the buffer to save the read data. * @param len the length of data buffer to be read. * * @return the actual read data bytes or 0 on end of file or failed. */

Source from the content-addressed store, hash-verified

423 * @return the actual read data bytes or 0 on end of file or failed.
424 */
425ssize_t dfs_file_read(struct dfs_file *fd, void *buf, size_t len)
426{
427 int result = 0;
428
429 if (fd == NULL)
430 {
431 return -EINVAL;
432 }
433
434 if (fd->vnode->fops->read == NULL)
435 {
436 return -ENOSYS;
437 }
438
439 if ((result = fd->vnode->fops->read(fd, buf, len)) < 0)
440 {
441 fd->flags |= DFS_F_EOF;
442 }
443
444 return result;
445}
446
447/**
448 * this function will fetch directory entries from a directory descriptor.

Callers 4

readFunction · 0.70
catFunction · 0.70
copyfileFunction · 0.70
test_dfs_readFunction · 0.50

Calls 1

readMethod · 0.45

Tested by 1

test_dfs_readFunction · 0.40