From 5c6f0f141d43703fe84b8c0ddcebf9b79001daf9 Mon Sep 17 00:00:00 2001 From: "arnd@arndb.de" Date: Mon, 24 Nov 2003 23:41:40 -0800 Subject: [PATCH] [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. --- namedev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/namedev.c b/namedev.c index 391da7ef..d183a363 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); -- 2.39.5