linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: [udev] updated man, subdirs, ownership, namedev enum patches
Date: Wed, 12 Nov 2003 13:23:30 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-106864349422413@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-106860942327356@msgid-missing>

[-- 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);

  reply	other threads:[~2003-11-12 13:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-12  3:53 [udev] updated man, subdirs, ownership, namedev enum patches Greg KH
2003-11-12 13:23 ` Kay Sievers [this message]
2003-11-13  6:23 ` Greg KH
2003-11-13  8:30 ` Kay Sievers
2003-11-13 19:49 ` Greg KH
2003-11-15 16:09 ` Kay Sievers
2003-11-17 17:33 ` Arnd Bergmann
2003-11-18  1:00 ` Greg KH
2003-11-18  1:14 ` Greg KH
2003-11-18  3:15 ` Kay Sievers
2003-11-18 12:09 ` Arnd Bergmann
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
  -- strict thread matches above, loose matches on Subject: below --
2003-11-05 19:38 Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-hotplug-106864349422413@msgid-missing \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).