Re: [PATCH/RFC] allow mapping from block-device-file to sysfs entry.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2007-08-07 at 16:07 +1000, Neil Brown wrote:
> Suppose that in a program I have an open file descriptor for a device,
> and I want to find the /sys/block information for this device.
> There is currently no direct way to do this.  I need to read
>    /sys/block/*/dev, /sys/block/*/*/dev
> and match major/minor numbers with the result from fstat.
> 
> I would like a more direct mechanism.
> 
> The following patch is a proposal for such a mechanism.
> 
> It provides an 'ioctl' which returns then 'name' of the device, as
> generated by bdevname.  This is the same name that is used to create
> entries in sysfs.
> For a partition of a device, it returns 'device/partition'.


how about returning the entire path relative to the start of sysfs? That
way, if things move or something you're tolerant against that....

(I'd not be against making this a generic IOCTL for every device, a
SYSFSLOCATION kind of ioctl... it's by no means block specific...)


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux