-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
Selectively refreshing disks #1375
Comments
Seems a bit weird to want to have disks but not their path or even their kind. I think the best course would be to instead detect when the |
I was thinking those would be present in the
Hummm. Canonicalize (on linux) IIUC is just |
The kind is retrieved from the function using
Mostly checking if it's a link, if not, checking if it doesn't start with Any clue why |
Ah, I see. I was thinking about So in my suggestion, I guess the populated fields would be
I believe it happens during the |
I think However the |
I'm not sure what you mean about |
Sure. Like for |
Ahh, I see. That's perfect! I'd be happy to extend that pattern over
... sound about right? That would work for me :) |
Yes but that wouldn't solve your problem since I still want |
What if you always get |
That could work. Only question, what value do you put into |
I'm not sure. I don't use the |
Indeed, I don't want an |
FWIW: even if it weren't for the annoying warnings, I would still use this functionality, since I'm currently loading way more information than I actually need :) |
We can do it in two passes then: a PR to implement the selective refresh and another where we can debate what's best for |
Look for a PR early next week! |
Thanks in advance! |
When running
Disks::new_with_refreshed_list()
on android devices, I often see warnings (from SELinux?) along the lines of:I've done some spelunking, and it appears they are a side-effect of this
canonicalize
call, on certain disks' mount points.(N.b. the dev="tmpfs" in the warning doesn't refer to the type of the filesystem being refreshed. I'm not using
linux-tmpfs
, so they're filtered out. In debugging, I've seen the warning for "ext4" and "fuse" filesystems.)I know these warnings are harmless! ...but I've had customers who were alarmed about them, so I'd prefer to avoid generating them. Given my use-case (I'm only reporting disk usage over time for one disk), I'd love some sort of mechanism for selectively refreshing
Disks
. There are lots of options.My first suggestion would be a separate
Disks
constructor (new_with_list()
ornew_with_unrefreshed_list()
?) that loads the list of disks from /proc/mounts, but defers the stat collection until a laterrefresh
. On linux, at least, I think the separation makes sense, and it gives complete control over what is refreshed to the library user, without adding much complexity to the interface. On other platforms, I haven't looked, but it seems like the worst-case would simply be thatnew_with_list()
callsnew_with_refreshed_list()
on platforms where there's no distinction between listing and refreshing.I'd be happy to do the work. If my proposal sounds reasonable, I'll submit a PR next week and we can hash out the specifics. If not, I'd be open to other ways of solving this... just let me know :)
The text was updated successfully, but these errors were encountered: