From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Tue, 08 Feb 2005 19:46:48 +0000 Subject: Re: [BUG, Patch] udev_volume_id -d option is broken Message-Id: <1107892008.5536.8.camel@localhost.localdomain> List-Id: References: <200501281441.26113.cborntra@de.ibm.com> In-Reply-To: <200501281441.26113.cborntra@de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Mon, 2005-02-07 at 19:39 +0100, Christian Borntraeger wrote: > Kay Sievers wrote: > > [...] > > If you have a chance to try the version in udev-051 on one of these > > boxes, it would be nice to know if it is still working as expected. I > > have moved the dasd label reading into a restructured version of the > > volume_id library now. > > > > Yes - sort of. Using -d alone works fine, but prints a lot of information: > > [root@tel22fe dev]# DEVPATH=/block/dasdb/dasdb1 /sbin/udev_volume_id -d > F:disklabel > T:dasd > V: > L:0XCE3E > N:0XCE3E > U: > > Usually, you are only interested in the volume lavel for your udev rule, > so, you might combine -d with -l. Unfortunately that does not work. It > also failed with udev 50....but it worked with udev 24 IIRC. Hmm, bad, sorry. Thanks for testing it. ... > Of course, vid->usage_id is != VOLUME_ID_FILESYSTEM if you read a volume > label. > Therefore, the "-l" option does not work on a dasd. > > I see 2 posibilities: > > 1: Make -d -l working, by changing this if statement > > 2: change the meaning of -d : only print the volume label This should work to print only the label. I've applied this to my tree and it will appear in the next release. Thanks again, Kay diff -Nru a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c --- a/extras/volume_id/udev_volume_id.c 2005-02-08 20:41:16 +01:00 +++ b/extras/volume_id/udev_volume_id.c 2005-02-08 20:41:16 +01:00 @@ -89,7 +89,7 @@ struct sysfs_class_device *class_dev_parent = NULL; struct volume_id *vid = NULL; char *devpath; - char probe_main_device = 0; + char probe_disk_label = 0; char print = 'a'; static char name[VOLUME_ID_LABEL_SIZE]; int len, i, j; @@ -116,7 +116,7 @@ print = 'u'; continue; case 'd': - probe_main_device = 1; + probe_disk_label = 1; continue; case 'h': case '?': @@ -146,8 +146,7 @@ goto exit; } - if (probe_main_device = 0) { - /* open block device */ + if (probe_disk_label = 0) { vid = open_classdev(class_dev); if (vid = NULL) goto exit; @@ -205,7 +204,8 @@ printf("%s\n", vid->type); break; case 'l': - if (name[0] = '\0' || vid->usage_id != VOLUME_ID_FILESYSTEM) { + if (name[0] = '\0' || + (vid->usage_id != VOLUME_ID_FILESYSTEM && vid->usage_id != VOLUME_ID_DISKLABEL)) { rc = 2; goto exit; } ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&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