Skip to contentSkip to conversation

support directory for rules and permissions

PATCH In review Andrey Borzenkov 4 participants 9 messages Feb 22, 2004 – Feb 28, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support directory for rules and permissions

Quoted 9 lines · Greg KH
Quoted 5 lines · Andrey Borzenkov

Attached patch adds support for

- multiple rules files. You can now do

udev_rules="file1 dir2 file3 ..."

Care to fix this patch up for the latest udev release?

This is new version that I have been runing for some time. It does not directly support multiple files; rather you can give either file or directory; directory is scanned, sorted and all files are read in order.

KLIBC case still supports single file only; I do not think anything more complicated will be needed for initrd.

The only reason for first patch was to ensure config files order and it is not done automatically.

regards

-andrey

namedev.c renamed from namedev.c.multi +2 -2
@@ -807,12 +807,12 @@ int namedev_name_device(struct sysfs_cla
 		if (match_rule(dev, class_dev, udev, sysfs_device) == 0) {
 			if (dev->name[0] == '\0') {
 				info("configured rule in '%s' at line %i applied, '%s' is ignored",
-				     udev_rules_filename, dev->config_line, udev->kernel_name);
+				     dev->config_file, 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);
+			     dev->config_file, dev->config_line, udev->kernel_name, dev->name);
 			strfieldcpy(udev->name, dev->name);
 			strfieldcpy(udev->symlink, dev->symlink);
 			goto found;
namedev.h renamed from namedev.h.multi +1 -0
@@ -71,6 +71,7 @@ struct config_device {
 	struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS];
 	int partitions;
 	int config_line;
+	char *config_file;
 };
 
 struct perm_device {
namedev_parse.c renamed from namedev_parse.c.multi +119 -9

183 lines not on this page · raw message

#1 lore raw
Quoted 3 lines · Andrey Borzenkov

This is new version that I have been runing for some time. It does not directly support multiple files; rather you can give either file or directory; directory is scanned, sorted and all files are read in order.

Again, I think scanning the directory makes the life of users and distributions *harder*: I will not be able to ship the package with different configurations in place, and users will have to be careful to use file names which will sort in the right order.

Signature · 13 lines
ciao, |
Marco | [4702 lupwubQmPnBbM]


-------------------------------------------------------
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
#2 lore raw
In reply to Andrey Borzenkov
Quoted 10 lines · Marco d'Itri
Quoted 3 lines · Andrey Borzenkov

This is new version that I have been runing for some time. It does not directly support multiple files; rather you can give either file or directory; directory is scanned, sorted and all files are read in order.

Again, I think scanning the directory makes the life of users and distributions *harder*: I will not be able to ship the package with different configurations in place, and users will have to be careful to use file names which will sort in the right order.

So, just that I understand - you

- do not want to have multiple files at all?
- do not want support directory but the config_file="file1 file2 ..."?

could you explain what do you mean under "different configurations in place"?

Users should be careful only if they want to replace kernel names with something else. But I still fail to see why on earth would they want to? And if they want to my patch lets them do it.

I fail to see how having conifguration directory may make life harder. If it was the case, SuSE would not have replaced single file with configuration directory nor would Debian have invented modules.d to complement for monolithic file.

regards

-andrey

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

#3 lore raw
In reply to Andrey Borzenkov
Quoted 1 line · Andrey Borzenkov

- do not want to have multiple files at all?

I definitely need multiple configuration files.

Quoted 1 line

- do not want support directory but the config_file="file1 file2 ..."?

I like this syntax a lot more, and in fact it is the one I implemented in the patch I posted yesterday (loosely based on an older version of your patch) and which I am using in the debian package.

Quoted 2 lines

could you explain what do you mean under "different configurations in place"?

My plan is to distribute with the package files like /etc/udev/udev.rules (enabled by default, devfs-like names) /etc/udev/udev-compat.rules (enabled by default, some compatibility links) /etc/udev/udev-full.rules (more compatibility links) /etc/udev/udev-traditional.rules (old style names)

and allow users to select the files they need from udev.conf. I /could/ install these files in /usr/share/doc/, but then users who choose a non-default configuration would have to manually update them after each upgrade.

Quoted 2 lines

Users should be careful only if they want to replace kernel names with something else. But I still fail to see why on earth would they want to?

Because some users want

The main reason to have a configuration directory like /etc/modprobe.d/ is to allow other packages to put there their own files, but this is not needed for udev.

Signature · 13 lines
ciao, |
Marco | [4709 ap7bUU.9AuD62]


-------------------------------------------------------
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
#4 lore raw
In reply to Andrey Borzenkov
Quoted 8 lines · Marco d'Itri
Quoted 2 lines

Users should be careful only if they want to replace kernel names with something else. But I still fail to see why on earth would they want to?

Because some users want

The main reason to have a configuration directory like /etc/modprobe.d/ is to allow other packages to put there their own files, but this is not needed for udev.

What if the same package would like to specify a dev name?

--
Gioele

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

#5 lore raw
In reply to Andrey Borzenkov
Quoted 4 lines · Gioele Barabucci
Quoted 3 lines

The main reason to have a configuration directory like /etc/modprobe.d/ is to allow other packages to put there their own files, but this is not needed for udev.

What if the same package would like to specify a dev name?

We adopt the same policy of MAKEDEV: the package will depend on a recent enough version of udev.

Signature · 13 lines
ciao, |
Marco | [4715 crVYU1cppv4Gc]


-------------------------------------------------------
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
#6 lore raw
In reply to Andrey Borzenkov
Quoted 9 lines · Marco d'Itri
Quoted 1 line · Andrey Borzenkov

- do not want to have multiple files at all?

I definitely need multiple configuration files.

Quoted 1 line

- do not want support directory but the config_file="file1 file2 ..."?

I like this syntax a lot more, and in fact it is the one I implemented in the patch I posted yesterday (loosely based on an older version of your patch) and which I am using in the debian package.

I still vote for the directory solution.
Andrey it's not acceptable to have a different config for klibc users, so I posted a patch on Friday based on your idea which does the sorting without scandir.

thanks,
Kay

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

#7 lore raw
In reply to Andrey Borzenkov
Quoted 11 lines · Kay Sievers
Quoted 9 lines · Marco d'Itri
Quoted 1 line · Andrey Borzenkov

- do not want to have multiple files at all?

I definitely need multiple configuration files.

Quoted 1 line

- do not want support directory but the config_file="file1 file2 ..."?

I like this syntax a lot more, and in fact it is the one I implemented in the patch I posted yesterday (loosely based on an older version of your patch) and which I am using in the debian package.

Quoted 5 lines

I still vote for the directory solution.
Andrey it's not acceptable to have a different config for klibc users, so I posted a patch on Friday based on your idea which does the sorting without scandir.

thank you

Quoted 3 lines

thanks,
Kay

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

#8 lore raw
In reply to Andrey Borzenkov
Quoted 6 lines · On Monday 23 February 2004 11:48, wrote:
Quoted 4 lines · Kay Sievers

I still vote for the directory solution.
Andrey it's not acceptable to have a different config for klibc users, so I posted a patch on Friday based on your idea which does the sorting without scandir.

your patch does not preserve config file name that was used making debug output in name_device

info("configured rule in '%s' at line %i applied, '%s' becomes '%s'",

      udev_rules_filename, dev->config_line, udev->kernel_name, dev->name);

rather out of mark.

regards

-andrey

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