udev-039-6 on Fedora Core 3
FYI,
I added several patches to udev-039 which will be on FC3.
I only describe the most patches here. The patches itsself are in the src.rpm and can be posted on request. The two relevant and important patches against 039 are attached.
ru
Harald
****
Patch1: udev-039-static.patch
makes inline getpwnam and getgrnam functions, which are used for the static version of udev, which is used in initramfs
Patch2: udev-025-volsbin.patch
moves volume_id from /usr/sbin to /sbin (such tools should not live in /usr, because /usr could be nfs-mounted
Patch3: udev-039-wait-error-log.patchwait_for_sysfs patch
Patch4: udev-039-logging.patch
logging patch
Patch5: udev-039-wait-ppp-class.patchwait_for_sysfs patch
Patch6: udev-039-wait-dm-block.patchwait_for_sysfs patch
Patch7: udev-039-static2.patch
include wait_for_sysfs in udev for the static udev version used in initramfs
Patch8: udev-039-netif.patch
only call dev_d_send for network interfaces, if the name was changed
Patch9: udev-039-dummy.patchwait_for_sysfs patch
Patch10: udev-039-volume_id-nonblock.patch
do not open(2) with O_NONBLOCK
Patch11: udev-039-norm.patch
add NOREMOVE keyword to the rules. this was necessary because removable ide devices were added/removed for every open(2)/close(2) added to the rules:
KERNEL="hd[a-z]*", NOREMOVE="1"
this could eventually be refined by checking the "removable" sysfs-attribute, but not for partitions..
Patch22: udev-032-symlink.patch
replace format directives in every symlink part
Patch24: udev-038-volmak.patchMakefile patch for volume_id
namedev.c renamed from namedev.c.symlink +10 -6
@@ -898,14 +898,18 @@if (dev->symlink[0 ] !='\0' ) {char temp[NAME_SIZE ]; - +char *p; +int len;info ("configured rule in '%s' at line %i applied, added symlink '%s'" , dev->config_file, dev->config_line, dev->symlink); -strfieldcpy (temp, dev->symlink); -apply_format (udev, temp,sizeof (temp), class_dev, sysfs_device); -if (udev->symlink[0 ] !='\0' ) -strfieldcat (udev->symlink," " ); -strfieldcat (udev->symlink, temp); + foreach_strpart(dev->symlink, " ", p, len) { +strncpy (temp, p, len); + temp[len] ='\0' ; +apply_format (udev, temp,sizeof (temp), class_dev, sysfs_device); +if (udev->symlink[0 ] !='\0' ) +strfieldcat (udev->symlink," " ); +strfieldcat (udev->symlink, temp); + } }if (dev->name[0 ] !='\0' ) {
namedev.h renamed from namedev.h.norm +2 -0
@@ -44,6 +44,7 @@#define FIELD_KERNEL "KERNEL"#define FIELD_NAME "NAME"#define FIELD_SYMLINK "SYMLINK" +#define FIELD_NOREMOVE "NOREMOVE"#define FIELD_OWNER "OWNER"#define FIELD_GROUP "GROUP"#define FIELD_MODE "MODE"
@@ -83,6 +84,7 @@struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS ];char owner[OWNER_SIZE ];char group[GROUP_SIZE ]; +char noremove;unsigned int mode;int partitions;char config_file[NAME_SIZE ];
udev_remove.c renamed from udev_remove.c.norm +5 -0
@@ -113,6 +113,11 @@strfieldcpy (filename, udev_root);strfieldcat (filename, dev->name); + +if ( dev->noremove !=0 ) { +info ("not removing device node '%s', because of rule" , filename); +return 0 ; + }info ("removing device node '%s'" , filename); retval =secure_unlink (filename);
namedev_parse.c renamed from namedev_parse.c.norm +8 -2
@@ -59,11 +59,11 @@dbg_parse ("name='%s', symlink='%s', bus='%s', place='%s', id='%s', " "sysfs_file[0]='%s', sysfs_value[0]='%s', " "kernel='%s', program='%s', result='%s'" -"owner='%s', group='%s', mode=%#o" , +"owner='%s', group='%s', mode=%#o remove=%d" , dev->name, dev->symlink, dev->bus, dev->place, dev->id, dev->sysfs_pair[0 ].file, dev->sysfs_pair[0 ].value, dev->kernel, dev->program, dev->result, - dev->owner, dev->group, dev->mode); + dev->owner, dev->group, dev->mode, dev->noremove); }void dump_config_dev_list (void )
@@ -265,6 +265,12 @@continue ; } +if (strcasecmp (temp2,FIELD_NOREMOVE ) ==0 ) { + dev.noremove =strtol (temp3,NULL ,10 ); + valid =1 ; +continue ; + } +if (strcasecmp (temp2,FIELD_RESULT ) ==0 ) {strfieldcpy (dev.result, temp3); valid =1 ;
namedev.c renamed from namedev.c.norm +4 -1
@@ -738,12 +738,15 @@list_for_each_entry (dev, &config_device_list, node) {dbg ("process rule" );if (match_rule (dev, class_dev, udev, sysfs_device) ==0 ) { -if (dev->name[0 ] =='\0' && dev->symlink[0 ] =='\0' ) { +if (dev->name[0 ] =='\0' && dev->symlink[0 ] =='\0' && dev->noremove ==0 ) {info ("configured rule in '%s' at line %i applied, '%s' is ignored" , dev->config_file, dev->config_line, udev->kernel_name);return -1 ; } +if (dev->noremove !=0 ) { + udev->noremove = dev->noremove; + }if (dev->symlink[0 ] !='\0' ) {char temp[NAME_SIZE ];
udev.h renamed from udev.h.norm +1 -0
@@ -52,6 +52,7 @@char owner[OWNER_SIZE ];char group[GROUP_SIZE ];char type; +char noremove;int major;int minor;unsigned int mode;/* not mode_t due to conflicting definitions in different libcs */
udevinfo.c renamed from udevinfo.c.norm +1 -0
@@ -116,6 +116,7 @@printf ("F: %s\n" , dev->config_file);printf ("L: %i\n" , dev->config_line);printf ("U: %li\n" , dev->config_uptime); +printf ("R: %d\n" , dev->noremove);printf ("\n" );return 0 ; }
Quoted 3 lines · Harald Hoyer
I added several patches to udev-039 which will be on FC3. I only describe the most patches here. The patches itsself are in the src.rpm and can be posted on request.
Cool, somebody sharing...
I've looked at all patches in the SRPM. Some comments on it:
Quoted 3 lines
Patch1: udev-039-static.patch
makes inline getpwnam and getgrnam functions, which are used for the static version of udev, which is used in initramfs
Why don't you compile it with klibc? Everything should work. The klibc-version is also be able to parse /etc/passwd to keep the same permissions file in initrd.
Quoted 3 lines
Patch2: udev-025-volsbin.patch
movesvolume_idfrom/usr/sbinto /sbin (such tools should not live in /usr, because /usr could be nfs-mounted
Right, should go in our tree.
Quoted 2 lines
Patch3: udev-039-wait-error-log.patch
wait_for_sysfspatch
Already in current version!
Quoted 2 lines
Patch4: udev-039-logging.patch
logging patch
Already in current version!
Quoted 2 lines
Patch5: udev-039-wait-ppp-class.patch
wait_for_sysfspatch
Already in current version!
Quoted 2 lines
Patch6: udev-039-wait-dm-block.patch
wait_for_sysfspatch
Already in current version!
Quoted 2 lines
Patch7: udev-039-static2.patch
includewait_for_sysfsin udev for the static udev version used in initramfs
Huh, #include of an .c file :)
The current version has a udev_sysfs.c file for that. I'm on converting everything to a be more like a toolbox. Something like this should only need a few lines of code now and you only need to open the device once.
Quoted 2 lines
Patch8: udev-039-netif.patch
only calldev_d_sendfor network interfaces, if the name was changed
Already in current version!
Quoted 2 lines
Patch9: udev-039-dummy.patch
wait_for_sysfspatch
Already in current version!
Quoted 2 lines
Patch10: udev-039-volume_id-nonblock.patch
do not open(2) withO_NONBLOCK
Already in current version!
Quoted 8 lines
Patch11: udev-039-norm.patch
add NOREMOVE keyword to the rules. this was necessary because removable ide devices were added/removed for every open(2)/close(2)
added to the rules:
KERNEL="hd[a-z]*", NOREMOVE="1"this could eventually be refined by checking the "removable" sysfs-attribute, but not for partitions..
I see the need for that, yes. But I would like to have a match of the ACTION string instead. This would make it more flexible. Something like:
KERNEL="abc", ACTION="add", NAME="xyz"
Quoted 2 lines
Patch22: udev-032-symlink.patch
replace format directives in every symlink part
Not needed, I think. Should work out of the box as the format replacement will not stop at the spaces in the symlink string. If you have problems with that, then we have a bug and please tell us.
Quoted 2 lines
Patch24: udev-038-volmak.patch
Makefilepatch forvolume_id
Should go in our tree. What was the problem here, On my box, this is working.
Harald,
I will take care, that:
udev-038-volmak.patch,
udev-025-volsbin.patch
are getting upstream.
Please give me some feedback on:
udev-039-norm.patch,
udev-032-symlink.patch,
udev-039-static.patch
Thanks,
Kay
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 10 lines · Kay Sievers
Quoted 3 lines · Harald Hoyer
Patch1: udev-039-static.patch
makes inline getpwnam and getgrnam functions, which are used for the static version of udev, which is used in initramfsWhy don't you compile it with klibc? Everything should work. The klibc-version is also be able to parse
/etc/passwdto keep the same permissions file in initrd.
Because maintaining another libc for all our architecures is a PITA...
Quoted 6 lines
Quoted 6 lines
Patch11: udev-039-norm.patch
add NOREMOVE keyword to the rules. this was necessary because removable ide devices were added/removed for every open(2)/close(2)
added to the rules:
KERNEL="hd[a-z]*", NOREMOVE="1"
Quoted 8 lines
Quoted 2 lines
this could eventually be refined by checking the "removable" sysfs-attribute, but not for partitions..
I see the need for that, yes. But I would like to have a match of the ACTION string instead. This would make it more flexible. Something like:
KERNEL="abc", ACTION="add", NAME="xyz"
what do you mean?
Quoted 9 lines
Quoted 4 lines
Patch22: udev-032-symlink.patch
replace format directives in every symlink partNot needed, I think. Should work out of the box as the format replacement will not stop at the spaces in the symlink string. If you have problems with that, then we have a bug and please tell us.
ok, I will remove that one...
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel