symlink only rules support
PATCH 1/1 symlink only rules support
Quoted 6 lines · Greg KH
Quoted 2 lines
What about the second part (allow symlink-only rules)?
Yes, I think that would be good to have too. Just split the patches up into two pieces, only one patch per feature/fix.
Slightly modified version. It is less aggressive in that it just adds symlink collection but otherwise behaves exactly like current code.
the patch is relative to previous one (configuration directory support).
regards
-andrey
namedev.c renamed from namedev.c.symlink +19 -7
@@ -805,17 +805,30 @@ int namedev_name_device(struct sysfs_clalist_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' ) { +if (dev->name[0 ] =='\0' && dev->symlink[0 ] =='\0' ) {info ("configured rule in '%s' at line %i applied, '%s' is ignored" , dev->config_file, dev->config_line, udev->kernel_name);return -1 ; } -info ("configured rule in '%s' at line %i applied, '%s' becomes '%s'" , - dev->config_file, dev->config_line, udev->kernel_name, dev->name); -strfieldcpy (udev->name, dev->name); -strfieldcpy (udev->symlink, dev->symlink); - goto found; +if (dev->symlink[0 ] !='\0' ) { +char temp[NAME_MAX ]; + +info ("configured rule in '%s' at line %i applied, added symlink '%s'" , + dev->config_file, dev->config_line, dev->symlink); +/* do not clobber dev */ +strfieldcpy (temp, dev->symlink); +apply_format (udev, temp, class_dev, sysfs_device); +strfieldcat (udev->symlink, temp); +strfieldcat (udev->symlink," " ); + } + +if (dev->name[0 ] !='\0' ) { +info ("configured rule in '%s' at line %i applied, '%s' becomes '%s'" , + dev->config_file, dev->config_line, udev->kernel_name, dev->name); +strfieldcpy (udev->name, dev->name); + goto found; + } } }
@@ -826,7 +839,6 @@ int namedev_name_device(struct sysfs_cla found:/* substitute placeholder */ apply_format (udev, udev->name, class_dev, sysfs_device); -apply_format (udev, udev->symlink, class_dev, sysfs_device); udev->partitions = dev->partitions; done: perm =find_perm (udev->name);
udev.h renamed from udev.h.symlink +6 -0
@@ -61,6 +61,12 @@ do { \strncpy (to, from,sizeof (to)-1 ); \ } while (0) +#define strfieldcat (to, from) \ +do { \ + to[sizeof(to)-1] = '\0'; \ + strncat(to, from, sizeof(to)-1); \ +} while (0) +extern int udev_add_device (char *path,char *subsystem,int fake);extern int udev_remove_device (char *path,char *subsystem);extern void udev_init_config (void );
Quoted 4 lines · Andrey Borzenkov
Quoted 3 lines · Greg KH
Quoted 2 lines
What about the second part (allow symlink-only rules)?
Quoted 8 lines
Quoted 3 lines
Yes, I think that would be good to have too. Just split the patches up into two pieces, only one patch per feature/fix.
Slightly modified version. It is less aggressive in that it just adds symlink collection but otherwise behaves exactly like current code.
the patch is relative to previous one (configuration directory support).
Hm, as Kay modified that one, and things have changed enough, can you resend this against the 019 release?
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 7 lines · Greg KH
Quoted 6 lines · Andrey Borzenkov
Quoted 4 lines · Greg KH
Quoted 1 line
What about the second part (allow symlink-only rules)?
Yes, I think that would be good to have too. Just split the patches up into two pieces, only one patch per feature/fix.
Quoted 8 lines
Quoted 4 lines
Slightly modified version. It is less aggressive in that it just adds symlink collection but otherwise behaves exactly like current code.
the patch is relative to previous one (configuration directory support).
Hm, as Kay modified that one, and things have changed enough, can you resend this against the 019 release?
attached
regdards
-andrey
namedev.c renamed from namedev.c.symlink +20 -8
@@ -816,17 +816,31 @@ int namedev_name_device(struct sysfs_clalist_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' ) { +if (dev->name[0 ] =='\0' && dev->symlink[0 ] =='\0' ) {info ("configured rule in '%s' at line %i applied, '%s' is ignored" , udev_rules_filename, dev->config_line, udev->kernel_name);return -1 ; } -info ("configured rule in '%s' at line %i applied, '%s' becomes '%s'" , - udev_rules_filename, dev->config_line, udev->kernel_name, dev->name); -strfieldcpy (udev->name, dev->name); -strfieldcpy (udev->symlink, dev->symlink); - goto found; +if (dev->symlink[0 ] !='\0' ) { +char temp[NAME_MAX ]; + +info ("configured rule in '%s' at line %i applied, added symlink '%s'" , + udev_rules_filename, dev->config_line, dev->symlink); +/* do not clobber dev */ +strfieldcpy (temp, dev->symlink); +apply_format (udev, temp,sizeof (temp), + class_dev, sysfs_device); +strfieldcat (udev->symlink, temp); +strfieldcat (udev->symlink," " ); + } + +if (dev->name[0 ] !='\0' ) { +info ("configured rule in '%s' at line %i applied, '%s' becomes '%s'" , + udev_rules_filename, dev->config_line, udev->kernel_name, dev->name); +strfieldcpy (udev->name, dev->name); + goto found; + } } }
@@ -838,8 +852,6 @@ found:/* substitute placeholder */ apply_format (udev, udev->name,sizeof (udev->name), class_dev, sysfs_device); -apply_format (udev, udev->symlink,sizeof (udev->symlink), - class_dev, sysfs_device); udev->partitions = dev->partitions; done: perm =find_perm (udev->name);
Quoted 11 lines · Andrey Borzenkov
Quoted 10 lines · Greg KH
Quoted 9 lines · Andrey Borzenkov
Quoted 4 lines · Greg KH
Quoted 1 line
What about the second part (allow symlink-only rules)?
Yes, I think that would be good to have too. Just split the patches up into two pieces, only one patch per feature/fix.
Slightly modified version. It is less aggressive in that it just adds symlink collection but otherwise behaves exactly like current code.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
the patch is relative to previous one (configuration directory support).
Hm, as Kay modified that one, and things have changed enough, can you resend this against the 019 release?
attached
Thanks for persisting, I've applied this. Care to write up a documentation patch so that people know how to use this now?
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel