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 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2007-02-28 11:40:55 +08:00
|
|
|
#ifndef _SCSI_DISK_H
|
|
|
|
#define _SCSI_DISK_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* More than enough for everybody ;) The huge number of majors
|
|
|
|
* is a leftover from 16bit dev_t days, we don't really need that
|
|
|
|
* much numberspace.
|
|
|
|
*/
|
|
|
|
#define SD_MAJORS 16
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Time out in seconds for disks and Magneto-opticals (which are slower).
|
|
|
|
*/
|
|
|
|
#define SD_TIMEOUT (30 * HZ)
|
|
|
|
#define SD_MOD_TIMEOUT (75 * HZ)
|
2013-10-05 05:42:24 +08:00
|
|
|
/*
|
|
|
|
* Flush timeout is a multiplier over the standard device timeout which is
|
|
|
|
* user modifiable via sysfs but initially set to SD_TIMEOUT
|
|
|
|
*/
|
|
|
|
#define SD_FLUSH_TIMEOUT_MULTIPLIER 2
|
2012-09-19 00:19:32 +08:00
|
|
|
#define SD_WRITE_SAME_TIMEOUT (120 * HZ)
|
2007-02-28 11:40:55 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Number of allowed retries
|
|
|
|
*/
|
|
|
|
#define SD_MAX_RETRIES 5
|
|
|
|
#define SD_PASSTHROUGH_RETRIES 1
|
2012-02-10 02:48:53 +08:00
|
|
|
#define SD_MAX_MEDIUM_TIMEOUTS 2
|
2007-02-28 11:40:55 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Size of the initial data buffer for mode and read capacity data
|
|
|
|
*/
|
|
|
|
#define SD_BUF_SIZE 512
|
|
|
|
|
2008-08-06 12:42:21 +08:00
|
|
|
/*
|
|
|
|
* Number of sectors at the end of the device to avoid multi-sector
|
|
|
|
* accesses to in the case of last_sector_bug
|
|
|
|
*/
|
|
|
|
#define SD_LAST_BUGGY_SECTORS 8
|
|
|
|
|
2009-09-21 04:49:38 +08:00
|
|
|
enum {
|
|
|
|
SD_EXT_CDB_SIZE = 32, /* Extended CDB size */
|
|
|
|
SD_MEMPOOL_SIZE = 2, /* CDB pool size */
|
|
|
|
};
|
|
|
|
|
2012-09-19 00:19:32 +08:00
|
|
|
enum {
|
2014-06-04 06:45:51 +08:00
|
|
|
SD_DEF_XFER_BLOCKS = 0xffff,
|
|
|
|
SD_MAX_XFER_BLOCKS = 0xffffffff,
|
2012-09-19 00:19:32 +08:00
|
|
|
SD_MAX_WS10_BLOCKS = 0xffff,
|
|
|
|
SD_MAX_WS16_BLOCKS = 0x7fffff,
|
|
|
|
};
|
|
|
|
|
2011-03-08 15:07:15 +08:00
|
|
|
enum {
|
|
|
|
SD_LBP_FULL = 0, /* Full logical block provisioning */
|
|
|
|
SD_LBP_UNMAP, /* Use UNMAP command */
|
|
|
|
SD_LBP_WS16, /* Use WRITE SAME(16) with UNMAP bit */
|
|
|
|
SD_LBP_WS10, /* Use WRITE SAME(10) with UNMAP bit */
|
|
|
|
SD_LBP_ZERO, /* Use WRITE SAME(10) with zero payload */
|
|
|
|
SD_LBP_DISABLE, /* Discard disabled due to failed cmd */
|
|
|
|
};
|
|
|
|
|
2017-04-06 01:21:24 +08:00
|
|
|
enum {
|
|
|
|
SD_ZERO_WRITE = 0, /* Use WRITE(10/16) command */
|
|
|
|
SD_ZERO_WS, /* Use WRITE SAME(10/16) command */
|
|
|
|
SD_ZERO_WS16_UNMAP, /* Use WRITE SAME(16) with UNMAP */
|
|
|
|
SD_ZERO_WS10_UNMAP, /* Use WRITE SAME(10) with UNMAP */
|
|
|
|
};
|
|
|
|
|
2007-02-28 11:40:55 +08:00
|
|
|
struct scsi_disk {
|
|
|
|
struct scsi_driver *driver; /* always &sd_template */
|
|
|
|
struct scsi_device *device;
|
2008-02-22 07:13:36 +08:00
|
|
|
struct device dev;
|
2007-02-28 11:40:55 +08:00
|
|
|
struct gendisk *disk;
|
2017-06-19 20:26:46 +08:00
|
|
|
struct opal_dev *opal_dev;
|
2016-10-18 14:40:34 +08:00
|
|
|
#ifdef CONFIG_BLK_DEV_ZONED
|
2018-04-17 09:04:39 +08:00
|
|
|
u32 nr_zones;
|
|
|
|
u32 zone_blocks;
|
|
|
|
u32 zones_optimal_open;
|
|
|
|
u32 zones_optimal_nonseq;
|
|
|
|
u32 zones_max_open;
|
2016-10-18 14:40:34 +08:00
|
|
|
#endif
|
2010-07-07 22:51:29 +08:00
|
|
|
atomic_t openers;
|
2016-03-29 09:18:56 +08:00
|
|
|
sector_t capacity; /* size in logical blocks */
|
2014-06-04 06:45:51 +08:00
|
|
|
u32 max_xfer_blocks;
|
2015-11-14 05:46:48 +08:00
|
|
|
u32 opt_xfer_blocks;
|
2011-03-08 15:07:15 +08:00
|
|
|
u32 max_ws_blocks;
|
|
|
|
u32 max_unmap_blocks;
|
|
|
|
u32 unmap_granularity;
|
|
|
|
u32 unmap_alignment;
|
2007-02-28 11:40:55 +08:00
|
|
|
u32 index;
|
2010-09-29 02:48:47 +08:00
|
|
|
unsigned int physical_block_size;
|
2012-02-10 02:48:53 +08:00
|
|
|
unsigned int max_medium_access_timeouts;
|
|
|
|
unsigned int medium_access_timed_out;
|
2007-02-28 11:40:55 +08:00
|
|
|
u8 media_present;
|
|
|
|
u8 write_prot;
|
2008-07-17 16:28:34 +08:00
|
|
|
u8 protection_type;/* Data Integrity Field */
|
2011-03-08 15:07:15 +08:00
|
|
|
u8 provisioning_mode;
|
2017-04-06 01:21:24 +08:00
|
|
|
u8 zeroing_mode;
|
2008-07-17 16:28:34 +08:00
|
|
|
unsigned ATO : 1; /* state of disk ATO bit */
|
2013-04-25 05:02:53 +08:00
|
|
|
unsigned cache_override : 1; /* temp override of WCE,RCD */
|
2007-02-28 11:40:55 +08:00
|
|
|
unsigned WCE : 1; /* state of disk WCE bit */
|
|
|
|
unsigned RCD : 1; /* state of disk RCD bit, unused */
|
|
|
|
unsigned DPOFUA : 1; /* state of disk DPOFUA bit */
|
2009-03-09 23:33:31 +08:00
|
|
|
unsigned first_scan : 1;
|
2011-03-08 15:07:15 +08:00
|
|
|
unsigned lbpme : 1;
|
|
|
|
unsigned lbprz : 1;
|
|
|
|
unsigned lbpu : 1;
|
|
|
|
unsigned lbpws : 1;
|
|
|
|
unsigned lbpws10 : 1;
|
|
|
|
unsigned lbpvpd : 1;
|
2013-06-07 10:15:55 +08:00
|
|
|
unsigned ws10 : 1;
|
2012-09-19 00:19:32 +08:00
|
|
|
unsigned ws16 : 1;
|
2016-10-18 14:40:34 +08:00
|
|
|
unsigned rc_basis: 2;
|
|
|
|
unsigned zoned: 2;
|
|
|
|
unsigned urswrz : 1;
|
2017-06-19 20:26:46 +08:00
|
|
|
unsigned security : 1;
|
2017-04-06 21:36:29 +08:00
|
|
|
unsigned ignore_medium_access_errors : 1;
|
2007-02-28 11:40:55 +08:00
|
|
|
};
|
2008-02-22 07:13:36 +08:00
|
|
|
#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
|
2007-02-28 11:40:55 +08:00
|
|
|
|
2008-06-25 23:22:41 +08:00
|
|
|
static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
|
|
|
|
{
|
|
|
|
return container_of(disk->private_data, struct scsi_disk, driver);
|
|
|
|
}
|
|
|
|
|
2007-02-28 11:40:55 +08:00
|
|
|
#define sd_printk(prefix, sdsk, fmt, a...) \
|
|
|
|
(sdsk)->disk ? \
|
2014-10-24 20:26:44 +08:00
|
|
|
sdev_prefix_printk(prefix, (sdsk)->device, \
|
|
|
|
(sdsk)->disk->disk_name, fmt, ##a) : \
|
|
|
|
sdev_printk(prefix, (sdsk)->device, fmt, ##a)
|
2007-02-28 11:40:55 +08:00
|
|
|
|
2014-01-04 07:19:26 +08:00
|
|
|
#define sd_first_printk(prefix, sdsk, fmt, a...) \
|
|
|
|
do { \
|
2019-02-05 18:10:48 +08:00
|
|
|
if ((sdsk)->first_scan) \
|
2014-01-04 07:19:26 +08:00
|
|
|
sd_printk(prefix, sdsk, fmt, ##a); \
|
|
|
|
} while (0)
|
|
|
|
|
2012-02-10 02:48:53 +08:00
|
|
|
static inline int scsi_medium_access_command(struct scsi_cmnd *scmd)
|
|
|
|
{
|
|
|
|
switch (scmd->cmnd[0]) {
|
|
|
|
case READ_6:
|
|
|
|
case READ_10:
|
|
|
|
case READ_12:
|
|
|
|
case READ_16:
|
|
|
|
case SYNCHRONIZE_CACHE:
|
|
|
|
case VERIFY:
|
|
|
|
case VERIFY_12:
|
|
|
|
case VERIFY_16:
|
|
|
|
case WRITE_6:
|
|
|
|
case WRITE_10:
|
|
|
|
case WRITE_12:
|
|
|
|
case WRITE_16:
|
|
|
|
case WRITE_SAME:
|
|
|
|
case WRITE_SAME_16:
|
|
|
|
case UNMAP:
|
|
|
|
return 1;
|
|
|
|
case VARIABLE_LENGTH_CMD:
|
|
|
|
switch (scmd->cmnd[9]) {
|
|
|
|
case READ_32:
|
|
|
|
case VERIFY_32:
|
|
|
|
case WRITE_32:
|
|
|
|
case WRITE_SAME_32:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-03-29 09:18:56 +08:00
|
|
|
static inline sector_t logical_to_sectors(struct scsi_device *sdev, sector_t blocks)
|
|
|
|
{
|
|
|
|
return blocks << (ilog2(sdev->sector_size) - 9);
|
|
|
|
}
|
|
|
|
|
2016-05-13 10:17:34 +08:00
|
|
|
static inline unsigned int logical_to_bytes(struct scsi_device *sdev, sector_t blocks)
|
|
|
|
{
|
|
|
|
return blocks * sdev->sector_size;
|
|
|
|
}
|
|
|
|
|
2017-04-24 15:51:10 +08:00
|
|
|
static inline sector_t bytes_to_logical(struct scsi_device *sdev, unsigned int bytes)
|
|
|
|
{
|
|
|
|
return bytes >> ilog2(sdev->sector_size);
|
|
|
|
}
|
|
|
|
|
2016-10-18 14:40:34 +08:00
|
|
|
static inline sector_t sectors_to_logical(struct scsi_device *sdev, sector_t sector)
|
|
|
|
{
|
|
|
|
return sector >> (ilog2(sdev->sector_size) - 9);
|
|
|
|
}
|
|
|
|
|
2008-10-14 03:20:06 +08:00
|
|
|
#ifdef CONFIG_BLK_DEV_INTEGRITY
|
2008-07-17 16:28:35 +08:00
|
|
|
|
|
|
|
extern void sd_dif_config_host(struct scsi_disk *);
|
|
|
|
|
|
|
|
#else /* CONFIG_BLK_DEV_INTEGRITY */
|
|
|
|
|
2008-10-14 03:20:06 +08:00
|
|
|
static inline void sd_dif_config_host(struct scsi_disk *disk)
|
|
|
|
{
|
|
|
|
}
|
2008-07-17 16:28:35 +08:00
|
|
|
|
|
|
|
#endif /* CONFIG_BLK_DEV_INTEGRITY */
|
|
|
|
|
2016-10-18 14:40:34 +08:00
|
|
|
static inline int sd_is_zoned(struct scsi_disk *sdkp)
|
|
|
|
{
|
|
|
|
return sdkp->zoned == 1 || sdkp->device->type == TYPE_ZBC;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_BLK_DEV_ZONED
|
|
|
|
|
|
|
|
extern int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buffer);
|
|
|
|
extern void sd_zbc_print_zones(struct scsi_disk *sdkp);
|
2018-11-09 21:42:39 +08:00
|
|
|
extern blk_status_t sd_zbc_setup_reset_cmnd(struct scsi_cmnd *cmd);
|
2016-10-18 14:40:34 +08:00
|
|
|
extern void sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes,
|
|
|
|
struct scsi_sense_hdr *sshdr);
|
2018-10-12 18:08:49 +08:00
|
|
|
extern int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
|
|
|
|
struct blk_zone *zones, unsigned int *nr_zones,
|
|
|
|
gfp_t gfp_mask);
|
2016-10-18 14:40:34 +08:00
|
|
|
|
|
|
|
#else /* CONFIG_BLK_DEV_ZONED */
|
|
|
|
|
|
|
|
static inline int sd_zbc_read_zones(struct scsi_disk *sdkp,
|
|
|
|
unsigned char *buf)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void sd_zbc_print_zones(struct scsi_disk *sdkp) {}
|
|
|
|
|
2018-11-09 21:42:39 +08:00
|
|
|
static inline blk_status_t sd_zbc_setup_reset_cmnd(struct scsi_cmnd *cmd)
|
2016-10-18 14:40:34 +08:00
|
|
|
{
|
2018-11-09 21:42:39 +08:00
|
|
|
return BLK_STS_TARGET;
|
2016-10-18 14:40:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void sd_zbc_complete(struct scsi_cmnd *cmd,
|
|
|
|
unsigned int good_bytes,
|
|
|
|
struct scsi_sense_hdr *sshdr) {}
|
|
|
|
|
2018-10-12 18:08:49 +08:00
|
|
|
#define sd_zbc_report_zones NULL
|
|
|
|
|
2016-10-18 14:40:34 +08:00
|
|
|
#endif /* CONFIG_BLK_DEV_ZONED */
|
|
|
|
|
2007-02-28 11:40:55 +08:00
|
|
|
#endif /* _SCSI_DISK_H */
|