summaryrefslogtreecommitdiff
path: root/namedev.c
diff options
context:
space:
mode:
authorarnd@arndb.de <arnd@arndb.de>2003-11-24 23:41:40 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:13:04 -0700
commit5c6f0f141d43703fe84b8c0ddcebf9b79001daf9 (patch)
tree6cec78137e2845ed0b46f2062e8c06fb02569cb9 /namedev.c
parentbefd83cc4ee33f6a557b531d4a1be13472ec67cd (diff)
[PATCH] Add format modifier for devfs like naming
On Monday 24 November 2003 01:29, Greg KH wrote: > I think with the ability to capture the output of the CALLOUT rule, > combined with the ability to put format modifiers in the CALLOUT program > string, we now have everything in place to emulate the existing devfs > naming scheme. Anyone want to verify this or not? I would prefer to have the ability of creating partition nodes in devfs style built-in to udev. Devfs used to call the whole disk e.g. "/dev/dasd/0123/disk" and the partitions "/dev/dasd/0123/part[1-3]". This can obviously be done with a CALLOUT rule, but its common enough to make it a format modifier. AFAIK, this scheme has been used for ide, scsi and dasd disks, which is about 99% of all disks ever connected to Linux.
Diffstat (limited to 'namedev.c')
-rw-r--r--namedev.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/namedev.c b/namedev.c
index 391da7efca..d183a36329 100644
--- a/namedev.c
+++ b/namedev.c
@@ -527,6 +527,15 @@ static void apply_format(struct udevice *udev, unsigned char *string)
strcat(pos, udev->kernel_number);
dbg("substitute kernel number '%s'", udev->kernel_number);
break;
+ case 'D':
+ if (strlen(udev->kernel_number) == 0) {
+ strcat(pos, "disk");
+ break;
+ }
+ strcat(pos, "part");
+ strcat(pos, udev->kernel_number);
+ dbg("substitute kernel number '%s'", udev->kernel_number);
+ break;
case 'm':
sprintf(pos, "%u", udev->minor);
dbg("substitute minor number '%u'", udev->minor);