vfs: add tell function

This commit is contained in:
Michael Shaw 2023-10-23 21:54:32 -04:00
commit bec327a4cc
2 changed files with 13 additions and 0 deletions

View file

@ -152,6 +152,18 @@ int seek(int fd, size_t offset, int whence)
return fdesc->pos;
}
size_t tell(int fd)
{
struct rbnode *fdnode = rbt_search(kfd, fd);
if (!fdnode)
return -EBADF;
struct file_descriptor *fdesc = (struct file_descriptor *)fdnode->value;
return fdesc->pos;
}
int mkdir(const char *pathname)
{
return rootfs->ops.mkdir(rootfs, pathname);