linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udev does not create scsi disk entries during bootup
@ 2003-11-13  5:28 Surekha.PC
  2003-11-13  6:25 ` Greg KH
                   ` (26 more replies)
  0 siblings, 27 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-13  5:28 UTC (permalink / raw)
  To: linux-hotplug


Hi all,

  I am not able to create the scsi disk entries during boot time using
udev.
  Manual addtion/removal of device entries using udev program works
fine.
  I have installed latest hotplug scripts.

  Am I missing something here ?

Appreciate your help.

Thanks,
surekha   




-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
@ 2003-11-13  6:25 ` Greg KH
  2003-11-13  8:13 ` Surekha.PC
                   ` (25 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Greg KH @ 2003-11-13  6:25 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Nov 13, 2003 at 10:46:33AM +0530, Surekha.PC wrote:
> 
>   I am not able to create the scsi disk entries during boot time using
> udev.
>   Manual addtion/removal of device entries using udev program works
> fine.
>   I have installed latest hotplug scripts.
> 
>   Am I missing something here ?

Anything in your debug logs to show that udev is really running?
Is /etc/hotplug.d/default/udev.hotplug pointing to your udev binary?

greg k-h


-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
  2003-11-13  6:25 ` Greg KH
@ 2003-11-13  8:13 ` Surekha.PC
  2003-11-14  1:07 ` Greg KH
                   ` (24 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-13  8:13 UTC (permalink / raw)
  To: linux-hotplug


Hi Greg,

>Anything in your debug logs to show that udev is really running? Is
>/etc/hotplug.d/default/udev.hotplug pointing to your udev binary?

The debug log is empty, it seems udev is not being invoked by hotplug
program.
The symlink exists from udev.hotplug to the binary.

CONFIG_HOTPLUG is enabled in the kernel.
The sd_mod driver is not a module, it is made part of the kernel.
Is that ok?

Thanks,
surekha


-----Original Message-----
From: linux-hotplug-devel-admin@lists.sourceforge.net
[mailto:linux-hotplug-devel-admin@lists.sourceforge.net] On Behalf Of
Greg KH
Sent: Thursday, November 13, 2003 11:56 AM
To: Surekha.PC
Cc: linux-hotplug-devel@lists.sourceforge.net
Subject: Re: udev does not create scsi disk entries during bootup


On Thu, Nov 13, 2003 at 10:46:33AM +0530, Surekha.PC wrote:
> 
>   I am not able to create the scsi disk entries during boot time using

> udev.
>   Manual addtion/removal of device entries using udev program works 
> fine.
>   I have installed latest hotplug scripts.
> 
>   Am I missing something here ?

Anything in your debug logs to show that udev is really running? Is
/etc/hotplug.d/default/udev.hotplug pointing to your udev binary?

greg k-h


-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest developments in
Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more!
http://www.apachecon.com/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel



-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
  2003-11-13  6:25 ` Greg KH
  2003-11-13  8:13 ` Surekha.PC
@ 2003-11-14  1:07 ` Greg KH
  2003-11-14  3:55 ` Surekha.PC
                   ` (23 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Greg KH @ 2003-11-14  1:07 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Nov 13, 2003 at 01:31:33PM +0530, Surekha.PC wrote:
> 
> Hi Greg,
> 
> >Anything in your debug logs to show that udev is really running? Is
> >/etc/hotplug.d/default/udev.hotplug pointing to your udev binary?
> 
> The debug log is empty, it seems udev is not being invoked by hotplug
> program.
> The symlink exists from udev.hotplug to the binary.

And does your /sbin/hotplug binary say that it will read from the
/etc/hotplug.d directories?

> CONFIG_HOTPLUG is enabled in the kernel.
> The sd_mod driver is not a module, it is made part of the kernel.
> Is that ok?

That's fine, but remember, only devices found after init mounts your
root disk will show up as being found by udev for right now, unless you
put udev into initramfs somehow.

thanks,

greg k-h


-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (2 preceding siblings ...)
  2003-11-14  1:07 ` Greg KH
@ 2003-11-14  3:55 ` Surekha.PC
  2003-11-17  4:54 ` Surekha.PC
                   ` (22 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-14  3:55 UTC (permalink / raw)
  To: linux-hotplug



>> >Anything in your debug logs to show that udev is really running? Is 
>> >/etc/hotplug.d/default/udev.hotplug pointing to your udev binary?
 
>> The debug log is empty, it seems udev is not being invoked by hotplug

>> program. The symlink exists from udev.hotplug to the binary.

>And does your /sbin/hotplug binary say that it will read from the
/etc/hotplug.d 
>directories?

Yes, it mentions that it reads from /etc/hotplug.d path.

I downloaded this package from the following URL.
http://kernel.org/pub/linux/utils/kernel/hotplug/hotplug-2003_08_05.tar.
gz

 
>> CONFIG_HOTPLUG is enabled in the kernel.
>> The sd_mod driver is not a module, it is made part of the kernel. Is 
>> that ok?

>That's fine, but remember, only devices found after init mounts your
root disk will show >up as being found by udev for right now, unless you
put udev into initramfs somehow.

Ok, that being the case, the local scsi disks would not be seen by udev
during bootup unless it is part of initrd, right ?

However I am bring up my iSCSI services, after root disk is mounted, so
these disks have to be recognised by udev. Stopping the iSCSI service,
will deconfigure the iSCSI disks, this should remove the disk entries in
udev.
Is it possible to achive this funtionality with the latest hotplug and
udev?

FYI, the /etc/hotplug directory has scsi.agent installed, along with
usb, pci ..etc.


Thanks,
surekha 




-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (3 preceding siblings ...)
  2003-11-14  3:55 ` Surekha.PC
@ 2003-11-17  4:54 ` Surekha.PC
  2003-11-17 13:02 ` Martin Hicks
                   ` (21 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-17  4:54 UTC (permalink / raw)
  To: linux-hotplug


Hi,

  I am not able to run udev during boot time inspite of having installed
udev, and the associated configuration.
Appreciate help in resolving this issue soon.

Is this feature working for udev-005 right now or one needs to manually
run "udev add/remove" to configure devices ?

TIA,
surekha

>> >Anything in your debug logs to show that udev is really running? Is
>> >/etc/hotplug.d/default/udev.hotplug pointing to your udev binary?
 
>> The debug log is empty, it seems udev is not being invoked by hotplug

>> program. The symlink exists from udev.hotplug to the binary.

>And does your /sbin/hotplug binary say that it will read from the
/etc/hotplug.d 
>directories?

Yes, it mentions that it reads from /etc/hotplug.d path.

I downloaded this package from the following URL.
http://kernel.org/pub/linux/utils/kernel/hotplug/hotplug-2003_08_05.tar.
gz

 
>> CONFIG_HOTPLUG is enabled in the kernel.
>> The sd_mod driver is not a module, it is made part of the kernel. Is
>> that ok?

>That's fine, but remember, only devices found after init mounts your
root disk will show >up as being found by udev for right now, unless you
put udev into initramfs somehow.

Ok, that being the case, the local scsi disks would not be seen by udev
during bootup unless it is part of initrd, right ?

However I am bring up my iSCSI services, after root disk is mounted, so
these disks have to be recognised by udev. Stopping the iSCSI service,
will deconfigure the iSCSI disks, this should remove the disk entries in
udev. Is it possible to achive this funtionality with the latest hotplug
and udev?

FYI, the /etc/hotplug directory has scsi.agent installed, along with
usb, pci ..etc.


Thanks,
surekha 





-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (4 preceding siblings ...)
  2003-11-17  4:54 ` Surekha.PC
@ 2003-11-17 13:02 ` Martin Hicks
  2003-11-18  8:23 ` Surekha.PC
                   ` (20 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Martin Hicks @ 2003-11-17 13:02 UTC (permalink / raw)
  To: linux-hotplug

On Sun, 2003-11-16 at 23:52, Surekha.PC wrote:
> Hi,
> 
>   I am not able to run udev during boot time inspite of having installed
> udev, and the associated configuration.
> Appreciate help in resolving this issue soon.
> 
> Is this feature working for udev-005 right now or one needs to manually
> run "udev add/remove" to configure devices ?

I suspect that you still have to run udev-005 manually unless the
devices are detected after the hotplug service starts (i.e., if your
scsi disk code is a module).  Is that right Greg?

mh
-- 
Martin Hicks                Wild Open Source Inc.
mort@wildopensource.com     613-266-2296




-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (5 preceding siblings ...)
  2003-11-17 13:02 ` Martin Hicks
@ 2003-11-18  8:23 ` Surekha.PC
  2003-11-19 13:48 ` Surekha.PC
                   ` (19 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-18  8:23 UTC (permalink / raw)
  To: linux-hotplug


>> Hi,
>>
>>   I am not able to run udev during boot time inspite of having 
>> installed udev, and the associated configuration. Appreciate help in 
>> resolving this issue soon.
>> 
>> Is this feature working for udev-005 right now or one needs to 
>> manually run "udev add/remove" to configure devices ?

>I suspect that you still have to run udev-005 manually unless the
devices are detected after the hotplug service starts 
>(i.e., if your scsi disk code is a module).  Is that right Greg?


Ok, that applies for native scsi disks. I have a iSCSI setup. My iSCSI
disks are detected long after hotplug service has started. In that case,
the device entries should have been created by udev.
Does this still require sd_mod to be loaded as a module?

Thanks,
surekha

 

-----Original Message-----
From: Martin Hicks [mailto:mort@wildopensource.com] 
Sent: Monday, November 17, 2003 6:33 PM
To: Surekha.PC
Cc: linux-hotplug-devel@lists.sourceforge.net
Subject: RE: udev does not create scsi disk entries during bootup


On Sun, 2003-11-16 at 23:52, Surekha.PC wrote:
> Hi,
> 
>   I am not able to run udev during boot time inspite of having 
> installed udev, and the associated configuration. Appreciate help in 
> resolving this issue soon.
> 
> Is this feature working for udev-005 right now or one needs to 
> manually run "udev add/remove" to configure devices ?

I suspect that you still have to run udev-005 manually unless the
devices are detected after the hotplug service starts (i.e., if your
scsi disk code is a module).  Is that right Greg?

mh
-- 
Martin Hicks                Wild Open Source Inc.
mort@wildopensource.com     613-266-2296





-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (6 preceding siblings ...)
  2003-11-18  8:23 ` Surekha.PC
@ 2003-11-19 13:48 ` Surekha.PC
  2003-11-19 23:57 ` Greg KH
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-19 13:48 UTC (permalink / raw)
  To: linux-hotplug


Hi all,

 Request your attention for the problem I am facing. This issue is
urgent for our iSCSI driver inclusion to 2.6 kernel.

Appreciate your response.

Thanks,
surekha

-----Original Message-----
From: Surekha.PC [mailto:surekhap@cisco.com] 
Sent: Tuesday, November 18, 2003 1:42 PM
To: 'Martin Hicks'
Cc: 'linux-hotplug-devel@lists.sourceforge.net'
Subject: RE: udev does not create scsi disk entries during bootup



>> Hi,
>>
>>   I am not able to run udev during boot time inspite of having
>> installed udev, and the associated configuration. Appreciate help in 
>> resolving this issue soon.
>> 
>> Is this feature working for udev-005 right now or one needs to
>> manually run "udev add/remove" to configure devices ?

>I suspect that you still have to run udev-005 manually unless the 
>devices are detected after the hotplug service starts
>(i.e., if your scsi disk code is a module).  Is that right Greg?


Ok, that applies for native scsi disks. I have a iSCSI setup. My iSCSI
disks are detected long after hotplug service has started. In that case,
the device entries should have been created by udev. Does this still
require sd_mod to be loaded as a module?

Thanks,
surekha

 

-----Original Message-----
From: Martin Hicks [mailto:mort@wildopensource.com] 
Sent: Monday, November 17, 2003 6:33 PM
To: Surekha.PC
Cc: linux-hotplug-devel@lists.sourceforge.net
Subject: RE: udev does not create scsi disk entries during bootup


On Sun, 2003-11-16 at 23:52, Surekha.PC wrote:
> Hi,
> 
>   I am not able to run udev during boot time inspite of having
> installed udev, and the associated configuration. Appreciate help in 
> resolving this issue soon.
> 
> Is this feature working for udev-005 right now or one needs to
> manually run "udev add/remove" to configure devices ?

I suspect that you still have to run udev-005 manually unless the
devices are detected after the hotplug service starts (i.e., if your
scsi disk code is a module).  Is that right Greg?

mh
-- 
Martin Hicks                Wild Open Source Inc.
mort@wildopensource.com     613-266-2296





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (7 preceding siblings ...)
  2003-11-19 13:48 ` Surekha.PC
@ 2003-11-19 23:57 ` Greg KH
  2003-11-20 15:11 ` Surekha.PC
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Greg KH @ 2003-11-19 23:57 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Nov 14, 2003 at 09:13:30AM +0530, Surekha.PC wrote:
> 
> root disk will show >up as being found by udev for right now, unless you
> put udev into initramfs somehow.
> 
> Ok, that being the case, the local scsi disks would not be seen by udev
> during bootup unless it is part of initrd, right ?

udev would need to be initrd, and sysfs needs to be mounted.  Have you
done that?

> However I am bring up my iSCSI services, after root disk is mounted, so
> these disks have to be recognised by udev. Stopping the iSCSI service,
> will deconfigure the iSCSI disks, this should remove the disk entries in
> udev.
> Is it possible to achive this funtionality with the latest hotplug and
> udev?

Yes, make sure that sysfs is mounted before you start finding the iscsi
devices.

Good luck,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (8 preceding siblings ...)
  2003-11-19 23:57 ` Greg KH
@ 2003-11-20 15:11 ` Surekha.PC
  2003-11-20 16:46 ` Greg KH
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-20 15:11 UTC (permalink / raw)
  To: linux-hotplug


Hi,

>> 
>> root disk will show >up as being found by udev for right now, unless 
>> you put udev into initramfs somehow.
>> 
>> Ok, that being the case, the local scsi disks would not be seen by 
>> udev during bootup unless it is part of initrd, right ?

>udev would need to be initrd, and sysfs needs to be mounted.  Have you
done that?

Ok thanks for that, I will try making udev part of initrd and test this
feature.

>> However I am bring up my iSCSI services, after root disk is mounted, 
>> so these disks have to be recognised by udev. Stopping the iSCSI 
>> service, will deconfigure the iSCSI disks, this should remove the
disk 
>> entries in udev. Is it possible to achive this funtionality with the 
>> latest hotplug and udev?

>Yes, make sure that sysfs is mounted before you start finding the iscsi
devices.

I have automounted sysfs. The /sys/block/ shows the iSCSI device
entries.
But hotplug event is not notified by the kernel. This is the reason why
udev
is not getting triggered for configuring device nodes.

I have few queries about the way hotplug mechanism works.

The /etc/hotplug/scsi.agent script does not seem to handle the "ACTION"
add/remove of a scsi device ?
Also the "/usr/src/linux/drivers/scsi" driver code does not have any
hotplug
initialization functions, then how does it indicate "/sbin/hotplug"
program about the addition/deletion of device ?

I have referred the hotplug documentation in the follg URL FYI
http://linux-hotplug.sourceforge.net/?selected=hotplug


Thanks,
surekha



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (9 preceding siblings ...)
  2003-11-20 15:11 ` Surekha.PC
@ 2003-11-20 16:46 ` Greg KH
  2003-11-20 16:53 ` Greg KH
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Greg KH @ 2003-11-20 16:46 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Nov 20, 2003 at 08:29:05PM +0530, Surekha.PC wrote:
> 
> >Yes, make sure that sysfs is mounted before you start finding the iscsi
> devices.
> 
> I have automounted sysfs. The /sys/block/ shows the iSCSI device
> entries.
> But hotplug event is not notified by the kernel. This is the reason
> why udev is not getting triggered for configuring device nodes.

How do you know hotplug is not running?  It will if CONFIG_HOTPLUG is
enabled in your kernel.

> I have few queries about the way hotplug mechanism works.
> 
> The /etc/hotplug/scsi.agent script does not seem to handle the "ACTION"
> add/remove of a scsi device ?

It should.

> Also the "/usr/src/linux/drivers/scsi" driver code does not have any
> hotplug initialization functions, then how does it indicate
> "/sbin/hotplug" program about the addition/deletion of device ?

The kobject core code does this when a scsi kobject is created.

thanks,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (10 preceding siblings ...)
  2003-11-20 16:46 ` Greg KH
@ 2003-11-20 16:53 ` Greg KH
  2003-11-20 18:38 ` Clay Haapala
                   ` (14 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Greg KH @ 2003-11-20 16:53 UTC (permalink / raw)
  To: linux-hotplug

On Wed, Nov 19, 2003 at 07:06:03PM +0530, Surekha.PC wrote:
> 
> Hi all,
> 
>  Request your attention for the problem I am facing. This issue is
> urgent for our iSCSI driver inclusion to 2.6 kernel.

Getting udev to work for your devices has nothing to do with getting
your iscsi driver to be included in the main 2.6 kernel.  Why do you say
that?

thanks,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (11 preceding siblings ...)
  2003-11-20 16:53 ` Greg KH
@ 2003-11-20 18:38 ` Clay Haapala
  2003-11-20 18:41 ` Greg KH
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Clay Haapala @ 2003-11-20 18:38 UTC (permalink / raw)
  To: linux-hotplug

On Thu, 20 Nov 2003, Greg KH uttered the following:
> On Wed, Nov 19, 2003 at 07:06:03PM +0530, Surekha.PC wrote:
>> 
>> Hi all,
>> 
>>  Request your attention for the problem I am facing. This issue is
>> urgent for our iSCSI driver inclusion to 2.6 kernel.
> 
> Getting udev to work for your devices has nothing to do with getting
> your iscsi driver to be included in the main 2.6 kernel.  Why do you
> say that?
> 
> thanks,
> 
In the effort to get this iSCSI driver included into the 2.6 kernel,
we are making a number of changes in response to comments from the
SCSI maintainers.  Many of these comments are regarding work-arounds
or designs currently in our [2.2/2.4-derived] driver that should be
removed or redesigned in favor of features now available in 2.6.  Udev
is one of those features.

iSCSI is a weird beast that allows SCSI commands to be sent over a TCP
network to a target device (usually fibrechannel-attached disk or
tape).  During normal operation, there is the opportunity for hotplug
events based on network access, etc.  Trying to boot from an iSCSI
disk is another, perhaps more complex, set of issues.  We are trying
our best to understand new things such as udev as fast as we can to
make best use of them.

That we are putting time pressure on ourselves for 2.6 inclusion is
not your or the community's problem, of course.  We do appreciate the
help that all of you provide.  I hope this information has helped to
answer your question.

Regards,
-- 
Clay Haapala (chaapala@cisco.com) Cisco Systems SRBU +1 763-398-1056
   6450 Wedgwood Rd, Suite 130 Maple Grove MN 55311 PGP: C89240AD
     Well, looks like hypocrisy is back on the airwaves.
       C'mon, Rush!  Do the crime, do the time, right?


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (12 preceding siblings ...)
  2003-11-20 18:38 ` Clay Haapala
@ 2003-11-20 18:41 ` Greg KH
  2003-11-20 19:11 ` Clay Haapala
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Greg KH @ 2003-11-20 18:41 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Nov 20, 2003 at 12:38:12PM -0600, Clay Haapala wrote:
> On Thu, 20 Nov 2003, Greg KH uttered the following:
> > On Wed, Nov 19, 2003 at 07:06:03PM +0530, Surekha.PC wrote:
> >> 
> >> Hi all,
> >> 
> >>  Request your attention for the problem I am facing. This issue is
> >> urgent for our iSCSI driver inclusion to 2.6 kernel.
> > 
> > Getting udev to work for your devices has nothing to do with getting
> > your iscsi driver to be included in the main 2.6 kernel.  Why do you
> > say that?
> > 
> > thanks,
> > 
> In the effort to get this iSCSI driver included into the 2.6 kernel,
> we are making a number of changes in response to comments from the
> SCSI maintainers.  Many of these comments are regarding work-arounds
> or designs currently in our [2.2/2.4-derived] driver that should be
> removed or redesigned in favor of features now available in 2.6.  Udev
> is one of those features.

Um, but what features does udev require, that any other well working
scsi driver not require?  sysfs support?  I thought the scsi core would
provide that for you.

thanks,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (13 preceding siblings ...)
  2003-11-20 18:41 ` Greg KH
@ 2003-11-20 19:11 ` Clay Haapala
  2003-11-21  5:49 ` Surekha.PC
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Clay Haapala @ 2003-11-20 19:11 UTC (permalink / raw)
  To: linux-hotplug

On Thu, 20 Nov 2003, Greg KH spake thusly:

> On Thu, Nov 20, 2003 at 12:38:12PM -0600, Clay Haapala wrote:
>> On Thu, 20 Nov 2003, Greg KH uttered the following:
>> > On Wed, Nov 19, 2003 at 07:06:03PM +0530, Surekha.PC wrote:
>> >> 
>> >> Hi all,
>> >> 
>> >>  Request your attention for the problem I am facing. This issue
>> >>  is
>> >> urgent for our iSCSI driver inclusion to 2.6 kernel.
>> > 
>> > Getting udev to work for your devices has nothing to do with
>> > getting your iscsi driver to be included in the main 2.6 kernel.
>> > Why do you say that?
>> > 
>> > thanks,
>> > 
>> In the effort to get this iSCSI driver included into the 2.6
>> kernel, we are making a number of changes in response to comments
>> from the SCSI maintainers.  Many of these comments are regarding
>> work-arounds or designs currently in our [2.2/2.4-derived] driver
>> that should be removed or redesigned in favor of features now
>> available in 2.6.  Udev is one of those features.
> 
> Um, but what features does udev require, that any other well working
> scsi driver not require?  sysfs support?  I thought the scsi core
> would provide that for you.
> 
> thanks,
> 
> greg k-h

Being newest to iSCSI dev, I probably shouldn't have entered the
discussion, since I'm not sure that what is needed is a new udev
feature, or rather a better understanding of udev.
-- 
Clay Haapala (chaapala@cisco.com) Cisco Systems SRBU +1 763-398-1056
   6450 Wedgwood Rd, Suite 130 Maple Grove MN 55311 PGP: C89240AD
     Well, looks like hypocrisy is back on the airwaves.
       C'mon, Rush!  Do the crime, do the time, right?


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (14 preceding siblings ...)
  2003-11-20 19:11 ` Clay Haapala
@ 2003-11-21  5:49 ` Surekha.PC
  2003-11-21  6:12 ` Greg KH
                   ` (10 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-21  5:49 UTC (permalink / raw)
  To: linux-hotplug


We need to make hotplugging work with udev for iSCSI devices, so that
persistent named device nodes are dynamically configured/de-configured.
iSCSI users look upon the persistent device nodes for any operation on
iSCSI devices.

We have a iSCSI network boot feature for which, we need to use
persistent device entries for early boot. Earlier we were creating our
own symlinks for persistency.

Now for 2.6 kernel changes, we are planning to use udev to do that work
for us, so we will need to make this feature working for completeness.

To achieve these things, I need to make udev work in hotplug mode. That
was the intent of my mention.

Thanks,
surekha

-----Original Message-----
From: linux-hotplug-devel-admin@lists.sourceforge.net
[mailto:linux-hotplug-devel-admin@lists.sourceforge.net] On Behalf Of
Greg KH
Sent: Thursday, November 20, 2003 10:24 PM
To: Surekha.PC
Cc: 'Martin Hicks'; linux-hotplug-devel@lists.sourceforge.net
Subject: Re: udev does not create scsi disk entries during bootup


On Wed, Nov 19, 2003 at 07:06:03PM +0530, Surekha.PC wrote:
> 
> Hi all,
> 
>  Request your attention for the problem I am facing. This issue is 
> urgent for our iSCSI driver inclusion to 2.6 kernel.

Getting udev to work for your devices has nothing to do with getting
your iscsi driver to be included in the main 2.6 kernel.  Why do you say
that?

thanks,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does
SourceForge.net help you be more productive?  Does it help you create
better code?  SHARE THE LOVE, and help us help YOU!  Click Here:
http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (15 preceding siblings ...)
  2003-11-21  5:49 ` Surekha.PC
@ 2003-11-21  6:12 ` Greg KH
  2003-11-21  6:52 ` Surekha.PC
                   ` (9 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Greg KH @ 2003-11-21  6:12 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Nov 21, 2003 at 11:18:38AM +0530, Surekha.PC wrote:
> 
> To achieve these things, I need to make udev work in hotplug mode. That
> was the intent of my mention.

Ok, if the iscsi driver creates a scsi device properly with the scsi
subsystem, and registers a block device, then udev will work just fine
with it.

What does your /sys/block/ tree look like with a iscsi drive connected?

thanks,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (16 preceding siblings ...)
  2003-11-21  6:12 ` Greg KH
@ 2003-11-21  6:52 ` Surekha.PC
  2003-11-22 18:12 ` Greg KH
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-21  6:52 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 1803 bytes --]


Yes, the iSCSI driver is registering the device with scsi layer and
sysfs shows the device attributes just like for any scsi device.

The /sys/block tree looks the same as with native scsi disks connected.

#ls -l /sys/block/sd*
sda  sdb  sdc  sdd  

FYI, I have attached the `ls -lR /sys/block/` in log file.

Here sda, sdb are my native scsi disks while sdc, sdd are iSCSI disks.

I am able to manually create the device nodes for iSCSI disks with udev.

Making udev work with hotplug is the only issue now :(

Thanks,
Surekha

-----Original Message-----
From: linux-hotplug-devel-admin@lists.sourceforge.net
[mailto:linux-hotplug-devel-admin@lists.sourceforge.net] On Behalf Of
Greg KH
Sent: Friday, November 21, 2003 11:43 AM
To: Surekha.PC
Cc: 'Martin Hicks'; linux-hotplug-devel@lists.sourceforge.net
Subject: Re: udev does not create scsi disk entries during bootup


On Fri, Nov 21, 2003 at 11:18:38AM +0530, Surekha.PC wrote:
> 
> To achieve these things, I need to make udev work in hotplug mode. 
> That was the intent of my mention.

Ok, if the iscsi driver creates a scsi device properly with the scsi
subsystem, and registers a block device, then udev will work just fine
with it.

What does your /sys/block/ tree look like with a iscsi drive connected?

thanks,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does
SourceForge.net help you be more productive?  Does it help you create
better code?  SHARE THE LOVE, and help us help YOU!  Click Here:
http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

[-- Attachment #2: sys.log --]
[-- Type: application/octet-stream, Size: 26312 bytes --]

/sys/block/:
total 0
drwxr-xr-x    3 root     root            0 Nov 20 09:54 fd0
drwxr-xr-x    3 root     root            0 Nov 20 09:54 hda
drwxr-xr-x    3 root     root            0 Nov 20 09:54 loop0
drwxr-xr-x    3 root     root            0 Nov 20 09:54 loop1
drwxr-xr-x    3 root     root            0 Nov 20 09:54 loop2
drwxr-xr-x    3 root     root            0 Nov 20 09:54 loop3
drwxr-xr-x    3 root     root            0 Nov 20 09:54 loop4
drwxr-xr-x    3 root     root            0 Nov 20 09:54 loop5
drwxr-xr-x    3 root     root            0 Nov 20 09:54 loop6
drwxr-xr-x    3 root     root            0 Nov 20 09:54 loop7
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram0
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram1
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram10
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram11
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram12
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram13
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram14
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram15
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram2
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram3
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram4
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram5
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram6
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram7
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram8
drwxr-xr-x    3 root     root            0 Nov 20 09:54 ram9
drwxr-xr-x    6 root     root            0 Nov 20 09:55 sda
drwxr-xr-x    9 root     root            0 Nov 20 09:55 sdb
drwxr-xr-x    6 root     root            0 Nov 20 14:55 sdc
drwxr-xr-x    6 root     root            0 Nov 20 14:55 sdd

/sys/block/fd0:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/fd0/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/fd0/queue/iosched:
total 0
-rw-r--r--    1 root     root         4096 Nov 20 09:54 antic_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:54 read_batch_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:54 read_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:54 write_batch_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:54 write_expire

/sys/block/hda:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
lrwxrwxrwx    1 root     root           22 Nov 20 09:54 device -> ../../devices/ide0/0.0
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/hda/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/hda/queue/iosched:
total 0
-rw-r--r--    1 root     root         4096 Nov 20 09:54 antic_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:54 read_batch_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:54 read_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:54 write_batch_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:54 write_expire

/sys/block/loop0:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/loop0/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/loop0/queue/iosched:
total 0

/sys/block/loop1:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/loop1/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/loop1/queue/iosched:
total 0

/sys/block/loop2:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/loop2/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/loop2/queue/iosched:
total 0

/sys/block/loop3:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/loop3/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/loop3/queue/iosched:
total 0

/sys/block/loop4:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/loop4/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/loop4/queue/iosched:
total 0

/sys/block/loop5:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/loop5/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/loop5/queue/iosched:
total 0

/sys/block/loop6:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/loop6/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/loop6/queue/iosched:
total 0

/sys/block/loop7:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/loop7/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/loop7/queue/iosched:
total 0

/sys/block/ram0:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram0/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram0/queue/iosched:
total 0

/sys/block/ram1:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram1/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram1/queue/iosched:
total 0

/sys/block/ram10:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram10/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram10/queue/iosched:
total 0

/sys/block/ram11:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram11/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram11/queue/iosched:
total 0

/sys/block/ram12:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram12/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram12/queue/iosched:
total 0

/sys/block/ram13:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram13/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram13/queue/iosched:
total 0

/sys/block/ram14:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram14/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram14/queue/iosched:
total 0

/sys/block/ram15:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram15/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram15/queue/iosched:
total 0

/sys/block/ram2:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram2/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram2/queue/iosched:
total 0

/sys/block/ram3:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram3/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram3/queue/iosched:
total 0

/sys/block/ram4:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram4/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram4/queue/iosched:
total 0

/sys/block/ram5:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram5/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram5/queue/iosched:
total 0

/sys/block/ram6:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram6/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram6/queue/iosched:
total 0

/sys/block/ram7:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram7/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram7/queue/iosched:
total 0

/sys/block/ram8:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram8/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram8/queue/iosched:
total 0

/sys/block/ram9:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:54 dev
drwxr-xr-x    3 root     root            0 Nov 20 09:54 queue
-r--r--r--    1 root     root         4096 Nov 20 09:54 range
-r--r--r--    1 root     root         4096 Nov 20 09:54 size
-r--r--r--    1 root     root         4096 Nov 20 09:54 stat

/sys/block/ram9/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:54 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:54 nr_requests

/sys/block/ram9/queue/iosched:
total 0

/sys/block/sda:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:55 dev
lrwxrwxrwx    1 root     root           51 Nov 20 09:55 device -> ../../devices/pci0000:01/0000:01:03.1/host0/0:0:0:0
drwxr-xr-x    3 root     root            0 Nov 20 09:55 queue
-r--r--r--    1 root     root         4096 Nov 20 09:55 range
drwxr-xr-x    2 root     root            0 Nov 20 09:55 sda1
drwxr-xr-x    2 root     root            0 Nov 20 09:55 sda2
drwxr-xr-x    2 root     root            0 Nov 20 09:55 sda3
-r--r--r--    1 root     root         4096 Nov 20 09:55 size
-r--r--r--    1 root     root         4096 Nov 20 09:55 stat

/sys/block/sda/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:55 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:55 nr_requests

/sys/block/sda/queue/iosched:
total 0
-rw-r--r--    1 root     root         4096 Nov 20 09:55 antic_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:55 read_batch_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:55 read_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:55 write_batch_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:55 write_expire

/sys/block/sda/sda1:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:55 dev
-r--r--r--    1 root     root         4096 Nov 20 09:55 size
-r--r--r--    1 root     root         4096 Nov 20 09:55 start
-r--r--r--    1 root     root         4096 Nov 20 09:55 stat

/sys/block/sda/sda2:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:55 dev
-r--r--r--    1 root     root         4096 Nov 20 09:55 size
-r--r--r--    1 root     root         4096 Nov 20 09:55 start
-r--r--r--    1 root     root         4096 Nov 20 09:55 stat

/sys/block/sda/sda3:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:55 dev
-r--r--r--    1 root     root         4096 Nov 20 09:55 size
-r--r--r--    1 root     root         4096 Nov 20 09:55 start
-r--r--r--    1 root     root         4096 Nov 20 09:55 stat

/sys/block/sdb:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:55 dev
lrwxrwxrwx    1 root     root           51 Nov 20 09:55 device -> ../../devices/pci0000:01/0000:01:03.1/host0/0:0:1:0
drwxr-xr-x    3 root     root            0 Nov 20 09:55 queue
-r--r--r--    1 root     root         4096 Nov 20 09:55 range
drwxr-xr-x    2 root     root            0 Nov 20 09:55 sdb1
drwxr-xr-x    2 root     root            0 Nov 20 09:55 sdb2
drwxr-xr-x    2 root     root            0 Nov 20 09:55 sdb5
drwxr-xr-x    2 root     root            0 Nov 20 09:55 sdb6
drwxr-xr-x    2 root     root            0 Nov 20 09:55 sdb7
drwxr-xr-x    2 root     root            0 Nov 20 09:55 sdb8
-r--r--r--    1 root     root         4096 Nov 20 09:55 size
-r--r--r--    1 root     root         4096 Nov 20 09:55 stat

/sys/block/sdb/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 09:55 iosched
-rw-r--r--    1 root     root         4096 Nov 20 09:55 nr_requests

/sys/block/sdb/queue/iosched:
total 0
-rw-r--r--    1 root     root         4096 Nov 20 09:55 antic_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:55 read_batch_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:55 read_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:55 write_batch_expire
-rw-r--r--    1 root     root         4096 Nov 20 09:55 write_expire

/sys/block/sdb/sdb1:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:55 dev
-r--r--r--    1 root     root         4096 Nov 20 09:55 size
-r--r--r--    1 root     root         4096 Nov 20 09:55 start
-r--r--r--    1 root     root         4096 Nov 20 09:55 stat

/sys/block/sdb/sdb2:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:55 dev
-r--r--r--    1 root     root         4096 Nov 20 09:55 size
-r--r--r--    1 root     root         4096 Nov 20 09:55 start
-r--r--r--    1 root     root         4096 Nov 20 09:55 stat

/sys/block/sdb/sdb5:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:55 dev
-r--r--r--    1 root     root         4096 Nov 20 09:55 size
-r--r--r--    1 root     root         4096 Nov 20 09:55 start
-r--r--r--    1 root     root         4096 Nov 20 09:55 stat

/sys/block/sdb/sdb6:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:55 dev
-r--r--r--    1 root     root         4096 Nov 20 09:55 size
-r--r--r--    1 root     root         4096 Nov 20 09:55 start
-r--r--r--    1 root     root         4096 Nov 20 09:55 stat

/sys/block/sdb/sdb7:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:55 dev
-r--r--r--    1 root     root         4096 Nov 20 09:55 size
-r--r--r--    1 root     root         4096 Nov 20 09:55 start
-r--r--r--    1 root     root         4096 Nov 20 09:55 stat

/sys/block/sdb/sdb8:
total 0
-r--r--r--    1 root     root         4096 Nov 20 09:55 dev
-r--r--r--    1 root     root         4096 Nov 20 09:55 size
-r--r--r--    1 root     root         4096 Nov 20 09:55 start
-r--r--r--    1 root     root         4096 Nov 20 09:55 stat

/sys/block/sdc:
total 0
-r--r--r--    1 root     root         4096 Nov 20 14:55 dev
lrwxrwxrwx    1 root     root           34 Nov 20 14:55 device -> ../../devices/legacy/host2/2:0:0:0
drwxr-xr-x    3 root     root            0 Nov 20 14:55 queue
-r--r--r--    1 root     root         4096 Nov 20 14:55 range
drwxr-xr-x    2 root     root            0 Nov 21 09:11 sdc1
drwxr-xr-x    2 root     root            0 Nov 21 09:11 sdc2
drwxr-xr-x    2 root     root            0 Nov 21 09:11 sdc3
-r--r--r--    1 root     root         4096 Nov 20 14:55 size
-r--r--r--    1 root     root         4096 Nov 20 14:55 stat

/sys/block/sdc/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 14:55 iosched
-rw-r--r--    1 root     root         4096 Nov 20 14:55 nr_requests

/sys/block/sdc/queue/iosched:
total 0
-rw-r--r--    1 root     root         4096 Nov 20 14:55 antic_expire
-rw-r--r--    1 root     root         4096 Nov 20 14:55 read_batch_expire
-rw-r--r--    1 root     root         4096 Nov 20 14:55 read_expire
-rw-r--r--    1 root     root         4096 Nov 20 14:55 write_batch_expire
-rw-r--r--    1 root     root         4096 Nov 20 14:55 write_expire

/sys/block/sdc/sdc1:
total 0
-r--r--r--    1 root     root         4096 Nov 21 09:11 dev
-r--r--r--    1 root     root         4096 Nov 21 09:11 size
-r--r--r--    1 root     root         4096 Nov 21 09:11 start
-r--r--r--    1 root     root         4096 Nov 21 09:11 stat

/sys/block/sdc/sdc2:
total 0
-r--r--r--    1 root     root         4096 Nov 21 09:11 dev
-r--r--r--    1 root     root         4096 Nov 21 09:11 size
-r--r--r--    1 root     root         4096 Nov 21 09:11 start
-r--r--r--    1 root     root         4096 Nov 21 09:11 stat

/sys/block/sdc/sdc3:
total 0
-r--r--r--    1 root     root         4096 Nov 21 09:11 dev
-r--r--r--    1 root     root         4096 Nov 21 09:11 size
-r--r--r--    1 root     root         4096 Nov 21 09:11 start
-r--r--r--    1 root     root         4096 Nov 21 09:11 stat

/sys/block/sdd:
total 0
-r--r--r--    1 root     root         4096 Nov 20 14:55 dev
lrwxrwxrwx    1 root     root           34 Nov 20 14:55 device -> ../../devices/legacy/host2/2:0:1:0
drwxr-xr-x    3 root     root            0 Nov 20 14:55 queue
-r--r--r--    1 root     root         4096 Nov 20 14:55 range
drwxr-xr-x    2 root     root            0 Nov 21 08:50 sdd1
drwxr-xr-x    2 root     root            0 Nov 21 08:50 sdd2
drwxr-xr-x    2 root     root            0 Nov 21 08:50 sdd3
-r--r--r--    1 root     root         4096 Nov 20 14:55 size
-r--r--r--    1 root     root         4096 Nov 20 14:55 stat

/sys/block/sdd/queue:
total 0
drwxr-xr-x    2 root     root            0 Nov 20 14:55 iosched
-rw-r--r--    1 root     root         4096 Nov 20 14:55 nr_requests

/sys/block/sdd/queue/iosched:
total 0
-rw-r--r--    1 root     root         4096 Nov 20 14:55 antic_expire
-rw-r--r--    1 root     root         4096 Nov 20 14:55 read_batch_expire
-rw-r--r--    1 root     root         4096 Nov 20 14:55 read_expire
-rw-r--r--    1 root     root         4096 Nov 20 14:55 write_batch_expire
-rw-r--r--    1 root     root         4096 Nov 20 14:55 write_expire

/sys/block/sdd/sdd1:
total 0
-r--r--r--    1 root     root         4096 Nov 21 08:50 dev
-r--r--r--    1 root     root         4096 Nov 21 08:50 size
-r--r--r--    1 root     root         4096 Nov 21 08:50 start
-r--r--r--    1 root     root         4096 Nov 21 08:50 stat

/sys/block/sdd/sdd2:
total 0
-r--r--r--    1 root     root         4096 Nov 21 08:50 dev
-r--r--r--    1 root     root         4096 Nov 21 08:50 size
-r--r--r--    1 root     root         4096 Nov 21 08:50 start
-r--r--r--    1 root     root         4096 Nov 21 08:50 stat

/sys/block/sdd/sdd3:
total 0
-r--r--r--    1 root     root         4096 Nov 21 08:50 dev
-r--r--r--    1 root     root         4096 Nov 21 08:50 size
-r--r--r--    1 root     root         4096 Nov 21 08:50 start
-r--r--r--    1 root     root         4096 Nov 21 08:50 stat

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (17 preceding siblings ...)
  2003-11-21  6:52 ` Surekha.PC
@ 2003-11-22 18:12 ` Greg KH
  2003-11-24 12:50 ` Surekha.PC
                   ` (7 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Greg KH @ 2003-11-22 18:12 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Nov 21, 2003 at 12:21:22PM +0530, Surekha.PC wrote:
> 
> Yes, the iSCSI driver is registering the device with scsi layer and
> sysfs shows the device attributes just like for any scsi device.
> 
> The /sys/block tree looks the same as with native scsi disks connected.
> 
> #ls -l /sys/block/sd*
> sda  sdb  sdc  sdd  
> 
> FYI, I have attached the `ls -lR /sys/block/` in log file.

The 'tree' function is much nicer for seeing things like this :)

> Here sda, sdb are my native scsi disks while sdc, sdd are iSCSI disks.

Why is your iscsi host controller haning off of the legacy bus?  Isn't
it connected to a ethernet device in reality?  You should link it to
that.

> I am able to manually create the device nodes for iSCSI disks with udev.
> 
> Making udev work with hotplug is the only issue now :(

Don't know why it isn't working for you.  Does any other devices work
with hotplug?   What distro are you using?  Can you install the hotplug
rpms instead of using the tarballs?

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (18 preceding siblings ...)
  2003-11-22 18:12 ` Greg KH
@ 2003-11-24 12:50 ` Surekha.PC
  2003-11-24 22:14 ` Greg KH
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-24 12:50 UTC (permalink / raw)
  To: linux-hotplug



>The 'tree' function is much nicer for seeing things like this :)

 Is this a utility? Appreciate if you can inform me where to get it.

>> Here sda, sdb are my native scsi disks while sdc, sdd are iSCSI
disks.

>Why is your iscsi host controller haning off of the legacy bus?  Isn't
it connected to a >ethernet device in reality?  You should link it to
that.

iSCSI is a pseudo SCSI HBA, it is registered with Scsi_Host template
just like any native SCSI HBA. Since there isn't any pci bus associated
with it, it appears on legacy bus.


>> I am able to manually create the device nodes for iSCSI disks with 
>> udev.
>> 
>> Making udev work with hotplug is the only issue now :(

>Don't know why it isn't working for you.  Does any other devices work
>with hotplug?   What distro are you using?  Can you install the hotplug
>rpms instead of using the tarballs?

I have native scsi disk devices on my system. These are not tested for
hotplugging since it requires to build udev with initrd, which I am yet
to test with.

I am using Redhat 9.0 with linux-kernel 2.6.0-test5.

I was not able to install from rpm, rpm on 2.6 kernel has an issue, it
gives following error and fails... That's another issue.
------------------------------------------------------------------------
--------------
rpmdb: unable to join the environment
error: db4 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages index using db3 - Resource temporarily
unavailable (11)
error: cannot open Packages database in /var/lib/rpm
------------------------------------------------------------------------
--------------

I have one more query. I happened to read from the URL mentioned below,
that hotplugging can be achieved by plugging/unplugging the scsi device
and executing the following command. 

echo "scsi add-single-device <h> <c> <t> <l>" > /proc/scsi/scsi
echo "scsi remove-single-device <h> <c> <t> <l>" > /proc/scsi/scsi

h - host number
c - channel
t - target
l - lun

http://lwn.net/Articles/12723/

Hope this is not all about scsi hotplugging ? I presume that hotplugging
should not take any user input and should be completely automated.

Thanks,
surekha 



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (19 preceding siblings ...)
  2003-11-24 12:50 ` Surekha.PC
@ 2003-11-24 22:14 ` Greg KH
  2003-11-25 12:56 ` Surekha.PC
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Greg KH @ 2003-11-24 22:14 UTC (permalink / raw)
  To: linux-hotplug

On Mon, Nov 24, 2003 at 06:18:54PM +0530, Surekha.PC wrote:
> 
> 
> >The 'tree' function is much nicer for seeing things like this :)
> 
>  Is this a utility? Appreciate if you can inform me where to get it.

Hm, it should be included in your distro.  What are you running?

> >> Here sda, sdb are my native scsi disks while sdc, sdd are iSCSI
> disks.
> 
> >Why is your iscsi host controller haning off of the legacy bus?  Isn't
> it connected to a >ethernet device in reality?  You should link it to
> that.
> 
> iSCSI is a pseudo SCSI HBA, it is registered with Scsi_Host template
> just like any native SCSI HBA. Since there isn't any pci bus associated
> with it, it appears on legacy bus.

But it's attached to a network connection, correct?  If so, why not link
it to the network device?

> >> I am able to manually create the device nodes for iSCSI disks with 
> >> udev.
> >> 
> >> Making udev work with hotplug is the only issue now :(
> 
> >Don't know why it isn't working for you.  Does any other devices work
> >with hotplug?   What distro are you using?  Can you install the hotplug
> >rpms instead of using the tarballs?
> 
> I have native scsi disk devices on my system. These are not tested for
> hotplugging since it requires to build udev with initrd, which I am yet
> to test with.
> 
> I am using Redhat 9.0 with linux-kernel 2.6.0-test5.
> 
> I was not able to install from rpm, rpm on 2.6 kernel has an issue, it
> gives following error and fails... That's another issue.

Sounds like you aren't running as root to do that.

Anyway, try grabbing the version of hotplug from rawhide/fedora that
should be a good base to work off of.  Other than that, I really have no
idea what's going wrong.  It doesn't look to be a kernel or udev error,
so I'll be of no help :)

Good luck,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (20 preceding siblings ...)
  2003-11-24 22:14 ` Greg KH
@ 2003-11-25 12:56 ` Surekha.PC
  2003-11-25 13:12 ` Martin Hicks
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-25 12:56 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 3765 bytes --]


Hi Greg,

 I was able to make hotplug work !!!
 The latest udev-007 release provides udev startup script, which was not
present in earlier udev-005 release. The script however does not get
installed in the rc.d path.
I had to install it manually to make it work. This needs to be taken
care in future releases.

I am now able to automatically add and remove my iSCSI devices through
udev.

I am submitting the patch with 2 changes.

1)To include new field in the NUMBER rule specially for iSCSI devices.
 
The current rule provided by udev is as below.

NUMBER, BUS="scsi", ID=2:0:0:0", NAME="disk%n"

For iSCSI devices, since hostid is not consistent, we are defining a new
iSCSI device attribute in sysfs, which will be checked while naming the
device.

NUMBER, BUS="scsi", ID="0:0:0", device_type="ISCSI", NAME="ib0t0l0%n"

2) Device partition name needs to be appended with "s" before partition
id.
 
If the device name consists of bus,target info like "c0b0t0l0" it will
be easier to identify the partition as in "c0b0t0l0s1".
 
Please find the patch alongwith.

Thanks,
surekha 

-----Original Message-----
From: linux-hotplug-devel-admin@lists.sourceforge.net
[mailto:linux-hotplug-devel-admin@lists.sourceforge.net] On Behalf Of
Greg KH
Sent: Tuesday, November 25, 2003 3:44 AM
To: Surekha.PC
Cc: 'Martin Hicks'; linux-hotplug-devel@lists.sourceforge.net
Subject: Re: udev does not create scsi disk entries during bootup


On Mon, Nov 24, 2003 at 06:18:54PM +0530, Surekha.PC wrote:
> 
> 
> >The 'tree' function is much nicer for seeing things like this :)
> 
>  Is this a utility? Appreciate if you can inform me where to get it.

Hm, it should be included in your distro.  What are you running?

> >> Here sda, sdb are my native scsi disks while sdc, sdd are iSCSI
> disks.
> 
> >Why is your iscsi host controller haning off of the legacy bus?  
> >Isn't
> it connected to a >ethernet device in reality?  You should link it to 
> that.
> 
> iSCSI is a pseudo SCSI HBA, it is registered with Scsi_Host template 
> just like any native SCSI HBA. Since there isn't any pci bus 
> associated with it, it appears on legacy bus.

But it's attached to a network connection, correct?  If so, why not link
it to the network device?

> >> I am able to manually create the device nodes for iSCSI disks with
> >> udev.
> >> 
> >> Making udev work with hotplug is the only issue now :(
> 
> >Don't know why it isn't working for you.  Does any other devices work
> >with hotplug?   What distro are you using?  Can you install the
hotplug
> >rpms instead of using the tarballs?
> 
> I have native scsi disk devices on my system. These are not tested for

> hotplugging since it requires to build udev with initrd, which I am 
> yet to test with.
> 
> I am using Redhat 9.0 with linux-kernel 2.6.0-test5.
> 
> I was not able to install from rpm, rpm on 2.6 kernel has an issue, it

> gives following error and fails... That's another issue.

Sounds like you aren't running as root to do that.

Anyway, try grabbing the version of hotplug from rawhide/fedora that
should be a good base to work off of.  Other than that, I really have no
idea what's going wrong.  It doesn't look to be a kernel or udev error,
so I'll be of no help :)

Good luck,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does
SourceForge.net help you be more productive?  Does it help you create
better code?  SHARE THE LOVE, and help us help YOU!  Click Here:
http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

[-- Attachment #2: namedev.c.org --]
[-- Type: application/octet-stream, Size: 24759 bytes --]

/*
 * namedev.c
 *
 * Userspace devfs
 *
 * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
 *
 *
 *	This program is free software; you can redistribute it and/or modify it
 *	under the terms of the GNU General Public License as published by the
 *	Free Software Foundation version 2 of the License.
 * 
 *	This program is distributed in the hope that it will be useful, but
 *	WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *	General Public License for more details.
 * 
 *	You should have received a copy of the GNU General Public License along
 *	with this program; if not, write to the Free Software Foundation, Inc.,
 *	675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

/* define this to enable parsing debugging */
/* #define DEBUG_PARSER */

#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <ctype.h>
#include <unistd.h>
#include <errno.h>
#include <sys/wait.h>

#include "list.h"
#include "udev.h"
#include "udev_version.h"
#include "namedev.h"
#include "libsysfs/libsysfs.h"
#include "klibc_fixups.h"

#define TYPE_LABEL	"LABEL"
#define TYPE_NUMBER	"NUMBER"
#define TYPE_TOPOLOGY	"TOPOLOGY"
#define TYPE_REPLACE	"REPLACE"
#define TYPE_CALLOUT	"CALLOUT"
#define CALLOUT_MAXARG	8

static LIST_HEAD(config_device_list);

/* s2 may end with '*' to match everything */
static int strncmp_wildcard(char *s1, char *s2, int max)
{
	int len = strlen(s2);
	if (len > max)
		len = max;
	if (s2[len-1] == '*')
		len--;
	else
		len = max;
	return strncmp(s1, s2, len);
}

static void dump_dev(struct config_device *dev)
{
	switch (dev->type) {
	case KERNEL_NAME:
		dbg_parse("KERNEL name='%s' ,"
			  "owner='%s', group='%s', mode=%#o",
			  dev->name, dev->owner, dev->group, dev->mode);
		break;
	case LABEL:
		dbg_parse("LABEL name='%s', bus='%s', sysfs_file='%s', sysfs_value='%s', "
			  "owner='%s', group='%s', mode=%#o",
			  dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value,
			  dev->owner, dev->group, dev->mode);
		break;
	case NUMBER:
		dbg_parse("NUMBER name='%s', bus='%s', id='%s', "
			  "owner='%s', group='%s', mode=%#o",
			  dev->name, dev->bus, dev->id,
			  dev->owner, dev->group, dev->mode);
		break;
	case TOPOLOGY:
		dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s', "
			  "owner='%s', group='%s', mode=%#o",
			  dev->name, dev->bus, dev->place,
			  dev->owner, dev->group, dev->mode);
		break;
	case REPLACE:
		dbg_parse("REPLACE name=%s, kernel_name=%s, "
			  "owner='%s', group='%s', mode=%#o",
			  dev->name, dev->kernel_name,
			  dev->owner, dev->group, dev->mode);
		break;
	case CALLOUT:
		dbg_parse("CALLOUT name='%s', bus='%s', program='%s', id='%s', "
			  "owner='%s', group='%s', mode=%#o",
			  dev->name, dev->bus, dev->exec_program, dev->id,
			  dev->owner, dev->group, dev->mode);
		break;
	default:
		dbg_parse("unknown type of method");
	}
}

#define copy_var(a, b, var)		\
	if (b->var)			\
		a->var = b->var;

#define copy_string(a, b, var)		\
	if (strlen(b->var))		\
		strcpy(a->var, b->var);

static int add_dev(struct config_device *new_dev)
{
	struct list_head *tmp;
	struct config_device *tmp_dev;

	/* update the values if we already have the device */
	list_for_each(tmp, &config_device_list) {
		struct config_device *dev = list_entry(tmp, struct config_device, node);
		if (strncmp_wildcard(dev->name, new_dev->name, sizeof(dev->name)))
			continue;
		copy_var(dev, new_dev, type);
		copy_var(dev, new_dev, mode);
		copy_string(dev, new_dev, bus);
		copy_string(dev, new_dev, sysfs_file);
		copy_string(dev, new_dev, sysfs_value);
		copy_string(dev, new_dev, id);
		copy_string(dev, new_dev, place);
		copy_string(dev, new_dev, kernel_name);
		copy_string(dev, new_dev, owner);
		copy_string(dev, new_dev, group);
		return 0;
	}

	/* not found, add new structure to the device list */
	tmp_dev = malloc(sizeof(*tmp_dev));
	if (!tmp_dev)
		return -ENOMEM;
	memcpy(tmp_dev, new_dev, sizeof(*tmp_dev));
	list_add(&tmp_dev->node, &config_device_list);
	//dump_dev(tmp_dev);
	return 0;
}

static void dump_dev_list(void)
{
	struct list_head *tmp;

	list_for_each(tmp, &config_device_list) {
		struct config_device *dev = list_entry(tmp, struct config_device, node);
		dump_dev(dev);
	}
}
	
static int get_pair(char **orig_string, char **left, char **right)
{
	char *temp;
	char *string = *orig_string;

	if (!string)
		return -ENODEV;

	/* eat any whitespace */
	while (isspace(*string))
		++string;

	/* split based on '=' */
	temp = strsep(&string, "=");
	*left = temp;
	if (!string)
		return -ENODEV;

	/* take the right side and strip off the '"' */
	while (isspace(*string))
		++string;
	if (*string == '"')
		++string;
	else
		return -ENODEV;

	temp = strsep(&string, "\"");
	if (!string || *temp == '\0')
		return -ENODEV;
	*right = temp;
	*orig_string = string;
	
	return 0;
}

static int get_value(const char *left, char **orig_string, char **ret_string)
{
	int retval;
	char *left_string;

	retval = get_pair(orig_string, &left_string, ret_string);
	if (retval)
		return retval;
	if (strcasecmp(left_string, left) != 0)
		return -ENODEV;
	return 0;
}

static int namedev_init_config(void)
{
	char line[255];
	int lineno;
	char *temp;
	char *temp2;
	char *temp3;
	FILE *fd;
	int retval = 0;
	struct config_device dev;

	dbg("opening %s to read as config", udev_config_filename);
	fd = fopen(udev_config_filename, "r");
	if (fd == NULL) {
		dbg("can't open %s", udev_config_filename);
		return -ENODEV;
	}

	/* loop through the whole file */
	lineno = 0;
	while (1) {
		/* get a line */
		temp = fgets(line, sizeof(line), fd);
		if (temp == NULL)
			goto exit;
		lineno++;

		dbg_parse("read %s", temp);

		/* eat the whitespace at the beginning of the line */
		while (isspace(*temp))
			++temp;

		/* empty line? */
		if (*temp == 0x00)
			continue;

		/* see if this is a comment */
		if (*temp == COMMENT_CHARACTER)
			continue;

		memset(&dev, 0x00, sizeof(struct config_device));

		/* parse the line */
		temp2 = strsep(&temp, ",");
		if (strcasecmp(temp2, TYPE_LABEL) == 0) {
			/* label type */
			dev.type = LABEL;

			/* BUS="bus" */
			retval = get_value("BUS", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.bus, temp3);

			/* file="value" */
			temp2 = strsep(&temp, ",");
			retval = get_pair(&temp, &temp2, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.sysfs_file, temp2);
			strfieldcpy(dev.sysfs_value, temp3);

			/* NAME="new_name" */
			temp2 = strsep(&temp, ",");
			retval = get_value("NAME", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.name, temp3);

			dbg_parse("LABEL name='%s', bus='%s', "
				  "sysfs_file='%s', sysfs_value='%s'",
				  dev.name, dev.bus, dev.sysfs_file,
				  dev.sysfs_value);
		}

		if (strcasecmp(temp2, TYPE_NUMBER) == 0) {
			/* number type */
			dev.type = NUMBER;

			/* BUS="bus" */
			retval = get_value("BUS", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.bus, temp3);

			/* ID="id" */
			temp2 = strsep(&temp, ",");
			retval = get_value("ID", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.id, temp3);

			/* NAME="new_name" */
			temp2 = strsep(&temp, ",");
			retval = get_value("NAME", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.name, temp3);

			dbg_parse("NUMBER name='%s', bus='%s', id='%s'",
				  dev.name, dev.bus, dev.id);
		}

		if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) {
			/* number type */
			dev.type = TOPOLOGY;

			/* BUS="bus" */
			retval = get_value("BUS", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.bus, temp3);

			/* PLACE="place" */
			temp2 = strsep(&temp, ",");
			retval = get_value("PLACE", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.place, temp3);

			/* NAME="new_name" */
			temp2 = strsep(&temp, ",");
			retval = get_value("NAME", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.name, temp3);

			dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s'",
				  dev.name, dev.bus, dev.place);
		}

		if (strcasecmp(temp2, TYPE_REPLACE) == 0) {
			/* number type */
			dev.type = REPLACE;

			/* KERNEL="kernel_name" */
			retval = get_value("KERNEL", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.kernel_name, temp3);

			/* NAME="new_name" */
			temp2 = strsep(&temp, ",");
			retval = get_value("NAME", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.name, temp3);
			dbg_parse("REPLACE name='%s', kernel_name='%s'",
				  dev.name, dev.kernel_name);
		}
		if (strcasecmp(temp2, TYPE_CALLOUT) == 0) {
			/* number type */
			dev.type = CALLOUT;

			/* BUS="bus" */
			retval = get_value("BUS", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.bus, temp3);

			/* PROGRAM="executable" */
			temp2 = strsep(&temp, ",");
			retval = get_value("PROGRAM", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.exec_program, temp3);

			/* ID="id" */
			temp2 = strsep(&temp, ",");
			retval = get_value("ID", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.id, temp3);

			/* NAME="new_name" */
			temp2 = strsep(&temp, ",");
			retval = get_value("NAME", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.name, temp3);
			dbg_parse("CALLOUT name='%s', program='%s'",
				  dev.name, dev.exec_program);
		}

		retval = add_dev(&dev);
		if (retval) {
			dbg("add_dev returned with error %d", retval);
			goto exit;
		}
	}
	dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename,
		  lineno, temp - line, temp);
exit:
	fclose(fd);
	return retval;
}	


static int namedev_init_permissions(void)
{
	char line[255];
	char *temp;
	char *temp2;
	FILE *fd;
	int retval = 0;
	struct config_device dev;

	dbg("opening %s to read as permissions config", udev_config_permission_filename);
	fd = fopen(udev_config_permission_filename, "r");
	if (fd == NULL) {
		dbg("can't open %s", udev_config_permission_filename);
		return -ENODEV;
	}

	/* loop through the whole file */
	while (1) {
		temp = fgets(line, sizeof(line), fd);
		if (temp == NULL)
			break;

		dbg_parse("read %s", temp);

		/* eat the whitespace at the beginning of the line */
		while (isspace(*temp))
			++temp;

		/* empty line? */
		if (*temp == 0x00)
			continue;

		/* see if this is a comment */
		if (*temp == COMMENT_CHARACTER)
			continue;

		memset(&dev, 0x00, sizeof(dev));

		/* parse the line */
		temp2 = strsep(&temp, ":");
		if (!temp2) {
			dbg("cannot parse line: %s", line);
			continue;
		}
		strncpy(dev.name, temp2, sizeof(dev.name));

		temp2 = strsep(&temp, ":");
		if (!temp2) {
			dbg("cannot parse line: %s", line);
			continue;
		}
		strncpy(dev.owner, temp2, sizeof(dev.owner));

		temp2 = strsep(&temp, ":");
		if (!temp2) {
			dbg("cannot parse line: %s", line);
			continue;
		}
		strncpy(dev.group, temp2, sizeof(dev.owner));

		dev.mode = strtol(temp, NULL, 8);

		dbg_parse("name='%s', owner='%s', group='%s', mode=%#o",
			  dev.name, dev.owner, dev.group,
			  dev.mode);
		retval = add_dev(&dev);
		if (retval) {
			dbg("add_dev returned with error %d", retval);
			goto exit;
		}
	}

exit:
	fclose(fd);
	return retval;
}	

static mode_t get_default_mode(struct sysfs_class_device *class_dev)
{
	/* just default everyone to rw for the world! */
	return 0666;
}

static void build_kernel_number(struct sysfs_class_device *class_dev, struct udevice *udev)
{
	char *dig;

	/* FIXME, figure out how to handle stuff like sdaj which will not work right now. */
	dig = class_dev->name + strlen(class_dev->name);
	while (isdigit(*(dig-1)))
		dig--;
	strfieldcpy(udev->kernel_number, dig);
	dbg("kernel_number = %s", udev->kernel_number);
}

static void apply_format(struct udevice *udev, unsigned char *string)
{
	char name[NAME_SIZE];
	char *pos;

	while (1) {
		pos = strchr(string, '%');

		if (pos) {
			strfieldcpy(name, pos+2);
			*pos = 0x00;
			switch (pos[1]) {
			case 'b':
				if (strlen(udev->bus_id) == 0)
					break;
				strcat(string, udev->bus_id);
				dbg("substitute bus_id '%s'", udev->bus_id);
				break;
			case 'n':
				if (strlen(udev->kernel_number) == 0)
					break;
				strcat(pos, udev->kernel_number);
				dbg("substitute kernel number '%s'", udev->kernel_number);
				break;
			case 'm':
				sprintf(pos, "%u", udev->minor);
				dbg("substitute minor number '%u'", udev->minor);
				break;
			case 'M':
				sprintf(pos, "%u", udev->major);
				dbg("substitute major number '%u'", udev->major);
				break;
			case 'c':
				if (strlen(udev->callout_value) == 0)
					break;
				strcat(pos, udev->callout_value);
				dbg("substitute callout output '%s'", udev->callout_value);
				break;
			default:
				dbg("unknown substitution type '%%%c'", pos[1]);
				break;
			}
			strcat(string, name);
		} else
			break;
	}
}


static int exec_callout(struct config_device *dev, char *value, int len)
{
	int retval;
	int res;
	int status;
	int fds[2];
	pid_t pid;
	int value_set = 0;
	char buffer[256];
	char *arg;
	char *args[CALLOUT_MAXARG];
	int i;

	dbg("callout to '%s'", dev->exec_program);
	retval = pipe(fds);
	if (retval != 0) {
		dbg("pipe failed");
		return -1;
	}
	pid = fork();
	if (pid == -1) {
		dbg("fork failed");
		return -1;
	}

	if (pid == 0) {
		/* child */
		close(STDOUT_FILENO);
		dup(fds[1]);	/* dup write side of pipe to STDOUT */
		if (strchr(dev->exec_program, ' ')) {
			/* callout with arguments */
			arg = dev->exec_program;
			for (i=0; i < CALLOUT_MAXARG-1; i++) {
				args[i] = strsep(&arg, " ");
				if (args[i] == NULL)
					break;
			}
			if (args[i]) {
				dbg("too many args - %d", i);
				args[i] = NULL;
			}
			retval = execve(args[0], args, main_envp);
		} else {
			retval = execve(dev->exec_program, main_argv, main_envp);
		}
		if (retval != 0) {
			dbg("child execve failed");
			exit(1);
		}
		return -1; /* avoid compiler warning */
	} else {
		/* parent reads from fds[0] */
		close(fds[1]);
		retval = 0;
		while (1) {
			res = read(fds[0], buffer, sizeof(buffer) - 1);
			if (res <= 0)
				break;
			buffer[res] = '\0';
			if (res > len) {
				dbg("callout len %d too short\n", len);
				retval = -1;
			}
			if (value_set) {
				dbg("callout value already set");
				retval = -1;
			} else {
				value_set = 1;
				strncpy(value, buffer, len);
			}
		}
		dbg("callout returned '%s'", value);
		close(fds[0]);
		res = wait(&status);
		if (res < 0) {
			dbg("wait failed result %d", res);
			retval = -1;
		}

#ifndef __KLIBC__
		if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) {
			dbg("callout program status 0x%x", status);
			retval = -1;
		}
#endif
	}
	return retval;
}

static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev)
{
	struct config_device *dev;
	struct list_head *tmp;

	list_for_each(tmp, &config_device_list) {
		dev = list_entry(tmp, struct config_device, node);
		if (dev->type != CALLOUT)
			continue;

		/* substitute anything that needs to be in the program name */
		apply_format(udev, dev->exec_program);
		if (exec_callout(dev, udev->callout_value, NAME_SIZE))
			continue;
		if (strncmp_wildcard(udev->callout_value, dev->id, NAME_SIZE) != 0)
			continue;
		strfieldcpy(udev->name, dev->name);
		if (dev->mode != 0) {
			udev->mode = dev->mode;
			strfieldcpy(udev->owner, dev->owner);
			strfieldcpy(udev->group, dev->group);
		}
		dbg_parse("callout returned matching value '%s', '%s' becomes '%s'"
			  " - owner='%s', group='%s', mode =%#o",
			  dev->id, class_dev->name, udev->name,
			  dev->owner, dev->group, dev->mode);
		return 0;
	}
	return -ENODEV;
}

static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device)
{
	struct sysfs_attribute *tmpattr = NULL;
	struct config_device *dev;
	struct list_head *tmp;

	list_for_each(tmp, &config_device_list) {
		dev = list_entry(tmp, struct config_device, node);
		if (dev->type != LABEL)
			continue;

		dbg_parse("look for device attribute '%s'", dev->sysfs_file);
		/* try to find the attribute in the class device directory */
		tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file);
		if (tmpattr)
			goto label_found;

		/* look in the class device directory if present */
		if (sysfs_device) {
			tmpattr = sysfs_get_device_attr(sysfs_device, dev->sysfs_file);
			if (tmpattr)
				goto label_found;
		}

		continue;

label_found:
		tmpattr->value[strlen(tmpattr->value)-1] = 0x00;
		dbg_parse("compare attribute '%s' value '%s' with '%s'",
			  dev->sysfs_file, tmpattr->value, dev->sysfs_value);
		if (strcmp(dev->sysfs_value, tmpattr->value) != 0)
			continue;

		strfieldcpy(udev->name, dev->name);
		if (dev->mode != 0) {
			udev->mode = dev->mode;
			strfieldcpy(udev->owner, dev->owner);
			strfieldcpy(udev->group, dev->group);
		}
		dbg_parse("found matching attribute '%s', '%s' becomes '%s' "
			  "- owner='%s', group='%s', mode=%#o",
			  dev->sysfs_file, class_dev->name, udev->name,
			  dev->owner, dev->group, dev->mode);

		return 0;
	}
	return -ENODEV;
}

static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device)
{
	struct config_device *dev;
	struct list_head *tmp;
	char path[SYSFS_PATH_MAX];
	int found;
	char *temp = NULL;

	/* we have to have a sysfs device for NUMBER to work */
	if (!sysfs_device)
		return -ENODEV;

	list_for_each(tmp, &config_device_list) {
		dev = list_entry(tmp, struct config_device, node);
		if (dev->type != NUMBER)
			continue;

		found = 0;
		strfieldcpy(path, sysfs_device->path);
		temp = strrchr(path, '/');
		dbg_parse("search '%s' in '%s', path='%s'", dev->id, temp, path);
		if (strstr(temp, dev->id) != NULL) {
			found = 1;
		} else {
			*temp = 0x00;
			temp = strrchr(path, '/');
			dbg_parse("search '%s' in '%s', path='%s'", dev->id, temp, path);
			if (strstr(temp, dev->id) != NULL)
				found = 1;
		}
		if (!found)
			continue;
		strfieldcpy(udev->name, dev->name);
		if (dev->mode != 0) {
			udev->mode = dev->mode;
			strfieldcpy(udev->owner, dev->owner);
			strfieldcpy(udev->group, dev->group);
		}
		dbg_parse("found matching id '%s', '%s' becomes '%s'"
			  " - owner='%s', group ='%s', mode=%#o",
			  dev->id, class_dev->name, udev->name,
			  dev->owner, dev->group, dev->mode);
		return 0;
	}
	return -ENODEV;
}


static int do_topology(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device)
{
	struct config_device *dev;
	struct list_head *tmp;
	char path[SYSFS_PATH_MAX];
	int found;
	char *temp = NULL;

	/* we have to have a sysfs device for TOPOLOGY to work */
	if (!sysfs_device)
		return -ENODEV;

	list_for_each(tmp, &config_device_list) {
		dev = list_entry(tmp, struct config_device, node);
		if (dev->type != TOPOLOGY)
			continue;

		found = 0;
		strfieldcpy(path, sysfs_device->path);
		temp = strrchr(path, '/');
		dbg_parse("search '%s' in '%s', path='%s'", dev->place, temp, path);
		if (strstr(temp, dev->place) != NULL) {
			found = 1;
		} else {
			*temp = 0x00;
			temp = strrchr(path, '/');
			dbg_parse("search '%s' in '%s', path='%s'", dev->place, temp, path);
			if (strstr(temp, dev->place) != NULL)
				found = 1;
		}
		if (!found)
			continue;

		strfieldcpy(udev->name, dev->name);
		if (dev->mode != 0) {
			udev->mode = dev->mode;
			strfieldcpy(udev->owner, dev->owner);
			strfieldcpy(udev->group, dev->group);
		}
		dbg_parse("found matching place '%s', '%s' becomes '%s'"
			  " - owner='%s', group ='%s', mode=%#o",
			  dev->place, class_dev->name, udev->name,
			  dev->owner, dev->group, dev->mode);
		return 0;
	}
	return -ENODEV;
}

static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev)
{
	struct config_device *dev;
	struct list_head *tmp;

	list_for_each(tmp, &config_device_list) {
		dev = list_entry(tmp, struct config_device, node);
		if (dev->type != REPLACE)
			continue;

		dbg_parse("compare name '%s' with '%s'",
			  dev->kernel_name, dev->name);
		if (strcmp(dev->kernel_name, class_dev->name) != 0)
			continue;

		strfieldcpy(udev->name, dev->name);
		if (dev->mode != 0) {
			udev->mode = dev->mode;
			strfieldcpy(udev->owner, dev->owner);
			strfieldcpy(udev->group, dev->group);
		}
		dbg_parse("found name, '%s' becomes '%s' - owner='%s', group='%s', mode = %#o",
			  dev->kernel_name, udev->name, 
			  dev->owner, dev->group, dev->mode);
		
		return 0;
	}
	return -ENODEV;
}

static void do_kernelname(struct sysfs_class_device *class_dev, struct udevice *udev)
{
	struct config_device *dev;
	struct list_head *tmp;
	int len;

	strfieldcpy(udev->name, class_dev->name);
	/* look for permissions */
	list_for_each(tmp, &config_device_list) {
		dev = list_entry(tmp, struct config_device, node);
		len = strlen(dev->name);
		if (strncmp_wildcard(class_dev->name, dev->name, sizeof(dev->name)))
			continue;
		if (dev->mode != 0) {
			dbg_parse("found permissions for '%s'", class_dev->name);
			udev->mode = dev->mode;
			strfieldcpy(udev->owner, dev->owner);
			strfieldcpy(udev->group, dev->group);
		}
	}
}

static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev)
{
	struct sysfs_device *sysfs_device = NULL;
	struct sysfs_class_device *class_dev_parent = NULL;
	int retval = 0;
	char *temp = NULL;

	udev->mode = 0;

	/* find the sysfs_device for this class device */
	/* Wouldn't it really be nice if libsysfs could do this for us? */
	if (class_dev->sysdevice) {
		sysfs_device = class_dev->sysdevice;
	} else {
		/* bah, let's go backwards up a level to see if the device is there,
		 * as block partitions don't point to the physical device.  Need to fix that
		 * up in the kernel...
		 */
		if (strstr(class_dev->path, "block")) {
			dbg_parse("looking at block device...");
			if (isdigit(class_dev->path[strlen(class_dev->path)-1])) {
				char path[SYSFS_PATH_MAX];

				dbg_parse("really is a partition...");
				strfieldcpy(path, class_dev->path);
				temp = strrchr(path, '/');
				*temp = 0x00;
				dbg_parse("looking for a class device at '%s'", path);
				class_dev_parent = sysfs_open_class_device(path);
				if (class_dev_parent == NULL) {
					dbg("sysfs_open_class_device at '%s' failed", path);
				} else {
					dbg_parse("class_dev_parent->name=%s", class_dev_parent->name);
					if (class_dev_parent->sysdevice)
						sysfs_device = class_dev_parent->sysdevice;
				}
			}
		}
	}
		
	if (sysfs_device) {
		dbg_parse("sysfs_device->path='%s'", sysfs_device->path);
		dbg_parse("sysfs_device->bus_id='%s'", sysfs_device->bus_id);
		strfieldcpy(udev->bus_id, sysfs_device->bus_id);
	} else {
		dbg_parse("class_dev->name = '%s'", class_dev->name);
	}

	build_kernel_number(class_dev, udev);

	/* rules are looked at in priority order */
	retval = do_callout(class_dev, udev);
	if (retval == 0)
		goto found;

	retval = do_label(class_dev, udev, sysfs_device);
	if (retval == 0)
		goto found;

	retval = do_number(class_dev, udev, sysfs_device);
	if (retval == 0)
		goto found;

	retval = do_topology(class_dev, udev, sysfs_device);
	if (retval == 0)
		goto found;

	retval = do_replace(class_dev, udev);
	if (retval == 0)
		goto found;

	do_kernelname(class_dev, udev);
	goto done;

found:
	/* substitute placeholder in NAME  */
	apply_format(udev, udev->name);

done:
	/* mode was never set above */
	if (!udev->mode) {
		udev->mode = get_default_mode(class_dev);
		udev->owner[0] = 0x00;
		udev->group[0] = 0x00;
	}

	if (class_dev_parent)
		sysfs_close_class_device(class_dev_parent);

	return 0;
}

int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *dev)
{
	int retval;

	retval = get_attr(class_dev, dev);
	if (retval)
		dbg("get_attr failed");

	return retval;
}

int namedev_init(void)
{
	int retval;
	
	retval = namedev_init_config();
	if (retval)
		return retval;

	retval = namedev_init_permissions();
	if (retval)
		return retval;

	dump_dev_list();
	return retval;
}

[-- Attachment #3: namedev.c.diff --]
[-- Type: application/octet-stream, Size: 3047 bytes --]

*** namedev.c.org	Tue Nov 25 17:48:47 2003
--- namedev.c	Tue Nov 25 17:45:27 2003
***************
*** 298,310 ****
  				break;
  			strfieldcpy(dev.id, temp3);
  
! 			/* NAME="new_name" */
  			temp2 = strsep(&temp, ",");
! 			retval = get_value("NAME", &temp, &temp3);
  			if (retval)
  				break;
! 			strfieldcpy(dev.name, temp3);
  
  			dbg_parse("NUMBER name='%s', bus='%s', id='%s'",
  				  dev.name, dev.bus, dev.id);
  		}
--- 298,320 ----
  				break;
  			strfieldcpy(dev.id, temp3);
  
! 			/* file="value" OR NAME="new_name" */
  			temp2 = strsep(&temp, ",");
! 			retval = get_pair(&temp, &temp2, &temp3);
  			if (retval)
  				break;
! 			if(strcmp("NAME", temp2) != 0) {
! 				/* file="value" */
! 				strfieldcpy(dev.sysfs_file, temp2);
! 				strfieldcpy(dev.sysfs_value, temp3);
! 				/* NAME="new_name" */
! 				temp2 = strsep(&temp, ",");
! 				retval = get_value("NAME", &temp, &temp3);
  
+ 				dbg_parse("sysfs_file='%s' sysfs_value='%s'",
+ 					 dev.sysfs_file, dev.sysfs_value);
+ 			}
+ 			strfieldcpy(dev.name, temp3);
  			dbg_parse("NUMBER name='%s', bus='%s', id='%s'",
  				  dev.name, dev.bus, dev.id);
  		}
***************
*** 520,525 ****
--- 530,536 ----
  			case 'n':
  				if (strlen(udev->kernel_number) == 0)
  					break;
+ 				strcat(pos, "s");
  				strcat(pos, udev->kernel_number);
  				dbg("substitute kernel number '%s'", udev->kernel_number);
  				break;
***************
*** 724,729 ****
--- 735,741 ----
  	char path[SYSFS_PATH_MAX];
  	int found;
  	char *temp = NULL;
+ 	struct sysfs_attribute *tmpattr = NULL;
  
  	/* we have to have a sysfs device for NUMBER to work */
  	if (!sysfs_device)
***************
*** 749,754 ****
--- 761,797 ----
  		}
  		if (!found)
  			continue;
+ 
+ 		dbg_parse(" device_type = %s\n", dev->sysfs_file);
+ 		if (strcmp(dev->sysfs_file, "device_type") == 0) {
+ 			dbg_parse("look for device_type attribute '%s'",
+ 				 dev->sysfs_file);
+ 			/* try to find the attribute in the class device directory */
+ 			tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file);
+ 			if (tmpattr)
+ 				goto number_found;
+ 
+ 			/* look in the class device directory if present */
+ 			if (sysfs_device) {
+ 				tmpattr = sysfs_get_device_attr(sysfs_device, dev->sysfs_file);
+ 				if (tmpattr)
+ 					goto number_found;
+ 			}
+ 
+ 			continue;
+ number_found:
+ 			tmpattr->value[strlen(tmpattr->value)-1] = '\0';
+ 			dbg_parse("compare attribute '%s' value '%s' with '%s'",
+ 				dev->sysfs_file, tmpattr->value,
+ 				dev->sysfs_value);
+ 			if (strncmp(dev->sysfs_value, tmpattr->value, strlen(dev->sysfs_value)) != 0)
+ 				continue;
+ 			
+ 			dbg_parse("found matching attribute '%s', '%s' becomes"
+ 				" '%s' - owner='%s', group='%s', mode=%#o",
+ 				dev->sysfs_file, class_dev->name, udev->name,
+ 				dev->owner, dev->group, dev->mode);
+ 		}
  		strfieldcpy(udev->name, dev->name);
  		if (dev->mode != 0) {
  			udev->mode = dev->mode;

[-- Attachment #4: namedev.c --]
[-- Type: application/octet-stream, Size: 26211 bytes --]

/*
 * namedev.c
 *
 * Userspace devfs
 *
 * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
 *
 *
 *	This program is free software; you can redistribute it and/or modify it
 *	under the terms of the GNU General Public License as published by the
 *	Free Software Foundation version 2 of the License.
 * 
 *	This program is distributed in the hope that it will be useful, but
 *	WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *	General Public License for more details.
 * 
 *	You should have received a copy of the GNU General Public License along
 *	with this program; if not, write to the Free Software Foundation, Inc.,
 *	675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

/* define this to enable parsing debugging */
/* #define DEBUG_PARSER */

#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <ctype.h>
#include <unistd.h>
#include <errno.h>
#include <sys/wait.h>

#include "list.h"
#include "udev.h"
#include "udev_version.h"
#include "namedev.h"
#include "libsysfs/libsysfs.h"
#include "klibc_fixups.h"

#define TYPE_LABEL	"LABEL"
#define TYPE_NUMBER	"NUMBER"
#define TYPE_TOPOLOGY	"TOPOLOGY"
#define TYPE_REPLACE	"REPLACE"
#define TYPE_CALLOUT	"CALLOUT"
#define CALLOUT_MAXARG	8

static LIST_HEAD(config_device_list);

/* s2 may end with '*' to match everything */
static int strncmp_wildcard(char *s1, char *s2, int max)
{
	int len = strlen(s2);
	if (len > max)
		len = max;
	if (s2[len-1] == '*')
		len--;
	else
		len = max;
	return strncmp(s1, s2, len);
}

static void dump_dev(struct config_device *dev)
{
	switch (dev->type) {
	case KERNEL_NAME:
		dbg_parse("KERNEL name='%s' ,"
			  "owner='%s', group='%s', mode=%#o",
			  dev->name, dev->owner, dev->group, dev->mode);
		break;
	case LABEL:
		dbg_parse("LABEL name='%s', bus='%s', sysfs_file='%s', sysfs_value='%s', "
			  "owner='%s', group='%s', mode=%#o",
			  dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value,
			  dev->owner, dev->group, dev->mode);
		break;
	case NUMBER:
		dbg_parse("NUMBER name='%s', bus='%s', id='%s', "
			  "owner='%s', group='%s', mode=%#o",
			  dev->name, dev->bus, dev->id,
			  dev->owner, dev->group, dev->mode);
		break;
	case TOPOLOGY:
		dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s', "
			  "owner='%s', group='%s', mode=%#o",
			  dev->name, dev->bus, dev->place,
			  dev->owner, dev->group, dev->mode);
		break;
	case REPLACE:
		dbg_parse("REPLACE name=%s, kernel_name=%s, "
			  "owner='%s', group='%s', mode=%#o",
			  dev->name, dev->kernel_name,
			  dev->owner, dev->group, dev->mode);
		break;
	case CALLOUT:
		dbg_parse("CALLOUT name='%s', bus='%s', program='%s', id='%s', "
			  "owner='%s', group='%s', mode=%#o",
			  dev->name, dev->bus, dev->exec_program, dev->id,
			  dev->owner, dev->group, dev->mode);
		break;
	default:
		dbg_parse("unknown type of method");
	}
}

#define copy_var(a, b, var)		\
	if (b->var)			\
		a->var = b->var;

#define copy_string(a, b, var)		\
	if (strlen(b->var))		\
		strcpy(a->var, b->var);

static int add_dev(struct config_device *new_dev)
{
	struct list_head *tmp;
	struct config_device *tmp_dev;

	/* update the values if we already have the device */
	list_for_each(tmp, &config_device_list) {
		struct config_device *dev = list_entry(tmp, struct config_device, node);
		if (strncmp_wildcard(dev->name, new_dev->name, sizeof(dev->name)))
			continue;
		copy_var(dev, new_dev, type);
		copy_var(dev, new_dev, mode);
		copy_string(dev, new_dev, bus);
		copy_string(dev, new_dev, sysfs_file);
		copy_string(dev, new_dev, sysfs_value);
		copy_string(dev, new_dev, id);
		copy_string(dev, new_dev, place);
		copy_string(dev, new_dev, kernel_name);
		copy_string(dev, new_dev, owner);
		copy_string(dev, new_dev, group);
		return 0;
	}

	/* not found, add new structure to the device list */
	tmp_dev = malloc(sizeof(*tmp_dev));
	if (!tmp_dev)
		return -ENOMEM;
	memcpy(tmp_dev, new_dev, sizeof(*tmp_dev));
	list_add(&tmp_dev->node, &config_device_list);
	//dump_dev(tmp_dev);
	return 0;
}

static void dump_dev_list(void)
{
	struct list_head *tmp;

	list_for_each(tmp, &config_device_list) {
		struct config_device *dev = list_entry(tmp, struct config_device, node);
		dump_dev(dev);
	}
}
	
static int get_pair(char **orig_string, char **left, char **right)
{
	char *temp;
	char *string = *orig_string;

	if (!string)
		return -ENODEV;

	/* eat any whitespace */
	while (isspace(*string))
		++string;

	/* split based on '=' */
	temp = strsep(&string, "=");
	*left = temp;
	if (!string)
		return -ENODEV;

	/* take the right side and strip off the '"' */
	while (isspace(*string))
		++string;
	if (*string == '"')
		++string;
	else
		return -ENODEV;

	temp = strsep(&string, "\"");
	if (!string || *temp == '\0')
		return -ENODEV;
	*right = temp;
	*orig_string = string;
	
	return 0;
}

static int get_value(const char *left, char **orig_string, char **ret_string)
{
	int retval;
	char *left_string;

	retval = get_pair(orig_string, &left_string, ret_string);
	if (retval)
		return retval;
	if (strcasecmp(left_string, left) != 0)
		return -ENODEV;
	return 0;
}

static int namedev_init_config(void)
{
	char line[255];
	int lineno;
	char *temp;
	char *temp2;
	char *temp3;
	FILE *fd;
	int retval = 0;
	struct config_device dev;

	dbg("opening %s to read as config", udev_config_filename);
	fd = fopen(udev_config_filename, "r");
	if (fd == NULL) {
		dbg("can't open %s", udev_config_filename);
		return -ENODEV;
	}

	/* loop through the whole file */
	lineno = 0;
	while (1) {
		/* get a line */
		temp = fgets(line, sizeof(line), fd);
		if (temp == NULL)
			goto exit;
		lineno++;

		dbg_parse("read %s", temp);

		/* eat the whitespace at the beginning of the line */
		while (isspace(*temp))
			++temp;

		/* empty line? */
		if (*temp == 0x00)
			continue;

		/* see if this is a comment */
		if (*temp == COMMENT_CHARACTER)
			continue;

		memset(&dev, 0x00, sizeof(struct config_device));

		/* parse the line */
		temp2 = strsep(&temp, ",");
		if (strcasecmp(temp2, TYPE_LABEL) == 0) {
			/* label type */
			dev.type = LABEL;

			/* BUS="bus" */
			retval = get_value("BUS", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.bus, temp3);

			/* file="value" */
			temp2 = strsep(&temp, ",");
			retval = get_pair(&temp, &temp2, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.sysfs_file, temp2);
			strfieldcpy(dev.sysfs_value, temp3);

			/* NAME="new_name" */
			temp2 = strsep(&temp, ",");
			retval = get_value("NAME", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.name, temp3);

			dbg_parse("LABEL name='%s', bus='%s', "
				  "sysfs_file='%s', sysfs_value='%s'",
				  dev.name, dev.bus, dev.sysfs_file,
				  dev.sysfs_value);
		}

		if (strcasecmp(temp2, TYPE_NUMBER) == 0) {
			/* number type */
			dev.type = NUMBER;

			/* BUS="bus" */
			retval = get_value("BUS", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.bus, temp3);

			/* ID="id" */
			temp2 = strsep(&temp, ",");
			retval = get_value("ID", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.id, temp3);

			/* file="value" OR NAME="new_name" */
			temp2 = strsep(&temp, ",");
			retval = get_pair(&temp, &temp2, &temp3);
			if (retval)
				break;
			if(strcmp("NAME", temp2) != 0) {
				/* file="value" */
				strfieldcpy(dev.sysfs_file, temp2);
				strfieldcpy(dev.sysfs_value, temp3);
				/* NAME="new_name" */
				temp2 = strsep(&temp, ",");
				retval = get_value("NAME", &temp, &temp3);

				dbg_parse("sysfs_file='%s' sysfs_value='%s'",
					 dev.sysfs_file, dev.sysfs_value);
			}
			strfieldcpy(dev.name, temp3);
			dbg_parse("NUMBER name='%s', bus='%s', id='%s'",
				  dev.name, dev.bus, dev.id);
		}

		if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) {
			/* number type */
			dev.type = TOPOLOGY;

			/* BUS="bus" */
			retval = get_value("BUS", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.bus, temp3);

			/* PLACE="place" */
			temp2 = strsep(&temp, ",");
			retval = get_value("PLACE", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.place, temp3);

			/* NAME="new_name" */
			temp2 = strsep(&temp, ",");
			retval = get_value("NAME", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.name, temp3);

			dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s'",
				  dev.name, dev.bus, dev.place);
		}

		if (strcasecmp(temp2, TYPE_REPLACE) == 0) {
			/* number type */
			dev.type = REPLACE;

			/* KERNEL="kernel_name" */
			retval = get_value("KERNEL", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.kernel_name, temp3);

			/* NAME="new_name" */
			temp2 = strsep(&temp, ",");
			retval = get_value("NAME", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.name, temp3);
			dbg_parse("REPLACE name='%s', kernel_name='%s'",
				  dev.name, dev.kernel_name);
		}
		if (strcasecmp(temp2, TYPE_CALLOUT) == 0) {
			/* number type */
			dev.type = CALLOUT;

			/* BUS="bus" */
			retval = get_value("BUS", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.bus, temp3);

			/* PROGRAM="executable" */
			temp2 = strsep(&temp, ",");
			retval = get_value("PROGRAM", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.exec_program, temp3);

			/* ID="id" */
			temp2 = strsep(&temp, ",");
			retval = get_value("ID", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.id, temp3);

			/* NAME="new_name" */
			temp2 = strsep(&temp, ",");
			retval = get_value("NAME", &temp, &temp3);
			if (retval)
				break;
			strfieldcpy(dev.name, temp3);
			dbg_parse("CALLOUT name='%s', program='%s'",
				  dev.name, dev.exec_program);
		}

		retval = add_dev(&dev);
		if (retval) {
			dbg("add_dev returned with error %d", retval);
			goto exit;
		}
	}
	dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename,
		  lineno, temp - line, temp);
exit:
	fclose(fd);
	return retval;
}	


static int namedev_init_permissions(void)
{
	char line[255];
	char *temp;
	char *temp2;
	FILE *fd;
	int retval = 0;
	struct config_device dev;

	dbg("opening %s to read as permissions config", udev_config_permission_filename);
	fd = fopen(udev_config_permission_filename, "r");
	if (fd == NULL) {
		dbg("can't open %s", udev_config_permission_filename);
		return -ENODEV;
	}

	/* loop through the whole file */
	while (1) {
		temp = fgets(line, sizeof(line), fd);
		if (temp == NULL)
			break;

		dbg_parse("read %s", temp);

		/* eat the whitespace at the beginning of the line */
		while (isspace(*temp))
			++temp;

		/* empty line? */
		if (*temp == 0x00)
			continue;

		/* see if this is a comment */
		if (*temp == COMMENT_CHARACTER)
			continue;

		memset(&dev, 0x00, sizeof(dev));

		/* parse the line */
		temp2 = strsep(&temp, ":");
		if (!temp2) {
			dbg("cannot parse line: %s", line);
			continue;
		}
		strncpy(dev.name, temp2, sizeof(dev.name));

		temp2 = strsep(&temp, ":");
		if (!temp2) {
			dbg("cannot parse line: %s", line);
			continue;
		}
		strncpy(dev.owner, temp2, sizeof(dev.owner));

		temp2 = strsep(&temp, ":");
		if (!temp2) {
			dbg("cannot parse line: %s", line);
			continue;
		}
		strncpy(dev.group, temp2, sizeof(dev.owner));

		dev.mode = strtol(temp, NULL, 8);

		dbg_parse("name='%s', owner='%s', group='%s', mode=%#o",
			  dev.name, dev.owner, dev.group,
			  dev.mode);
		retval = add_dev(&dev);
		if (retval) {
			dbg("add_dev returned with error %d", retval);
			goto exit;
		}
	}

exit:
	fclose(fd);
	return retval;
}	

static mode_t get_default_mode(struct sysfs_class_device *class_dev)
{
	/* just default everyone to rw for the world! */
	return 0666;
}

static void build_kernel_number(struct sysfs_class_device *class_dev, struct udevice *udev)
{
	char *dig;

	/* FIXME, figure out how to handle stuff like sdaj which will not work right now. */
	dig = class_dev->name + strlen(class_dev->name);
	while (isdigit(*(dig-1)))
		dig--;
	strfieldcpy(udev->kernel_number, dig);
	dbg("kernel_number = %s", udev->kernel_number);
}

static void apply_format(struct udevice *udev, unsigned char *string)
{
	char name[NAME_SIZE];
	char *pos;

	while (1) {
		pos = strchr(string, '%');

		if (pos) {
			strfieldcpy(name, pos+2);
			*pos = 0x00;
			switch (pos[1]) {
			case 'b':
				if (strlen(udev->bus_id) == 0)
					break;
				strcat(string, udev->bus_id);
				dbg("substitute bus_id '%s'", udev->bus_id);
				break;
			case 'n':
				if (strlen(udev->kernel_number) == 0)
					break;
				strcat(pos, "s");
				strcat(pos, udev->kernel_number);
				dbg("substitute kernel number '%s'", udev->kernel_number);
				break;
			case 'm':
				sprintf(pos, "%u", udev->minor);
				dbg("substitute minor number '%u'", udev->minor);
				break;
			case 'M':
				sprintf(pos, "%u", udev->major);
				dbg("substitute major number '%u'", udev->major);
				break;
			case 'c':
				if (strlen(udev->callout_value) == 0)
					break;
				strcat(pos, udev->callout_value);
				dbg("substitute callout output '%s'", udev->callout_value);
				break;
			default:
				dbg("unknown substitution type '%%%c'", pos[1]);
				break;
			}
			strcat(string, name);
		} else
			break;
	}
}


static int exec_callout(struct config_device *dev, char *value, int len)
{
	int retval;
	int res;
	int status;
	int fds[2];
	pid_t pid;
	int value_set = 0;
	char buffer[256];
	char *arg;
	char *args[CALLOUT_MAXARG];
	int i;

	dbg("callout to '%s'", dev->exec_program);
	retval = pipe(fds);
	if (retval != 0) {
		dbg("pipe failed");
		return -1;
	}
	pid = fork();
	if (pid == -1) {
		dbg("fork failed");
		return -1;
	}

	if (pid == 0) {
		/* child */
		close(STDOUT_FILENO);
		dup(fds[1]);	/* dup write side of pipe to STDOUT */
		if (strchr(dev->exec_program, ' ')) {
			/* callout with arguments */
			arg = dev->exec_program;
			for (i=0; i < CALLOUT_MAXARG-1; i++) {
				args[i] = strsep(&arg, " ");
				if (args[i] == NULL)
					break;
			}
			if (args[i]) {
				dbg("too many args - %d", i);
				args[i] = NULL;
			}
			retval = execve(args[0], args, main_envp);
		} else {
			retval = execve(dev->exec_program, main_argv, main_envp);
		}
		if (retval != 0) {
			dbg("child execve failed");
			exit(1);
		}
		return -1; /* avoid compiler warning */
	} else {
		/* parent reads from fds[0] */
		close(fds[1]);
		retval = 0;
		while (1) {
			res = read(fds[0], buffer, sizeof(buffer) - 1);
			if (res <= 0)
				break;
			buffer[res] = '\0';
			if (res > len) {
				dbg("callout len %d too short\n", len);
				retval = -1;
			}
			if (value_set) {
				dbg("callout value already set");
				retval = -1;
			} else {
				value_set = 1;
				strncpy(value, buffer, len);
			}
		}
		dbg("callout returned '%s'", value);
		close(fds[0]);
		res = wait(&status);
		if (res < 0) {
			dbg("wait failed result %d", res);
			retval = -1;
		}

#ifndef __KLIBC__
		if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) {
			dbg("callout program status 0x%x", status);
			retval = -1;
		}
#endif
	}
	return retval;
}

static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev)
{
	struct config_device *dev;
	struct list_head *tmp;

	list_for_each(tmp, &config_device_list) {
		dev = list_entry(tmp, struct config_device, node);
		if (dev->type != CALLOUT)
			continue;

		/* substitute anything that needs to be in the program name */
		apply_format(udev, dev->exec_program);
		if (exec_callout(dev, udev->callout_value, NAME_SIZE))
			continue;
		if (strncmp_wildcard(udev->callout_value, dev->id, NAME_SIZE) != 0)
			continue;
		strfieldcpy(udev->name, dev->name);
		if (dev->mode != 0) {
			udev->mode = dev->mode;
			strfieldcpy(udev->owner, dev->owner);
			strfieldcpy(udev->group, dev->group);
		}
		dbg_parse("callout returned matching value '%s', '%s' becomes '%s'"
			  " - owner='%s', group='%s', mode =%#o",
			  dev->id, class_dev->name, udev->name,
			  dev->owner, dev->group, dev->mode);
		return 0;
	}
	return -ENODEV;
}

static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device)
{
	struct sysfs_attribute *tmpattr = NULL;
	struct config_device *dev;
	struct list_head *tmp;

	list_for_each(tmp, &config_device_list) {
		dev = list_entry(tmp, struct config_device, node);
		if (dev->type != LABEL)
			continue;

		dbg_parse("look for device attribute '%s'", dev->sysfs_file);
		/* try to find the attribute in the class device directory */
		tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file);
		if (tmpattr)
			goto label_found;

		/* look in the class device directory if present */
		if (sysfs_device) {
			tmpattr = sysfs_get_device_attr(sysfs_device, dev->sysfs_file);
			if (tmpattr)
				goto label_found;
		}

		continue;

label_found:
		tmpattr->value[strlen(tmpattr->value)-1] = 0x00;
		dbg_parse("compare attribute '%s' value '%s' with '%s'",
			  dev->sysfs_file, tmpattr->value, dev->sysfs_value);
		if (strcmp(dev->sysfs_value, tmpattr->value) != 0)
			continue;

		strfieldcpy(udev->name, dev->name);
		if (dev->mode != 0) {
			udev->mode = dev->mode;
			strfieldcpy(udev->owner, dev->owner);
			strfieldcpy(udev->group, dev->group);
		}
		dbg_parse("found matching attribute '%s', '%s' becomes '%s' "
			  "- owner='%s', group='%s', mode=%#o",
			  dev->sysfs_file, class_dev->name, udev->name,
			  dev->owner, dev->group, dev->mode);

		return 0;
	}
	return -ENODEV;
}

static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device)
{
	struct config_device *dev;
	struct list_head *tmp;
	char path[SYSFS_PATH_MAX];
	int found;
	char *temp = NULL;
	struct sysfs_attribute *tmpattr = NULL;

	/* we have to have a sysfs device for NUMBER to work */
	if (!sysfs_device)
		return -ENODEV;

	list_for_each(tmp, &config_device_list) {
		dev = list_entry(tmp, struct config_device, node);
		if (dev->type != NUMBER)
			continue;

		found = 0;
		strfieldcpy(path, sysfs_device->path);
		temp = strrchr(path, '/');
		dbg_parse("search '%s' in '%s', path='%s'", dev->id, temp, path);
		if (strstr(temp, dev->id) != NULL) {
			found = 1;
		} else {
			*temp = 0x00;
			temp = strrchr(path, '/');
			dbg_parse("search '%s' in '%s', path='%s'", dev->id, temp, path);
			if (strstr(temp, dev->id) != NULL)
				found = 1;
		}
		if (!found)
			continue;

		if (strcmp(dev->sysfs_file, "device_type") == 0) {
			dbg_parse("look for device_type attribute '%s'",
				 dev->sysfs_file);
			/* try to find the attribute in the class device directory */
			tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file);
			if (tmpattr)
				goto number_found;

			/* look in the class device directory if present */
			if (sysfs_device) {
				tmpattr = sysfs_get_device_attr(sysfs_device, dev->sysfs_file);
				if (tmpattr)
					goto number_found;
			}

			continue;
number_found:
			tmpattr->value[strlen(tmpattr->value)-1] = '\0';
			dbg_parse("compare attribute '%s' value '%s' with '%s'",
				dev->sysfs_file, tmpattr->value,
				dev->sysfs_value);
			if (strncmp(dev->sysfs_value, tmpattr->value, strlen(dev->sysfs_value)) != 0)
				continue;
			
			dbg_parse("found matching attribute '%s', '%s' becomes"
				" '%s' - owner='%s', group='%s', mode=%#o",
				dev->sysfs_file, class_dev->name, udev->name,
				dev->owner, dev->group, dev->mode);
		}
		strfieldcpy(udev->name, dev->name);
		if (dev->mode != 0) {
			udev->mode = dev->mode;
			strfieldcpy(udev->owner, dev->owner);
			strfieldcpy(udev->group, dev->group);
		}
		dbg_parse("found matching id '%s', '%s' becomes '%s'"
			  " - owner='%s', group ='%s', mode=%#o",
			  dev->id, class_dev->name, udev->name,
			  dev->owner, dev->group, dev->mode);
		return 0;
	}
	return -ENODEV;
}


static int do_topology(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device)
{
	struct config_device *dev;
	struct list_head *tmp;
	char path[SYSFS_PATH_MAX];
	int found;
	char *temp = NULL;

	/* we have to have a sysfs device for TOPOLOGY to work */
	if (!sysfs_device)
		return -ENODEV;

	list_for_each(tmp, &config_device_list) {
		dev = list_entry(tmp, struct config_device, node);
		if (dev->type != TOPOLOGY)
			continue;

		found = 0;
		strfieldcpy(path, sysfs_device->path);
		temp = strrchr(path, '/');
		dbg_parse("search '%s' in '%s', path='%s'", dev->place, temp, path);
		if (strstr(temp, dev->place) != NULL) {
			found = 1;
		} else {
			*temp = 0x00;
			temp = strrchr(path, '/');
			dbg_parse("search '%s' in '%s', path='%s'", dev->place, temp, path);
			if (strstr(temp, dev->place) != NULL)
				found = 1;
		}
		if (!found)
			continue;

		strfieldcpy(udev->name, dev->name);
		if (dev->mode != 0) {
			udev->mode = dev->mode;
			strfieldcpy(udev->owner, dev->owner);
			strfieldcpy(udev->group, dev->group);
		}
		dbg_parse("found matching place '%s', '%s' becomes '%s'"
			  " - owner='%s', group ='%s', mode=%#o",
			  dev->place, class_dev->name, udev->name,
			  dev->owner, dev->group, dev->mode);
		return 0;
	}
	return -ENODEV;
}

static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev)
{
	struct config_device *dev;
	struct list_head *tmp;

	list_for_each(tmp, &config_device_list) {
		dev = list_entry(tmp, struct config_device, node);
		if (dev->type != REPLACE)
			continue;

		dbg_parse("compare name '%s' with '%s'",
			  dev->kernel_name, dev->name);
		if (strcmp(dev->kernel_name, class_dev->name) != 0)
			continue;

		strfieldcpy(udev->name, dev->name);
		if (dev->mode != 0) {
			udev->mode = dev->mode;
			strfieldcpy(udev->owner, dev->owner);
			strfieldcpy(udev->group, dev->group);
		}
		dbg_parse("found name, '%s' becomes '%s' - owner='%s', group='%s', mode = %#o",
			  dev->kernel_name, udev->name, 
			  dev->owner, dev->group, dev->mode);
		
		return 0;
	}
	return -ENODEV;
}

static void do_kernelname(struct sysfs_class_device *class_dev, struct udevice *udev)
{
	struct config_device *dev;
	struct list_head *tmp;
	int len;

	strfieldcpy(udev->name, class_dev->name);
	/* look for permissions */
	list_for_each(tmp, &config_device_list) {
		dev = list_entry(tmp, struct config_device, node);
		len = strlen(dev->name);
		if (strncmp_wildcard(class_dev->name, dev->name, sizeof(dev->name)))
			continue;
		if (dev->mode != 0) {
			dbg_parse("found permissions for '%s'", class_dev->name);
			udev->mode = dev->mode;
			strfieldcpy(udev->owner, dev->owner);
			strfieldcpy(udev->group, dev->group);
		}
	}
}

static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev)
{
	struct sysfs_device *sysfs_device = NULL;
	struct sysfs_class_device *class_dev_parent = NULL;
	int retval = 0;
	char *temp = NULL;

	udev->mode = 0;

	/* find the sysfs_device for this class device */
	/* Wouldn't it really be nice if libsysfs could do this for us? */
	if (class_dev->sysdevice) {
		sysfs_device = class_dev->sysdevice;
	} else {
		/* bah, let's go backwards up a level to see if the device is there,
		 * as block partitions don't point to the physical device.  Need to fix that
		 * up in the kernel...
		 */
		if (strstr(class_dev->path, "block")) {
			dbg_parse("looking at block device...");
			if (isdigit(class_dev->path[strlen(class_dev->path)-1])) {
				char path[SYSFS_PATH_MAX];

				dbg_parse("really is a partition...");
				strfieldcpy(path, class_dev->path);
				temp = strrchr(path, '/');
				*temp = 0x00;
				dbg_parse("looking for a class device at '%s'", path);
				class_dev_parent = sysfs_open_class_device(path);
				if (class_dev_parent == NULL) {
					dbg("sysfs_open_class_device at '%s' failed", path);
				} else {
					dbg_parse("class_dev_parent->name=%s", class_dev_parent->name);
					if (class_dev_parent->sysdevice)
						sysfs_device = class_dev_parent->sysdevice;
				}
			}
		}
	}
		
	if (sysfs_device) {
		dbg_parse("sysfs_device->path='%s'", sysfs_device->path);
		dbg_parse("sysfs_device->bus_id='%s'", sysfs_device->bus_id);
		strfieldcpy(udev->bus_id, sysfs_device->bus_id);
	} else {
		dbg_parse("class_dev->name = '%s'", class_dev->name);
	}

	build_kernel_number(class_dev, udev);

	/* rules are looked at in priority order */
	retval = do_callout(class_dev, udev);
	if (retval == 0)
		goto found;

	retval = do_label(class_dev, udev, sysfs_device);
	if (retval == 0)
		goto found;

	retval = do_number(class_dev, udev, sysfs_device);
	if (retval == 0)
		goto found;

	retval = do_topology(class_dev, udev, sysfs_device);
	if (retval == 0)
		goto found;

	retval = do_replace(class_dev, udev);
	if (retval == 0)
		goto found;

	do_kernelname(class_dev, udev);
	goto done;

found:
	/* substitute placeholder in NAME  */
	apply_format(udev, udev->name);

done:
	/* mode was never set above */
	if (!udev->mode) {
		udev->mode = get_default_mode(class_dev);
		udev->owner[0] = 0x00;
		udev->group[0] = 0x00;
	}

	if (class_dev_parent)
		sysfs_close_class_device(class_dev_parent);

	return 0;
}

int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *dev)
{
	int retval;

	retval = get_attr(class_dev, dev);
	if (retval)
		dbg("get_attr failed");

	return retval;
}

int namedev_init(void)
{
	int retval;
	
	retval = namedev_init_config();
	if (retval)
		return retval;

	retval = namedev_init_permissions();
	if (retval)
		return retval;

	dump_dev_list();
	return retval;
}

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (21 preceding siblings ...)
  2003-11-25 12:56 ` Surekha.PC
@ 2003-11-25 13:12 ` Martin Hicks
  2003-11-25 13:40 ` Surekha.PC
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Martin Hicks @ 2003-11-25 13:12 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 644 bytes --]

On Tue, 2003-11-25 at 07:44, Surekha.PC wrote:
>
> For iSCSI devices, since hostid is not consistent, we are defining a new
> iSCSI device attribute in sysfs, which will be checked while naming the
> device.
> 
> NUMBER, BUS="scsi", ID="0:0:0", device_type="ISCSI", NAME="ib0t0l0%n"

What happens when you are connecting to multiple ISCSI targets?  do you
end up with multiple iscsi hosts?  Is there any situation that you can
think of where someone might have more than one iSCSI host?  if there is
then your patch probably doesn't go far enough.

Thinking Big,
mh

-- 
Martin Hicks || mort@bork.org || PGP/GnuPG: 0x4C7F2BEE

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (22 preceding siblings ...)
  2003-11-25 13:12 ` Martin Hicks
@ 2003-11-25 13:40 ` Surekha.PC
  2003-11-25 16:36 ` Greg KH
                   ` (2 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-25 13:40 UTC (permalink / raw)
  To: linux-hotplug


Hi,
 
  Our iSCSI driver supports only one HBA. So even  if we connect to
multiple targets, the same iSCSI host will be used. Work is underway for
inclusion of our iSCSI driver in 2.6 kernel. So I don't foresee the case
you mentioned.

Thanks,
surekha
  
-----Original Message-----
From: Martin Hicks [mailto:mort@bork.org] 
Sent: Tuesday, November 25, 2003 6:42 PM
To: Surekha.PC
Cc: 'Greg KH'; linux-hotplug
Subject: RE: udev does not create scsi disk entries during bootup


On Tue, 2003-11-25 at 07:44, Surekha.PC wrote:
>
> For iSCSI devices, since hostid is not consistent, we are defining a 
> new iSCSI device attribute in sysfs, which will be checked while 
> naming the device.
> 
> NUMBER, BUS="scsi", ID="0:0:0", device_type="ISCSI", NAME="ib0t0l0%n"

What happens when you are connecting to multiple ISCSI targets?  do you
end up with multiple iscsi hosts?  Is there any situation that you can
think of where someone might have more than one iSCSI host?  if there is
then your patch probably doesn't go far enough.

Thinking Big,
mh

-- 
Martin Hicks || mort@bork.org || PGP/GnuPG: 0x4C7F2BEE



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (23 preceding siblings ...)
  2003-11-25 13:40 ` Surekha.PC
@ 2003-11-25 16:36 ` Greg KH
  2003-11-27 11:36 ` Surekha.PC
  2003-12-01 23:59 ` Greg KH
  26 siblings, 0 replies; 28+ messages in thread
From: Greg KH @ 2003-11-25 16:36 UTC (permalink / raw)
  To: linux-hotplug

On Tue, Nov 25, 2003 at 06:14:12PM +0530, Surekha.PC wrote:
> 
> I am submitting the patch with 2 changes.

Can you split this up into 2 different patches, both generated with
'diff -u' so we can see the changes easier?

> 1)To include new field in the NUMBER rule specially for iSCSI devices.
>  
> The current rule provided by udev is as below.
> 
> NUMBER, BUS="scsi", ID=2:0:0:0", NAME="disk%n"
> 
> For iSCSI devices, since hostid is not consistent, we are defining a new
> iSCSI device attribute in sysfs, which will be checked while naming the
> device.
> 
> NUMBER, BUS="scsi", ID="0:0:0", device_type="ISCSI", NAME="ib0t0l0%n"

Where does the device_type come from?  Is it a sysfs file?

> 2) Device partition name needs to be appended with "s" before partition
> id.
>  
> If the device name consists of bus,target info like "c0b0t0l0" it will
> be easier to identify the partition as in "c0b0t0l0s1".

It looks like your patch just always adds a 's' whenever you use a %n
field.  Why not just put the 's' in your NAME?  Otherwise you just broke
everyone's rules who do not want a 's' :)

Can't you do everything you need with a simple callout script right now
with no changes needed for udev?

> Please find the patch alongwith.

patches are all that need to be sent.  You don't have to send the
original and modified files.

thanks,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (24 preceding siblings ...)
  2003-11-25 16:36 ` Greg KH
@ 2003-11-27 11:36 ` Surekha.PC
  2003-12-01 23:59 ` Greg KH
  26 siblings, 0 replies; 28+ messages in thread
From: Surekha.PC @ 2003-11-27 11:36 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 2644 bytes --]


Hi,

>Can you split this up into 2 different patches, both generated with
'diff -u' so we can 
>see the changes easier?

I have generated the patch in the suggested format. The patch for
appending partition name  is just a one liner, so it is part of patch
enclosed alongwith. Line #34, is the change with this statement.

+ strcat(pos, "s");


>> 1)To include new field in the NUMBER rule specially for iSCSI
devices.
>>  
>> The current rule provided by udev is as below.
>> 
>> NUMBER, BUS="scsi", ID=2:0:0:0", NAME="disk%n"
>> 
>> For iSCSI devices, since hostid is not consistent, we are defining a 
>> new iSCSI device attribute in sysfs, which will be checked while 
>> naming the device.
>> 
>> NUMBER, BUS="scsi", ID="0:0:0", device_type="ISCSI", NAME="ib0t0l0%n"

>Where does the device_type come from?  Is it a sysfs file?

It is a sysfs file which is a device attribute defined for iSCSI devices
in the iSCSI driver.

>> 2) Device partition name needs to be appended with "s" before 
>> partition id.
>>  
>> If the device name consists of bus,target info like "c0b0t0l0" it
will 
>> be easier to identify the partition as in "c0b0t0l0s1".

>It looks like your patch just always adds a 's' whenever you use a %n
field.  Why not 
>just put the 's' in your NAME?  Otherwise you just broke everyone's
rules who do not want >a 's' :)

The string 's' (it could be named as 'part' also) has be used only on
partition names like 'sda1', 'sda2' and not on block device name 'sda'.
So  it can't be put in the NAME field. 

Below is the how the output for iSCSI device looks with this patch. 

This will help separately identify the partition number from lun number.

#ls -l /udev
total 0
brw-rw-rw-    1 root     root       8,  32 Nov 27 07:17 ib0t4l0
brw-rw-rw-    1 root     root       8,  33 Nov 27 07:17 ib0t4l0s1
brw-rw-rw-    1 root     root       8,  34 Nov 27 07:17 ib0t4l0s2

 
>Can't you do everything you need with a simple callout script right now
with no changes 
>needed for udev?

Persistent naming of iSCSI devices require bus, target and lun info.
This is in conjunction with persistent target binding done internally in
our driver where we bind each iSCSI device to a unique bus/target pair
based on the iSCSI targetname.

In a case where there are many targets connected to iSCSI host,
udev.config is automatically generated by looking up the bus and target
id allocated for the iSCSI device.

This needs to be matched with iSCSI specific device attribute
'device_type' to make sure this naming applies only for a iSCSI device.
It is not possible to achieve this funtionality with CALLOUT
configuration.

Thanks,
surekha

[-- Attachment #2: namedev.c.diff --]
[-- Type: application/octet-stream, Size: 2591 bytes --]

--- namedev.c.org	2003-11-27 14:52:50.738368424 -0500
+++ namedev.c	2003-11-25 16:45:18.000000000 -0500
@@ -298,13 +298,23 @@
 				break;
 			strfieldcpy(dev.id, temp3);
 
-			/* NAME="new_name" */
+			/* file="value" OR NAME="new_name" */
 			temp2 = strsep(&temp, ",");
-			retval = get_value("NAME", &temp, &temp3);
+			retval = get_pair(&temp, &temp2, &temp3);
 			if (retval)
 				break;
-			strfieldcpy(dev.name, temp3);
+			if(strcmp("NAME", temp2) != 0) {
+				/* file="value" */
+				strfieldcpy(dev.sysfs_file, temp2);
+				strfieldcpy(dev.sysfs_value, temp3);
+				/* NAME="new_name" */
+				temp2 = strsep(&temp, ",");
+				retval = get_value("NAME", &temp, &temp3);
 
+				dbg_parse("sysfs_file='%s' sysfs_value='%s'",
+					 dev.sysfs_file, dev.sysfs_value);
+			}
+			strfieldcpy(dev.name, temp3);
 			dbg_parse("NUMBER name='%s', bus='%s', id='%s'",
 				  dev.name, dev.bus, dev.id);
 		}
@@ -520,6 +530,7 @@
 			case 'n':
 				if (strlen(udev->kernel_number) == 0)
 					break;
+				strcat(pos, "s");
 				strcat(pos, udev->kernel_number);
 				dbg("substitute kernel number '%s'", udev->kernel_number);
 				break;
@@ -724,6 +735,7 @@
 	char path[SYSFS_PATH_MAX];
 	int found;
 	char *temp = NULL;
+	struct sysfs_attribute *tmpattr = NULL;
 
 	/* we have to have a sysfs device for NUMBER to work */
 	if (!sysfs_device)
@@ -749,6 +761,36 @@
 		}
 		if (!found)
 			continue;
+
+		if (strcmp(dev->sysfs_file, "device_type") == 0) {
+			dbg_parse("look for device_type attribute '%s'",
+				 dev->sysfs_file);
+			/* try to find the attribute in the class device directory */
+			tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file);
+			if (tmpattr)
+				goto number_found;
+
+			/* look in the class device directory if present */
+			if (sysfs_device) {
+				tmpattr = sysfs_get_device_attr(sysfs_device, dev->sysfs_file);
+				if (tmpattr)
+					goto number_found;
+			}
+
+			continue;
+number_found:
+			tmpattr->value[strlen(tmpattr->value)-1] = '\0';
+			dbg_parse("compare attribute '%s' value '%s' with '%s'",
+				dev->sysfs_file, tmpattr->value,
+				dev->sysfs_value);
+			if (strncmp(dev->sysfs_value, tmpattr->value, strlen(dev->sysfs_value)) != 0)
+				continue;
+			
+			dbg_parse("found matching attribute '%s', '%s' becomes"
+				" '%s' - owner='%s', group='%s', mode=%#o",
+				dev->sysfs_file, class_dev->name, udev->name,
+				dev->owner, dev->group, dev->mode);
+		}
 		strfieldcpy(udev->name, dev->name);
 		if (dev->mode != 0) {
 			udev->mode = dev->mode;

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: udev does not create scsi disk entries during bootup
  2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
                   ` (25 preceding siblings ...)
  2003-11-27 11:36 ` Surekha.PC
@ 2003-12-01 23:59 ` Greg KH
  26 siblings, 0 replies; 28+ messages in thread
From: Greg KH @ 2003-12-01 23:59 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Nov 27, 2003 at 04:54:37PM +0530, Surekha.PC wrote:
> 
> Hi,
> 
> >Can you split this up into 2 different patches, both generated with
> 'diff -u' so we can 
> >see the changes easier?
> 
> I have generated the patch in the suggested format. The patch for
> appending partition name  is just a one liner, so it is part of patch
> enclosed alongwith. Line #34, is the change with this statement.
> 
> + strcat(pos, "s");

With that, you break everyone who uses the %n modifier.  Why not just
add a 's' to your NAME value?

Not applied.

> >> 1)To include new field in the NUMBER rule specially for iSCSI
> devices.
> >>  
> >> The current rule provided by udev is as below.
> >> 
> >> NUMBER, BUS="scsi", ID=2:0:0:0", NAME="disk%n"
> >> 
> >> For iSCSI devices, since hostid is not consistent, we are defining a 
> >> new iSCSI device attribute in sysfs, which will be checked while 
> >> naming the device.
> >> 
> >> NUMBER, BUS="scsi", ID="0:0:0", device_type="ISCSI", NAME="ib0t0l0%n"
> 
> >Where does the device_type come from?  Is it a sysfs file?
> 
> It is a sysfs file which is a device attribute defined for iSCSI devices
> in the iSCSI driver.
> 
> >> 2) Device partition name needs to be appended with "s" before 
> >> partition id.
> >>  
> >> If the device name consists of bus,target info like "c0b0t0l0" it
> will 
> >> be easier to identify the partition as in "c0b0t0l0s1".
> 
> >It looks like your patch just always adds a 's' whenever you use a %n
> field.  Why not 
> >just put the 's' in your NAME?  Otherwise you just broke everyone's
> rules who do not want >a 's' :)
> 
> The string 's' (it could be named as 'part' also) has be used only on
> partition names like 'sda1', 'sda2' and not on block device name 'sda'.
> So  it can't be put in the NAME field. 
> 
> Below is the how the output for iSCSI device looks with this patch. 
> 
> This will help separately identify the partition number from lun number.
> 
> #ls -l /udev
> total 0
> brw-rw-rw-    1 root     root       8,  32 Nov 27 07:17 ib0t4l0
> brw-rw-rw-    1 root     root       8,  33 Nov 27 07:17 ib0t4l0s1
> brw-rw-rw-    1 root     root       8,  34 Nov 27 07:17 ib0t4l0s2

What is driving naming iscsi devices like this?  Any LSB standard?  Any
devfs standard?

I really think you can handle all of this for iscsi devices with a
CALLOUT script that can handle this more complex way of creating a name.

> >Can't you do everything you need with a simple callout script right now
> with no changes 
> >needed for udev?
> 
> Persistent naming of iSCSI devices require bus, target and lun info.
> This is in conjunction with persistent target binding done internally in
> our driver where we bind each iSCSI device to a unique bus/target pair
> based on the iSCSI targetname.

Why?  What if I want to name my iscsi device "greg_server_storage"?
What is forcing users to use bus, target, and lun info?

> In a case where there are many targets connected to iSCSI host,
> udev.config is automatically generated by looking up the bus and target
> id allocated for the iSCSI device.

What tool modifies udev.config automatically today?

> This needs to be matched with iSCSI specific device attribute
> 'device_type' to make sure this naming applies only for a iSCSI device.
> It is not possible to achieve this funtionality with CALLOUT
> configuration.

Again, why?  What about:
CALLOUT, BUS="scsi", PROGRAM="/sbin/name_iscsi", ID="*", NAME="%c"

and then your program can test the 'type' value of the sysfs device
passed to it.  As most scsi device naming issues are going to be handled
by a CALLOUT rule anyway (due to a lot of the scsi device info not
available in sysfs), I don't see a big problem with this.

thanks,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2003-12-01 23:59 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-13  5:28 udev does not create scsi disk entries during bootup Surekha.PC
2003-11-13  6:25 ` Greg KH
2003-11-13  8:13 ` Surekha.PC
2003-11-14  1:07 ` Greg KH
2003-11-14  3:55 ` Surekha.PC
2003-11-17  4:54 ` Surekha.PC
2003-11-17 13:02 ` Martin Hicks
2003-11-18  8:23 ` Surekha.PC
2003-11-19 13:48 ` Surekha.PC
2003-11-19 23:57 ` Greg KH
2003-11-20 15:11 ` Surekha.PC
2003-11-20 16:46 ` Greg KH
2003-11-20 16:53 ` Greg KH
2003-11-20 18:38 ` Clay Haapala
2003-11-20 18:41 ` Greg KH
2003-11-20 19:11 ` Clay Haapala
2003-11-21  5:49 ` Surekha.PC
2003-11-21  6:12 ` Greg KH
2003-11-21  6:52 ` Surekha.PC
2003-11-22 18:12 ` Greg KH
2003-11-24 12:50 ` Surekha.PC
2003-11-24 22:14 ` Greg KH
2003-11-25 12:56 ` Surekha.PC
2003-11-25 13:12 ` Martin Hicks
2003-11-25 13:40 ` Surekha.PC
2003-11-25 16:36 ` Greg KH
2003-11-27 11:36 ` Surekha.PC
2003-12-01 23:59 ` Greg KH

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).