udev_volume_id update
PATCH 1/1 udev_volume_id update
Here is a update to extras/volume_id/*
o The device is now specified by the DEVPATH in the environment, it's no longer needed to pass the major/minor to the callout.
o leading spaces and slashes are now removed from the returned string and spaces are replaced by underscore, to not to confuse udev.
o Arnd Bergmann <[email protected]> provided the code to recognize s390 dasd disk labels. The -d switch tries to read the main block device instead of the partition.
thanks,
Kay
extras/volume_id/Makefile +14 -3
@@ -1,6 +1,6 @@ # Makefile for udev_volume_id # -# Copyright (C) 2004 Kay Sievers <[email protected]> +# Copyright (C) 2004 Kay Sievers <[email protected]> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by
@@ -29,8 +29,19 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM} override CFLAGS+=-Wall -fno-builtin -OBJS = volume_id.o udev_volume_id.o -HEADERS = volume_id.h + +SYSFS = ../../libsysfs/sysfs_bus.o \ + ../../libsysfs/sysfs_class.o \ + ../../libsysfs/sysfs_device.o \ + ../../libsysfs/sysfs_dir.o \ + ../../libsysfs/sysfs_driver.o \ + ../../libsysfs/sysfs_utils.o \ + ../../libsysfs/dlist.o + + + +OBJS = volume_id.o udev_volume_id.o dasdlabel.o $(SYSFS) +HEADERS = volume_id.h dasdlabel.h $(OBJS): $(HEADERS)
extras/volume_id/README new file +49 -0
49 lines not on this page · raw message
extras/volume_id/dasdlabel.c new file +178 -0
178 lines not on this page · raw message
extras/volume_id/dasdlabel.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* dasdlabel - read label from s390 block device +* +* Copyright (C) 2004 Arnd Bergmann <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation version 2 of the License. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +* +*/ + +#ifndef _DASDLABEL_H_ +#define _DASDLABEL_H_ + +extern int probe_ibm_partition (int fd,char *out); + +#endif
extras/volume_id/s390-dasd.rules new file +7 -0
@@ -0,0 +1,7 @@ +# s390 block devices named by disk label +KERNEL="dasd*[a-z]", PROGRAM="/sbin/udev_volume_id -d -l" RESULT="[0-9A-Z]*", SYMLINK="dasd/%c/disc dasd/%b/disc" +KERNEL="dasd*[0-9]", PROGRAM="/sbin/udev_volume_id -d -l" RESULT="[0-9A-Z]*", SYMLINK="dasd/%c/part%n dasd/%b/part%n" +KERNEL="dasd*[a-z]", SYMLINK="dasd/%b/disc" +KERNEL="dasd*[0-9]", SYMLINK="dasd/%b/part%n" +KERNEL="dcssblk*", NAME="%k", SYMLINK="dcssblk/%b" +
extras/volume_id/udev_volume_id.c +160 -46
261 lines not on this page · raw message
extras/volume_id/volume_id.c +3 -2
@@ -82,7 +82,7 @@memcpy (id->label_string, buf, count);/* remove trailing whitespace */ - i =strlen (id->label_string); + i =strnlen (id->label_string, count);while (i--) {if (!isspace (id->label_string[i]))break ;
@@ -839,10 +839,11 @@char tmp_node[VOLUME_ID_PATH_MAX ];snprintf (tmp_node,VOLUME_ID_PATH_MAX , -"/tmp/volume-%u-%u" ,major (devt),minor (devt)); +"/tmp/volume-%u-%u-%u" ,getpid (),major (devt),minor (devt)); tmp_node[VOLUME_ID_PATH_MAX ] ='\0' ;/* create tempory node to open the block device */ +unlink (tmp_node);if (mknod (tmp_node, (S_IFBLK |0600 ), devt) !=0 )return NULL ;
Greg KH
AppliedQuoted 11 lines · Kay Sievers
Here is a update to extras/volume_id/*
o The device is now specified by the DEVPATH in the environment, it's no longer needed to pass the major/minor to the callout.
o leading spaces and slashes are now removed from the returned string and spaces are replaced by underscore, to not to confuse udev.
o Arnd Bergmann <[email protected]> provided the code to recognize s390 dasd disk labels. The -d switch tries to read the main block device instead of the partition.
Applied, thanks.
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel