update udev scsi_id to scsi_id 0.3
PATCH 1/1 update udev scsi_id to scsi_id 0.3
Greg -
Can you apply this patch to update udev's scsi_id to version 0.3?
Thanks!
extras/scsi_id/ChangeLog renamed from extras/orig-scsi_id/ChangeLog +36 -3
@@ -1,3 +1,36 @@ +2004-jan-15: + * Makefile: Version 0.3 + +2004-jan-13: + * scsi_id.c, Makefile: Fix prefix usage with scsi_id.config. + +2004-jan-13: + * scsi_id.config: Clean up some comment entries. + +2004-jan-13: + * Makefile: Install the sample scsi_id.config file. + +2004-jan-13: + * Makefile: Use DESTDIR in all install/uninstall rules, per + problem reported by Svetoslav Slavtchev. + +2004-jan-12: + * scsi_id.h, scsi_id.c, scsi_serial.c: Fix to work with current + sysfs 0.4, based on patch from Dan Stekloff, but uses + sysfs_read_attribute_value instead of + sysfs_get_value_from_attributes. + +2004-jan-08: + * scsi_id.c: SYSFS_BUS_DIR was replaced with SYSFS_BUS_NAME. + +2004-jan-08: + * scsi_id.c: Must now use sysfs_open_class_device_path instead of the + previous sysfs_open_class_device. + +2003-dec-07: + * Makefile: patch from Olaf Hering <[email protected]> remove DEBUG and + add --fno-builtin + 2003-dec-05: * Makefile, scsi_id.8: Add a man page.
@@ -53,12 +86,12 @@ is no support for that in klibc. 2003-nov-17: - * scsi_id.c: Patch from Brian King: check result of setting model, - not vendor in per_dev_options. + * scsi_id.c: Patch from Brian King <[email protected]>: check + result of setting model, not vendor in per_dev_options. 2003-nov-03: * scsi_id.c, scsi_serial.c: Use new and correct path to libsysfs.h. 2003-nov-03: - * scsi_id.h: Fix scsi_id.h so var args in marcros works ok with + * scsi_id.h: Fix scsi_id.h so var args in macros works ok with older gcc.
extras/scsi_id/Makefile renamed from extras/orig-scsi_id/Makefile +20 -10
@@ -14,9 +14,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -SCSI_ID_VERSION=0.2 +SCSI_ID_VERSION=0.3 prefix +etcdir = ${prefix}/etc sbindir = ${prefix}/sbin mandir = ${prefix}/usr/share/man
@@ -27,7 +28,7 @@ INSTALL_DATA = ${INSTALL} -m 644 # Note some of the variables used here are set when built under udev, and # otherwise might not be set. -override CFLAGS+=-DSCSI_ID_VERSION=\"$(SCSI_ID_VERSION)\" -Wall +override CFLAGS+=-Wall -fno-builtin PROG=scsi_id SYSFS=-lsysfs
@@ -39,25 +40,35 @@ SYSFS=-lsysfs # LDFLAGS=$(STRIP) LD=$(CC) -OBJS= scsi_id.o \ - scsi_serial.o \ +OBJS= scsi_id.o scsi_serial.o all: $(PROG) # XXX use a compressed man page? install: all - $(INSTALL_PROGRAM) -D $(PROG) $(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(sbindir)/$(PROG) $(INSTALL_DATA) -D scsi_id.8 $(DESTDIR)$(mandir)/man8/scsi_id.8 + @if [ ! -r $(DESTDIR)$(etcdir)/scsi_id.config ]; then \ + echo $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir); \ + $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir)/scsi_id.config; \ + fi uninstall: - -rm $(sbindir)/$(PROG) - -rm $(mandir)/man8/scsi_id.8 - -$(OBJS): scsi_id.h scsi.h + -rm $(DESTDIR)$(sbindir)/$(PROG) + -rm $(DESTDIR)$(mandir)/man8/scsi_id.8 + -rm $(DESTDIR)$(etcdir)/scsi_id.config + +GEN_HEADER=scsi_id_version.h + +scsi_id_version.h: + @echo "/* This file is auto-generated by the Makefile */" > $@ + @echo \#define SCSI_ID_VERSION \"$(SCSI_ID_VERSION)\" >> $@ + @echo \#define SCSI_ID_CONFIG_FILE \"$(etcdir)/scsi_id.config\" >> $@ +$(OBJS): scsi_id.h scsi.h scsi_id_version.h clean: - rm -f $(PROG) $(OBJS) + rm -f $(PROG) $(OBJS) $(GEN_HEADER) $(PROG): $(OBJS) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS)
extras/scsi_id/README renamed from extras/orig-scsi_id/README +1 -6
@@ -7,12 +7,7 @@ Requires: - Linux kernel 2.6 - - libsysfs - -No man page yet. - -libsysfs 0_2_0 was not installing libsysfs.h or dlist.h, manually copy -those files to /usr/include/sys before compiling. + - sysfsutils 0.4 Build via make and make install.
extras/scsi_id/TODO renamed from extras/orig-scsi_id/TODO +1 -1
@@ -1,4 +1,4 @@ -- add information abou the config file to the man page +- add information about the config file to the man page - change so non-KLIBC builds under udev don't use /usr/include/sysfs, but instead use the sysfs included with udev (needs udev change and/or
extras/scsi_id/release-notes renamed from extras/orig-scsi_id/release-notes +39 -0
@@ -0,0 +1,39 @@ +Version 0.3 of scsi_id is available at: + +http://www-124.ibm.com/storageio/scsi_id/scsi_id-0.3.tar.gz + +scsi_id is a program to generate a SCSI unique identifier for a given SCSI +device. + +It is primarily for use with udev callout config entries. It can also be +used for automatic multi-path configuration or device mapper configuration. + +Version 0.3 requires: + +- Linux kernel 2.6 +- libsysfs 0.4.0 + +Major changes since the last release: + + - Changes to work with libsysfs 0.4.0 + +All changes: + + - fix "prefix" usage for path to scsi_id.config + + - install the sample scsi_id.config file. + + - Use DESTDIR in all install/uninstall rules, per problem reported + by Svetoslav Slavtchev. + + - Fix to work with current sysfs 0.4, based on patch from Dan + Stekloff, but uses sysfs_read_attribute_value instead of + sysfs_get_value_from_attributes. + + - SYSFS_BUS_DIR was replaced with SYSFS_BUS_NAME. + + - Must now use sysfs_open_class_device_path instead of the + previous sysfs_open_class_device. + + - patch from Olaf Hering <[email protected]> remove DEBUG and + add --fno-builtin
extras/scsi_id/scsi_id.c renamed from extras/orig-scsi_id/scsi_id.c +27 -30
112 lines not on this page · raw message
extras/scsi_id/scsi_id.config renamed from extras/orig-scsi_id/scsi_id.config +5 -2
@@ -21,7 +21,9 @@ # vendor=string[,model=string],options=<per-device scsi_id options> # -# If you normally don't need id's, black list everyone: +# If you normally don't need scsi id's, or might be attaching devices of +# an unknown functionality, black list everyone. This is the default +# behaviour (if no -b or -g is specified). # options=-b
@@ -30,7 +32,8 @@ options=-b # vendor=someone, model=nicedrive, options=-g -# If you have all good devices on your system use, mark all as good: +# If you all the scsi devices are your system support valid id's, remove +# the -b line above, and mark all devices as good: ## options=-g
extras/scsi_id/scsi_id.h renamed from extras/orig-scsi_id/scsi_id.h +8 -13
@@ -28,6 +28,12 @@#define OFFSET (2 * sizeof(unsigned int))/* +* MAX_ATTR_LEN: maximum length of the result of reading a sysfs +* attribute. +*/ +#define MAX_ATTR_LEN 256 + +/* * MAX_SERIAL_LEN: the maximum length of the serial number, including * added prefixes such as vendor and product (model) strings. */
@@ -39,19 +45,8 @@*/ #define MAX_BUFFER_LEN 256 -static inline char *sysfs_get_attr (struct sysfs_class_device *dev, -const char *attr) -{ -struct dlist *attributes =NULL ; - - attributes =sysfs_get_classdev_attributes (dev); - -if (attributes =NULL ) -return NULL ; - -return sysfs_get_value_from_attributes (attributes, attr); -} - +extern int sysfs_get_attr (const char *devpath,const char *attr,char *value, +size_t bufsize);extern int scsi_get_serial (struct sysfs_class_device *scsi_dev,const char *devname,int page_code,char *serial,int len);
extras/scsi_id/scsi_serial.c renamed from extras/orig-scsi_id/scsi_serial.c +10 -11
@@ -385,7 +385,7 @@ static int do_scsi_page0_inquiry(struct char *buffer, int len) { int retval; -char *vendor; +char vendor[MAX_ATTR_LEN ];memset (buffer,0 , len); retval =scsi_inquiry (scsi_dev, fd,1 ,0x0 , buffer, len);
@@ -415,9 +415,10 @@ static int do_scsi_page0_inquiry(struct* If the vendor id appears in the page assume the page is * invalid. */ - vendor =sysfs_get_attr (scsi_dev,"vendor" ); -if (!vendor) { -log_message (LOG_WARNING ,"%s: no vendor attribute\n" , +if (sysfs_get_attr (scsi_dev->path,"vendor" , vendor, +MAX_ATTR_LEN )) { +log_message (LOG_WARNING , +"%s: cannot get model attribute\n" , scsi_dev->name);return 1 ; }
@@ -437,12 +438,11 @@ static int do_scsi_page0_inquiry(structstatic int prepend_vendor_model (struct sysfs_class_device *scsi_dev,char *serial) { -char *attr; +char attr[MAX_ATTR_LEN ];int ind; - attr =sysfs_get_attr (scsi_dev,"vendor" ); -if (!attr) { -log_message (LOG_WARNING ,"%s: no vendor attribute\n" , +if (sysfs_get_attr (scsi_dev->path,"vendor" , attr,MAX_ATTR_LEN )) { +log_message (LOG_WARNING ,"%s: cannot get vendor attribute\n" , scsi_dev->name);return 1 ; }
@@ -454,9 +454,8 @@ static int prepend_vendor_model(struct sif (serial[ind] ='\n' ) serial[ind] ='\0' ; - attr =sysfs_get_attr (scsi_dev,"model" ); -if (!attr) { -log_message (LOG_WARNING ,"%s: no model attribute\n" , +if (sysfs_get_attr (scsi_dev->path,"model" , attr,MAX_ATTR_LEN )) { +log_message (LOG_WARNING ,"%s: cannot get model attribute\n" , scsi_dev->name);return 1 ; }
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Oops! That last one was diff-ed against the wrong scsi_id/Makefile, this one should work with no rejects.
extras/scsi_id/ChangeLog renamed from extras/orig-scsi_id/ChangeLog +36 -3
@@ -1,3 +1,36 @@ +2004-jan-15: + * Makefile: Version 0.3 + +2004-jan-13: + * scsi_id.c, Makefile: Fix prefix usage with scsi_id.config. + +2004-jan-13: + * scsi_id.config: Clean up some comment entries. + +2004-jan-13: + * Makefile: Install the sample scsi_id.config file. + +2004-jan-13: + * Makefile: Use DESTDIR in all install/uninstall rules, per + problem reported by Svetoslav Slavtchev. + +2004-jan-12: + * scsi_id.h, scsi_id.c, scsi_serial.c: Fix to work with current + sysfs 0.4, based on patch from Dan Stekloff, but uses + sysfs_read_attribute_value instead of + sysfs_get_value_from_attributes. + +2004-jan-08: + * scsi_id.c: SYSFS_BUS_DIR was replaced with SYSFS_BUS_NAME. + +2004-jan-08: + * scsi_id.c: Must now use sysfs_open_class_device_path instead of the + previous sysfs_open_class_device. + +2003-dec-07: + * Makefile: patch from Olaf Hering <[email protected]> remove DEBUG and + add --fno-builtin + 2003-dec-05: * Makefile, scsi_id.8: Add a man page.
@@ -53,12 +86,12 @@ is no support for that in klibc. 2003-nov-17: - * scsi_id.c: Patch from Brian King: check result of setting model, - not vendor in per_dev_options. + * scsi_id.c: Patch from Brian King <[email protected]>: check + result of setting model, not vendor in per_dev_options. 2003-nov-03: * scsi_id.c, scsi_serial.c: Use new and correct path to libsysfs.h. 2003-nov-03: - * scsi_id.h: Fix scsi_id.h so var args in marcros works ok with + * scsi_id.h: Fix scsi_id.h so var args in macros works ok with older gcc.
extras/scsi_id/Makefile renamed from extras/orig-scsi_id/Makefile +20 -10
@@ -14,9 +14,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -SCSI_ID_VERSION=0.2 +SCSI_ID_VERSION=0.3 prefix +etcdir = ${prefix}/etc sbindir = ${prefix}/sbin mandir = ${prefix}/usr/share/man
@@ -27,7 +28,7 @@ INSTALL_DATA = ${INSTALL} -m 644 # Note some of the variables used here are set when built under udev, and # otherwise might not be set. -override CFLAGS+=-DSCSI_ID_VERSION=\"$(SCSI_ID_VERSION)\" $(DEBUG) -Wall +override CFLAGS+=-Wall -fno-builtin PROG=scsi_id SYSFS=-lsysfs
@@ -39,25 +40,35 @@ SYSFS=-lsysfs # LDFLAGS=$(STRIP) LD=$(CC) -OBJS= scsi_id.o \ - scsi_serial.o \ +OBJS= scsi_id.o scsi_serial.o all: $(PROG) # XXX use a compressed man page? install: all - $(INSTALL_PROGRAM) -D $(PROG) $(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(sbindir)/$(PROG) $(INSTALL_DATA) -D scsi_id.8 $(DESTDIR)$(mandir)/man8/scsi_id.8 + @if [ ! -r $(DESTDIR)$(etcdir)/scsi_id.config ]; then \ + echo $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir); \ + $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir)/scsi_id.config; \ + fi uninstall: - -rm $(sbindir)/$(PROG) - -rm $(mandir)/man8/scsi_id.8 - -$(OBJS): scsi_id.h scsi.h + -rm $(DESTDIR)$(sbindir)/$(PROG) + -rm $(DESTDIR)$(mandir)/man8/scsi_id.8 + -rm $(DESTDIR)$(etcdir)/scsi_id.config + +GEN_HEADER=scsi_id_version.h + +scsi_id_version.h: + @echo "/* This file is auto-generated by the Makefile */" > $@ + @echo \#define SCSI_ID_VERSION \"$(SCSI_ID_VERSION)\" >> $@ + @echo \#define SCSI_ID_CONFIG_FILE \"$(etcdir)/scsi_id.config\" >> $@ +$(OBJS): scsi_id.h scsi.h scsi_id_version.h clean: - rm -f $(PROG) $(OBJS) + rm -f $(PROG) $(OBJS) $(GEN_HEADER) $(PROG): $(OBJS) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS)
extras/scsi_id/README renamed from extras/orig-scsi_id/README +1 -6
@@ -7,12 +7,7 @@ Requires: - Linux kernel 2.6 - - libsysfs - -No man page yet. - -libsysfs 0_2_0 was not installing libsysfs.h or dlist.h, manually copy -those files to /usr/include/sys before compiling. + - sysfsutils 0.4 Build via make and make install.
extras/scsi_id/TODO renamed from extras/orig-scsi_id/TODO +1 -1
@@ -1,4 +1,4 @@ -- add information abou the config file to the man page +- add information about the config file to the man page - change so non-KLIBC builds under udev don't use /usr/include/sysfs, but instead use the sysfs included with udev (needs udev change and/or
extras/scsi_id/release-notes renamed from extras/orig-scsi_id/release-notes +39 -0
@@ -0,0 +1,39 @@ +Version 0.3 of scsi_id is available at: + +http://www-124.ibm.com/storageio/scsi_id/scsi_id-0.3.tar.gz + +scsi_id is a program to generate a SCSI unique identifier for a given SCSI +device. + +It is primarily for use with udev callout config entries. It can also be +used for automatic multi-path configuration or device mapper configuration. + +Version 0.3 requires: + +- Linux kernel 2.6 +- libsysfs 0.4.0 + +Major changes since the last release: + + - Changes to work with libsysfs 0.4.0 + +All changes: + + - fix "prefix" usage for path to scsi_id.config + + - install the sample scsi_id.config file. + + - Use DESTDIR in all install/uninstall rules, per problem reported + by Svetoslav Slavtchev. + + - Fix to work with current sysfs 0.4, based on patch from Dan + Stekloff, but uses sysfs_read_attribute_value instead of + sysfs_get_value_from_attributes. + + - SYSFS_BUS_DIR was replaced with SYSFS_BUS_NAME. + + - Must now use sysfs_open_class_device_path instead of the + previous sysfs_open_class_device. + + - patch from Olaf Hering <[email protected]> remove DEBUG and + add --fno-builtin
extras/scsi_id/scsi_id.c renamed from extras/orig-scsi_id/scsi_id.c +27 -30
112 lines not on this page · raw message
extras/scsi_id/scsi_id.config renamed from extras/orig-scsi_id/scsi_id.config +5 -2
@@ -21,7 +21,9 @@ # vendor=string[,model=string],options=<per-device scsi_id options> # -# If you normally don't need id's, black list everyone: +# If you normally don't need scsi id's, or might be attaching devices of +# an unknown functionality, black list everyone. This is the default +# behaviour (if no -b or -g is specified). # options=-b
@@ -30,7 +32,8 @@ options=-b # vendor=someone, model=nicedrive, options=-g -# If you have all good devices on your system use, mark all as good: +# If you all the scsi devices are your system support valid id's, remove +# the -b line above, and mark all devices as good: ## options=-g
extras/scsi_id/scsi_id.h renamed from extras/orig-scsi_id/scsi_id.h +8 -13
@@ -28,6 +28,12 @@#define OFFSET (2 * sizeof(unsigned int))/* +* MAX_ATTR_LEN: maximum length of the result of reading a sysfs +* attribute. +*/ +#define MAX_ATTR_LEN 256 + +/* * MAX_SERIAL_LEN: the maximum length of the serial number, including * added prefixes such as vendor and product (model) strings. */
@@ -39,19 +45,8 @@*/ #define MAX_BUFFER_LEN 256 -static inline char *sysfs_get_attr (struct sysfs_class_device *dev, -const char *attr) -{ -struct dlist *attributes =NULL ; - - attributes =sysfs_get_classdev_attributes (dev); - -if (attributes =NULL ) -return NULL ; - -return sysfs_get_value_from_attributes (attributes, attr); -} - +extern int sysfs_get_attr (const char *devpath,const char *attr,char *value, +size_t bufsize);extern int scsi_get_serial (struct sysfs_class_device *scsi_dev,const char *devname,int page_code,char *serial,int len);
extras/scsi_id/scsi_serial.c renamed from extras/orig-scsi_id/scsi_serial.c +10 -11
@@ -385,7 +385,7 @@ static int do_scsi_page0_inquiry(struct char *buffer, int len) { int retval; -char *vendor; +char vendor[MAX_ATTR_LEN ];memset (buffer,0 , len); retval =scsi_inquiry (scsi_dev, fd,1 ,0x0 , buffer, len);
@@ -415,9 +415,10 @@ static int do_scsi_page0_inquiry(struct* If the vendor id appears in the page assume the page is * invalid. */ - vendor =sysfs_get_attr (scsi_dev,"vendor" ); -if (!vendor) { -log_message (LOG_WARNING ,"%s: no vendor attribute\n" , +if (sysfs_get_attr (scsi_dev->path,"vendor" , vendor, +MAX_ATTR_LEN )) { +log_message (LOG_WARNING , +"%s: cannot get model attribute\n" , scsi_dev->name);return 1 ; }
@@ -437,12 +438,11 @@ static int do_scsi_page0_inquiry(structstatic int prepend_vendor_model (struct sysfs_class_device *scsi_dev,char *serial) { -char *attr; +char attr[MAX_ATTR_LEN ];int ind; - attr =sysfs_get_attr (scsi_dev,"vendor" ); -if (!attr) { -log_message (LOG_WARNING ,"%s: no vendor attribute\n" , +if (sysfs_get_attr (scsi_dev->path,"vendor" , attr,MAX_ATTR_LEN )) { +log_message (LOG_WARNING ,"%s: cannot get vendor attribute\n" , scsi_dev->name);return 1 ; }
@@ -454,9 +454,8 @@ static int prepend_vendor_model(struct sif (serial[ind] ='\n' ) serial[ind] ='\0' ; - attr =sysfs_get_attr (scsi_dev,"model" ); -if (!attr) { -log_message (LOG_WARNING ,"%s: no model attribute\n" , +if (sysfs_get_attr (scsi_dev->path,"model" , attr,MAX_ATTR_LEN )) { +log_message (LOG_WARNING ,"%s: cannot get model attribute\n" , scsi_dev->name);return 1 ; }
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Greg KH
AppliedQuoted 2 lines · Patrick Mansfield
Oops! That last one was diff-ed against the wrong scsi_id/Makefile, this one should work with no rejects.
Applied, thanks.
greg k-h
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
PATCH 1/1 update udev scsi_id to scsi_id 0.4
In reply to Patrick MansfieldHi -
Greg, can you please apply this to your udev tree?
This patch syncs the scsi_id in the udev tree to version 0.4.
See the announce email for details.
Thanks.
extras/scsi_id/ChangeLog +43 -0
@@ -1,3 +1,46 @@ +2004-feb-25: + * scsi_id.8: Add verbage about usage with udev, and running via + hotplug. + +2004-feb-25: + * scsi_id.c, scsi_id.8: Disable support for -e (all output to + stderr) as it cannot be used in any useful way, and the -c + (device specific callout) as the code is incomplete and has no + users. + +2004-feb-25: + * scsi_id.c: Don't print errno for NULL return from + sysfs_get_classdev_device. + +2004-feb-23: + * scsi_id.c: Get rid of dead/leftover code that checked + if we are on a scsi bus. + +2004-feb-23: + * scsi_serial.c, scsi_id.c: Use ":" consistently in output messages. + +2004-feb-23: + * scsi_serial.c: Add missing new lines for some error messages. + +2004-feb-23: + * scsi_serial.c: open O_NONBLOCK so we handle tape drives without + tapes loaded. + +2004-feb-20: + * scsi_id.h, scsi_id.c: Remove hacks based on KLIBC define to get + around problems when building with udev (udev libsysfs files + were rearranged). + +2004-feb-19: + * scsi_id.h, scsi_id.c, scsi_serial.c: As done in udev code, support + partitions via looking for a parent of the target path. Uses + libsysfs functions to do most of the work, and includes changing + a lot of variables to be struct sysfs_device instead of + sysfs_class_device. + +2004-feb-19: + * Makefile: Version 0.4 + 2004-jan-15: * Makefile: Version 0.3
extras/scsi_id/Makefile +1 -1
@@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -SCSI_ID_VERSION=0.3 +SCSI_ID_VERSION=0.4 prefix etcdir = ${prefix}/etc
extras/scsi_id/TODO +6 -9
@@ -1,11 +1,8 @@ -- add information about the config file to the man page +- Document that config file options override command line options, or fix + the code. This means a '-b' in the config file disables any -g on the + command line. -- change so non-KLIBC builds under udev don't use /usr/include/sysfs, - but instead use the sysfs included with udev (needs udev change and/or - sysfsutils changes). +- Add code to check that SCSI commands get back enough data for their + intended usage, mainly callers of scsi_inquiry(). -- do something with callout code - remove or change to a tag? - - This needs an implementation of a device specific callout or device - specific code (called via some special "tag" or such) before it can be - completed. Someone with such hardware to send in a patch. +- Document the config file in the man page
extras/scsi_id/gen_scsi_id_udev_rules.sh +85 -0
85 lines not on this page · raw message
extras/scsi_id/release-notes +30 -20
69 lines not on this page · raw message
Binary files udev-bk/extras/scsi_id/scsi_id and udev-scsi_id-0.4/extras/scsi_id/scsi_id differ
extras/scsi_id/scsi_id.8 +38 -9
79 lines not on this page · raw message
extras/scsi_id/scsi_id.c +51 -83
222 lines not on this page · raw message
extras/scsi_id/scsi_id.h +3 -3
@@ -47,9 +47,9 @@extern int sysfs_get_attr (const char *devpath,const char *attr,char *value,size_t bufsize); -extern int scsi_get_serial (struct sysfs_class_device *scsi_dev, -const char *devname,int page_code,char *serial, -int len); +extern int scsi_get_serial (struct sysfs_device *scsi_dev,const char + *devname,int page_code,char *serial,int + len);extern void log_message (int level,const char *format, ...) __attribute__ ((format (printf,2 ,3 )));
extras/scsi_id/scsi_id_version.h +1 -1
@@ -1,3 +1,3 @@/* This file is auto-generated by the Makefile */ -#define SCSI_ID_VERSION "0.3" +#define SCSI_ID_VERSION "0.4"#define SCSI_ID_CONFIG_FILE "/etc/scsi_id.config"
extras/scsi_id/scsi_serial.c +22 -42
177 lines not on this page · raw message
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Greg KH
AppliedRe: [PATCH] update udev scsi_id to scsi_id 0.4
In reply to Patrick MansfieldQuoted 3 lines · Patrick Mansfield
Hi -
Greg, can you please apply this to your udev tree?
I applied it, but had to cut out the change to your _version.h file as that shouldn't have been there, right?
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Re: [PATCH] update udev scsi_id to scsi_id 0.4
In reply to Patrick MansfieldQuoted 7 lines · Greg KH
Quoted 3 lines · Patrick Mansfield
Hi -
Greg, can you please apply this to your udev tree?
I applied it, but had to cut out the change to your
_version.hfile as that shouldn't have been there, right?
Yes, thanks for catching that.
-- Patrick Mansfield
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
PATCH 1/1 update udev scsi_id to scsi_id 0.5
In reply to Patrick MansfieldHi -
Greg can you please apply? Patch against current udev bk.
This patch syncs the scsi_id in the udev tree to version 0.5.
extras/scsi_id/ChangeLog renamed from extras/orig-scsi_id/ChangeLog +39 -0
@@ -1,3 +1,42 @@ +2004-jun-23: + * scsi_id.h: increase MAX_SERIAL_LEN from 128 to 256, as some + devices (maybe broken ones) are giving really long id's. + +2004-jun-17: + * Makefile: Olaf Hering add spotless target (already in udev). + +2004-jun-17: + * scsi_serial.c: Include linux/compiler.h so we can build with + klibc using kernel headers. + +2004-may-24: + * scsi_id.c: Rename major and minor to maj min to avoid compiler + warnings when compiled with -D_GNU_SOURCE. + +2004-mar-30: + * scsi_id.config: Minor wording changes + +2004-mar-30: + * scsi_id.h: Don't supply a makedev() when built under klibc. + +2004-mar-30: + * scsi_id.c: Ken Brush <[email protected]> Have the command line + options override generic options. + +2004-mar-05: + * scsi_serial.c: Log INQUIRY failure, including the + failing page code and vpd values. And add a dprintf() to + the scsi_inquiry function. + +2004-mar-02: + * gen_scsi_id_udev_rules.sh: Per bug report from Atul Sabharwal + <[email protected]> change to not require that sysfs be + in the mount tab (and default to "/sys"), and fix so scsi_id + results containing spaces work correctly. + +2004-mar-02: + * scsi_id.8: Escape '-' with '\-'. + 2004-feb-25: * scsi_id.8: Add verbage about usage with udev, and running via hotplug.
extras/scsi_id/Makefile renamed from extras/orig-scsi_id/Makefile +2 -1
@@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -SCSI_ID_VERSION=0.4 +SCSI_ID_VERSION=0.5 prefix etcdir = ${prefix}/etc
@@ -71,5 +71,6 @@ clean: rm -f $(PROG) $(OBJS) $(GEN_HEADER) spotless: clean + $(PROG): $(OBJS) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS)
extras/scsi_id/TODO renamed from extras/orig-scsi_id/TODO +6 -3
@@ -1,6 +1,9 @@ -- Document that config file options override command line options, or fix - the code. This means a '-b' in the config file disables any -g on the - command line. +- Add an option to replace blanks with spaces, so the generated id can be + more easily used as a /dev name. + +- Add a bus white/black list option. So for example, all scsi devices + under USB could easily be blacklisted. This should allow multiple busses + to be listed. - Add code to check that SCSI commands get back enough data for their intended usage, mainly callers of scsi_inquiry().
extras/scsi_id/gen_scsi_id_udev_rules.sh renamed from extras/orig-scsi_id/gen_scsi_id_udev_rules.sh +15 -20
@@ -27,22 +27,12 @@ prefix=disk- scsi_id=/sbin/scsi_id -dump_ids() -{ - cd ${sysfs_dir}/block - for b in sd* - do - echo -n "$b " - $scsi_id -s /block/$b - if [ $? != 0 ] - then - echo $0 failed for device $b >&2 - exit 1 - fi - done -} - sysfs_dir=$(mount | awk '$5 = "sysfs" {print $3}') +if [ "$sysfs_dir" = "" ] +then + sysfs_dir="/sys" + echo "Using sysfs mount point \"$sysfs_dir\"" >&2 +fi c=$(ls /${sysfs_dir}/block/sd* 2>/dev/null | wc -l) if [ $c = 0 ]
@@ -56,12 +46,17 @@ echo "# Start of autogenerated scsi_id r echo "# rules to your liking." echo "#" first_line=yes -dump_ids | while read in + +# +cd ${sysfs_dir}/block +for name in sd* do - set $in - name=$1 - shift - id="$*" + id=$($scsi_id -s /block/$name) + if [ $? != 0 ] + then + echo $0 failed for device $name exiting >&2 + exit 1 + fi if [ $first_line = "yes" ] then first_line=no
extras/scsi_id/release-notes renamed from extras/orig-scsi_id/release-notes +21 -28
70 lines not on this page · raw message
extras/scsi_id/scsi_id.8 renamed from extras/orig-scsi_id/scsi_id.8 +10 -10
@@ -12,12 +12,12 @@ all SCSI devices that properly support p If a result is generated it is sent to standard output, and the program exits with a zero value. If no identifier is output, the program exits -with a non-zero value. +with a non\-zero value. \fBscsi_id\fP is primarily for use by other utilities such as \fBudev\fP that require a unique SCSI identifier. -By default all devices are assume black listed, the \fB-g\fP option must +By default all devices are assume black listed, the \fB\-g\fP option must be specified on the command line or in the config file for any useful behaviour.
@@ -58,18 +58,18 @@ mode, and expects the environment variab corresponding sysfs device. See section below on usage with \fBudev\fP. .TP .BI \-b -The default behaviour - treat the device as black listed, and do nothing -unless a white listed device is found in the scsi_id config-file. +The default behaviour \- treat the device as black listed, and do nothing +unless a white listed device is found in the scsi_id config\-file. .TP .BI \-d "\| device\^" Instead of determining and creating a device node based on a sysfs dev -entry as done for the \fB-s\fP, send SG_IO commands to +entry as done for the \fB\-s\fP, send SG_IO commands to \fBdevice\fP, such as \fB/dev/sdc\fP. .TP -.BI \-f "\| config-file" +.BI \-f "\| config\-file" Read configuration and black/white list entries from -.B config-file +.B config\-file rather than the default .B /etc/scsi_id.config file.
@@ -89,9 +89,9 @@ Use SCSI INQUIRY VPD page code 0x80 or 0 query the available VPD pages, and use page 0x83 if found, else page 0x80 if found, else nothing. .TP -.BI \-s "\| sysfs-device" +.BI \-s "\| sysfs\-device" Generate an id for the -.B sysfs-device. +.B sysfs\-device. The sysfs mount point must not be included. For example, use /block/sd, not /sys/block/sd. .TP
@@ -113,7 +113,7 @@ and the results will likely not be as ex When in this mode, all errors and warnings are sent via syslog. -To determine the specific value needed in a RESULT key, use the -s option, +To determine the specific value needed in a RESULT key, use the \-s option, for example: .sp
extras/scsi_id/scsi_id.c renamed from extras/orig-scsi_id/scsi_id.c +11 -10
@@ -111,7 +111,7 @@ int sysfs_get_attr(const char *devpath,return sysfs_read_attribute_value (attr_path, value,SYSFS_NAME_LEN ); } -static int get_major_minor (const char *devpath,int *major,int *minor) +static int get_major_minor (const char *devpath,int *maj,int *min) {char dev_value[MAX_ATTR_LEN ];
@@ -129,7 +129,7 @@ static int get_major_minor(const char *d }dprintf ("dev value %s" , dev_value);/* dev_value has a trailing \n */ -if (sscanf (dev_value,"%u:%u" , major, minor) !=2 ) { +if (sscanf (dev_value,"%u:%u" , maj, min) !=2 ) {log_message (LOG_WARNING ,"%s: invalid dev major/minor\n" , devpath);return -1 ;
@@ -140,18 +140,18 @@ static int get_major_minor(const char *dstatic int create_tmp_dev (const char *devpath,char *tmpdev,int dev_type) { -int major, minor; +int maj, min;dprintf ("(%s)\n" , devpath); -if (get_major_minor (devpath, &major, &minor)) +if (get_major_minor (devpath, &maj, &min))return -1 ;snprintf (tmpdev,MAX_NAME_LEN ,"%s/%s-maj%d-min%d-%u" , -TMP_DIR ,TMP_PREFIX , major, minor,getpid ()); +TMP_DIR ,TMP_PREFIX , maj, min,getpid ());dprintf ("tmpdev '%s'\n" , tmpdev); -if (mknod (tmpdev,0600 | dev_type,makedev (major, minor))) { +if (mknod (tmpdev,0600 | dev_type,makedev (maj, min))) {log_message (LOG_WARNING ,"mknod failed: %s\n" ,strerror (errno));return -1 ; }
@@ -759,10 +759,6 @@ int main(int argc, char **argv)strncpy (target_path, sysfs_mnt_path,MAX_NAME_LEN );strncat (target_path, devpath,MAX_NAME_LEN ); - }else { -if (set_options (argc, argv, short_options, target_path, - maj_min_dev) <0 ) -exit (1 ); }/*
@@ -778,6 +774,11 @@ int main(int argc, char **argv) maj_min_dev) < 0)exit (1 );free (newargv); + } +if (!hotplug_mode) { +if (set_options (argc, argv, short_options, target_path, + maj_min_dev) <0 ) +exit (1 ); }if (!sys_specified) {
extras/scsi_id/scsi_id.config renamed from extras/orig-scsi_id/scsi_id.config +6 -6
@@ -9,12 +9,12 @@ # INQUIRY product identification field. Per the SCSI INQUIRY, the vendor # is limited to 8 bytes, model to 16 bytes. # -# The first maching line found is used. Short matches match longer ones, +# The first matching line found is used. Short matches match longer ones, # if you do not want such a match space fill the extra bytes. If no model # is specified, only the vendor string need match. # -# The "option" line is searched when scsi_id first starts up (for use with -# hotplug during boot). +# The "options" line is searched for when scsi_id starts up, and is +# primarily for use with hotplug. # # options=<any scsi_id command line options> #
@@ -32,12 +32,12 @@ options=-b # vendor=someone, model=nicedrive, options=-g -# If you all the scsi devices are your system support valid id's, remove -# the -b line above, and mark all devices as good: +# If you know all the scsi devices on your system support valid id's, +# remove the options=-b line, and mark all devices as good: ## options=-g # Then black list any offenders. Missing entries here could be dangerous -# if you rely on the id for naming or multi-path configuration! +# if you rely on the id for persistent naming or multi-path configuration. ## vendor=ELBONIA, model=borken, options=-b
extras/scsi_id/scsi_id.h renamed from extras/orig-scsi_id/scsi_id.h +1 -5
@@ -37,7 +37,7 @@* MAX_SERIAL_LEN: the maximum length of the serial number, including * added prefixes such as vendor and product (model) strings. */ -#define MAX_SERIAL_LEN 128 +#define MAX_SERIAL_LEN 256/* * MAX_BUFFER_LEN: maximum buffer size and line length used while reading
@@ -52,10 +52,6 @@ extern int scsi_get_serial (struct sysfs len);extern void log_message (int level,const char *format, ...) __attribute__ ((format (printf,2 ,3 ))); - -#ifdef __KLIBC__ -#define makedev (major, minor) ((major) << 8) | (minor) -#endif #ifndef u8typedef unsigned char u8 ;
extras/scsi_id/scsi_serial.c renamed from extras/orig-scsi_id/scsi_serial.c +8 -0
@@ -30,6 +30,7 @@#include <stdlib.h> #include <unistd.h> #include <syslog.h> +#include <linux/compiler.h> /* need __user when built via klibc */ #include <scsi/sg.h> #include <sysfs/libsysfs.h> #include "scsi_id.h"
@@ -312,6 +313,8 @@ static int scsi_inquiry(struct sysfs_dev buffer = inq +OFFSET ; resend: +dprintf ("%s evpd %d, page 0x%x\n" , scsi_dev->name, evpd, page); +memset (&io_hdr,0 ,sizeof (struct sg_io_hdr )); io_hdr.interface_id ='S' ; io_hdr.cmd_len =sizeof (inq_cmd);
@@ -351,6 +354,11 @@ resend: } retval =-1 ; } + +if (retval <0 ) +log_message (LOG_WARNING , +"%s: Unable to get INQUIRY vpd %d page 0x%x.\n" , + scsi_dev->name, evpd, page);free (inq);return retval;
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Greg KH
AppliedRe: [PATCH] update udev scsi_id to scsi_id 0.5
In reply to Patrick MansfieldQuoted 5 lines · Patrick Mansfield
Hi -
Greg can you please apply? Patch against current udev bk.
This patch syncs the
scsi_idin the udev tree to version 0.5.
Applied, thanks.
greg k-h
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel