linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Lukas Czerner <lczerner@redhat.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	tytso@mit.edu, sandeen@redhat.com, hch@infradead.org,
	axboe@kernel.dk
Subject: Re: [RFC PATCH 0/2 v1] Ioctl for reading block queue information
Date: Thu, 9 Dec 2010 11:54:01 -0800	[thread overview]
Message-ID: <20101209195401.GA27819@suse.de> (raw)
In-Reply-To: <A9CA290C-6611-478D-B6DD-8DF443575FC4@dilger.ca>

On Thu, Dec 09, 2010 at 12:49:32PM -0700, Andreas Dilger wrote:
> On 2010-12-09, at 12:20, Greg KH wrote:
> > On Thu, Dec 09, 2010 at 04:25:35PM +0100, Lukas Czerner wrote:
> >> For a long time it has been pretty painful to retrieve informations from
> >> /sys/block/*/queue for particular block device. Not only it is painful
> >> to retrieve informations within C tool, parsing strings, etc, but one
> >> have to run into problem even finding the proper path in sysfs.
> > 
> > What's wrong with using libudev?  That should give you all of this
> > information easily using a .c program without any need to change the
> > kernel at all.
> > 
> > Ick, no, please just use the sysfs files, don't create a new ioctl, they
> > are horrid.
> 
> Can you please show a real example of how using libudev is less horrid
> than just calling "ioctl(fd, BLKGETQUEUEINFO, &val)"?

It doesn't need permissions to open that fd in the first place, and in
maintaining the ioctl from within the kernel code, it's a _world_ easier
to handle over time.

I'm not saying that your .c code is somehow "easier" than just using an
ioctl, I'm saying that it is "future proof and saner" to use libudev
than to try to parse sysfs files yourself.

> How is trying to map a block device name from /etc/mtab (via
> getmntent()) into a possibly wildly different block device name in
> /sys (e.g. /dev/vgroot/lvhome vs. /dev/dm-0 vs.
> /dev/mapper/vgroot-lvhome => /sys/block/dm-0), then parsing text
> output considered a "good API"?

Again, use libudev, it handles that mapping for you and you don't have
to parse text output.

good luck,

greg k-h

  reply	other threads:[~2010-12-09 19:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-09 15:25 [RFC PATCH 0/2 v1] Ioctl for reading block queue information Lukas Czerner
2010-12-09 15:25 ` [PATCH 1/2] blk-sysfs: Clean-up attribute definitions Lukas Czerner
2010-12-09 15:25 ` [PATCH 2/2] Add BLKGETQUEUEINFO for reading block queue attributes Lukas Czerner
2010-12-10 18:39   ` Arnd Bergmann
2010-12-09 19:20 ` [RFC PATCH 0/2 v1] Ioctl for reading block queue information Greg KH
2010-12-09 19:49   ` Andreas Dilger
2010-12-09 19:54     ` Greg KH [this message]
2010-12-10 14:07     ` Lukas Czerner
2010-12-10 17:34       ` Greg KH
2010-12-10 17:59         ` Lukas Czerner
2010-12-10 18:25           ` Kay Sievers
2010-12-10 18:38             ` Lukas Czerner
2010-12-10 17:51       ` Kay Sievers
2010-12-10 17:54         ` Lukas Czerner

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=20101209195401.GA27819@suse.de \
    --to=gregkh@suse.de \
    --cc=adilger.kernel@dilger.ca \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=lczerner@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=tytso@mit.edu \
    /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;
as well as URLs for NNTP newsgroup(s).