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

Support for fetching disk quota information #290

Open
Heliozoa opened this issue Nov 24, 2020 · 2 comments
Open

Support for fetching disk quota information #290

Heliozoa opened this issue Nov 24, 2020 · 2 comments
Labels
A-disk Area: heim-disk crate C-design Category: design decisions and discussions C-enhancement Category: new feature or request

Comments

@Heliozoa
Copy link

Hi, thanks for your work on heim.
Would it be possible to add functionality relating to disk quotas? In particular, I was looking for a cross-platform way to find the remaining disk space with the quota being taken into account. As far as I can tell there's no crate that does it at the moment, so it would be nice to see in heim. Thanks!

@svartalf svartalf added A-disk Area: heim-disk crate C-design Category: design decisions and discussions C-enhancement Category: new feature or request labels Dec 1, 2020
@svartalf
Copy link
Member

svartalf commented Dec 1, 2020

Hi, @Heliozoa! That is a great idea, but I dont have enough knowledge if it's possible to implement it properly (and preferably cross-platform), so it needs to be researched first.
If you have any insights on that matter, that would be really helpful.

@Heliozoa
Copy link
Author

Heliozoa commented Dec 3, 2020

I'm not too knowledgeable either, unfortunately. My understanding is that disk quotas are supported at least on all the tier 1 platforms.

On Windows: https://docs.microsoft.com/en-gb/windows/win32/fileio/managing-disk-quotas

nix has a module for disk quotas: https://docs.rs/nix/0.18.0/nix/sys/quota/index.html
But I get an ENOSYS error trying to use it. quotactl's manpage says the error means my "kernel has not been compiled with the CONFIG_QUOTA option", but I don't think that's the case. I might just be using the command wrong, I'm not too experienced with APIs this low-level. I'll try and investigate this later and hopefully fix it so I can play around with the commands a bit.

It looks like Usage::free() is already quota-aware on Windows: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getdiskfreespaceexa

If per-user quotas are being used, this value may be less than the total number of free bytes on a disk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-disk Area: heim-disk crate C-design Category: design decisions and discussions C-enhancement Category: new feature or request
Projects
None yet
Development

No branches or pull requests

2 participants