Skip to contentSkip to conversation

updated man, subdirs, ownership, namedev enum patches

udev Greg KH 3 participants 15 messages Nov 12, 2003 – Nov 19, 2003 Kbuild

lore
Share & tools
lore

Greg KH

author
#0 lore raw
Quoted 4 lines · Kay Sievers

01-udev.8.diff:
man page style fixes
present the tiny udev in bold font :)

Thanks, I've applied this.

Quoted 5 lines

02-udev-add.c-subdirs.diff:
02-udev-remove.c-subdirs.diff:
support subdirectory creation/removal for NAME="/devfs/is/crazy/video0" create parent subdirs for device node if needed
remove subdirs when last node is removed

Nice, I've applied this.

Quoted 4 lines

03-udev-add.c-set_owner.diff
set uid/gid of node specified in udev.permissions only numeric id's are supported cause we can't resolve with klibc or libc before real /etc is mounted

Thanks, I've applied this, and fixed the patch so that it will build with older versions of gcc.

Quoted 3 lines

04-namedev.c-cleanup.diff
remove part of udev that appends the kernel enumeration to character devices in LABEL method: NAME="webcam" results in /udev/webcam0

Hm, are you sure this patch is correct? What happened to your other one where you could put a '%' in the string to put the number into the name? I think this patch breaks partition naming, did you try it on them?

Thanks a lot for your changes, I really apprecate them,

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 7 lines · Greg KH
Quoted 3 lines · Kay Sievers

04-namedev.c-cleanup.diff
remove part of udev that appends the kernel enumeration to character devices in LABEL method: NAME="webcam" results in /udev/webcam0

I think this patch breaks partition naming, did you try it on them? Hm, are you sure this patch is correct?

I think so, block devices are handled at line 580. At line 626 the last digit from kernel name is appended to _every_ device including char devs. Partition naming seems ok with the patch, but i may miss something here.

Quoted 2 lines

What happened to your other one
where you could put a '%' in the string to put the number into the name?

Alternate patch is attached, but i don't know if it is really useful. It substitutes the '%' placeholder in NAME= with the kernel device number.

thank,
Kay

namedev.c renamed from udev/namedev.c +15 -7
@@ -540,6 +540,7 @@
 static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev)
 {
 	struct list_head *tmp;
+	char *pos;
 	int retval = 0;
 	int found;
 
@@ -623,10 +624,6 @@
 			}
 
 			strcpy(udev->name, dev->name);
-			if (isdigit(class_dev->path[strlen(class_dev->path)-1])) {
-				temp = &class_dev->path[strlen(class_dev->path)-1];
-				strcat(udev->name, temp);
-			}
 			if (dev->mode != 0) {
 				udev->mode = dev->mode;
 				strcpy(udev->owner, dev->owner);
@@ -671,8 +668,8 @@
 				strcpy(udev->group, dev->group);
 			}
 			dbg_parse("device id '%s' becomes '%s' - owner = %s, group = %s, mode = %#o",
-				dev->id, udev->name, 
-				dev->owner, dev->group, dev->mode);
+				  dev->id, udev->name,
+				  dev->owner, dev->group, dev->mode);
 			goto done;
 			break;
 			}
@@ -683,7 +680,7 @@
 
 			if (!class_dev->sysdevice)
 				continue;
-			found = 0;	
+			found = 0;
 			strcpy(path, class_dev->sysdevice->path);
 			temp = strrchr(path, '/');
 			dbg_parse("TOPOLOGY path = '%s'", path);
@@ -756,6 +753,17 @@
 	strcpy(udev->name, class_dev->name);
 
 done:
+	/* substitute placeholder in NAME= with trailing digits from device */
+	pos = udev->name + strlen(udev->name)-1;
+	if (*pos == '%') {
+		*pos = 0x00;
+		pos = class_dev->name + strlen(class_dev->name);
+		while (isdigit(*(pos-1)))
+			pos--;
+		strcat(udev->name, pos);
+		dbg_parse("placeholder in NAME substituted by: '%s'", pos);
+	}
+
 	/* mode was never set above */
 	if (!udev->mode) {
 		udev->mode = get_default_mode(class_dev);
author
#2 lore raw
In reply to Greg KH
Quoted 6 lines · Kay Sievers
Quoted 5 lines · Greg KH
Quoted 3 lines · Kay Sievers

04-namedev.c-cleanup.diff
remove part of udev that appends the kernel enumeration to character devices in LABEL method: NAME="webcam" results in /udev/webcam0

Quoted 6 lines
Quoted 2 lines

I think this patch breaks partition naming, did you try it on them? Hm, are you sure this patch is correct?

I think so, block devices are handled at line 580. At line 626 the last digit from kernel name is appended to _every_ device including char devs. Partition naming seems ok with the patch, but i may miss something here.

Hm, if you take those lines out, I can't name a partition with the number at the end of the name. Yeah, that's a hack, and I need to fix it up.

Quoted 6 lines
Quoted 2 lines

What happened to your other one
where you could put a '%' in the string to put the number into the name?

Alternate patch is attached, but i don't know if it is really useful. It substitutes the '%' placeholder in NAME= with the kernel device number.

I think we need more than just a %. Users might care about a few things for the name. Like major, minor, and kernel device number (but it's tricky to figure out what a device number is, think of sdaa...) I'll work on fixing this up next.

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Greg KH
Quoted 10 lines · Greg KH
Quoted 9 lines · Kay Sievers
Quoted 7 lines · Greg KH
Quoted 3 lines · Kay Sievers

04-namedev.c-cleanup.diff
remove part of udev that appends the kernel enumeration to character devices in LABEL method: NAME="webcam" results in /udev/webcam0

I think this patch breaks partition naming, did you try it on them? Hm, are you sure this patch is correct?

Quoted 7 lines
Quoted 3 lines

I think so, block devices are handled at line 580. At line 626 the last digit from kernel name is appended to _every_ device including char devs. Partition naming seems ok with the patch, but i may miss something here.

Hm, if you take those lines out, I can't name a partition with the number at the end of the name. Yeah, that's a hack, and I need to fix it up.

What do you mean?
The partition name is crated with the number.

Nov 13 09:01:24 pim udev[13671]: main: version 005
Nov 13 09:01:24 pim udev[13671]: main: looking at /block/hda/hda1
Nov 13 09:01:24 pim udev[13671]: get_dirs: sysfs_path = /sys
Nov 13 09:01:24 pim udev[13671]: namedev_init_config: opening /etc/udev/udev.config to read as config
Nov 13 09:01:24 pim udev[13671]: namedev_init_permissions: opening /etc/udev/udev.permissions to read as permissions config
Nov 13 09:01:24 pim udev[13671]: sleep_for_dev: looking for /sys/block/hda/hda1/dev
Nov 13 09:01:24 pim udev[13671]: get_class_dev: looking at /sys/block/hda/hda1
Nov 13 09:01:24 pim udev[13671]: get_class_dev: class_dev->name = hda1
Nov 13 09:01:24 pim udev[13671]: get_major_minor: dev = 3:1 
Nov 13 09:01:24 pim udev[13671]: get_major_minor: found major = 3, minor = 1
Nov 13 09:01:24 pim udev[13671]: udev_add_device: name = hda1
Nov 13 09:01:24 pim udev[13671]: create_node: mknod(/udev/hda1, 060666,3, 1)

Yes, it doesn't append the number when a label is specified for a partition. But what when i want my partition labeled "data" not "data1" LABEL, BUS="ide", size="117210177", NAME="data"

Nov 13 09:08:45 pim udev[13871]: main: version 005
Nov 13 09:08:45 pim udev[13871]: main: looking at /block/hdb/hdb1
Nov 13 09:08:45 pim udev[13871]: get_dirs: sysfs_path = /sys
Nov 13 09:08:45 pim udev[13871]: namedev_init_config: opening /etc/udev/udev.config to read as config
Nov 13 09:08:45 pim udev[13871]: namedev_init_permissions: opening /etc/udev/udev.permissions to read as permissions config
Nov 13 09:08:45 pim udev[13871]: sleep_for_dev: looking for /sys/block/hdb/hdb1/dev
Nov 13 09:08:45 pim udev[13871]: get_class_dev: looking at /sys/block/hdb/hdb1
Nov 13 09:08:45 pim udev[13871]: get_class_dev: class_dev->name = hdb1
Nov 13 09:08:45 pim udev[13871]: get_major_minor: dev = 3:65 
Nov 13 09:08:45 pim udev[13871]: get_major_minor: found major = 3, minor = 65
Nov 13 09:08:45 pim udev[13871]: udev_add_device: name = data1
Nov 13 09:08:45 pim udev[13871]: create_node: mknod(/udev/data1, 060666, 3, 65)

This is not what i would expect!

And i don't want my WebCam named with the number appended:
But without the patch this is impossible:
LABEL, BUS="usb", model="Creative Labs WebCam 3", NAME="webcam"

Nov 13 09:19:19 pim udev[14015]: main: version 005
Nov 13 09:19:19 pim udev[14015]: main: looking at /class/video4linux/video0
Nov 13 09:19:19 pim udev[14015]: get_dirs: sysfs_path = /sys
Nov 13 09:19:19 pim udev[14015]: namedev_init_config: opening /etc/udev/udev.config to read as config
Nov 13 09:19:19 pim udev[14015]: namedev_init_permissions: opening /etc/udev/udev.permissions to read as permissions config
Nov 13 09:19:19 pim udev[14015]: sleep_for_dev: looking for /sys/class/video4linux/video0/dev
Nov 13 09:19:19 pim kernel: drivers/usb/media/ov511.c: Device at usb-0000:00:1d.1-2.1 registered to minor 0
Nov 13 09:19:20 pim udev[14015]: sleep_for_dev: looking for /sys/class/video4linux/video0/dev
Nov 13 09:19:20 pim udev[14015]: get_class_dev: looking at /sys/class/video4linux/video0
Nov 13 09:19:20 pim udev[14015]: get_class_dev: class_dev->name = video0
Nov 13 09:19:20 pim udev[14015]: get_major_minor: dev = 81:0 
Nov 13 09:19:20 pim udev[14015]: get_major_minor: found major = 81, minor = 0
Nov 13 09:19:20 pim udev[14015]: udev_add_device: name = webcam0
Nov 13 09:19:20 pim udev[14015]: create_node: mknod(/udev/webcam0, 020600, 81, 0)

How can you create a partition name or name for any other char device by a LABEL method without these "magic" number?
Sorry, do i get something completely wrong?

thanks,
Kay

-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#4 lore raw
In reply to Greg KH
Quoted 22 lines · Kay Sievers
Quoted 10 lines · Greg KH
Quoted 9 lines · Kay Sievers
Quoted 7 lines · Greg KH
Quoted 3 lines · Kay Sievers

04-namedev.c-cleanup.diff
remove part of udev that appends the kernel enumeration to character devices in LABEL method: NAME="webcam" results in /udev/webcam0

I think this patch breaks partition naming, did you try it on them? Hm, are you sure this patch is correct?

Quoted 7 lines
Quoted 3 lines

I think so, block devices are handled at line 580. At line 626 the last digit from kernel name is appended to _every_ device including char devs. Partition naming seems ok with the patch, but i may miss something here.

Hm, if you take those lines out, I can't name a partition with the number at the end of the name. Yeah, that's a hack, and I need to fix it up.

What do you mean?
The partition name is crated with the number.

Quoted 12 lines
Nov 13 09:01:24 pim udev[13671]: main: version 005
Nov 13 09:01:24 pim udev[13671]: main: looking at /block/hda/hda1
Nov 13 09:01:24 pim udev[13671]: get_dirs: sysfs_path = /sys
Nov 13 09:01:24 pim udev[13671]: namedev_init_config: opening /etc/udev/udev.config to read as config
Nov 13 09:01:24 pim udev[13671]: namedev_init_permissions: opening /etc/udev/udev.permissions to read as permissions config
Nov 13 09:01:24 pim udev[13671]: sleep_for_dev: looking for /sys/block/hda/hda1/dev
Nov 13 09:01:24 pim udev[13671]: get_class_dev: looking at /sys/block/hda/hda1
Nov 13 09:01:24 pim udev[13671]: get_class_dev: class_dev->name = hda1
Nov 13 09:01:24 pim udev[13671]: get_major_minor: dev = 3:1 
Nov 13 09:01:24 pim udev[13671]: get_major_minor: found major = 3, minor = 1
Nov 13 09:01:24 pim udev[13671]: udev_add_device: name = hda1
Nov 13 09:01:24 pim udev[13671]: create_node: mknod(/udev/hda1, 060666,3, 1)

With no rules, yes.

Quoted 3 lines

Yes, it doesn't append the number when a label is specified for a partition. But what when i want my partition labeled "data" not "data1" LABEL, BUS="ide", size="117210177", NAME="data"

Problem is, if you use the LABEL rule to match a device, like a SCSI vendor, then all of the partitions, as well as the main block device, will end up with the same name. That's why I added the "add the number" hack to the LABEL rule.

So yes, your patch is correct in that we shouldn't always be adding the number to any match for LABEL (like for char devices), but if we do that, then we break partitions. Your '%' patch fixes this, but I'd just like to extend it a bit. Let me see what I can come up with...

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#5 lore raw
In reply to Greg KH
Quoted 11 lines · Greg KH
Quoted 3 lines · Kay Sievers

Yes, it doesn't append the number when a label is specified for a partition. But what when i want my partition labeled "data" not "data1" LABEL, BUS="ide", size="117210177", NAME="data"

Problem is, if you use the LABEL rule to match a device, like a SCSI vendor, then all of the partitions, as well as the main block device, will end up with the same name. That's why I added the "add the number" hack to the LABEL rule.

Quoted 4 lines

So yes, your patch is correct in that we shouldn't always be adding the number to any match for LABEL (like for char devices), but if we do that, then we break partitions. Your '%' patch fixes this, but I'd just like to extend it a bit. Let me see what I can come up with...

Oh, I see. Do you mean something like this:

LABEL, BUS="usb", model="Creative Labs WebCam 3", NAME="webcam%n-%M:%m-test"

results in: "webcam0-81:0-test"

Nov 15 16:51:53 pim udev[16193]: get_class_dev: looking at /sys/class/video4linux/video0
Nov 15 16:51:53 pim udev[16193]: get_class_dev: class_dev->name = video0
Nov 15 16:51:53 pim udev[16193]: get_major_minor: dev = 81:0 
Nov 15 16:51:53 pim udev[16193]: get_major_minor: found major = 81, minor = 0
Nov 15 16:51:53 pim udev[16193]: udev_add_device: name = webcam0-81:0-test
Nov 15 16:51:53 pim udev[16193]: create_node: mknod(/udev/webcam0-81:0-test, 020666, 81, 0)

thanks,
Kay

04-udev-add.c-minor_before_namedev.diff
move get_major_minor() before namedev_name_device(), so namedev knows major/minor of device

04-namedev.c-multiple-placeholder-support.diff
implement printf-like placeholder support for NAME %n-kernel number, %M-major number, %m-minor number

udev-add.c renamed from usr/src/udev/udev-add.c +4 -4
@@ -183,16 +183,16 @@
 	if (class_dev == NULL)
 		goto exit;
 
-	retval = namedev_name_device(class_dev, &dev);
-	if (retval)
-		return retval;
-
 	retval = get_major_minor(class_dev, &dev.major, &dev.minor);
 	if (retval) {
 		dbg("get_major_minor failed");
 		goto exit;
 	}
 
+	retval = namedev_name_device(class_dev, &dev);
+	if (retval)
+		return retval;
+
 //	strcpy(dev.name, attr.name);
 //	strcpy(dev.owner, attr.owner);
 //	strcpy(dev.group, attr.group);
namedev.c renamed from udev/namedev.c +34 -4
@@ -540,6 +540,9 @@
 static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev)
 {
 	struct list_head *tmp;
+	char *pos;
+	char *dig;
+	char name[NAME_SIZE];
 	int retval = 0;
 	int found;
 
@@ -623,10 +626,6 @@
 			}
 
 			strcpy(udev->name, dev->name);
-			if (isdigit(class_dev->path[strlen(class_dev->path)-1])) {
-				temp = &class_dev->path[strlen(class_dev->path)-1];
-				strcat(udev->name, temp);
-			}
 			if (dev->mode != 0) {
 				udev->mode = dev->mode;
 				strcpy(udev->owner, dev->owner);
@@ -756,6 +755,37 @@
 	strcpy(udev->name, class_dev->name);
 
 done:
+	/* substitute placeholder in NAME  */
+	while (1) {
+		pos = strchr(udev->name, '%');
+		if (pos) {
+			strcpy(name, pos+2);
+			*pos = 0x00;
+			switch (pos[1]) {
+			case 'n':
+				dig = class_dev->name + strlen(class_dev->name);
+				while (isdigit(*(dig-1)))
+					dig--;
+				strcat(udev->name, dig);
+				dbg_parse("kernel number appended: %s", dig);
+				break;
+			case 'm':
+				sprintf(pos, "%u", udev->minor);
+				dbg_parse("minor number appended: %u", udev->minor);
+				break;
+			case 'M':
+				sprintf(pos, "%u", udev->major);
+				dbg_parse("major number appended: %u", udev->major);
+				break;
+			default:
+				dbg_parse("unknown substitution type: %%%c", pos[1]);
+				break;
+			}
+			strcat(udev->name, name);
+		} else
+			break;
+	}
+
 	/* mode was never set above */
 	if (!udev->mode) {
 		udev->mode = get_default_mode(class_dev);
#6 lore raw
In reply to Greg KH
Quoted 4 lines · Kay Sievers

Oh, I see. Do you mean something like this:

LABEL, BUS="usb", model="Creative Labs WebCam 3",
NAME="webcam%n-%M:%m-test"

That would at least be part of the solution I'm looking for. How about extra format characters for bus_id and for the result of a callout program?

What I really need is a way to generate names for my devices without having to list each one in the configuration file in its own line. With the old devfs naming scheme, the dasda1 block device would become visible as /dev/dasd/0.0.0203/part1, where 0.0.0203 is the bus_id. I've tried implementing at least autogeneration of /udev/dasd-0.0.0203p1, but I haven't found an easy way to get from the partition's sysfs_class_device to the corresponding sysfs_device in get_attr().

Also, do I get problems with the database implementation when I try to use the same configuration file entry for all devices using the same driver or similar?

	Arnd <><

-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#7 lore raw
In reply to Greg KH
Quoted 17 lines · Kay Sievers
Quoted 11 lines · Greg KH
Quoted 3 lines · Kay Sievers

Yes, it doesn't append the number when a label is specified for a partition. But what when i want my partition labeled "data" not "data1" LABEL, BUS="ide", size="117210177", NAME="data"

Problem is, if you use the LABEL rule to match a device, like a SCSI vendor, then all of the partitions, as well as the main block device, will end up with the same name. That's why I added the "add the number" hack to the LABEL rule.

Quoted 4 lines

So yes, your patch is correct in that we shouldn't always be adding the number to any match for LABEL (like for char devices), but if we do that, then we break partitions. Your '%' patch fixes this, but I'd just like to extend it a bit. Let me see what I can come up with...

Quoted 5 lines

Oh, I see. Do you mean something like this:

LABEL, BUS="usb", model="Creative Labs WebCam 3", NAME="webcam%n-%M:%m-test"

results in: "webcam0-81:0-test"

Very nice, this is exactly what I was thinking of. I've applied your patchs (the first one wasn't necessary, as I already did that a few days ago.)

thanks again, I really appreciate the help.

greg k-h

-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#8 lore raw
In reply to Greg KH
Quoted 9 lines · Arnd Bergmann
Quoted 4 lines · Kay Sievers

Oh, I see. Do you mean something like this:

LABEL, BUS="usb", model="Creative Labs WebCam 3",
NAME="webcam%n-%M:%m-test"

That would at least be part of the solution I'm looking for. How about extra format characters for bus_id and for the result of a callout program?

Sure, I can see the use for that. Want to send a patch? :)

Quoted 7 lines

What I really need is a way to generate names for my devices without having to list each one in the configuration file in its own line. With the old devfs naming scheme, the dasda1 block device would become visible as /dev/dasd/0.0.0203/part1, where 0.0.0203 is the bus_id. I've tried implementing at least autogeneration of /udev/dasd-0.0.0203p1, but I haven't found an easy way to get from the partition's sysfs_class_device to the corresponding sysfs_device in get_attr().

Take a look at the current bk tree (which has moved to bk://linuxusb.bkbits.net/udev/ ) I've made finding that device a lot easier now, and it works for all rule types.

Quoted 3 lines

Also, do I get problems with the database implementation when I try to use the same configuration file entry for all devices using the same driver or similar?

You shouldn't. udev doesn't care about drivers, only names of devices.

thanks,

greg k-h

-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#9 lore raw
In reply to Greg KH
Quoted 5 lines · Greg KH
Quoted 4 lines · Arnd Bergmann
Quoted 2 lines · Kay Sievers

Oh, I see. Do you mean something like this:

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

LABEL, BUS="usb", model="Creative Labs WebCam 3",
NAME="webcam%n-%M:%m-test"

That would at least be part of the solution I'm looking for. How about extra format characters for bus_id and for the result of a callout program?

Sure, I can see the use for that. Want to send a patch? :)

Cause we only match against a already known result of the callout program, it doesn't make much sense to provide a format character without support of wildcards for ID. Is this what we want to do?

By the way: What about putting udev.tdb at /udev/.udev.tdb? We get FHS compliance by leaving /etc and
get in memory db if mounted as ramfs for free :)

thanks,
Kay

-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#10 lore raw
In reply to Greg KH
Quoted 3 lines · Kay Sievers

Cause we only match against a already known result of the callout program, it doesn't make much sense to provide a format character without support of wildcards for ID.

Correct, with the current CALLOUT rule definition, there is not much point in that. I was rather thinking of either adding support for globbing to callout or having another rule that runs an external program and can take its output into account:

a)
CALLOUT, PROGRAM="/sbin/dasd_id" BUS="ccw", ID="dasd-*", NAME="%i%n"

b)
DCALLOUT, DRIVER="dasd-eckd", PROGRAM="/sbin/dasd_id", NAME="%i%n"

	Arnd <><

-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#11 lore raw
In reply to Greg KH
Quoted 10 lines · Greg KH
Quoted 3 lines · Arnd Bergmann

That would at least be part of the solution I'm looking for. How about extra format characters for bus_id and for the result of a callout program?

Sure, I can see the use for that. Want to send a patch? :)

Take a look at the current bk tree (which has moved to bk://linuxusb.bkbits.net/udev/ ) I've made finding that device a lot easier now, and it works for all rule types.

Great, just what I was missing. I didn't see the any link to the bk repository. Here's the patch for the bus_id. I'll need to think about the handling of callout results a bit more.

	Arnd <><

=== namedev.c 1.32 vs edited ==--- 1.32/namedev.c Tue Nov 18 02:22:01 2003
+++ edited/namedev.c Tue Nov 18 13:16:30 2003
@@ -822,6 +822,13 @@
strcpy(name, pos+2);
*pos = 0x00;
switch (pos[1]) {
+ case 'b':
+ if (!sysfs_device)
+ break;
+ strcat(udev->name, sysfs_device->bus_id);
+ dbg("bus_id appended: %s",
+ sysfs_device->bus_id);
+ break;
case 'n':
dig = class_dev->name + strlen(class_dev->name); while (isdigit(*(dig-1)))

-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#12 lore raw
In reply to Greg KH
Quoted 8 lines · Arnd Bergmann
Quoted 6 lines · Greg KH
Quoted 3 lines · Arnd Bergmann

That would at least be part of the solution I'm looking for. How about extra format characters for bus_id and for the result of a callout program?

Sure, I can see the use for that. Want to send a patch? :)

Quoted 7 lines
Quoted 3 lines

Take a look at the current bk tree (which has moved to bk://linuxusb.bkbits.net/udev/ ) I've made finding that device a lot easier now, and it works for all rule types.

Great, just what I was missing. I didn't see the any link to the bk repository. Here's the patch for the bus_id. I'll need to think about the handling of callout results a bit more.

Ah, very nice, thanks.

I've applied this.

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#13 lore raw
In reply to Greg KH
Quoted 4 lines · Kay Sievers

By the way: What about putting udev.tdb at /udev/.udev.tdb? We get FHS compliance by leaving /etc and
get in memory db if mounted as ramfs for free :)

Hm, not a bad idea, I'll play around with 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#14 lore raw
In reply to Greg KH
Quoted 5 lines · Arnd Bergmann
Quoted 3 lines · Kay Sievers

Cause we only match against a already known result of the callout program, it doesn't make much sense to provide a format character without support of wildcards for ID.

Quoted 7 lines

Correct, with the current CALLOUT rule definition, there is not much point in that. I was rather thinking of either adding support for globbing to callout or having another rule that runs an external program and can take its output into account:

a)
CALLOUT, PROGRAM="/sbin/dasd_id" BUS="ccw", ID="dasd-*", NAME="%i%n"

I think the result of a CALLOUT program should be able to be put into a NAME, it would make udev much more flexible.

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel