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 17:07:57 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-17 02:20:36 +04:00
|
|
|
#ifndef _LINUX_MISCDEVICE_H
|
|
|
|
#define _LINUX_MISCDEVICE_H
|
|
|
|
#include <linux/major.h>
|
2011-08-29 23:22:17 +04:00
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/types.h>
|
2016-08-25 20:00:49 +03:00
|
|
|
#include <linux/device.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2010-06-09 12:39:49 +04:00
|
|
|
/*
|
2020-08-03 08:43:45 +03:00
|
|
|
* These allocations are managed by device@lanana.org. If you need
|
|
|
|
* an entry that is not assigned here, it can be moved and
|
|
|
|
* reassigned or dynamically set if a fixed value is not justified.
|
2010-06-09 12:39:49 +04:00
|
|
|
*/
|
|
|
|
|
2008-11-26 14:03:54 +03:00
|
|
|
#define PSMOUSE_MINOR 1
|
2014-02-18 09:27:24 +04:00
|
|
|
#define MS_BUSMOUSE_MINOR 2 /* unused */
|
|
|
|
#define ATIXL_BUSMOUSE_MINOR 3 /* unused */
|
2008-11-26 14:03:54 +03:00
|
|
|
/*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */
|
2014-02-18 09:27:24 +04:00
|
|
|
#define ATARIMOUSE_MINOR 5 /* unused */
|
|
|
|
#define SUN_MOUSE_MINOR 6 /* unused */
|
|
|
|
#define APOLLO_MOUSE_MINOR 7 /* unused */
|
|
|
|
#define PC110PAD_MINOR 9 /* unused */
|
2008-11-26 14:03:54 +03:00
|
|
|
/*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */
|
2005-04-17 02:20:36 +04:00
|
|
|
#define WATCHDOG_MINOR 130 /* Watchdog timer */
|
|
|
|
#define TEMP_MINOR 131 /* Temperature Sensor */
|
2016-12-15 22:36:33 +03:00
|
|
|
#define APM_MINOR_DEV 134
|
2008-11-26 14:03:54 +03:00
|
|
|
#define RTC_MINOR 135
|
2020-02-27 01:43:21 +03:00
|
|
|
/*#define EFI_RTC_MINOR 136 was EFI Time services */
|
2014-02-18 09:19:26 +04:00
|
|
|
#define VHCI_MINOR 137
|
2008-11-26 14:03:54 +03:00
|
|
|
#define SUN_OPENPROM_MINOR 139
|
2014-02-18 09:27:24 +04:00
|
|
|
#define DMAPI_MINOR 140 /* unused */
|
2008-11-26 14:03:54 +03:00
|
|
|
#define NVRAM_MINOR 144
|
2020-03-11 10:16:54 +03:00
|
|
|
#define SBUS_FLASH_MINOR 152
|
2008-11-26 14:03:54 +03:00
|
|
|
#define SGI_MMTIMER 153
|
2020-03-11 10:16:53 +03:00
|
|
|
#define PMU_MINOR 154
|
2014-02-18 09:27:24 +04:00
|
|
|
#define STORE_QUEUE_MINOR 155 /* unused */
|
2020-03-11 10:16:53 +03:00
|
|
|
#define LCD_MINOR 156
|
|
|
|
#define AC_MINOR 157
|
|
|
|
#define BUTTON_MINOR 158 /* Major 10, Minor 158, /dev/nwbutton */
|
2020-03-11 10:16:54 +03:00
|
|
|
#define NWFLASH_MINOR 160 /* MAJOR is 10 - miscdevice */
|
2020-03-11 10:16:53 +03:00
|
|
|
#define ENVCTRL_MINOR 162
|
2008-11-26 14:03:54 +03:00
|
|
|
#define I2O_MINOR 166
|
2020-03-11 10:16:53 +03:00
|
|
|
#define UCTRL_MINOR 174
|
2019-11-21 11:14:42 +03:00
|
|
|
#define AGPGART_MINOR 175
|
2020-03-11 10:16:53 +03:00
|
|
|
#define TOSH_MINOR_DEV 181
|
2016-12-13 17:51:13 +03:00
|
|
|
#define HWRNG_MINOR 183
|
2005-04-17 02:20:36 +04:00
|
|
|
#define MICROCODE_MINOR 184
|
2020-03-11 10:16:53 +03:00
|
|
|
#define KEYPAD_MINOR 185
|
2016-12-15 13:42:48 +03:00
|
|
|
#define IRNET_MINOR 187
|
2017-09-18 21:10:36 +03:00
|
|
|
#define D7S_MINOR 193
|
2013-12-19 21:17:11 +04:00
|
|
|
#define VFIO_MINOR 196
|
2020-03-11 10:16:53 +03:00
|
|
|
#define PXA3XX_GCU_MINOR 197
|
2008-11-26 14:03:54 +03:00
|
|
|
#define TUN_MINOR 200
|
2013-09-09 22:18:27 +04:00
|
|
|
#define CUSE_MINOR 203
|
2008-11-26 14:03:54 +03:00
|
|
|
#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
|
|
|
|
#define MPT_MINOR 220
|
2009-03-09 10:27:49 +03:00
|
|
|
#define MPT2SAS_MINOR 221
|
2012-11-30 06:28:10 +04:00
|
|
|
#define MPT3SAS_MINOR 222
|
2010-08-19 20:52:28 +04:00
|
|
|
#define UINPUT_MINOR 223
|
2012-06-07 15:56:51 +04:00
|
|
|
#define MISC_MCELOG_MINOR 227
|
2008-11-26 14:03:54 +03:00
|
|
|
#define HPET_MINOR 228
|
|
|
|
#define FUSE_MINOR 229
|
2020-03-11 10:16:53 +03:00
|
|
|
#define SNAPSHOT_MINOR 231
|
2008-11-26 14:03:54 +03:00
|
|
|
#define KVM_MINOR 232
|
driver core: add devname module aliases to allow module on-demand auto-loading
This adds:
alias: devname:<name>
to some common kernel modules, which will allow the on-demand loading
of the kernel module when the device node is accessed.
Ideally all these modules would be compiled-in, but distros seems too
much in love with their modularization that we need to cover the common
cases with this new facility. It will allow us to remove a bunch of pretty
useless init scripts and modprobes from init scripts.
The static device node aliases will be carried in the module itself. The
program depmod will extract this information to a file in the module directory:
$ cat /lib/modules/2.6.34-00650-g537b60d-dirty/modules.devname
# Device nodes to trigger on-demand module loading.
microcode cpu/microcode c10:184
fuse fuse c10:229
ppp_generic ppp c108:0
tun net/tun c10:200
dm_mod mapper/control c10:235
Udev will pick up the depmod created file on startup and create all the
static device nodes which the kernel modules specify, so that these modules
get automatically loaded when the device node is accessed:
$ /sbin/udevd --debug
...
static_dev_create_from_modules: mknod '/dev/cpu/microcode' c10:184
static_dev_create_from_modules: mknod '/dev/fuse' c10:229
static_dev_create_from_modules: mknod '/dev/ppp' c108:0
static_dev_create_from_modules: mknod '/dev/net/tun' c10:200
static_dev_create_from_modules: mknod '/dev/mapper/control' c10:235
udev_rules_apply_static_dev_perms: chmod '/dev/net/tun' 0666
udev_rules_apply_static_dev_perms: chmod '/dev/fuse' 0666
A few device nodes are switched to statically allocated numbers, to allow
the static nodes to work. This might also useful for systems which still run
a plain static /dev, which is completely unsafe to use with any dynamic minor
numbers.
Note:
The devname aliases must be limited to the *common* and *single*instance*
device nodes, like the misc devices, and never be used for conceptually limited
systems like the loop devices, which should rather get fixed properly and get a
control node for losetup to talk to, instead of creating a random number of
device nodes in advance, regardless if they are ever used.
This facility is to hide the mess distros are creating with too modualized
kernels, and just to hide that these modules are not compiled-in, and not to
paper-over broken concepts. Thanks! :)
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Alasdair G Kergon <agk@redhat.com>
Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Cc: Ian Kent <raven@themaw.net>
Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20 20:07:20 +04:00
|
|
|
#define BTRFS_MINOR 234
|
|
|
|
#define AUTOFS_MINOR 235
|
2010-08-12 07:14:05 +04:00
|
|
|
#define MAPPER_CTRL_MINOR 236
|
loop: add management interface for on-demand device allocation
Loop devices today have a fixed pre-allocated number of usually 8.
The number can only be changed at module init time. To find a free
device to use, /dev/loop%i needs to be scanned, and all devices need
to be opened until a free one is possibly found.
This adds a new /dev/loop-control device node, that allows to
dynamically find or allocate a free device, and to add and remove loop
devices from the running system:
LOOP_CTL_ADD adds a specific device. Arg is the number
of the device. It returns the device i or a negative
error code.
LOOP_CTL_REMOVE removes a specific device, Arg is the
number the device. It returns the device i or a negative
error code.
LOOP_CTL_GET_FREE finds the next unbound device or allocates
a new one. No arg is given. It returns the device i or a
negative error code.
The loop kernel module gets automatically loaded when
/dev/loop-control is accessed the first time. The alias
specified in the module, instructs udev to create this
'dead' device node, even when the module is not loaded.
Example:
cfd = open("/dev/loop-control", O_RDWR);
# add a new specific loop device
err = ioctl(cfd, LOOP_CTL_ADD, devnr);
# remove a specific loop device
err = ioctl(cfd, LOOP_CTL_REMOVE, devnr);
# find or allocate a free loop device to use
devnr = ioctl(cfd, LOOP_CTL_GET_FREE);
sprintf(loopname, "/dev/loop%i", devnr);
ffd = open("backing-file", O_RDWR);
lfd = open(loopname, O_RDWR);
err = ioctl(lfd, LOOP_SET_FD, ffd);
Cc: Tejun Heo <tj@kernel.org>
Cc: Karel Zak <kzak@redhat.com>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
2011-08-01 00:08:04 +04:00
|
|
|
#define LOOP_CTRL_MINOR 237
|
2012-01-11 23:30:38 +04:00
|
|
|
#define VHOST_NET_MINOR 238
|
2013-09-09 20:33:54 +04:00
|
|
|
#define UHID_MINOR 239
|
2015-10-24 23:10:29 +03:00
|
|
|
#define USERIO_MINOR 240
|
2017-05-10 17:19:18 +03:00
|
|
|
#define VHOST_VSOCK_MINOR 241
|
2019-10-24 20:40:42 +03:00
|
|
|
#define RFKILL_MINOR 242
|
2008-11-26 14:03:54 +03:00
|
|
|
#define MISC_DYNAMIC_MINOR 255
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
struct device;
|
2015-02-02 17:44:54 +03:00
|
|
|
struct attribute_group;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
struct miscdevice {
|
|
|
|
int minor;
|
|
|
|
const char *name;
|
2006-03-28 13:56:41 +04:00
|
|
|
const struct file_operations *fops;
|
2005-04-17 02:20:36 +04:00
|
|
|
struct list_head list;
|
2006-07-28 03:16:04 +04:00
|
|
|
struct device *parent;
|
|
|
|
struct device *this_device;
|
2015-02-02 17:44:54 +03:00
|
|
|
const struct attribute_group **groups;
|
2009-09-19 01:01:12 +04:00
|
|
|
const char *nodename;
|
2011-07-26 12:47:38 +04:00
|
|
|
umode_t mode;
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
2014-05-16 12:36:13 +04:00
|
|
|
extern int misc_register(struct miscdevice *misc);
|
2015-07-31 01:59:57 +03:00
|
|
|
extern void misc_deregister(struct miscdevice *misc);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2016-10-23 01:36:05 +03:00
|
|
|
/*
|
|
|
|
* Helper macro for drivers that don't do anything special in the initcall.
|
2020-08-03 08:43:45 +03:00
|
|
|
* This helps to eliminate boilerplate code.
|
2016-10-23 01:36:05 +03:00
|
|
|
*/
|
|
|
|
#define builtin_misc_device(__misc_device) \
|
|
|
|
builtin_driver(__misc_device, misc_register)
|
|
|
|
|
2016-08-25 20:00:49 +03:00
|
|
|
/*
|
|
|
|
* Helper macro for drivers that don't do anything special in module init / exit
|
2020-08-03 08:43:45 +03:00
|
|
|
* call. This helps to eliminate boilerplate code.
|
2016-08-25 20:00:49 +03:00
|
|
|
*/
|
|
|
|
#define module_misc_device(__misc_device) \
|
|
|
|
module_driver(__misc_device, misc_register, misc_deregister)
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#define MODULE_ALIAS_MISCDEV(minor) \
|
|
|
|
MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \
|
|
|
|
"-" __stringify(minor))
|
|
|
|
#endif
|