vfs: add tell function
This commit is contained in:
parent
d42cd7b090
commit
bec327a4cc
2 changed files with 13 additions and 0 deletions
12
fs/vfs.c
12
fs/vfs.c
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ int read(int fd, void *buf, size_t count);
|
|||
int open(const char *pathname, int flags);
|
||||
int close(int fd);
|
||||
int seek(int fd, size_t offset, int whence);
|
||||
size_t tell(int fd);
|
||||
int statfd(int fd, struct statbuf *statbuf);
|
||||
int mkdir(const char *pathname);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue