The patch titled revert "scsi: Improve inquiry printing" has been added to the -mm tree. Its filename is revert-scsi-improve-inquiry-printing.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: revert "scsi: Improve inquiry printing" From: Andrew Morton <akpm@xxxxxxxx> Breaks ydl-4.1 userspace tools (at least). Cc: Matthew Wilcox <willy@xxxxxxxxxx> Cc: James Bottomley <James.Bottomley@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/block/cciss_scsi.c | 14 ++++--- drivers/scsi/fcal.c | 3 + drivers/scsi/g_NCR5380.c | 3 + drivers/scsi/megaraid.c | 4 +- drivers/scsi/scsi.c | 36 +++++-------------- drivers/scsi/scsi_proc.c | 4 +- drivers/scsi/scsi_scan.c | 66 ++++++++++++++++++++++++++++++----- include/scsi/scsi.h | 10 +++-- 8 files changed, 94 insertions(+), 46 deletions(-) diff -puN drivers/block/cciss_scsi.c~revert-scsi-improve-inquiry-printing drivers/block/cciss_scsi.c --- a/drivers/block/cciss_scsi.c~revert-scsi-improve-inquiry-printing +++ a/drivers/block/cciss_scsi.c @@ -251,6 +251,10 @@ scsi_cmd_stack_free(int ctlr) stk->pool = NULL; } +/* scsi_device_types comes from scsi.h */ +#define DEVICETYPE(n) (n<0 || n>MAX_SCSI_DEVICE_CODE) ? \ + "Unknown" : scsi_device_types[n] + #if 0 static int xmargin=8; static int amargin=60; @@ -385,7 +389,7 @@ cciss_scsi_add_entry(int ctlr, int hostn time anyway (the scsi layer's inquiries will show that info) */ if (hostno != -1) printk("cciss%d: %s device c%db%dt%dl%d added.\n", - ctlr, scsi_device_type(sd->devtype), hostno, + ctlr, DEVICETYPE(sd->devtype), hostno, sd->bus, sd->target, sd->lun); return 0; } @@ -403,7 +407,7 @@ cciss_scsi_remove_entry(int ctlr, int ho ccissscsi[ctlr].dev[i] = ccissscsi[ctlr].dev[i+1]; ccissscsi[ctlr].ndevices--; printk("cciss%d: %s device c%db%dt%dl%d removed.\n", - ctlr, scsi_device_type(sd.devtype), hostno, + ctlr, DEVICETYPE(sd.devtype), hostno, sd.bus, sd.target, sd.lun); } @@ -454,7 +458,7 @@ adjust_cciss_scsi_table(int ctlr, int ho if (found == 0) { /* device no longer present. */ changes++; /* printk("cciss%d: %s device c%db%dt%dl%d removed.\n", - ctlr, scsi_device_type(csd->devtype), hostno, + ctlr, DEVICETYPE(csd->devtype), hostno, csd->bus, csd->target, csd->lun); */ cciss_scsi_remove_entry(ctlr, hostno, i); /* note, i not incremented */ @@ -464,7 +468,7 @@ adjust_cciss_scsi_table(int ctlr, int ho printk("cciss%d: device c%db%dt%dl%d type changed " "(device type now %s).\n", ctlr, hostno, csd->bus, csd->target, csd->lun, - scsi_device_type(csd->devtype)); + DEVICETYPE(csd->devtype)); csd->devtype = sd[j].devtype; i++; /* so just move along. */ } else /* device is same as it ever was, */ @@ -1094,7 +1098,7 @@ cciss_update_non_disk_devices(int cntl_n if (ncurrent >= CCISS_MAX_SCSI_DEVS_PER_HBA) { printk(KERN_INFO "cciss%d: %s ignored, " "too many devices.\n", cntl_num, - scsi_device_type(devtype)); + DEVICETYPE(devtype)); break; } memcpy(¤tsd[ncurrent].scsi3addr[0], diff -puN drivers/scsi/fcal.c~revert-scsi-improve-inquiry-printing drivers/scsi/fcal.c --- a/drivers/scsi/fcal.c~revert-scsi-improve-inquiry-printing +++ a/drivers/scsi/fcal.c @@ -248,7 +248,8 @@ int fcal_proc_info (struct Scsi_Host *ho if (scd->id == target) { SPRINTF (" [AL-PA: %02x, Id: %02d, Port WWN: %08x%08x, Node WWN: %08x%08x] ", alpa, target, u1[0], u1[1], u2[0], u2[1]); - SPRINTF ("%s ", scsi_device_type(scd->type)); + SPRINTF ("%s ", (scd->type < MAX_SCSI_DEVICE_CODE) ? + scsi_device_types[(short) scd->type] : "Unknown device"); for (j = 0; (j < 8) && (scd->vendor[j] >= 0x20); j++) SPRINTF ("%c", scd->vendor[j]); diff -puN drivers/scsi/g_NCR5380.c~revert-scsi-improve-inquiry-printing drivers/scsi/g_NCR5380.c --- a/drivers/scsi/g_NCR5380.c~revert-scsi-improve-inquiry-printing +++ a/drivers/scsi/g_NCR5380.c @@ -811,6 +811,7 @@ static int generic_NCR5380_proc_info(str struct NCR5380_hostdata *hostdata; #ifdef NCR5380_STATS struct scsi_device *dev; + extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE]; #endif NCR5380_setup(scsi_ptr); @@ -850,7 +851,7 @@ static int generic_NCR5380_proc_info(str long tr = hostdata->time_read[dev->id] / HZ; long tw = hostdata->time_write[dev->id] / HZ; - PRINTP(" T:%d %s " ANDP dev->id ANDP scsi_device_type(dev->type)); + PRINTP(" T:%d %s " ANDP dev->id ANDP(dev->type < MAX_SCSI_DEVICE_CODE) ? scsi_device_types[(int) dev->type] : "Unknown"); for (i = 0; i < 8; i++) if (dev->vendor[i] >= 0x20) *(buffer + (len++)) = dev->vendor[i]; diff -puN drivers/scsi/megaraid.c~revert-scsi-improve-inquiry-printing drivers/scsi/megaraid.c --- a/drivers/scsi/megaraid.c~revert-scsi-improve-inquiry-printing +++ a/drivers/scsi/megaraid.c @@ -2822,7 +2822,9 @@ mega_print_inquiry(char *page, char *scs i = scsi_inq[0] & 0x1f; - len += sprintf(page+len, " Type: %s ", scsi_device_type(i)); + len += sprintf(page+len, " Type: %s ", + i < MAX_SCSI_DEVICE_CODE ? scsi_device_types[i] : + "Unknown "); len += sprintf(page+len, " ANSI SCSI revision: %02x", scsi_inq[2] & 0x07); diff -puN drivers/scsi/scsi.c~revert-scsi-improve-inquiry-printing drivers/scsi/scsi.c --- a/drivers/scsi/scsi.c~revert-scsi-improve-inquiry-printing +++ a/drivers/scsi/scsi.c @@ -96,40 +96,24 @@ unsigned int scsi_logging_level; EXPORT_SYMBOL(scsi_logging_level); #endif -static const char *const scsi_device_types[] = { - "Direct access ", - "Sequential access", +const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] = { + "Direct-Access ", + "Sequential-Access", "Printer ", "Processor ", "WORM ", - "CD/DVD ", + "CD-ROM ", "Scanner ", - "Optical memory ", - "Media changer ", + "Optical Device ", + "Medium Changer ", "Communications ", - "ASC IT8 ", - "ASC IT8 ", + "Unknown ", + "Unknown ", "RAID ", "Enclosure ", - "Direct access RBC", - "Optical card ", - "Bridge controller", - "Object storage ", - "Automation/Drive ", + "Direct-Access-RBC", }; - -const char * scsi_device_type(unsigned type) -{ - if (type == 0x1e) - return "Well-known LUN "; - if (type == 0x1f) - return "No Device "; - if (type > ARRAY_SIZE(scsi_device_types)) - return "Unknown "; - return scsi_device_types[type]; -} - -EXPORT_SYMBOL(scsi_device_type); +EXPORT_SYMBOL(scsi_device_types); struct scsi_host_cmd_pool { kmem_cache_t *slab; diff -puN drivers/scsi/scsi_proc.c~revert-scsi-improve-inquiry-printing drivers/scsi/scsi_proc.c --- a/drivers/scsi/scsi_proc.c~revert-scsi-improve-inquiry-printing +++ a/drivers/scsi/scsi_proc.c @@ -178,7 +178,9 @@ static int proc_print_scsidevice(struct seq_printf(s, "\n"); - seq_printf(s, " Type: %s ", scsi_device_type(sdev->type)); + seq_printf(s, " Type: %s ", + sdev->type < MAX_SCSI_DEVICE_CODE ? + scsi_device_types[(int) sdev->type] : "Unknown "); seq_printf(s, " ANSI" " SCSI revision: %02x", (sdev->scsi_level - 1) ? sdev->scsi_level - 1 : 1); diff -puN drivers/scsi/scsi_scan.c~revert-scsi-improve-inquiry-printing drivers/scsi/scsi_scan.c --- a/drivers/scsi/scsi_scan.c~revert-scsi-improve-inquiry-printing +++ a/drivers/scsi/scsi_scan.c @@ -134,6 +134,59 @@ static void scsi_unlock_floptical(struct } /** + * print_inquiry - printk the inquiry information + * @inq_result: printk this SCSI INQUIRY + * + * Description: + * printk the vendor, model, and other information found in the + * INQUIRY data in @inq_result. + * + * Notes: + * Remove this, and replace with a hotplug event that logs any + * relevant information. + **/ +static void print_inquiry(unsigned char *inq_result) +{ + int i; + + printk(KERN_NOTICE " Vendor: "); + for (i = 8; i < 16; i++) + if (inq_result[i] >= 0x20 && i < inq_result[4] + 5) + printk("%c", inq_result[i]); + else + printk(" "); + + printk(" Model: "); + for (i = 16; i < 32; i++) + if (inq_result[i] >= 0x20 && i < inq_result[4] + 5) + printk("%c", inq_result[i]); + else + printk(" "); + + printk(" Rev: "); + for (i = 32; i < 36; i++) + if (inq_result[i] >= 0x20 && i < inq_result[4] + 5) + printk("%c", inq_result[i]); + else + printk(" "); + + printk("\n"); + + i = inq_result[0] & 0x1f; + + printk(KERN_NOTICE " Type: %s ", + i < + MAX_SCSI_DEVICE_CODE ? scsi_device_types[i] : + "Unknown "); + printk(" ANSI SCSI revision: %02x", + inq_result[2] & 0x07); + if ((inq_result[2] & 0x07) == 1 && (inq_result[3] & 0x0f) == 1) + printk(" CCS\n"); + else + printk("\n"); +} + +/** * scsi_alloc_sdev - allocate and setup a scsi_Device * * Description: @@ -600,8 +653,9 @@ static int scsi_add_lun(struct scsi_devi if (*bflags & BLIST_ISROM) { /* * It would be better to modify sdev->type, and set - * sdev->removable; this can now be done since - * print_inquiry has gone away. + * sdev->removable, but then the print_inquiry() output + * would not show TYPE_ROM; if print_inquiry() is removed + * the issue goes away. */ inq_result[0] = TYPE_ROM; inq_result[1] |= 0x80; /* removable */ @@ -630,6 +684,8 @@ static int scsi_add_lun(struct scsi_devi printk(KERN_INFO "scsi: unknown device type %d\n", sdev->type); } + print_inquiry(inq_result); + /* * For a peripheral qualifier (PQ) value of 1 (001b), the SCSI * spec says: The device server is capable of supporting the @@ -659,12 +715,6 @@ static int scsi_add_lun(struct scsi_devi if (inq_result[7] & 0x10) sdev->sdtr = 1; - sdev_printk(KERN_NOTICE, sdev, "%s %.8s %.16s %.4s PQ: %d " - "ANSI: %d%s\n", scsi_device_type(sdev->type), - sdev->vendor, sdev->model, sdev->rev, - sdev->inq_periph_qual, inq_result[2] & 0x07, - (inq_result[3] & 0x0f) == 1 ? " CCS" : ""); - /* * End sysfs code. */ diff -puN include/scsi/scsi.h~revert-scsi-improve-inquiry-printing include/scsi/scsi.h --- a/include/scsi/scsi.h~revert-scsi-improve-inquiry-printing +++ a/include/scsi/scsi.h @@ -25,6 +25,13 @@ extern const unsigned char scsi_command_ #define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7] /* + * SCSI device types + */ + +#define MAX_SCSI_DEVICE_CODE 15 +extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE]; + +/* * Special value for scanning to specify scanning or rescanning of all * possible channels, (target) ids, or luns on a given shost. */ @@ -218,9 +225,6 @@ static inline int scsi_status_is_good(in #define TYPE_RBC 0x0e #define TYPE_NO_LUN 0x7f -/* Returns a human-readable name for the device */ -extern const char * scsi_device_type(unsigned type); - /* * standard mode-select header prepended to all mode-select commands */ _ Patches currently in -mm which might be from akpm@xxxxxxxx are oops-on-boot-fix-for-ide.patch adfs-error-message-fix.patch fix-x86_64-mm-allow-users-to-force-a-panic-on-nmi.patch workqueue-remove-lock_cpu_hotplug.patch fuse-fix-error-case-in-fuse_readpages.patch revert-input-wistron-fix-section-reference-mismatches.patch lockdep-fix-blkdev_open-warning-fix.patch git-acpi.patch acpi-asus-s3-resume-fix.patch sony_apci-resume.patch kauditd_thread-warning-fix.patch revert-gregkh-driver-class_device_rename-remove.patch revert-gregkh-driver-network-class_device-to-device.patch revert-gregkh-driver-tty-device.patch revert-gregkh-driver-mem-devices.patch add-__must_check-to-device-management-code.patch add-config_enable_must_check.patch v4l-dev2-handle-__must_check.patch drivers-base-check-errors.patch sysfs-add-proper-sysfs_init-prototype.patch scsi-device_reprobe-can-fail.patch git-drm.patch drm-build-fix.patch git-dvb.patch git-gfs2.patch git-ia64.patch git-ieee1394-fixup.patch git-input.patch git-kbuild.patch git-libata-all.patch asus-mv-device-ids.patch 1-of-2-jmicron-driver-hard_port_no-fix.patch git-netdev-all.patch 82596-section-fixes.patch ac3200-section-fixes.patch cops-section-fix.patch cs89x0-section-fix.patch at1700-section-fix.patch e2100-section-fix.patch eepro-section-fix.patch eexpress-section-fix.patch es3210-section-fix.patch eth16i-section-fix.patch lance-section-fix.patch lne390-section-fix.patch ni52-section-fix.patch ibmtr-section-fix.patch smctr-section-fix.patch wd-section-fix.patch ni65-section-fix.patch seeq8005-section-fix.patch winbond-840-section-fix.patch fealnx-section-fix.patch sundance-section-fix.patch s2io-build-fix.patch drivers-net-ns83820c-add-paramter-to-disable-auto.patch git-net.patch ppp-handle-kmalloc-failures.patch xt_physdev-build-fix.patch git-nfs.patch git-pcmcia-fixup.patch git-powerpc.patch git-sas.patch git-block-vs-git-sas.patch tickle-nmi-watchdog-on-serial-output-fix.patch serial-fix-uart_bug_txen-test.patch revert-gregkh-pci-pci-use-pci_bios-as-last-fallback.patch pcie-check-and-return-bus_register-errors-fix.patch git-scsi-misc.patch revert-scsi-improve-inquiry-printing.patch fix-panic-when-reinserting-adaptec-pcmcia-scsi-card.patch git-scsi-target-fixup.patch git-scsi-target-vs-git-block.patch usb-hub-driver-improve-use-of-ifdef-fix.patch pm-usb-hcds-use-pm_event_prethaw-fix.patch rtl8150_disconnect-needs-tasklet_kill.patch git-supertrak-fixup.patch git-watchdog.patch kthread-airoc.patch revert-x86_64-mm-i386-remove-lock-section.patch revert-x86_64-mm-detect-cfi.patch x86_64-wire-up-oops_enter-oops_exit.patch git-cryptodev.patch git-cryptodev-broke-geode-aes.patch git-cryptodev-padlock-generic-build-fix.patch adix-tree-rcu-lockless-readside-update-tidy.patch mm-tracking-shared-dirty-pages-checks.patch mm-tracking-shared-dirty-pages-wimp.patch convert-i386-numa-kva-space-to-bootmem-tidy.patch reduce-max_nr_zones-make-display-of-highmem-counters-conditional-on-config_highmem-tidy.patch reduce-max_nr_zones-use-enum-to-define-zones-reformat-and-comment-cleanup.patch reduce-max_nr_zones-use-enum-to-define-zones-reformat-and-comment-fix.patch reduce-max_nr_zones-remove-display-of-counters-for-unconfigured-zones-s390-fix.patch out-of-memory-notifier-tidy.patch mm-swap-write-failure-fixup-fix.patch slab-optimize-kmalloc_node-the-same-way-as-kmalloc-fix.patch slab-fix-lockdep-warnings-fix-2.patch acx1xx-wireless-driver.patch tiacx-pci-build-fix.patch tiacx-ia64-fix.patch tiacx-build-fix.patch binfmt_elf-consistently-use-loff_t.patch convert-i386-summit-subarch-to-use-srat-info-for-apicid_to_node-calls-tidy.patch x86-increase-max_mp_busses-on-default-arch.patch add-force-of-use-mmconfig.patch add-efi-e820-memory-mapping-on-x86.patch i386-adds-smp_call_function_single-fix.patch swsusp-write-timer.patch swsusp-write-speedup.patch swsusp-read-timer.patch swsusp-read-speedup.patch swsusp-read-speedup-fix.patch swsusp-read-speedup-cleanup.patch swsusp-read-speedup-cleanup-2.patch swsusp-read-speedup-fix-fix-2.patch deprecate-smbfs-in-favour-of-cifs.patch edac-new-opteron-athlon64-memory-controller-driver-tidy.patch inode_diet-replace-inodeugeneric_ip-with-inodei_private-gfs-fix.patch x86-microcode-microcode-driver-cleanup-tidy.patch x86-microcode-add-sysfs-and-hotplug-support-fix.patch eisa-bus-modalias-attributes-support-1-fix-git-kbuild-fix.patch add-address_space_operationsbatch_write-fix.patch alloc_fdtable-cleanup.patch add-probe_kernel_address.patch x86-use-probe_kernel_address-in-handle_bug.patch blockdevc-check-errors.patch let-warn_on-warn_on_once-return-the-condition-fix.patch let-warn_on-warn_on_once-return-the-condition-fix-2.patch omap-add-watchdog-driver-support-tweaks.patch move-valid_dma_direction-from-x86_64-to-generic-code-fix.patch single-bit-flip-detector-tidy.patch fix-unserialized-task-files-changing-fix.patch tty-make-termios_sem-a-mutex-fix.patch ntp-move-all-the-ntp-related-code-to-ntpc-fix.patch reiserfs-on-demand-bitmap-loading.patch streamline-generic_file_-interfaces-and-filemap-gfs-fix.patch add-vector-aio-support-fix.patch csa-basic-accounting-over-taskstats-fix.patch fs-cache-make-kafs-use-fs-cache-fix.patch fs-cache-make-kafs-use-fs-cache-vs-streamline-generic_file_-interfaces-and-filemap.patch nfs-use-local-caching-12-fix.patch stack-overflow-safe-kdump-crash_use_safe_smp_processor_id-fix.patch some-cleanup-in-the-pipe-code-tidy.patch move-pidmap-to-pspaceh-fix.patch isdn-work-around-excessive-udelay.patch knfsd-add-a-callback-for-when-last-rpc-thread-finishes-tidy.patch knfsd-add-a-callback-for-when-last-rpc-thread-finishes-fix.patch knfsd-separate-out-some-parts-of-nfsd_svc-which-start-nfs-servers-tweaks.patch knfsd-define-new-nfsdfs-file-portlist-contains-list-of-ports-tidy.patch knfsd-define-new-nfsdfs-file-portlist-contains-list-of-ports-fix.patch knfsd-have-ext2-reject-file-handles-with-bad-inode-numbers-early-tidy.patch knfsd-make-ext3-reject-filehandles-referring-to-invalid-inode-numbers-tidy.patch knfsd-drop-serv-option-to-svc_recv-and-svc_process-nfs-callback-fix-nfs-callback-fix.patch knfsd-move-tempsock-aging-to-a-timer-tidy.patch sched-remove-unnecessary-sched-group-allocations-fix.patch swap_prefetch-vs-zoned-counters.patch ecryptfs-mmap-operations.patch ecryptfs-alpha-build-fix.patch ecryptfs-more-elegant-aes-key-size-manipulation.patch ecryptfs-get_sb_dev-fix.patch namespaces-add-nsproxy-dont-include-compileh.patch namespaces-utsname-switch-to-using-uts-namespaces.patch namespaces-utsname-use-init_utsname-when-appropriate.patch namespaces-utsname-use-init_utsname-when-appropriate-gmidi.patch namespaces-utsname-use-init_utsname-when-appropriate-print_kernel_version.patch namespaces-utsname-implement-utsname-namespaces.patch namespaces-utsname-sysctl-hack.patch namespaces-utsname-switch-to-using-uts-namespaces-klibc-bit-sparc.patch ipc-namespace-core.patch readahead-sysctl-parameters-fix.patch make-copy_from_user_inatomic-not-zero-the-tail-on-i386-vs-reiser4.patch reiser4-hardirq-include-fix.patch reiser4-run-truncate_inode_pages-in-reiser4_delete_inode.patch reiser4-get_sb_dev-fix.patch reiser4-vs-zoned-allocator.patch reiser4-rename-generic_sounding_globalspatch-fix.patch hpt3xx-rework-rate-filtering-tidy.patch asus-mv-ide-device-ids.patch genirq-convert-the-i386-architecture-to-irq-chips.patch genirq-x86_64-irq-reenable-migrating-irqs-to-other-cpus.patch genirq-msi-simplify-msi-enable-and-disable.patch genirq-ia64-irq-dynamic-irq-support.patch genirq-msi-only-build-msi-apicc-on-ia64-fix.patch genirq-i386-irq-remove-the-msi-assumption-that-irq-==-vector.patch genirq-x86_64-irq-make-vector_irq-per-cpu-fix.patch genirq-x86_64-irq-make-vector_irq-per-cpu-warning-fix.patch add-hypertransport-capability-defines-fix.patch initial-generic-hypertransport-interrupt-support-Kconfig-fix.patch srcu-report-out-of-memory-errors-fixlet.patch nr_blockdev_pages-in_interrupt-warning.patch device-suspend-debug.patch slab-leaks3-default-y.patch x86-kmap_atomic-debugging.patch restore-rogue-readahead-printk.patch input_register_device-debug.patch put_bh-debug.patch jmicron-warning-fix.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html