ext2: slightly clean up indirect read/alloc

This commit is contained in:
Michael Shaw 2023-10-21 14:25:28 -04:00
commit 0a1b73edc2
4 changed files with 275 additions and 169 deletions

View file

@ -64,6 +64,20 @@ int read(int fd, void *buf, size_t count)
return ret;
}
int statfd(int fd, struct statbuf *statbuf)
{
struct rbnode *fdnode = rbt_search(kfd, fd);
if (!fdnode)
return -EBADF;
struct file_descriptor *fdesc = (struct file_descriptor *)fdnode->value;
statbuf->size = fdesc->file.size;
return 0;
}
int open(const char *pathname, int flags)
{
/* allocate a file descriptor */