License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 21:07:57 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#include <linux/blkdev.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/moduleparam.h>
|
|
|
|
#include <linux/proc_fs.h>
|
|
|
|
#include <linux/seq_file.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 15:04:11 +07:00
|
|
|
#include <linux/slab.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#include <scsi/scsi_device.h>
|
|
|
|
#include <scsi/scsi_devinfo.h>
|
|
|
|
|
|
|
|
#include "scsi_priv.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* scsi_dev_info_list: structure to hold black/white listed devices.
|
|
|
|
*/
|
|
|
|
struct scsi_dev_info_list {
|
|
|
|
struct list_head dev_info_list;
|
|
|
|
char vendor[8];
|
|
|
|
char model[16];
|
2017-11-15 18:07:30 +07:00
|
|
|
blist_flags_t flags;
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned compatible; /* for use with scsi_static_device_list entries */
|
|
|
|
};
|
|
|
|
|
2009-06-18 02:01:58 +07:00
|
|
|
struct scsi_dev_info_list_table {
|
|
|
|
struct list_head node; /* our node for being on the master list */
|
|
|
|
struct list_head scsi_dev_info_list; /* head of dev info list */
|
|
|
|
const char *name; /* name of list for /proc (NULL for global) */
|
|
|
|
int key; /* unique numeric identifier */
|
|
|
|
};
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
static const char spaces[] = " "; /* 16 of them */
|
2017-11-15 18:07:30 +07:00
|
|
|
static blist_flags_t scsi_default_dev_flags;
|
2005-04-17 05:20:36 +07:00
|
|
|
static LIST_HEAD(scsi_dev_info_list);
|
|
|
|
static char scsi_dev_flags[256];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* scsi_static_device_list: deprecated list of devices that require
|
|
|
|
* settings that differ from the default, includes black-listed (broken)
|
|
|
|
* devices. The entries here are added to the tail of scsi_dev_info_list
|
|
|
|
* via scsi_dev_info_list_init.
|
|
|
|
*
|
|
|
|
* Do not add to this list, use the command line or proc interface to add
|
|
|
|
* to the scsi_dev_info_list. This table will eventually go away.
|
|
|
|
*/
|
|
|
|
static struct {
|
|
|
|
char *vendor;
|
|
|
|
char *model;
|
|
|
|
char *revision; /* revision known to be bad, unused */
|
2017-11-15 18:07:30 +07:00
|
|
|
blist_flags_t flags;
|
2005-04-17 05:20:36 +07:00
|
|
|
} scsi_static_device_list[] __initdata = {
|
|
|
|
/*
|
|
|
|
* The following devices are known not to tolerate a lun != 0 scan
|
|
|
|
* for one reason or another. Some will respond to all luns,
|
|
|
|
* others will lock up.
|
|
|
|
*/
|
|
|
|
{"Aashima", "IMAGERY 2400SP", "1.03", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"CHINON", "CD-ROM CDS-431", "H42", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"CHINON", "CD-ROM CDS-535", "Q14", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"DENON", "DRD-25X", "V", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"HITACHI", "DK312C", "CM81", BLIST_NOLUN}, /* responds to all lun */
|
|
|
|
{"HITACHI", "DK314C", "CR21", BLIST_NOLUN}, /* responds to all lun */
|
2006-04-27 01:48:11 +07:00
|
|
|
{"IBM", "2104-DU3", NULL, BLIST_NOLUN}, /* locks up */
|
|
|
|
{"IBM", "2104-TU3", NULL, BLIST_NOLUN}, /* locks up */
|
2005-04-17 05:20:36 +07:00
|
|
|
{"IMS", "CDD521/10", "2.06", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"MAXTOR", "XT-3280", "PR02", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"MAXTOR", "XT-4380S", "B3C", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"MAXTOR", "MXT-1240S", "I1.2", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"MAXTOR", "XT-4170S", "B5A", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"MAXTOR", "XT-8760S", "B7B", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"MEDIAVIS", "RENO CD-ROMX2A", "2.03", BLIST_NOLUN}, /* responds to all lun */
|
|
|
|
{"MICROTEK", "ScanMakerIII", "2.30", BLIST_NOLUN}, /* responds to all lun */
|
|
|
|
{"NEC", "CD-ROM DRIVE:841", "1.0", BLIST_NOLUN},/* locks up */
|
|
|
|
{"PHILIPS", "PCA80SC", "V4-2", BLIST_NOLUN}, /* responds to all lun */
|
|
|
|
{"RODIME", "RO3000S", "2.33", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"SUN", "SENA", NULL, BLIST_NOLUN}, /* responds to all luns */
|
|
|
|
/*
|
|
|
|
* The following causes a failed REQUEST SENSE on lun 1 for
|
|
|
|
* aha152x controller, which causes SCSI code to reset bus.
|
|
|
|
*/
|
|
|
|
{"SANYO", "CRD-250S", "1.20", BLIST_NOLUN},
|
|
|
|
/*
|
|
|
|
* The following causes a failed REQUEST SENSE on lun 1 for
|
|
|
|
* aha152x controller, which causes SCSI code to reset bus.
|
|
|
|
*/
|
|
|
|
{"SEAGATE", "ST157N", "\004|j", BLIST_NOLUN},
|
|
|
|
{"SEAGATE", "ST296", "921", BLIST_NOLUN}, /* responds to all lun */
|
|
|
|
{"SEAGATE", "ST1581", "6538", BLIST_NOLUN}, /* responds to all lun */
|
|
|
|
{"SONY", "CD-ROM CDU-541", "4.3d", BLIST_NOLUN},
|
|
|
|
{"SONY", "CD-ROM CDU-55S", "1.0i", BLIST_NOLUN},
|
|
|
|
{"SONY", "CD-ROM CDU-561", "1.7x", BLIST_NOLUN},
|
|
|
|
{"SONY", "CD-ROM CDU-8012", NULL, BLIST_NOLUN},
|
|
|
|
{"SONY", "SDT-5000", "3.17", BLIST_SELECT_NO_ATN},
|
|
|
|
{"TANDBERG", "TDC 3600", "U07", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"TEAC", "CD-R55S", "1.0H", BLIST_NOLUN}, /* locks up */
|
|
|
|
/*
|
|
|
|
* The following causes a failed REQUEST SENSE on lun 1 for
|
|
|
|
* seagate controller, which causes SCSI code to reset bus.
|
|
|
|
*/
|
|
|
|
{"TEAC", "CD-ROM", "1.06", BLIST_NOLUN},
|
|
|
|
{"TEAC", "MT-2ST/45S2-27", "RV M", BLIST_NOLUN}, /* responds to all lun */
|
|
|
|
/*
|
|
|
|
* The following causes a failed REQUEST SENSE on lun 1 for
|
|
|
|
* seagate controller, which causes SCSI code to reset bus.
|
|
|
|
*/
|
|
|
|
{"HP", "C1750A", "3226", BLIST_NOLUN}, /* scanjet iic */
|
|
|
|
{"HP", "C1790A", "", BLIST_NOLUN}, /* scanjet iip */
|
|
|
|
{"HP", "C2500A", "", BLIST_NOLUN}, /* scanjet iicx */
|
|
|
|
{"MEDIAVIS", "CDR-H93MV", "1.31", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"MICROTEK", "ScanMaker II", "5.61", BLIST_NOLUN}, /* responds to all lun */
|
|
|
|
{"MITSUMI", "CD-R CR-2201CS", "6119", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"NEC", "D3856", "0009", BLIST_NOLUN},
|
|
|
|
{"QUANTUM", "LPS525S", "3110", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"QUANTUM", "PD1225S", "3110", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"QUANTUM", "FIREBALL ST4.3S", "0F0C", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"RELISYS", "Scorpio", NULL, BLIST_NOLUN}, /* responds to all lun */
|
|
|
|
{"SANKYO", "CP525", "6.64", BLIST_NOLUN}, /* causes failed REQ SENSE, extra reset */
|
|
|
|
{"TEXEL", "CD-ROM", "1.06", BLIST_NOLUN},
|
2005-09-12 21:15:14 +07:00
|
|
|
{"transtec", "T5008", "0001", BLIST_NOREPORTLUN },
|
2005-04-17 05:20:36 +07:00
|
|
|
{"YAMAHA", "CDR100", "1.00", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"YAMAHA", "CDR102", "1.00", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"YAMAHA", "CRW8424S", "1.0", BLIST_NOLUN}, /* locks up */
|
|
|
|
{"YAMAHA", "CRW6416S", "1.0c", BLIST_NOLUN}, /* locks up */
|
2005-08-09 06:01:43 +07:00
|
|
|
{"", "Scanner", "1.80", BLIST_NOLUN}, /* responds to all lun */
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Other types of devices that have special flags.
|
|
|
|
* Note that all USB devices should have the BLIST_INQUIRY_36 flag.
|
|
|
|
*/
|
|
|
|
{"3PARdata", "VV", NULL, BLIST_REPORTLUN2},
|
|
|
|
{"ADAPTEC", "AACRAID", NULL, BLIST_FORCELUN},
|
|
|
|
{"ADAPTEC", "Adaptec 5400S", NULL, BLIST_FORCELUN},
|
2017-10-17 14:10:26 +07:00
|
|
|
{"AIX", "VDASD", NULL, BLIST_TRY_VPD_PAGES},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"AFT PRO", "-IX CF", "0.0>", BLIST_FORCELUN},
|
|
|
|
{"BELKIN", "USB 2 HS-CF", "1.95", BLIST_FORCELUN | BLIST_INQUIRY_36},
|
2007-07-05 21:57:50 +07:00
|
|
|
{"BROWNIE", "1200U3P", NULL, BLIST_NOREPORTLUN},
|
2006-03-02 02:04:46 +07:00
|
|
|
{"BROWNIE", "1600U3P", NULL, BLIST_NOREPORTLUN},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"CANON", "IPUBJD", NULL, BLIST_SPARSELUN},
|
|
|
|
{"CBOX3", "USB Storage-SMC", "300A", BLIST_FORCELUN | BLIST_INQUIRY_36},
|
|
|
|
{"CMD", "CRA-7280", NULL, BLIST_SPARSELUN}, /* CMD RAID Controller */
|
|
|
|
{"CNSI", "G7324", NULL, BLIST_SPARSELUN}, /* Chaparral G7324 RAID */
|
|
|
|
{"CNSi", "G8324", NULL, BLIST_SPARSELUN}, /* Chaparral G8324 RAID */
|
2006-04-01 09:07:45 +07:00
|
|
|
{"COMPAQ", "ARRAY CONTROLLER", NULL, BLIST_SPARSELUN | BLIST_LARGELUN |
|
|
|
|
BLIST_MAX_512 | BLIST_REPORTLUN2}, /* Compaq RA4x00 */
|
|
|
|
{"COMPAQ", "LOGICAL VOLUME", NULL, BLIST_FORCELUN | BLIST_MAX_512}, /* Compaq RA4x00 */
|
2005-04-17 05:20:36 +07:00
|
|
|
{"COMPAQ", "CR3500", NULL, BLIST_FORCELUN},
|
|
|
|
{"COMPAQ", "MSA1000", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD},
|
|
|
|
{"COMPAQ", "MSA1000 VOLUME", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD},
|
|
|
|
{"COMPAQ", "HSV110", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD},
|
|
|
|
{"DDN", "SAN DataDirector", "*", BLIST_SPARSELUN},
|
2005-08-10 00:57:11 +07:00
|
|
|
{"DEC", "HSG80", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"DELL", "PV660F", NULL, BLIST_SPARSELUN},
|
|
|
|
{"DELL", "PV660F PSEUDO", NULL, BLIST_SPARSELUN},
|
|
|
|
{"DELL", "PSEUDO DEVICE .", NULL, BLIST_SPARSELUN}, /* Dell PV 530F */
|
|
|
|
{"DELL", "PV530F", NULL, BLIST_SPARSELUN},
|
|
|
|
{"DELL", "PERCRAID", NULL, BLIST_FORCELUN},
|
|
|
|
{"DGC", "RAID", NULL, BLIST_SPARSELUN}, /* Dell PV 650F, storage on LUN 0 */
|
|
|
|
{"DGC", "DISK", NULL, BLIST_SPARSELUN}, /* Dell PV 650F, no storage on LUN 0 */
|
2006-10-01 07:42:28 +07:00
|
|
|
{"EMC", "Invista", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
2017-10-17 14:10:45 +07:00
|
|
|
{"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN | BLIST_REPORTLUN2},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"EMULEX", "MD21/S2 ESDI", NULL, BLIST_SINGLELUN},
|
2007-07-28 03:30:02 +07:00
|
|
|
{"easyRAID", "16P", NULL, BLIST_NOREPORTLUN},
|
|
|
|
{"easyRAID", "X6P", NULL, BLIST_NOREPORTLUN},
|
|
|
|
{"easyRAID", "F8", NULL, BLIST_NOREPORTLUN},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"FSC", "CentricStor", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"Generic", "USB SD Reader", "1.00", BLIST_FORCELUN | BLIST_INQUIRY_36},
|
|
|
|
{"Generic", "USB Storage-SMC", "0180", BLIST_FORCELUN | BLIST_INQUIRY_36},
|
|
|
|
{"Generic", "USB Storage-SMC", "0207", BLIST_FORCELUN | BLIST_INQUIRY_36},
|
2009-11-11 04:22:19 +07:00
|
|
|
{"HITACHI", "DF400", "*", BLIST_REPORTLUN2},
|
|
|
|
{"HITACHI", "DF500", "*", BLIST_REPORTLUN2},
|
|
|
|
{"HITACHI", "DISK-SUBSYSTEM", "*", BLIST_REPORTLUN2},
|
2012-08-29 01:29:35 +07:00
|
|
|
{"HITACHI", "HUS1530", "*", BLIST_NO_DIF},
|
2017-10-17 14:10:33 +07:00
|
|
|
{"HITACHI", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES},
|
2006-10-01 07:42:31 +07:00
|
|
|
{"HITACHI", "OP-C-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"HITACHI", "3380-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"HITACHI", "3390-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"HITACHI", "6586-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"HITACHI", "6588-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"HP", "A6189A", NULL, BLIST_SPARSELUN | BLIST_LARGELUN}, /* HP VA7400 */
|
2006-06-22 14:19:51 +07:00
|
|
|
{"HP", "OPEN-", "*", BLIST_REPORTLUN2}, /* HP XP Arrays */
|
2005-04-17 05:20:36 +07:00
|
|
|
{"HP", "NetRAID-4M", NULL, BLIST_FORCELUN},
|
|
|
|
{"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD},
|
|
|
|
{"HP", "C1557A", NULL, BLIST_FORCELUN},
|
|
|
|
{"HP", "C3323-300", "4269", BLIST_NOTQ},
|
2006-05-16 11:38:29 +07:00
|
|
|
{"HP", "C5713A", NULL, BLIST_NOREPORTLUN},
|
2006-10-01 07:42:31 +07:00
|
|
|
{"HP", "DF400", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"HP", "DF500", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"HP", "DF600", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"HP", "OP-C-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"HP", "3380-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"HP", "3390-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"HP", "6586-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"HP", "6588-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN},
|
|
|
|
{"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"IBM", "2105", NULL, BLIST_RETRY_HWERROR},
|
|
|
|
{"iomega", "jaz 1GB", "J.86", BLIST_NOTQ | BLIST_NOLUN},
|
2011-06-09 12:24:24 +07:00
|
|
|
{"IOMEGA", "ZIP", NULL, BLIST_NOTQ | BLIST_NOLUN},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"IOMEGA", "Io20S *F", NULL, BLIST_KEY},
|
|
|
|
{"INSITE", "Floptical F*8I", NULL, BLIST_KEY},
|
|
|
|
{"INSITE", "I325VM", NULL, BLIST_KEY},
|
2014-11-19 02:23:32 +07:00
|
|
|
{"Intel", "Multi-Flex", NULL, BLIST_NO_RSOC},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36},
|
|
|
|
{"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN},
|
2016-01-27 21:19:13 +07:00
|
|
|
{"Marvell", "Console", NULL, BLIST_SKIP_VPD_PAGES},
|
2016-02-10 09:02:07 +07:00
|
|
|
{"Marvell", "91xx Config", "1.01", BLIST_SKIP_VPD_PAGES},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
|
|
|
|
{"MATSHITA", "DMC-LC5", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36},
|
|
|
|
{"MATSHITA", "DMC-LC40", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36},
|
|
|
|
{"Medion", "Flash XL MMC/SD", "2.6D", BLIST_FORCELUN},
|
|
|
|
{"MegaRAID", "LD", NULL, BLIST_FORCELUN},
|
|
|
|
{"MICROP", "4110", NULL, BLIST_NOTQ},
|
2014-12-04 09:18:10 +07:00
|
|
|
{"MSFT", "Virtual HD", NULL, BLIST_NO_RSOC},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"MYLEX", "DACARMRB", "*", BLIST_REPORTLUN2},
|
|
|
|
{"nCipher", "Fastness Crypto", NULL, BLIST_FORCELUN},
|
|
|
|
{"NAKAMICH", "MJ-4.8S", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
|
|
|
|
{"NAKAMICH", "MJ-5.16S", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
|
|
|
|
{"NEC", "PD-1 ODX654P", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
|
2006-10-01 07:42:30 +07:00
|
|
|
{"NEC", "iStorage", NULL, BLIST_REPORTLUN2},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"NRC", "MBR-7", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
|
|
|
|
{"NRC", "MBR-7.4", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
|
|
|
|
{"PIONEER", "CD-ROM DRM-600", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
|
|
|
|
{"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
|
|
|
|
{"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
|
2005-10-17 15:05:42 +07:00
|
|
|
{"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
|
2014-07-24 20:48:46 +07:00
|
|
|
{"Promise", "VTrak E610f", NULL, BLIST_SPARSELUN | BLIST_NO_RSOC},
|
2007-05-10 11:50:33 +07:00
|
|
|
{"Promise", "", NULL, BLIST_SPARSELUN},
|
2016-05-31 20:42:29 +07:00
|
|
|
{"QEMU", "QEMU CD-ROM", NULL, BLIST_SKIP_VPD_PAGES},
|
2015-04-21 10:42:24 +07:00
|
|
|
{"QNAP", "iSCSI Storage", NULL, BLIST_MAX_1024},
|
2016-01-08 05:34:05 +07:00
|
|
|
{"SYNOLOGY", "iSCSI Storage", NULL, BLIST_MAX_1024},
|
2007-07-26 22:39:46 +07:00
|
|
|
{"QUANTUM", "XP34301", "1071", BLIST_NOTQ},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN},
|
|
|
|
{"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN},
|
|
|
|
{"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */
|
|
|
|
{"SEAGATE", "ST3390N", "9546", BLIST_NOTQ},
|
2013-04-25 08:19:47 +07:00
|
|
|
{"SEAGATE", "ST900MM0006", NULL, BLIST_SKIP_VPD_PAGES},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"SGI", "RAID3", "*", BLIST_SPARSELUN},
|
|
|
|
{"SGI", "RAID5", "*", BLIST_SPARSELUN},
|
|
|
|
{"SGI", "TP9100", "*", BLIST_REPORTLUN2},
|
|
|
|
{"SGI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
|
2005-09-06 15:08:14 +07:00
|
|
|
{"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
|
[SCSI] Add SUN Universal Xport to no attach blacklist
I was using a Sun ST2510 device (iSCSI) and a special "block device"
appeared which is used by SUN Common Array Manager in-band management.
However it also appeared as a block device and caused some IO error:
[ 716.868000] scsi 15:0:0:31: Direct-Access SUN Universal Xport 0735 PQ: 0 ANSI: 5
[ 716.868000] qla4xxx 0000:04:01.1: scsi(15:0:0:31): Enabled tagged queuing, queue depth 32.
[ 716.868000] sd 15:0:0:31: [sdf] 40960 512-byte hardware sectors (21 MB)
[ 716.868000] sd 15:0:0:31: [sdf] Write Protect is off
[ 716.868000] sd 15:0:0:31: [sdf] Mode Sense: 77 00 10 08
[ 716.868000] sd 15:0:0:31: [sdf] Write cache: disabled, read cache: enabled, supports DPO and FUA
[ 716.868000] sd 15:0:0:31: [sdf] 40960 512-byte hardware sectors (21 MB)
[ 716.868000] sd 15:0:0:31: [sdf] Write Protect is off
[ 716.868000] sd 15:0:0:31: [sdf] Mode Sense: 77 00 10 08
[ 716.872000] sd 15:0:0:31: [sdf] Write cache: disabled, read cache: enabled, supports DPO and FUA
[ 716.872000] sdf: unknown partition table
[ 716.932000] sd 15:0:0:31: [sdf] Attached SCSI disk
[ 716.932000] sd 15:0:0:31: Attached scsi generic sg6 type 0
[ 717.412000] end_request: I/O error, dev sdf, sector 40
[ 717.412000] Buffer I/O error on device sdf, logical block 5
[ 717.412000] Buffer I/O error on device sdf, logical block 6
[ 717.412000] Buffer I/O error on device sdf, logical block 7
[ 717.412000] Buffer I/O error on device sdf, logical block 8
[ 717.412000] Buffer I/O error on device sdf, logical block 9
[ 717.412000] Buffer I/O error on device sdf, logical block 10
[ 717.412000] Buffer I/O error on device sdf, logical block 11
[ 717.412000] Buffer I/O error on device sdf, logical block 12
[ 717.412000] Buffer I/O error on device sdf, logical block 13
[ 717.412000] Buffer I/O error on device sdf, logical block 14
After some googling it appeared that similar issue has been solved for
SGI/IBM devices in 4869040512082b761de2d7c35975d01044f8bfea, so here is
the patch for SUN, please apply.
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-01-12 21:45:52 +07:00
|
|
|
{"SUN", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
|
2009-06-13 21:21:43 +07:00
|
|
|
{"DELL", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
|
2016-08-13 05:56:03 +07:00
|
|
|
{"STK", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
|
|
|
|
{"NETAPP", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
|
|
|
|
{"LSI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
|
|
|
|
{"ENGENIO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36},
|
|
|
|
{"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN},
|
|
|
|
{"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */
|
|
|
|
{"ST650211", "CF", NULL, BLIST_RETRY_HWERROR},
|
|
|
|
{"SUN", "T300", "*", BLIST_SPARSELUN},
|
|
|
|
{"SUN", "T4", "*", BLIST_SPARSELUN},
|
|
|
|
{"TEXEL", "CD-ROM", "1.06", BLIST_BORKEN},
|
2006-10-01 07:42:29 +07:00
|
|
|
{"Tornado-", "F4", "*", BLIST_NOREPORTLUN},
|
2005-04-17 05:20:36 +07:00
|
|
|
{"TOSHIBA", "CDROM", NULL, BLIST_ISROM},
|
|
|
|
{"TOSHIBA", "CD-ROM", NULL, BLIST_ISROM},
|
2011-06-09 12:24:24 +07:00
|
|
|
{"Traxdata", "CDR4120", NULL, BLIST_NOLUN}, /* locks up */
|
2005-04-17 05:20:36 +07:00
|
|
|
{"USB2.0", "SMARTMEDIA/XD", NULL, BLIST_FORCELUN | BLIST_INQUIRY_36},
|
|
|
|
{"WangDAT", "Model 2600", "01.7", BLIST_SELECT_NO_ATN},
|
|
|
|
{"WangDAT", "Model 3200", "02.2", BLIST_SELECT_NO_ATN},
|
|
|
|
{"WangDAT", "Model 1300", "02.4", BLIST_SELECT_NO_ATN},
|
|
|
|
{"WDC WD25", "00JB-00FUA0", NULL, BLIST_NOREPORTLUN},
|
|
|
|
{"XYRATEX", "RS", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
|
|
|
{"Zzyzx", "RocketStor 500S", NULL, BLIST_SPARSELUN},
|
|
|
|
{"Zzyzx", "RocketStor 2000", NULL, BLIST_SPARSELUN},
|
|
|
|
{ NULL, NULL, NULL, 0 },
|
|
|
|
};
|
|
|
|
|
2009-06-18 02:01:58 +07:00
|
|
|
static struct scsi_dev_info_list_table *scsi_devinfo_lookup_by_key(int key)
|
|
|
|
{
|
|
|
|
struct scsi_dev_info_list_table *devinfo_table;
|
|
|
|
int found = 0;
|
|
|
|
|
|
|
|
list_for_each_entry(devinfo_table, &scsi_dev_info_list, node)
|
|
|
|
if (devinfo_table->key == key) {
|
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!found)
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
|
|
|
|
return devinfo_table;
|
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* scsi_strcpy_devinfo: called from scsi_dev_info_list_add to copy into
|
|
|
|
* devinfo vendor and model strings.
|
|
|
|
*/
|
|
|
|
static void scsi_strcpy_devinfo(char *name, char *to, size_t to_length,
|
|
|
|
char *from, int compatible)
|
|
|
|
{
|
|
|
|
size_t from_length;
|
|
|
|
|
|
|
|
from_length = strlen(from);
|
|
|
|
strncpy(to, from, min(to_length, from_length));
|
|
|
|
if (from_length < to_length) {
|
|
|
|
if (compatible) {
|
|
|
|
/*
|
|
|
|
* NUL terminate the string if it is short.
|
|
|
|
*/
|
|
|
|
to[from_length] = '\0';
|
|
|
|
} else {
|
2017-10-02 21:26:36 +07:00
|
|
|
/*
|
|
|
|
* space pad the string if it is short.
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
|
|
|
strncpy(&to[from_length], spaces,
|
|
|
|
to_length - from_length);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (from_length > to_length)
|
|
|
|
printk(KERN_WARNING "%s: %s string '%s' is too long\n",
|
2008-07-04 13:47:27 +07:00
|
|
|
__func__, name, from);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-11-04 01:30:39 +07:00
|
|
|
* scsi_dev_info_list_add - add one dev_info list entry.
|
|
|
|
* @compatible: if true, null terminate short strings. Otherwise space pad.
|
2005-04-17 05:20:36 +07:00
|
|
|
* @vendor: vendor string
|
|
|
|
* @model: model (product) string
|
|
|
|
* @strflags: integer string
|
2007-11-04 01:30:39 +07:00
|
|
|
* @flags: if strflags NULL, use this flag value
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* Description:
|
2017-10-02 21:26:36 +07:00
|
|
|
* Create and add one dev_info entry for @vendor, @model, @strflags or
|
|
|
|
* @flag. If @compatible, add to the tail of the list, do not space
|
|
|
|
* pad, and set devinfo->compatible. The scsi_static_device_list entries
|
|
|
|
* are added with @compatible 1 and @clfags NULL.
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* Returns: 0 OK, -error on failure.
|
|
|
|
**/
|
|
|
|
static int scsi_dev_info_list_add(int compatible, char *vendor, char *model,
|
2017-11-15 18:07:30 +07:00
|
|
|
char *strflags, blist_flags_t flags)
|
2009-06-18 02:01:58 +07:00
|
|
|
{
|
|
|
|
return scsi_dev_info_list_add_keyed(compatible, vendor, model,
|
|
|
|
strflags, flags,
|
|
|
|
SCSI_DEVINFO_GLOBAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* scsi_dev_info_list_add_keyed - add one dev_info list entry.
|
|
|
|
* @compatible: if true, null terminate short strings. Otherwise space pad.
|
|
|
|
* @vendor: vendor string
|
|
|
|
* @model: model (product) string
|
|
|
|
* @strflags: integer string
|
|
|
|
* @flags: if strflags NULL, use this flag value
|
|
|
|
* @key: specify list to use
|
|
|
|
*
|
|
|
|
* Description:
|
2017-10-02 21:26:36 +07:00
|
|
|
* Create and add one dev_info entry for @vendor, @model,
|
|
|
|
* @strflags or @flag in list specified by @key. If @compatible,
|
|
|
|
* add to the tail of the list, do not space pad, and set
|
|
|
|
* devinfo->compatible. The scsi_static_device_list entries are
|
|
|
|
* added with @compatible 1 and @clfags NULL.
|
2009-06-18 02:01:58 +07:00
|
|
|
*
|
|
|
|
* Returns: 0 OK, -error on failure.
|
|
|
|
**/
|
|
|
|
int scsi_dev_info_list_add_keyed(int compatible, char *vendor, char *model,
|
2017-12-05 01:36:33 +07:00
|
|
|
char *strflags, blist_flags_t flags,
|
|
|
|
enum scsi_devinfo_key key)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
struct scsi_dev_info_list *devinfo;
|
2009-06-18 02:01:58 +07:00
|
|
|
struct scsi_dev_info_list_table *devinfo_table =
|
|
|
|
scsi_devinfo_lookup_by_key(key);
|
|
|
|
|
|
|
|
if (IS_ERR(devinfo_table))
|
|
|
|
return PTR_ERR(devinfo_table);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
devinfo = kmalloc(sizeof(*devinfo), GFP_KERNEL);
|
|
|
|
if (!devinfo) {
|
2008-07-04 13:47:27 +07:00
|
|
|
printk(KERN_ERR "%s: no memory\n", __func__);
|
2005-04-17 05:20:36 +07:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
scsi_strcpy_devinfo("vendor", devinfo->vendor, sizeof(devinfo->vendor),
|
|
|
|
vendor, compatible);
|
|
|
|
scsi_strcpy_devinfo("model", devinfo->model, sizeof(devinfo->model),
|
|
|
|
model, compatible);
|
|
|
|
|
|
|
|
if (strflags)
|
|
|
|
devinfo->flags = simple_strtoul(strflags, NULL, 0);
|
|
|
|
else
|
|
|
|
devinfo->flags = flags;
|
|
|
|
|
|
|
|
devinfo->compatible = compatible;
|
|
|
|
|
|
|
|
if (compatible)
|
2009-06-18 02:01:58 +07:00
|
|
|
list_add_tail(&devinfo->dev_info_list,
|
|
|
|
&devinfo_table->scsi_dev_info_list);
|
2005-04-17 05:20:36 +07:00
|
|
|
else
|
2009-06-18 02:01:58 +07:00
|
|
|
list_add(&devinfo->dev_info_list,
|
|
|
|
&devinfo_table->scsi_dev_info_list);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2009-06-18 02:01:58 +07:00
|
|
|
EXPORT_SYMBOL(scsi_dev_info_list_add_keyed);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2011-01-07 03:31:29 +07:00
|
|
|
/**
|
2015-08-03 22:57:21 +07:00
|
|
|
* scsi_dev_info_list_find - find a matching dev_info list entry.
|
2017-10-02 21:26:37 +07:00
|
|
|
* @vendor: full vendor string
|
|
|
|
* @model: full model (product) string
|
2011-01-07 03:31:29 +07:00
|
|
|
* @key: specify list to use
|
|
|
|
*
|
|
|
|
* Description:
|
2015-08-03 22:57:21 +07:00
|
|
|
* Finds the first dev_info entry matching @vendor, @model
|
2017-10-02 21:26:36 +07:00
|
|
|
* in list specified by @key.
|
2011-01-07 03:31:29 +07:00
|
|
|
*
|
2015-08-03 22:57:21 +07:00
|
|
|
* Returns: pointer to matching entry, or ERR_PTR on failure.
|
2011-01-07 03:31:29 +07:00
|
|
|
**/
|
2015-08-03 22:57:21 +07:00
|
|
|
static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
|
2017-12-05 01:36:33 +07:00
|
|
|
const char *model, enum scsi_devinfo_key key)
|
2011-01-07 03:31:29 +07:00
|
|
|
{
|
2015-08-03 22:57:21 +07:00
|
|
|
struct scsi_dev_info_list *devinfo;
|
2011-01-07 03:31:29 +07:00
|
|
|
struct scsi_dev_info_list_table *devinfo_table =
|
|
|
|
scsi_devinfo_lookup_by_key(key);
|
2017-10-02 21:26:37 +07:00
|
|
|
size_t vmax, mmax, mlen;
|
SCSI: fix bug in scsi_dev_info_list matching
The "compatible" matching algorithm used for looking up old-style
blacklist entries in a scsi_dev_info_list is buggy. The core of the
algorithm looks like this:
if (memcmp(devinfo->vendor, vendor,
min(max, strlen(devinfo->vendor))))
/* not a match */
where max is the length of the device's vendor string after leading
spaces have been removed but trailing spaces have not. Because of the
min() computation, either entry could be a proper substring of the
other and the code would still think that they match.
In the case originally reported, the device's vendor and product
strings were "Inateck " and " ". These matched against
the following entry in the global device list:
{"", "Scanner", "1.80", BLIST_NOLUN}
because "" is a substring of "Inateck " and "" (the result of removing
leading spaces from the device's product string) is a substring of
"Scanner". The mistaken match prevented the system from scanning and
finding the device's second Logical Unit.
This patch fixes the problem by making two changes. First, the code
for leading-space removal is hoisted out of the loop. (This means it
will sometimes run unnecessarily, but since a large percentage of all
lookups involve the "compatible" entries in global device list, this
should be an overall improvement.) Second and more importantly, the
patch removes trailing spaces and adds a check to verify that the two
resulting strings are exactly the same length. This prevents matches
where one entry is a proper substring of the other.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Giulio Bernardi <ugilio@gmail.com>
Tested-by: Giulio Bernardi <ugilio@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-08-03 22:57:29 +07:00
|
|
|
const char *vskip, *mskip;
|
2011-01-07 03:31:29 +07:00
|
|
|
|
|
|
|
if (IS_ERR(devinfo_table))
|
2015-08-03 22:57:21 +07:00
|
|
|
return (struct scsi_dev_info_list *) devinfo_table;
|
2011-01-07 03:31:29 +07:00
|
|
|
|
SCSI: fix bug in scsi_dev_info_list matching
The "compatible" matching algorithm used for looking up old-style
blacklist entries in a scsi_dev_info_list is buggy. The core of the
algorithm looks like this:
if (memcmp(devinfo->vendor, vendor,
min(max, strlen(devinfo->vendor))))
/* not a match */
where max is the length of the device's vendor string after leading
spaces have been removed but trailing spaces have not. Because of the
min() computation, either entry could be a proper substring of the
other and the code would still think that they match.
In the case originally reported, the device's vendor and product
strings were "Inateck " and " ". These matched against
the following entry in the global device list:
{"", "Scanner", "1.80", BLIST_NOLUN}
because "" is a substring of "Inateck " and "" (the result of removing
leading spaces from the device's product string) is a substring of
"Scanner". The mistaken match prevented the system from scanning and
finding the device's second Logical Unit.
This patch fixes the problem by making two changes. First, the code
for leading-space removal is hoisted out of the loop. (This means it
will sometimes run unnecessarily, but since a large percentage of all
lookups involve the "compatible" entries in global device list, this
should be an overall improvement.) Second and more importantly, the
patch removes trailing spaces and adds a check to verify that the two
resulting strings are exactly the same length. This prevents matches
where one entry is a proper substring of the other.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Giulio Bernardi <ugilio@gmail.com>
Tested-by: Giulio Bernardi <ugilio@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-08-03 22:57:29 +07:00
|
|
|
/* Prepare for "compatible" matches */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX why skip leading spaces? If an odd INQUIRY
|
|
|
|
* value, that should have been part of the
|
|
|
|
* scsi_static_device_list[] entry, such as " FOO"
|
|
|
|
* rather than "FOO". Since this code is already
|
|
|
|
* here, and we don't know what device it is
|
|
|
|
* trying to work with, leave it as-is.
|
|
|
|
*/
|
2016-06-24 02:05:26 +07:00
|
|
|
vmax = sizeof(devinfo->vendor);
|
SCSI: fix bug in scsi_dev_info_list matching
The "compatible" matching algorithm used for looking up old-style
blacklist entries in a scsi_dev_info_list is buggy. The core of the
algorithm looks like this:
if (memcmp(devinfo->vendor, vendor,
min(max, strlen(devinfo->vendor))))
/* not a match */
where max is the length of the device's vendor string after leading
spaces have been removed but trailing spaces have not. Because of the
min() computation, either entry could be a proper substring of the
other and the code would still think that they match.
In the case originally reported, the device's vendor and product
strings were "Inateck " and " ". These matched against
the following entry in the global device list:
{"", "Scanner", "1.80", BLIST_NOLUN}
because "" is a substring of "Inateck " and "" (the result of removing
leading spaces from the device's product string) is a substring of
"Scanner". The mistaken match prevented the system from scanning and
finding the device's second Logical Unit.
This patch fixes the problem by making two changes. First, the code
for leading-space removal is hoisted out of the loop. (This means it
will sometimes run unnecessarily, but since a large percentage of all
lookups involve the "compatible" entries in global device list, this
should be an overall improvement.) Second and more importantly, the
patch removes trailing spaces and adds a check to verify that the two
resulting strings are exactly the same length. This prevents matches
where one entry is a proper substring of the other.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Giulio Bernardi <ugilio@gmail.com>
Tested-by: Giulio Bernardi <ugilio@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-08-03 22:57:29 +07:00
|
|
|
vskip = vendor;
|
|
|
|
while (vmax > 0 && *vskip == ' ') {
|
|
|
|
vmax--;
|
|
|
|
vskip++;
|
|
|
|
}
|
|
|
|
/* Also skip trailing spaces */
|
|
|
|
while (vmax > 0 && vskip[vmax - 1] == ' ')
|
|
|
|
--vmax;
|
|
|
|
|
2016-06-24 02:05:26 +07:00
|
|
|
mmax = sizeof(devinfo->model);
|
SCSI: fix bug in scsi_dev_info_list matching
The "compatible" matching algorithm used for looking up old-style
blacklist entries in a scsi_dev_info_list is buggy. The core of the
algorithm looks like this:
if (memcmp(devinfo->vendor, vendor,
min(max, strlen(devinfo->vendor))))
/* not a match */
where max is the length of the device's vendor string after leading
spaces have been removed but trailing spaces have not. Because of the
min() computation, either entry could be a proper substring of the
other and the code would still think that they match.
In the case originally reported, the device's vendor and product
strings were "Inateck " and " ". These matched against
the following entry in the global device list:
{"", "Scanner", "1.80", BLIST_NOLUN}
because "" is a substring of "Inateck " and "" (the result of removing
leading spaces from the device's product string) is a substring of
"Scanner". The mistaken match prevented the system from scanning and
finding the device's second Logical Unit.
This patch fixes the problem by making two changes. First, the code
for leading-space removal is hoisted out of the loop. (This means it
will sometimes run unnecessarily, but since a large percentage of all
lookups involve the "compatible" entries in global device list, this
should be an overall improvement.) Second and more importantly, the
patch removes trailing spaces and adds a check to verify that the two
resulting strings are exactly the same length. This prevents matches
where one entry is a proper substring of the other.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Giulio Bernardi <ugilio@gmail.com>
Tested-by: Giulio Bernardi <ugilio@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-08-03 22:57:29 +07:00
|
|
|
mskip = model;
|
|
|
|
while (mmax > 0 && *mskip == ' ') {
|
|
|
|
mmax--;
|
|
|
|
mskip++;
|
|
|
|
}
|
|
|
|
while (mmax > 0 && mskip[mmax - 1] == ' ')
|
|
|
|
--mmax;
|
|
|
|
|
2011-01-07 03:31:29 +07:00
|
|
|
list_for_each_entry(devinfo, &devinfo_table->scsi_dev_info_list,
|
|
|
|
dev_info_list) {
|
|
|
|
if (devinfo->compatible) {
|
|
|
|
/*
|
2017-10-02 21:26:37 +07:00
|
|
|
* vendor strings must be an exact match
|
2011-01-07 03:31:29 +07:00
|
|
|
*/
|
2017-10-02 21:26:37 +07:00
|
|
|
if (vmax != strlen(devinfo->vendor) ||
|
|
|
|
memcmp(devinfo->vendor, vskip, vmax))
|
2011-01-07 03:31:29 +07:00
|
|
|
continue;
|
2017-10-02 21:26:37 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @model specifies the full string, and
|
|
|
|
* must be larger or equal to devinfo->model
|
|
|
|
*/
|
|
|
|
mlen = strlen(devinfo->model);
|
|
|
|
if (mmax < mlen || memcmp(devinfo->model, mskip, mlen))
|
2011-01-07 03:31:29 +07:00
|
|
|
continue;
|
2015-08-03 22:57:21 +07:00
|
|
|
return devinfo;
|
2011-01-07 03:31:29 +07:00
|
|
|
} else {
|
|
|
|
if (!memcmp(devinfo->vendor, vendor,
|
2017-10-02 21:26:36 +07:00
|
|
|
sizeof(devinfo->vendor)) &&
|
|
|
|
!memcmp(devinfo->model, model,
|
|
|
|
sizeof(devinfo->model)))
|
2015-08-03 22:57:21 +07:00
|
|
|
return devinfo;
|
2011-01-07 03:31:29 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-03 22:57:21 +07:00
|
|
|
return ERR_PTR(-ENOENT);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* scsi_dev_info_list_del_keyed - remove one dev_info list entry.
|
|
|
|
* @vendor: vendor string
|
|
|
|
* @model: model (product) string
|
|
|
|
* @key: specify list to use
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Remove and destroy one dev_info entry for @vendor, @model
|
|
|
|
* in list specified by @key.
|
|
|
|
*
|
|
|
|
* Returns: 0 OK, -error on failure.
|
|
|
|
**/
|
2017-12-05 01:36:33 +07:00
|
|
|
int scsi_dev_info_list_del_keyed(char *vendor, char *model,
|
|
|
|
enum scsi_devinfo_key key)
|
2015-08-03 22:57:21 +07:00
|
|
|
{
|
|
|
|
struct scsi_dev_info_list *found;
|
2011-01-07 03:31:29 +07:00
|
|
|
|
2015-08-03 22:57:21 +07:00
|
|
|
found = scsi_dev_info_list_find(vendor, model, key);
|
|
|
|
if (IS_ERR(found))
|
|
|
|
return PTR_ERR(found);
|
|
|
|
|
|
|
|
list_del(&found->dev_info_list);
|
|
|
|
kfree(found);
|
|
|
|
return 0;
|
2011-01-07 03:31:29 +07:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(scsi_dev_info_list_del_keyed);
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/**
|
2007-11-04 01:30:39 +07:00
|
|
|
* scsi_dev_info_list_add_str - parse dev_list and add to the scsi_dev_info_list.
|
2005-04-17 05:20:36 +07:00
|
|
|
* @dev_list: string of device flags to add
|
|
|
|
*
|
|
|
|
* Description:
|
2017-10-02 21:26:36 +07:00
|
|
|
* Parse dev_list, and add entries to the scsi_dev_info_list.
|
|
|
|
* dev_list is of the form "vendor:product:flag,vendor:product:flag".
|
|
|
|
* dev_list is modified via strsep. Can be called for command line
|
|
|
|
* addition, for proc or mabye a sysfs interface.
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* Returns: 0 if OK, -error on failure.
|
|
|
|
**/
|
|
|
|
static int scsi_dev_info_list_add_str(char *dev_list)
|
|
|
|
{
|
|
|
|
char *vendor, *model, *strflags, *next;
|
|
|
|
char *next_check;
|
|
|
|
int res = 0;
|
|
|
|
|
|
|
|
next = dev_list;
|
|
|
|
if (next && next[0] == '"') {
|
|
|
|
/*
|
|
|
|
* Ignore both the leading and trailing quote.
|
|
|
|
*/
|
|
|
|
next++;
|
|
|
|
next_check = ",\"";
|
|
|
|
} else {
|
|
|
|
next_check = ",";
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For the leading and trailing '"' case, the for loop comes
|
|
|
|
* through the last time with vendor[0] == '\0'.
|
|
|
|
*/
|
|
|
|
for (vendor = strsep(&next, ":"); vendor && (vendor[0] != '\0')
|
|
|
|
&& (res == 0); vendor = strsep(&next, ":")) {
|
|
|
|
strflags = NULL;
|
|
|
|
model = strsep(&next, ":");
|
|
|
|
if (model)
|
|
|
|
strflags = strsep(&next, next_check);
|
|
|
|
if (!model || !strflags) {
|
|
|
|
printk(KERN_ERR "%s: bad dev info string '%s' '%s'"
|
2008-07-04 13:47:27 +07:00
|
|
|
" '%s'\n", __func__, vendor, model,
|
2005-04-17 05:20:36 +07:00
|
|
|
strflags);
|
|
|
|
res = -EINVAL;
|
|
|
|
} else
|
|
|
|
res = scsi_dev_info_list_add(0 /* compatible */, vendor,
|
|
|
|
model, strflags, 0);
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-11-04 01:30:39 +07:00
|
|
|
* get_device_flags - get device specific flags from the dynamic device list.
|
|
|
|
* @sdev: &scsi_device to get flags for
|
2005-04-17 05:20:36 +07:00
|
|
|
* @vendor: vendor name
|
|
|
|
* @model: model name
|
|
|
|
*
|
|
|
|
* Description:
|
2009-06-18 02:01:58 +07:00
|
|
|
* Search the global scsi_dev_info_list (specified by list zero)
|
|
|
|
* for an entry matching @vendor and @model, if found, return the
|
|
|
|
* matching flags value, else return the host or global default
|
|
|
|
* settings. Called during scan time.
|
2005-04-17 05:20:36 +07:00
|
|
|
**/
|
2017-11-15 18:07:30 +07:00
|
|
|
blist_flags_t scsi_get_device_flags(struct scsi_device *sdev,
|
|
|
|
const unsigned char *vendor,
|
|
|
|
const unsigned char *model)
|
2009-06-18 02:01:58 +07:00
|
|
|
{
|
|
|
|
return scsi_get_device_flags_keyed(sdev, vendor, model,
|
|
|
|
SCSI_DEVINFO_GLOBAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-11-18 05:53:20 +07:00
|
|
|
* scsi_get_device_flags_keyed - get device specific flags from the dynamic device list
|
2009-06-18 02:01:58 +07:00
|
|
|
* @sdev: &scsi_device to get flags for
|
|
|
|
* @vendor: vendor name
|
|
|
|
* @model: model name
|
|
|
|
* @key: list to look up
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Search the scsi_dev_info_list specified by @key for an entry
|
|
|
|
* matching @vendor and @model, if found, return the matching
|
|
|
|
* flags value, else return the host or global default settings.
|
|
|
|
* Called during scan time.
|
|
|
|
**/
|
2017-11-15 18:07:30 +07:00
|
|
|
blist_flags_t scsi_get_device_flags_keyed(struct scsi_device *sdev,
|
2009-06-18 02:01:58 +07:00
|
|
|
const unsigned char *vendor,
|
|
|
|
const unsigned char *model,
|
2017-12-05 01:36:33 +07:00
|
|
|
enum scsi_devinfo_key key)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
struct scsi_dev_info_list *devinfo;
|
2009-06-18 02:01:58 +07:00
|
|
|
|
2015-08-03 22:57:21 +07:00
|
|
|
devinfo = scsi_dev_info_list_find(vendor, model, key);
|
|
|
|
if (!IS_ERR(devinfo))
|
|
|
|
return devinfo->flags;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2017-12-05 01:36:31 +07:00
|
|
|
/* key or device not found: return nothing */
|
2009-06-18 02:01:58 +07:00
|
|
|
if (key != SCSI_DEVINFO_GLOBAL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* except for the global list, where we have an exception */
|
|
|
|
if (sdev->sdev_bflags)
|
|
|
|
return sdev->sdev_bflags;
|
|
|
|
|
|
|
|
return scsi_default_dev_flags;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
2009-06-18 02:01:58 +07:00
|
|
|
EXPORT_SYMBOL(scsi_get_device_flags_keyed);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#ifdef CONFIG_SCSI_PROC_FS
|
2009-06-18 02:01:58 +07:00
|
|
|
struct double_list {
|
|
|
|
struct list_head *top;
|
|
|
|
struct list_head *bottom;
|
|
|
|
};
|
|
|
|
|
2008-04-29 15:01:55 +07:00
|
|
|
static int devinfo_seq_show(struct seq_file *m, void *v)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2009-06-18 02:01:58 +07:00
|
|
|
struct double_list *dl = v;
|
|
|
|
struct scsi_dev_info_list_table *devinfo_table =
|
|
|
|
list_entry(dl->top, struct scsi_dev_info_list_table, node);
|
2008-04-29 15:01:55 +07:00
|
|
|
struct scsi_dev_info_list *devinfo =
|
2009-06-18 02:01:58 +07:00
|
|
|
list_entry(dl->bottom, struct scsi_dev_info_list,
|
|
|
|
dev_info_list);
|
|
|
|
|
|
|
|
if (devinfo_table->scsi_dev_info_list.next == dl->bottom &&
|
|
|
|
devinfo_table->name)
|
|
|
|
seq_printf(m, "[%s]:\n", devinfo_table->name);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-04-29 15:01:55 +07:00
|
|
|
seq_printf(m, "'%.8s' '%.16s' 0x%x\n",
|
2009-06-18 02:01:58 +07:00
|
|
|
devinfo->vendor, devinfo->model, devinfo->flags);
|
2008-04-29 15:01:55 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-06-18 02:01:58 +07:00
|
|
|
static void *devinfo_seq_start(struct seq_file *m, loff_t *ppos)
|
2008-04-29 15:01:55 +07:00
|
|
|
{
|
2009-06-18 02:01:58 +07:00
|
|
|
struct double_list *dl = kmalloc(sizeof(*dl), GFP_KERNEL);
|
|
|
|
loff_t pos = *ppos;
|
|
|
|
|
|
|
|
if (!dl)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
list_for_each(dl->top, &scsi_dev_info_list) {
|
|
|
|
struct scsi_dev_info_list_table *devinfo_table =
|
|
|
|
list_entry(dl->top, struct scsi_dev_info_list_table,
|
|
|
|
node);
|
|
|
|
list_for_each(dl->bottom, &devinfo_table->scsi_dev_info_list)
|
|
|
|
if (pos-- == 0)
|
|
|
|
return dl;
|
|
|
|
}
|
|
|
|
|
|
|
|
kfree(dl);
|
|
|
|
return NULL;
|
2008-04-29 15:01:55 +07:00
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2009-06-18 02:01:58 +07:00
|
|
|
static void *devinfo_seq_next(struct seq_file *m, void *v, loff_t *ppos)
|
2008-04-29 15:01:55 +07:00
|
|
|
{
|
2009-06-18 02:01:58 +07:00
|
|
|
struct double_list *dl = v;
|
|
|
|
struct scsi_dev_info_list_table *devinfo_table =
|
|
|
|
list_entry(dl->top, struct scsi_dev_info_list_table, node);
|
|
|
|
|
|
|
|
++*ppos;
|
|
|
|
dl->bottom = dl->bottom->next;
|
|
|
|
while (&devinfo_table->scsi_dev_info_list == dl->bottom) {
|
|
|
|
dl->top = dl->top->next;
|
|
|
|
if (dl->top == &scsi_dev_info_list) {
|
|
|
|
kfree(dl);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
devinfo_table = list_entry(dl->top,
|
|
|
|
struct scsi_dev_info_list_table,
|
|
|
|
node);
|
|
|
|
dl->bottom = devinfo_table->scsi_dev_info_list.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return dl;
|
2008-04-29 15:01:55 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void devinfo_seq_stop(struct seq_file *m, void *v)
|
|
|
|
{
|
2009-06-18 02:01:58 +07:00
|
|
|
kfree(v);
|
2008-04-29 15:01:55 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct seq_operations scsi_devinfo_seq_ops = {
|
|
|
|
.start = devinfo_seq_start,
|
|
|
|
.next = devinfo_seq_next,
|
|
|
|
.stop = devinfo_seq_stop,
|
|
|
|
.show = devinfo_seq_show,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int proc_scsi_devinfo_open(struct inode *inode, struct file *file)
|
|
|
|
{
|
|
|
|
return seq_open(file, &scsi_devinfo_seq_ops);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2017-10-02 21:26:36 +07:00
|
|
|
/*
|
2007-11-04 01:30:39 +07:00
|
|
|
* proc_scsi_dev_info_write - allow additions to scsi_dev_info_list via /proc.
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
2007-11-04 01:30:39 +07:00
|
|
|
* Description: Adds a black/white list entry for vendor and model with an
|
|
|
|
* integer value of flag to the scsi device info list.
|
|
|
|
* To use, echo "vendor:model:flag" > /proc/scsi/device_info
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
2008-04-29 15:01:55 +07:00
|
|
|
static ssize_t proc_scsi_devinfo_write(struct file *file,
|
|
|
|
const char __user *buf,
|
|
|
|
size_t length, loff_t *ppos)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
char *buffer;
|
2008-04-29 15:01:55 +07:00
|
|
|
ssize_t err = length;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
if (!buf || length>PAGE_SIZE)
|
|
|
|
return -EINVAL;
|
|
|
|
if (!(buffer = (char *) __get_free_page(GFP_KERNEL)))
|
|
|
|
return -ENOMEM;
|
|
|
|
if (copy_from_user(buffer, buf, length)) {
|
|
|
|
err =-EFAULT;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (length < PAGE_SIZE)
|
|
|
|
buffer[length] = '\0';
|
|
|
|
else if (buffer[PAGE_SIZE-1]) {
|
|
|
|
err = -EINVAL;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
scsi_dev_info_list_add_str(buffer);
|
|
|
|
|
|
|
|
out:
|
|
|
|
free_page((unsigned long)buffer);
|
|
|
|
return err;
|
|
|
|
}
|
2008-04-29 15:01:55 +07:00
|
|
|
|
|
|
|
static const struct file_operations scsi_devinfo_proc_fops = {
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.open = proc_scsi_devinfo_open,
|
|
|
|
.read = seq_read,
|
|
|
|
.write = proc_scsi_devinfo_write,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = seq_release,
|
|
|
|
};
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif /* CONFIG_SCSI_PROC_FS */
|
|
|
|
|
|
|
|
module_param_string(dev_flags, scsi_dev_flags, sizeof(scsi_dev_flags), 0);
|
|
|
|
MODULE_PARM_DESC(dev_flags,
|
|
|
|
"Given scsi_dev_flags=vendor:model:flags[,v:m:f] add black/white"
|
|
|
|
" list entries for vendor and model with an integer value of flags"
|
|
|
|
" to the scsi device info list");
|
|
|
|
|
|
|
|
module_param_named(default_dev_flags, scsi_default_dev_flags, int, S_IRUGO|S_IWUSR);
|
|
|
|
MODULE_PARM_DESC(default_dev_flags,
|
|
|
|
"scsi default device flag integer value");
|
|
|
|
|
|
|
|
/**
|
2009-11-18 05:53:20 +07:00
|
|
|
* scsi_exit_devinfo - remove /proc/scsi/device_info & the scsi_dev_info_list
|
2005-04-17 05:20:36 +07:00
|
|
|
**/
|
|
|
|
void scsi_exit_devinfo(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_SCSI_PROC_FS
|
|
|
|
remove_proc_entry("scsi/device_info", NULL);
|
|
|
|
#endif
|
|
|
|
|
2009-06-18 02:01:58 +07:00
|
|
|
scsi_dev_info_remove_list(SCSI_DEVINFO_GLOBAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* scsi_dev_info_add_list - add a new devinfo list
|
|
|
|
* @key: key of the list to add
|
|
|
|
* @name: Name of the list to add (for /proc/scsi/device_info)
|
|
|
|
*
|
|
|
|
* Adds the requested list, returns zero on success, -EEXIST if the
|
|
|
|
* key is already registered to a list, or other error on failure.
|
|
|
|
*/
|
2017-12-05 01:36:33 +07:00
|
|
|
int scsi_dev_info_add_list(enum scsi_devinfo_key key, const char *name)
|
2009-06-18 02:01:58 +07:00
|
|
|
{
|
|
|
|
struct scsi_dev_info_list_table *devinfo_table =
|
|
|
|
scsi_devinfo_lookup_by_key(key);
|
|
|
|
|
|
|
|
if (!IS_ERR(devinfo_table))
|
|
|
|
/* list already exists */
|
|
|
|
return -EEXIST;
|
|
|
|
|
|
|
|
devinfo_table = kmalloc(sizeof(*devinfo_table), GFP_KERNEL);
|
|
|
|
|
|
|
|
if (!devinfo_table)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
INIT_LIST_HEAD(&devinfo_table->node);
|
|
|
|
INIT_LIST_HEAD(&devinfo_table->scsi_dev_info_list);
|
|
|
|
devinfo_table->name = name;
|
|
|
|
devinfo_table->key = key;
|
|
|
|
list_add_tail(&devinfo_table->node, &scsi_dev_info_list);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(scsi_dev_info_add_list);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* scsi_dev_info_remove_list - destroy an added devinfo list
|
|
|
|
* @key: key of the list to destroy
|
|
|
|
*
|
|
|
|
* Iterates over the entire list first, freeing all the values, then
|
|
|
|
* frees the list itself. Returns 0 on success or -EINVAL if the key
|
|
|
|
* can't be found.
|
|
|
|
*/
|
2017-12-05 01:36:33 +07:00
|
|
|
int scsi_dev_info_remove_list(enum scsi_devinfo_key key)
|
2009-06-18 02:01:58 +07:00
|
|
|
{
|
|
|
|
struct list_head *lh, *lh_next;
|
|
|
|
struct scsi_dev_info_list_table *devinfo_table =
|
|
|
|
scsi_devinfo_lookup_by_key(key);
|
|
|
|
|
|
|
|
if (IS_ERR(devinfo_table))
|
|
|
|
/* no such list */
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
/* remove from the master list */
|
|
|
|
list_del(&devinfo_table->node);
|
|
|
|
|
|
|
|
list_for_each_safe(lh, lh_next, &devinfo_table->scsi_dev_info_list) {
|
|
|
|
struct scsi_dev_info_list *devinfo;
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
devinfo = list_entry(lh, struct scsi_dev_info_list,
|
|
|
|
dev_info_list);
|
|
|
|
kfree(devinfo);
|
|
|
|
}
|
2009-06-18 02:01:58 +07:00
|
|
|
kfree(devinfo_table);
|
|
|
|
|
|
|
|
return 0;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
2009-06-18 02:01:58 +07:00
|
|
|
EXPORT_SYMBOL(scsi_dev_info_remove_list);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/**
|
2007-11-16 08:07:28 +07:00
|
|
|
* scsi_init_devinfo - set up the dynamic device list.
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* Description:
|
2017-10-02 21:26:36 +07:00
|
|
|
* Add command line entries from scsi_dev_flags, then add
|
|
|
|
* scsi_static_device_list entries to the scsi device info list.
|
2007-11-04 01:30:39 +07:00
|
|
|
*/
|
2005-04-17 05:20:36 +07:00
|
|
|
int __init scsi_init_devinfo(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_SCSI_PROC_FS
|
|
|
|
struct proc_dir_entry *p;
|
|
|
|
#endif
|
|
|
|
int error, i;
|
|
|
|
|
2009-06-18 02:01:58 +07:00
|
|
|
error = scsi_dev_info_add_list(SCSI_DEVINFO_GLOBAL, NULL);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (error)
|
|
|
|
return error;
|
|
|
|
|
2009-06-18 02:01:58 +07:00
|
|
|
error = scsi_dev_info_list_add_str(scsi_dev_flags);
|
|
|
|
if (error)
|
|
|
|
goto out;
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
for (i = 0; scsi_static_device_list[i].vendor; i++) {
|
|
|
|
error = scsi_dev_info_list_add(1 /* compatibile */,
|
|
|
|
scsi_static_device_list[i].vendor,
|
|
|
|
scsi_static_device_list[i].model,
|
|
|
|
NULL,
|
|
|
|
scsi_static_device_list[i].flags);
|
|
|
|
if (error)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_SCSI_PROC_FS
|
2008-04-29 15:01:55 +07:00
|
|
|
p = proc_create("scsi/device_info", 0, NULL, &scsi_devinfo_proc_fops);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (!p) {
|
|
|
|
error = -ENOMEM;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_SCSI_PROC_FS */
|
|
|
|
|
|
|
|
out:
|
|
|
|
if (error)
|
|
|
|
scsi_exit_devinfo();
|
|
|
|
return error;
|
|
|
|
}
|