Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vfs: statvfs() support and df utility #55

Closed
mkilgore opened this issue Aug 3, 2020 · 0 comments
Closed

vfs: statvfs() support and df utility #55

mkilgore opened this issue Aug 3, 2020 · 0 comments

Comments

@mkilgore
Copy link
Owner

mkilgore commented Aug 3, 2020

This one should generally be pretty easy. statvfs() is just a syscall that takes a mount point and returns generic information about it like file system type, size, amount of free space, etc. The details can be seen here. Generally speaking, to implement this we just add a new function for super-blocks and then in ./src/fs/super.c we look up the correct super-block and call the function to fill in the structure (and then copy it back to userspace).

statvfs() should enable us to write a simple df utility that prints information on the current mounted file systems. The only extra part is that we need a list of the current mounted file systems so we can get all their info. The information already in /proc/mounts is probably sufficient, as it lists the mount point and df should be able to simply pass that directory directly to statvfs(), but that approach probably needs to be verified. BSD also has a getmntinfo() which basically does all of this in one shot which we could implement pretty easily, but it might make sense to avoid adding extra syscalls when we don't really need them.

mkilgore added a commit that referenced this issue Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant