chiark / gitweb /
[PATCH] implement printf-like placeholder support for NAME
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Tue, 18 Nov 2003 08:59:27 +0000 (00:59 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:06:24 +0000 (21:06 -0700)
commit98b88dbf704a1376ee4c79051086089adde5d626
tree7ff012ae5707e101b7f640fdaca850636fe30a21
parent30defadd3fbef99628a16dcd7c4a2964982deac2
[PATCH] implement printf-like placeholder support for NAME

> Problem is, if you use the LABEL rule to match a device, like a SCSI
> vendor, then all of the partitions, as well as the main block device,
> will end up with the same name.  That's why I added the "add the number"
> hack to the LABEL rule.
>
> So yes, your patch is correct in that we shouldn't always be adding the
> number to any match for LABEL (like for char devices), but if we do
> that, then we break partitions.  Your '%' patch fixes this, but I'd just
> like to extend it a bit.  Let me see what I can come up with...

Oh, I see. Do you mean something like this:

LABEL, BUS="usb", model="Creative Labs WebCam 3", NAME="webcam%n-%M:%m-test"

results in: "webcam0-81:0-test"

Nov 15 16:51:53 pim udev[16193]: get_class_dev: looking at /sys/class/video4linux/video0
Nov 15 16:51:53 pim udev[16193]: get_class_dev: class_dev->name = video0
Nov 15 16:51:53 pim udev[16193]: get_major_minor: dev = 81:0
Nov 15 16:51:53 pim udev[16193]: get_major_minor: found major = 81, minor = 0
Nov 15 16:51:53 pim udev[16193]: udev_add_device: name = webcam0-81:0-test
Nov 15 16:51:53 pim udev[16193]: create_node: mknod(/udev/webcam0-81:0-test, 020666, 81, 0)

  implement printf-like placeholder support for NAME
  %n-kernel number, %M-major number, %m-minor number
namedev.c