[systemd-devel] How to use libudev to monitor for /sys/firmware/iscsi_boot*?

Greg KH gregkh at linuxfoundation.org
Fri Dec 5 15:03:22 PST 2014

On Fri, Dec 05, 2014 at 01:42:29PM -0800, Lee Duncan wrote:
> On 12/05/2014 01:14 PM, Greg KH wrote:
> > On Fri, Dec 05, 2014 at 11:51:16AM -0800, Lee Duncan wrote:
> >> Hi:
> >>
> >> I am trying to figure out how to use libudev to monitor for new iSCSI
> >> boot targets.
> >>
> >> For Emulex CNA cards, a new directory gets created of the form
> >> /sys/firmware/iscsi_bootN.
> > 
> > Really?  That's horrid, what kernel driver is doing that?
> Why is it horrid? drivers/scsi/iscsi_boot_sysfs.c does that, and it
> looks like it's been doing it for quite a while.
> The code in open-iscsi that looks for firmware iSCSI boot targets knows
> to look in both "/sys/firmware/iscsi_boot%d, and in /sys/firmware/ibft.
> iBFT is actually the standard, but many iSCSI CNA cards don't follow the
> standard.

Why is this a "firmware" thing at all?  These are devices, and
attributes for different devices, how are they related to firmware like
ACPI and PnP?

> >> I am new to libudev, but it looks like it's set up to monitor for new
> >> devices. Can I use it to monitor for non-device events? There must be
> >> some better way than polling.
> > 
> > Yes, go kick some kernel developers to do this "properly", which does
> > not mean using "raw" kobjects.  If you want, I will be glad to do that,
> > just point me at them...
> Feel free to kick away, though I'm still not sure why (or who). The
> '/sys/firmware' subsystem seems like a good place to me for iSCSI CNA
> cards to place their firmware target information. But I obviously have
> much to learn about it.
> And, for the record, I believe you are saying that my interpretation of
> libudev was right: it's not the tool to detect new iSCSI boot target
> presence, at least using the current /sys/firmware/iscsi_boot%d
> architecture. Correct?

That is correct, and that is why it's not a good idea for the kernel to
be placing code in such a location where no tool will ever be able to
see it.  It is making your life harder than it has to be, but now that
it is in that location, the odds of being able to move it out is slim.

greg k-h

More information about the systemd-devel mailing list