* getting /dev/<DEVICE> from (MAJOR, minor)
@ 2004-07-05 18:05 Benoît Dejean
0 siblings, 0 replies; only message in thread
From: Benoît Dejean @ 2004-07-05 18:05 UTC (permalink / raw)
To: LKML
(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.
--
Benoît Dejean
JID: TazForEver@jabber.org
http://gdesklets.gnomedesktop.org
http://www.paulla.asso.fr
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-07-05 18:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-05 18:05 getting /dev/<DEVICE> from (MAJOR, minor) Benoît Dejean
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®