linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [udev] introduce format char 'k' for kernel-name
@ 2003-12-20  1:32 Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2003-12-20  1:32 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

Attached is a patch that introduces the format char 'k' to be replaced with
the kernel name. I like to have it in a callout script.

I've moved the build_kernel_name() back to namedev_name_device() since
we don't expect it growing cause of 'sdaj' :)

thanks,
Kay

[-- Attachment #2: 03-format-char-k-for-kernel-name.diff --]
[-- Type: text/plain, Size: 1841 bytes --]

diff -Nru a/namedev.c b/namedev.c
--- a/namedev.c	Sat Dec 20 02:00:30 2003
+++ b/namedev.c	Sat Dec 20 02:00:30 2003
@@ -185,17 +185,6 @@
 	return mode;
 }
 
-static void build_kernel_number(struct sysfs_class_device *class_dev, struct udevice *udev)
-{
-	char *dig;
-
-	dig = class_dev->name + strlen(class_dev->name);
-	while (isdigit(*(dig-1)))
-		dig--;
-	strfieldcpy(udev->kernel_number, dig);
-	dbg("kernel_number='%s'", udev->kernel_number);
-}
-
 static void apply_format(struct udevice *udev, unsigned char *string)
 {
 	char name[NAME_SIZE];
@@ -229,6 +218,12 @@
 				strcat(pos, udev->bus_id);
 				dbg("substitute bus_id '%s'", udev->bus_id);
 				break;
+			case 'k':
+				if (strlen(udev->kernel_name) == 0)
+					break;
+				strcat(pos, udev->kernel_name);
+				dbg("substitute kernel name '%s'", udev->kernel_name);
+				break;
 			case 'n':
 				if (strlen(udev->kernel_number) == 0)
 					break;
@@ -586,6 +581,7 @@
 	struct sysfs_class_device *class_dev_parent = NULL;
 	int retval = 0;
 	struct perm_device *perm;
+	char *pos;
 
 	udev->mode = 0;
 
@@ -622,7 +618,14 @@
 		dbg("class_dev->name = '%s'", class_dev->name);
 	}
 
-	build_kernel_number(class_dev, udev);
+	strfieldcpy(udev->kernel_name, class_dev->name);
+
+	/* get kernel number */
+	pos = class_dev->name + strlen(class_dev->name);
+	while (isdigit(*(pos-1)))
+		pos--;
+	strfieldcpy(udev->kernel_number, pos);
+	dbg("kernel_number='%s'", udev->kernel_number);
 
 	/* rules are looked at in priority order */
 	retval = do_callout(class_dev, udev, sysfs_device);
diff -Nru a/udev.h b/udev.h
--- a/udev.h	Sat Dec 20 02:00:30 2003
+++ b/udev.h	Sat Dec 20 02:00:30 2003
@@ -70,6 +70,7 @@
 	unsigned char bus_id[SYSFS_NAME_LEN];
 	unsigned char callout_value[NAME_SIZE];
 	unsigned char kernel_number[NAME_SIZE];
+	unsigned char kernel_name[NAME_SIZE];
 
 };
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [udev] introduce format char 'k' for kernel-name
@ 2003-12-22 19:14 Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2003-12-22 19:14 UTC (permalink / raw)
  To: linux-hotplug

On Sat, Dec 20, 2003 at 02:32:01AM +0100, Kay Sievers wrote:
> Attached is a patch that introduces the format char 'k' to be replaced with
> the kernel name. I like to have it in a callout script.
> 
> I've moved the build_kernel_name() back to namedev_name_device() since
> we don't expect it growing cause of 'sdaj' :)

Applied, thanks.

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id\x1278&alloc_id371&op=click
_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2003-12-22 19:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-22 19:14 [udev] introduce format char 'k' for kernel-name Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2003-12-20  1:32 Kay Sievers

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