* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
@ 2003-11-12 13:23 ` Kay Sievers
2003-11-13 6:23 ` Greg KH
` (12 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Kay Sievers @ 2003-11-12 13:23 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 898 bytes --]
On Tue, Nov 11, 2003 at 07:53:55PM -0800, Greg KH wrote:
> On Wed, Nov 05, 2003 at 08:31:28PM +0100, Kay Sievers wrote:
> > 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.
> 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
[-- Attachment #2: 04-namedev.c-append-number.diff --]
[-- Type: text/plain, Size: 1645 bytes --]
--- ../udev/namedev.c 2003-11-12 13:56:20.000000000 +0100
+++ namedev.c 2003-11-12 14:00:56.000000000 +0100
@@ -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);
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
2003-11-12 13:23 ` Kay Sievers
@ 2003-11-13 6:23 ` Greg KH
2003-11-13 8:30 ` Kay Sievers
` (11 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2003-11-13 6:23 UTC (permalink / raw)
To: linux-hotplug
On Wed, Nov 12, 2003 at 02:23:30PM +0100, Kay Sievers wrote:
> On Tue, Nov 11, 2003 at 07:53:55PM -0800, Greg KH wrote:
> > On Wed, Nov 05, 2003 at 08:31:28PM +0100, Kay Sievers wrote:
> > > 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.
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 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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
2003-11-12 13:23 ` Kay Sievers
2003-11-13 6:23 ` Greg KH
@ 2003-11-13 8:30 ` Kay Sievers
2003-11-13 19:49 ` Greg KH
` (10 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Kay Sievers @ 2003-11-13 8:30 UTC (permalink / raw)
To: linux-hotplug
On Wed, Nov 12, 2003 at 10:23:25PM -0800, Greg KH wrote:
> On Wed, Nov 12, 2003 at 02:23:30PM +0100, Kay Sievers wrote:
> > On Tue, Nov 11, 2003 at 07:53:55PM -0800, Greg KH wrote:
> > > On Wed, Nov 05, 2003 at 08:31:28PM +0100, Kay Sievers wrote:
> > > > 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.
>
> 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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
` (2 preceding siblings ...)
2003-11-13 8:30 ` Kay Sievers
@ 2003-11-13 19:49 ` Greg KH
2003-11-15 16:09 ` Kay Sievers
` (9 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2003-11-13 19:49 UTC (permalink / raw)
To: linux-hotplug
On Thu, Nov 13, 2003 at 09:30:08AM +0100, Kay Sievers wrote:
> On Wed, Nov 12, 2003 at 10:23:25PM -0800, Greg KH wrote:
> > On Wed, Nov 12, 2003 at 02:23:30PM +0100, Kay Sievers wrote:
> > > On Tue, Nov 11, 2003 at 07:53:55PM -0800, Greg KH wrote:
> > > > On Wed, Nov 05, 2003 at 08:31:28PM +0100, Kay Sievers wrote:
> > > > > 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.
> >
> > 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)
With no rules, yes.
> 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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
` (3 preceding siblings ...)
2003-11-13 19:49 ` Greg KH
@ 2003-11-15 16:09 ` Kay Sievers
2003-11-17 17:33 ` Arnd Bergmann
` (8 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Kay Sievers @ 2003-11-15 16:09 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 1787 bytes --]
On Thu, Nov 13, 2003 at 11:49:03AM -0800, Greg KH wrote:
> On Thu, Nov 13, 2003 at 09:30:08AM +0100, Kay Sievers wrote:
> > 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...
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
[-- Attachment #2: 04-udev-add.c-minor_before_namedev.diff --]
[-- Type: text/plain, Size: 581 bytes --]
--- /usr/src/udev/udev-add.c 2003-10-30 08:37:11.000000000 +0100
+++ udev-add.c 2003-10-30 15:21:02.000000000 +0100
@@ -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);
[-- Attachment #3: 04-namedev.c-multiple-placeholder-support.diff --]
[-- Type: text/plain, Size: 1564 bytes --]
--- ../udev/namedev.c 2003-11-12 13:56:20.000000000 +0100
+++ namedev.c 2003-11-15 17:06:07.000000000 +0100
@@ -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);
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
` (4 preceding siblings ...)
2003-11-15 16:09 ` Kay Sievers
@ 2003-11-17 17:33 ` Arnd Bergmann
2003-11-18 1:00 ` Greg KH
` (7 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Arnd Bergmann @ 2003-11-17 17:33 UTC (permalink / raw)
To: linux-hotplug
On Saturday 15 November 2003 17:09, Kay Sievers wrote:
> 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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
` (5 preceding siblings ...)
2003-11-17 17:33 ` Arnd Bergmann
@ 2003-11-18 1:00 ` Greg KH
2003-11-18 1:14 ` Greg KH
` (6 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2003-11-18 1:00 UTC (permalink / raw)
To: linux-hotplug
On Sat, Nov 15, 2003 at 05:09:14PM +0100, Kay Sievers wrote:
> On Thu, Nov 13, 2003 at 11:49:03AM -0800, Greg KH wrote:
> > On Thu, Nov 13, 2003 at 09:30:08AM +0100, Kay Sievers wrote:
>
> > > 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...
>
> 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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
` (6 preceding siblings ...)
2003-11-18 1:00 ` Greg KH
@ 2003-11-18 1:14 ` Greg KH
2003-11-18 3:15 ` Kay Sievers
` (5 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2003-11-18 1:14 UTC (permalink / raw)
To: linux-hotplug
On Mon, Nov 17, 2003 at 06:33:32PM +0100, Arnd Bergmann wrote:
> On Saturday 15 November 2003 17:09, Kay Sievers wrote:
>
> > 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? :)
> 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.
> 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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
` (7 preceding siblings ...)
2003-11-18 1:14 ` Greg KH
@ 2003-11-18 3:15 ` Kay Sievers
2003-11-18 12:09 ` Arnd Bergmann
` (4 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Kay Sievers @ 2003-11-18 3:15 UTC (permalink / raw)
To: linux-hotplug
On Mon, Nov 17, 2003 at 05:14:34PM -0800, Greg KH wrote:
> On Mon, Nov 17, 2003 at 06:33:32PM +0100, Arnd Bergmann wrote:
> > On Saturday 15 November 2003 17:09, Kay Sievers wrote:
> >
> > > 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? :)
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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
` (8 preceding siblings ...)
2003-11-18 3:15 ` Kay Sievers
@ 2003-11-18 12:09 ` Arnd Bergmann
2003-11-18 12:17 ` Arnd Bergmann
` (3 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Arnd Bergmann @ 2003-11-18 12:09 UTC (permalink / raw)
To: linux-hotplug
On Tuesday 18 November 2003 04:15, Kay Sievers wrote:
> 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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
` (9 preceding siblings ...)
2003-11-18 12:09 ` Arnd Bergmann
@ 2003-11-18 12:17 ` Arnd Bergmann
2003-11-19 0:24 ` Greg KH
` (2 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Arnd Bergmann @ 2003-11-18 12:17 UTC (permalink / raw)
To: linux-hotplug
On Tuesday 18 November 2003 02:14, Greg KH wrote:
> On Mon, Nov 17, 2003 at 06:33:32PM +0100, Arnd Bergmann wrote:
> > 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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
` (10 preceding siblings ...)
2003-11-18 12:17 ` Arnd Bergmann
@ 2003-11-19 0:24 ` Greg KH
2003-11-19 23:40 ` Greg KH
2003-11-19 23:42 ` Greg KH
13 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2003-11-19 0:24 UTC (permalink / raw)
To: linux-hotplug
On Tue, Nov 18, 2003 at 01:17:25PM +0100, Arnd Bergmann wrote:
> On Tuesday 18 November 2003 02:14, Greg KH wrote:
> > On Mon, Nov 17, 2003 at 06:33:32PM +0100, Arnd Bergmann wrote:
> > > 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.
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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
` (11 preceding siblings ...)
2003-11-19 0:24 ` Greg KH
@ 2003-11-19 23:40 ` Greg KH
2003-11-19 23:42 ` Greg KH
13 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2003-11-19 23:40 UTC (permalink / raw)
To: linux-hotplug
On Tue, Nov 18, 2003 at 04:15:40AM +0100, Kay Sievers wrote:
>
> 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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [udev] updated man, subdirs, ownership, namedev enum patches
2003-11-12 3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
` (12 preceding siblings ...)
2003-11-19 23:40 ` Greg KH
@ 2003-11-19 23:42 ` Greg KH
13 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2003-11-19 23:42 UTC (permalink / raw)
To: linux-hotplug
On Tue, Nov 18, 2003 at 01:09:02PM +0100, Arnd Bergmann wrote:
> On Tuesday 18 November 2003 04:15, Kay Sievers wrote:
> > 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"
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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 16+ messages in thread