mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Benoît Dejean" <TazForEver@free.fr>
To: LKML <linux-kernel@vger.kernel.org>
Subject: getting /dev/<DEVICE> from (MAJOR, minor)
Date: Mon, 05 Jul 2004 20:05:50 +0200	[thread overview]
Message-ID: <1089050750.20203.12.camel@athlon> (raw)

(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


                 reply	other threads:[~2004-07-05 18:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1089050750.20203.12.camel@athlon \
    --to=tazforever@free.fr \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®