Hello community, here is the log from the commit of package udev checked in at Thu Oct 12 15:25:54 CEST 2006. -------- --- udev/udev.changes 2006-09-30 15:09:01.000000000 +0200 +++ /mounts/work_src_done/STABLE/udev/udev.changes 2006-10-10 17:15:26.000000000 +0200 @@ -1,0 +2,8 @@ +Tue Oct 10 17:00:00 CEST 2006 - kay.sievers@suse.de + +- new upstream release 102 + full support for future sysfs layout changes + fix path_id for SAS devices +- create compat rules for /dev/disk/ for libata switch (#211236) + +------------------------------------------------------------------- Old: ---- udev-101.tar.bz2 udev-warn-about-PHYSDEV+device-01.patch New: ---- udev-102.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ udev.spec ++++++ --- /var/tmp/diff_new_pack.XCy8fE/_old 2006-10-12 15:24:54.000000000 +0200 +++ /var/tmp/diff_new_pack.XCy8fE/_new 2006-10-12 15:24:54.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package udev (Version 101) +# spec file for package udev (Version 102) # # Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -12,7 +12,7 @@ Name: udev URL: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/ -Version: 101 +Version: 102 Release: 1 License: GPL Group: System/Kernel @@ -260,6 +260,11 @@ /%{_lib}/libvolume_id.so.* %changelog -n udev +* Tue Oct 10 2006 - kay.sievers@suse.de +- new upstream release 102 + full support for future sysfs layout changes + fix path_id for SAS devices +- create compat rules for /dev/disk/ for libata switch (#211236) * Sat Sep 30 2006 - kay.sievers@suse.de - new upstream release 101 udevd now has --debug-trace option for bootup in trace mode ++++++ 60-persistent-storage.rules ++++++ --- udev/60-persistent-storage.rules 2006-09-30 15:23:06.000000000 +0200 +++ /mounts/work_src_done/STABLE/udev/60-persistent-storage.rules 2006-10-11 12:06:39.000000000 +0200 @@ -5,7 +5,7 @@ SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*", GOTO="persistent_storage_end" # never access non-cdrom removable ide devices, the drivers are causing event loops on open() KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" @@ -26,6 +26,8 @@ KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}-part%n" KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # by-path (shortest physical path) ++++++ udev-101.tar.bz2 -> udev-102.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/ChangeLog new/udev-102/ChangeLog --- old/udev-101/ChangeLog 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/ChangeLog 2006-10-10 17:07:35.000000000 +0200 @@ -1,3 +1,60 @@ +Summary of changes from v101 to v102 +============================================ + +Daniel Drake: + writing_udev_rules: fix typo in example rule + +Kay Sievers: + create missing ChangeLog for version 101 + update SUSE rules + update default rules + first try "subsystem" link at a parent device, before guessing + if /sys/subsystem exists, skip class, bus, block scanning + scsi_id: export ID_SERIAL_SHORT without vendor/product + update SUSE rules + +MUNEDA Takahiro: + path_id: fix SAS disk handling + + +Summary of changes from v100 to v101 +============================================ + +Arjan Opmeer: + fix udevinfo help text typo + +Bryan Kadzban: + cleanup default rules + add IMPORT operations to the udev man page + +Kay Sievers: + remove Makefile magic for leading '0' in version + udevd: use getopt_long() + udevd: add --verbose option to log also to stdout + udevd: add --debug-trace option + rule_generator: improve net rule comment generation + volume_id: correct iso9660 high sierra header + warn if a PHYSEDV* key, the "device" link, or a parent attribute is used + don't print PHYSDEV* warnings for old WAIT_FOR_SYSFS rules + udevinfo: print error in --attribute-walk + udev_sysfs: unify symlink resolving + udevtrigger: trigger devices sorted by their dependency + fix spelling in deprecation warning + release 101 + +Michał Bartoszkiewicz: + udevtrigger: fix typo that prevents partition events + +Miles Lane: + clarify "specified user/group unknown" error + +Piter PUNK: + update slackware rules + +VMiklos: + update Frugalware rules + + Summary of changes from v099 to v100 ============================================ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/Makefile new/udev-102/Makefile --- old/udev-101/Makefile 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/Makefile 2006-10-10 17:07:35.000000000 +0200 @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 101 +VERSION = 102 # set this to make use of syslog USE_LOG = true diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/RELEASE-NOTES new/udev-102/RELEASE-NOTES --- old/udev-101/RELEASE-NOTES 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/RELEASE-NOTES 2006-10-10 17:07:35.000000000 +0200 @@ -1,3 +1,7 @@ +udev 102 +======== +Fix path_id for SAS devices. + udev 101 ======== The udev daemon can be started with --debug-trace now, which will diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/docs/writing_udev_rules/index.html new/udev-102/docs/writing_udev_rules/index.html --- old/udev-101/docs/writing_udev_rules/index.html 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/docs/writing_udev_rules/index.html 2006-10-10 17:07:35.000000000 +0200 @@ -16,7 +16,7 @@ <h1>Writing udev rules</h1> by Daniel Drake (dsd)<br /> -Version 0.7<br /><br /> +Version 0.72<br /><br /> The most recent version of this document can always be found at: <br /> @@ -112,6 +112,7 @@ <h3>History</h3> <ul> +<ul>October 2nd 2006 v0.72: Fixed a typo in one of the example rules.</li> <li>June 10th 2006 v0.71: Misc changes based on recent feedback - thanks!</li> <li>June 3rd 2006 v0.7: Complete rework, to be more suited for the modern-day udev.</li> <li>May 9th 2005 v0.6: Misc updates, including information about udevinfo, groups and permissions, logging, and udevtest.</li> @@ -671,7 +672,7 @@ My rule: </p> -<blockquote><pre>NAME=="sd?1", BUS=="scsi", SYSFS{model}=="X250,D560Z,C350Z", SYMLINK+="camera"</pre></blockquote> +<blockquote><pre>KERNEL=="sd?1", BUS=="scsi", SYSFS{model}=="X250,D560Z,C350Z", SYMLINK+="camera"</pre></blockquote> <a name="example-usbhdd"></a> <h3>USB Hard Disk</h3> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/etc/udev/rules.d/60-persistent-storage.rules new/udev-102/etc/udev/rules.d/60-persistent-storage.rules --- old/udev-101/etc/udev/rules.d/60-persistent-storage.rules 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/etc/udev/rules.d/60-persistent-storage.rules 2006-10-10 17:07:35.000000000 +0200 @@ -17,7 +17,7 @@ # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="hd*[0-9]", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/etc/udev/suse/50-udev-default.rules new/udev-102/etc/udev/suse/50-udev-default.rules --- old/udev-101/etc/udev/suse/50-udev-default.rules 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/etc/udev/suse/50-udev-default.rules 2006-10-10 17:07:35.000000000 +0200 @@ -62,7 +62,7 @@ KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" # network -KERNEL=="tun", NAME="net/%k", MODE="0600" +KERNEL=="tun", NAME="net/%k", MODE="0666" # misc devices KERNEL=="mem|kmem", GROUP="kmem", MODE="640" @@ -131,7 +131,7 @@ KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" # libusb device access -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" +SUBSYSTEM=="usb_device", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" # kernel firmware loader SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/etc/udev/suse/60-persistent-storage.rules new/udev-102/etc/udev/suse/60-persistent-storage.rules --- old/udev-101/etc/udev/suse/60-persistent-storage.rules 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/etc/udev/suse/60-persistent-storage.rules 2006-10-10 17:07:35.000000000 +0200 @@ -12,20 +12,22 @@ KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" # for partitions import parent information -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", IMPORT{parent}="ID_*" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="hd*[0-9]", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}-part%n" KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # by-path (shortest physical path) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/extras/path_id/path_id new/udev-102/extras/path_id/path_id --- old/udev-101/extras/path_id/path_id 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/extras/path_id/path_id 2006-10-10 17:07:35.000000000 +0200 @@ -278,15 +278,17 @@ local DEV=$1 local cil adapter controller_dev # SAS device - sas_host_path="${DEV%%/phy*}" + sas_host_path="${DEV%%/port*}" sas_phy_path="${DEV#*/host*/}" sas_phy_path="${sas_phy_path%%/target*}" sas_phy_id="${sas_phy_path%%/*}" - sas_rphy_id="${sas_phy_path##*/}" - sas_phy_dev="/sys/class/sas_phy/${sas_phy_id}" + sas_phy_id="${sas_phy_id##*port-}" + sas_port_id="${sas_phy_path%%/end_device*}" + sas_port_id="${sas_port_id##*port-}" + sas_end_id="${sas_phy_path##*end_device-}" + sas_phy_dev="/sys/class/sas_phy/phy-${sas_phy_id}" if [ -e "$sas_phy_dev/sas_address" ]; then read phy_address < $sas_phy_dev/sas_address - read phy_port < $sas_phy_dev/port_identifier read phy_id < $sas_phy_dev/phy_identifier fi if [ -z "$phy_address" ] ; then @@ -295,22 +297,32 @@ RESULT=1 return fi + sas_port_dev="/sys/class/sas_port/port-${sas_port_id}" + if [ -e "$sas_port_dev/num_phys" ] ; then + read phy_port < $sas_port_dev/num_phys + fi + if [ -z "$phy_port" ] ; then + : no initiator address + D= + RESULT=1 + return + fi sas_phy_address="$phy_address:$phy_port:$phy_id" - sas_rphy_dev="/sys/class/sas_device/${sas_rphy_id}" - if [ -e "$sas_rphy_dev/sas_address" ]; then - read rphy_address < $sas_rphy_dev/sas_address - read rphy_id < $sas_rphy_dev/phy_identifier + sas_end_dev="/sys/class/sas_device/end_device-${sas_end_id}" + if [ -e "$sas_end_dev/sas_address" ]; then + read end_address < $sas_end_dev/sas_address + read end_id < $sas_end_dev/phy_identifier fi - if [ -z "$rphy_address" ] ; then + if [ -z "$end_address" ] ; then : no initiator address D= RESULT=1 return fi - sas_rphy_address="$rphy_address:$rphy_id" + sas_end_address="$end_address:$end_id" controller_dev="${sas_host_path%/host[0-9]*}" # SAS devices are always endpoints - d="sas-${sas_phy_address}-${sas_rphy_address}" + d="sas-${sas_phy_address}-${sas_end_address}" D="$controller_dev" RESULT=0 } @@ -470,7 +482,7 @@ */rport-[0-9]*:[0-9]*-[0-9]*/*) handle_fc "$D" ;; - */phy-[0-9]*:[0-9]*/*) + */end_device-[0-9]*:[0-9]*:[0-9]*/*) handle_sas "$D" ;; */fw-host[0-9]*/*) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/extras/scsi_id/scsi_id.c new/udev-102/extras/scsi_id/scsi_id.c --- old/udev-101/extras/scsi_id/scsi_id.c 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/extras/scsi_id/scsi_id.c 2006-10-10 17:07:35.000000000 +0200 @@ -614,11 +614,12 @@ { int retval; int dev_type = 0; - char *serial, *unaligned_buf; struct sysfs_device *dev; struct sysfs_device *dev_scsi; int good_dev; int page_code; + char serial[MAX_SERIAL_LEN]; + char serial_short[MAX_SERIAL_LEN]; dbg("devpath %s\n", devpath); @@ -650,29 +651,25 @@ retval = per_dev_options(dev_scsi, &good_dev, &page_code); dbg("per dev options: good %d; page code 0x%x", good_dev, page_code); -#define ALIGN 512 - unaligned_buf = malloc(MAX_SERIAL_LEN + ALIGN); - serial = (char*) (((unsigned long) unaligned_buf + (ALIGN - 1)) - & ~(ALIGN - 1)); - dbg("buffer unaligned 0x%p; aligned 0x%p\n", unaligned_buf, serial); -#undef ALIGN - if (!good_dev) { retval = 1; } else if (scsi_get_serial(dev_scsi, maj_min_dev, page_code, - serial, MAX_SERIAL_LEN)) { + serial, serial_short, MAX_SERIAL_LEN)) { retval = always_info?0:1; } else { retval = 0; } if (!retval) { if (export) { - static char serial_str[64]; + char serial_str[MAX_SERIAL_LEN]; + printf("ID_VENDOR=%s\n", vendor_str); printf("ID_MODEL=%s\n", model_str); printf("ID_REVISION=%s\n", revision_str); set_str(serial_str, serial, sizeof(serial_str)); printf("ID_SERIAL=%s\n", serial_str); + set_str(serial_str, serial_short, sizeof(serial_str)); + printf("ID_SERIAL_SHORT=%s\n", serial_str); printf("ID_TYPE=%s\n", type_str); printf("ID_BUS=scsi\n"); } else { diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/extras/scsi_id/scsi_id.h new/udev-102/extras/scsi_id/scsi_id.h --- old/udev-101/extras/scsi_id/scsi_id.h 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/extras/scsi_id/scsi_id.h 2006-10-10 17:07:35.000000000 +0200 @@ -31,7 +31,7 @@ #define MAX_BUFFER_LEN 256 extern int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, - int page_code, char *serial, int len); + int page_code, char *serial, char *serial_short, int len); /* * Page code values. diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/extras/scsi_id/scsi_serial.c new/udev-102/extras/scsi_id/scsi_serial.c --- old/udev-101/extras/scsi_id/scsi_serial.c 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/extras/scsi_id/scsi_serial.c 2006-10-10 17:07:35.000000000 +0200 @@ -433,9 +433,9 @@ static int check_fill_0x83_id(struct sysfs_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values - *id_search, char *serial, int max_len) + *id_search, char *serial, char *serial_short, int max_len) { - int i, j, len; + int i, j, s, len; /* * ASSOCIATION must be with the device (value 0) @@ -469,7 +469,7 @@ */ len *= 2; - /* + /* * Add one byte for the NUL termination, and one for the id_type. */ len += 2; @@ -497,7 +497,7 @@ } i = 4; /* offset to the start of the identifier */ - j = strlen(serial); + s = j = strlen(serial); if ((page_83[0] & 0x0f) == SCSI_ID_ASCII) { /* * ASCII descriptor. @@ -515,6 +515,8 @@ i++; } } + + strcpy(serial_short, &serial[s]); return 0; } @@ -522,10 +524,11 @@ static int check_fill_0x83_prespc3(struct sysfs_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values - *id_search, char *serial, int max_len) + *id_search, char *serial, char *serial_short, int max_len) { int i, j; - + + dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel); serial[0] = hex_str[id_search->id_type]; /* serial has been memset to zero before */ j = strlen(serial); /* j = 1; */ @@ -534,14 +537,14 @@ serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; serial[j++] = hex_str[ page_83[4+i] & 0x0f]; } - dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel); + strcpy(serial_short, serial); return 0; } /* Get device identification VPD page */ static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, - char *serial, int len) + char *serial, char *serial_short, int len) { int retval; unsigned int id_ind, j; @@ -588,8 +591,8 @@ */ if (page_83[6] != 0) - return check_fill_0x83_prespc3(dev_scsi, page_83, - id_search_list, serial, len); + return check_fill_0x83_prespc3(dev_scsi, page_83, id_search_list, + serial, serial_short, len); /* * Search for a match in the prioritized id_search_list. @@ -604,7 +607,7 @@ for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) { retval = check_fill_0x83_id(dev_scsi, &page_83[j], &id_search_list[id_ind], - serial, len); + serial, serial_short, len); dbg("%s id desc %d/%d/%d\n", dev_scsi->kernel, id_search_list[id_ind].id_type, id_search_list[id_ind].naa_type, @@ -631,7 +634,7 @@ * conformant to the SCSI-2 format. */ static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *dev_scsi, int fd, - char *serial, int len) + char *serial, char *serial_short, int len) { int retval; int i, j; @@ -693,7 +696,7 @@ /* Get unit serial number VPD page */ static int do_scsi_page80_inquiry(struct sysfs_device *dev_scsi, int fd, - char *serial, int max_len) + char *serial, char *serial_short, int max_len) { int retval; int ser_ind; @@ -728,11 +731,12 @@ len = buf[3]; for (i = 4; i < len + 4; i++, ser_ind++) serial[ser_ind] = buf[i]; + memcpy(serial_short, &buf[4], len); return 0; } int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, - int page_code, char *serial, int len) + int page_code, char *serial, char *serial_short, int len) { unsigned char page0[SCSI_INQ_BUFF_LEN]; int fd; @@ -749,7 +753,7 @@ } if (page_code == PAGE_80) { - if (do_scsi_page80_inquiry(dev_scsi, fd, serial, len)) { + if (do_scsi_page80_inquiry(dev_scsi, fd, serial, serial_short, len)) { retval = 1; goto completed; } else { @@ -757,7 +761,7 @@ goto completed; } } else if (page_code == PAGE_83) { - if (do_scsi_page83_inquiry(dev_scsi, fd, serial, len)) { + if (do_scsi_page83_inquiry(dev_scsi, fd, serial, serial_short, len)) { retval = 1; goto completed; } else { @@ -765,7 +769,7 @@ goto completed; } } else if (page_code == PAGE_83_PRE_SPC3) { - retval = do_scsi_page83_prespc3_inquiry(dev_scsi, fd, serial, len); + retval = do_scsi_page83_prespc3_inquiry(dev_scsi, fd, serial, serial_short, len); if (retval) { /* * Fallback to servicing a SPC-2/3 compliant page 83 @@ -773,7 +777,7 @@ * conform to pre-SPC3 expectations. */ if (retval == 2) { - if (do_scsi_page83_inquiry(dev_scsi, fd, serial, len)) { + if (do_scsi_page83_inquiry(dev_scsi, fd, serial, serial_short, len)) { retval = 1; goto completed; } else { @@ -812,8 +816,8 @@ for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_83) - if (!do_scsi_page83_inquiry(dev_scsi, fd, serial, - len)) { + if (!do_scsi_page83_inquiry(dev_scsi, fd, + serial, serial_short, len)) { /* * Success */ @@ -823,8 +827,8 @@ for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_80) - if (!do_scsi_page80_inquiry(dev_scsi, fd, serial, - len)) { + if (!do_scsi_page80_inquiry(dev_scsi, fd, + serial, serial_short, len)) { /* * Success */ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/udev_sysfs.c new/udev-102/udev_sysfs.c --- old/udev-101/udev_sysfs.c 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/udev_sysfs.c 2006-10-10 17:07:35.000000000 +0200 @@ -197,8 +197,20 @@ sysfs_device_set_values(dev, devpath_real, NULL, NULL); - /* get subsystem */ - if (strncmp(dev->devpath, "/class/", 7) == 0) { + /* get subsystem name */ + strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcat(link_path, dev->devpath, sizeof(link_path)); + strlcat(link_path, "/subsystem", sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len > 0) { + /* get subsystem from "subsystem" link */ + link_target[len] = '\0'; + dbg("subsystem link '%s' points to '%s'", link_path, link_target); + pos = strrchr(link_target, '/'); + if (pos != NULL) + strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); + } else if (strncmp(dev->devpath, "/class/", 7) == 0) { + /* get subsystem from class dir */ strlcpy(dev->subsystem, &dev->devpath[7], sizeof(dev->subsystem)); pos = strchr(dev->subsystem, '/'); if (pos != NULL) @@ -219,38 +231,26 @@ pos = strrchr(link_target, '/'); if (pos != NULL) strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); - } else { - /* get subsystem from "subsystem" link */ - strlcpy(link_path, sysfs_path, sizeof(link_path)); - strlcat(link_path, dev->devpath, sizeof(link_path)); - strlcat(link_path, "/subsystem", sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len > 0) { - link_target[len] = '\0'; - dbg("subsystem link '%s' points to '%s'", link_path, link_target); - pos = strrchr(link_target, '/'); - if (pos != NULL) - strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); - } - } - /* get driver name */ - strlcpy(link_path, sysfs_path, sizeof(link_path)); - strlcat(link_path, dev->devpath, sizeof(link_path)); - strlcat(link_path, "/driver", sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len > 0) { - link_target[len] = '\0'; - dbg("driver link '%s' points to '%s'", link_path, link_target); - pos = strrchr(link_target, '/'); - if (pos != NULL) - strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); } - } else if (strncmp(dev->devpath, "/bus/", 5) == 0 && strstr(dev->devpath, "/drivers/")) { + } else if (strstr(dev->devpath, "/drivers/") != NULL) { strlcpy(dev->subsystem, "drivers", sizeof(dev->subsystem)); } else if (strncmp(dev->devpath, "/module/", 8) == 0) { strlcpy(dev->subsystem, "module", sizeof(dev->subsystem)); } + /* get driver name */ + strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcat(link_path, dev->devpath, sizeof(link_path)); + strlcat(link_path, "/driver", sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len > 0) { + link_target[len] = '\0'; + dbg("driver link '%s' points to '%s'", link_path, link_target); + pos = strrchr(link_target, '/'); + if (pos != NULL) + strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); + } + dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'", dev->devpath, dev->subsystem, dev->driver); list_add(&dev->node, &dev_list); @@ -270,6 +270,7 @@ /* requesting a parent is only valid for devices */ if ((strncmp(dev->devpath, "/devices/", 9) != 0) && + (strncmp(dev->devpath, "/subsystem/", 11) != 0) && (strncmp(dev->devpath, "/class/", 7) != 0) && (strncmp(dev->devpath, "/block/", 7) != 0)) return NULL; @@ -289,10 +290,13 @@ return NULL; } - /* at the top level of class/block we want to follow the "device" link */ - if (strcmp(parent_devpath, "/block") == 0) { - dbg("/block top level, look for device link"); - goto device_link; + /* at the subsystems top level we want to follow the old-style "device" link */ + if (strncmp(parent_devpath, "/subsystem", 10) == 0) { + pos = strrchr(parent_devpath, '/'); + if (pos == &parent_devpath[10] || pos == parent_devpath || strcmp(pos, "/devices") == 0) { + dbg("/subsystem top level, look for device link"); + goto device_link; + } } if (strncmp(parent_devpath, "/class", 6) == 0) { pos = strrchr(parent_devpath, '/'); @@ -301,6 +305,11 @@ goto device_link; } } + if (strcmp(parent_devpath, "/block") == 0) { + dbg("/block top level, look for device link"); + goto device_link; + } + /* get parent and remember it */ dev->parent = sysfs_device_get(parent_devpath); return dev->parent; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/udev-101/udevtrigger.c new/udev-102/udevtrigger.c --- old/udev-101/udevtrigger.c 2006-09-30 14:30:00.000000000 +0200 +++ new/udev-102/udevtrigger.c 2006-10-10 17:07:35.000000000 +0200 @@ -237,14 +237,15 @@ return 0; } -static void scan_bus(void) +static void scan_subsystem(const char *subsys) { char base[PATH_SIZE]; DIR *dir; struct dirent *dent; strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/bus", sizeof(base)); + strlcat(base, "/", sizeof(base)); + strlcat(base, subsys, sizeof(base)); dir = opendir(base); if (dir != NULL) { @@ -292,13 +293,6 @@ char base[PATH_SIZE]; DIR *dir; struct dirent *dent; - struct stat statbuf; - - /* skip if "block" is already a "class" */ - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/class/block", sizeof(base)); - if (stat(base, &statbuf) == 0) - return; if (subsystem_filtered("block")) return; @@ -506,9 +500,24 @@ if (failed) scan_failed(); else { - scan_bus(); - scan_class(); - scan_block(); + char base[PATH_SIZE]; + struct stat statbuf; + + /* if we have /sys/subsystem, forget all the old stuff */ + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/subsystem", sizeof(base)); + if (stat(base, &statbuf) == 0) + scan_subsystem("subsystem"); + else { + scan_subsystem("bus"); + scan_class(); + + /* scan "block" if it isn't a "class" */ + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/class/block", sizeof(base)); + if (stat(base, &statbuf) != 0) + scan_block(); + } } exec_list(); ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org