Make use of device/partition argument
df command can take a device or partition in argument. In this case, it prints only information about this device.
[robin@thor ~] % df /dev/sda5 Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda5 13173352 7048316 6125036 54% /var
Version 3.0.0 of
dfccan do something similar. However, it requires usage of
-poption like such:
[robin@thor ~] % dfc -p /dev/sda5 FILESYSTEM (=) USED FREE (-) %USED AVAILABLE TOTAL MOUNTED ON /dev/sda5 [===========---------] 54% 5.8G 12.6G /var
df would be nice.
#2 Updated by George Angelopoulos over 1 year ago
I'm also interested in implementing this. I want to also note that "-p" has a bad quirk: It matches the truncated string of the filesystem name as it appears in the output. For example, if you have "/dev/mapper/vgroot-lvroot", it gets truncated to "+ev/mapper/vgroot-lvroot" in the output and this is what -p matches. This is definitely a bug. Maybe it deserves it's own issue. If I end up looking into the code, I'll be back with more details.
#4 Updated by George Angelopoulos over 1 year ago
Hi Robin, thanks for responding.
Just to clarify: truncation is of course a feature. The bug is that -p matches the given string against fsname after it has been truncated. If we disagree about this being a bug, just let me know and I'll elaborate.
However... I'm not sure what the best way would be to fix this considering how the truncation happens, considering that the original fsname value just gets overwritten. A very simple fix would be to just set Wflag when pflag is set, i.e. disable truncation when matching fsnames with -p.
Another solution would be to add another variable where we store the original value of fsname (maybe a new variable in struct fsmntinfo?) which is passed to fsfilter() for the pattern matching. The behavior would then be that the matches are done against the actual fsname as it is seen in the system, but the name that is output is still truncated.
If you go ahead and completely remove truncation then this whole problem goes away.
Finally, sorry for hijacking the original issue. I just think it's worth figuring out this truncation issue before implementing the arguments feature.
In conclusion, please let me know which approach you think is the best, and I'll try to implement it.
P.S. I'm a n00b when it comes to C. I'm using dfc somewhat as a learning project. Please bear with me if I'm making any obvious oversights. :)