-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
Make disks show info about unmounted disks as well, first effort #1446
base: master
Are you sure you want to change the base?
Conversation
Not sure if it's really useful but if you're willing to implement it for all sysinfo supported systems, I'm fine with it. |
|
||
container.push(new_disk( | ||
disk.as_ref(), | ||
mount_point, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this new feature, I think mount_point
should become an enum looking like this:
enum MountPoint {
Path(Path)
Swap,
Unmounted,
}
I don't have a Mac (and don't know it's system), so I doubt I can implement for it. But I can try with Windows. |
// The list of unmounted disks, initially it include all disks | ||
let mut unmounted = procfs_disk_stats | ||
.keys() | ||
.map(|disk| "/dev/".to_owned() + disk) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be a const?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The /dev/
part? I suppose it could be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
We clone the keys of
procfs_disk_stats
to create a list of all disks, including unmounted ones, and let's call thatunmounted
. Then after adding the mounted disks (and at the same time removing those disks from theunmounted
), we can iterate over unmounted and add the remaining disks.Unmounted disks will have "Unknown" file system and empty mount point, except Zram, which has "swap" file system and "[SWAP]" mount point (like lsblk).