getting /dev/<DEVICE> from (MAJOR, minor)
(sorry for my english)
(sorry if this is not the good place to ask, but i didn't get any anwser on comp.os.linux.development.system)
Hi, i'd like to retrieve iostats from /sys in a userspace program. My
library has a function fsusage(mount_point) which is implemented using statvfs(), etc. I'd like to extend it to provide information described in linux/documentation/iostats.txt : read/write sectors (? the documentation doesn't say what is a sector, am i wrong if i assume it's 512B on every arch and filesystem ?).
So i need to know the device name to browse /sys/block to the 'stat'
file. I would like to avoid getmntent() (retrieving the device name from the mount table). I was thinking about retrieving the (major, minor) with stat() in order to get the devname. But i didn't find any quick way to get it (readdir()-ing /dev is stupid, i'd better use getmntent()).
How can i retrieve the devname with its (M, m) ?
I want to avoid getmntent, not for performance issue (should not be
critical) but for internal reasons. Btw, even if i finally read the mnttab, i'm interested in the answer.
thank you.
Signature · 4 lines
Benoît Dejean JID: [email protected] http://gdesklets.gnomedesktop.org http://www.paulla.asso.fr