From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Wed, 12 Nov 2003 13:23:30 +0000 Subject: Re: [udev] updated man, subdirs, ownership, namedev enum patches MIME-Version: 1 Content-Type: multipart/mixed; boundary="rwEMma7ioTxnRzrJ" Message-Id: List-Id: References: In-Reply-To: To: linux-hotplug@vger.kernel.org --rwEMma7ioTxnRzrJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --rwEMma7ioTxnRzrJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="04-namedev.c-append-number.diff" --- ../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); --rwEMma7ioTxnRzrJ-- ------------------------------------------------------- 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