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 */
|
2005-04-17 06:20:36 +08:00
|
|
|
#ifndef _SCSI_PRIV_H
|
|
|
|
#define _SCSI_PRIV_H
|
|
|
|
|
|
|
|
#include <linux/device.h>
|
2012-07-10 10:33:25 +08:00
|
|
|
#include <linux/async.h>
|
2012-05-18 12:56:57 +08:00
|
|
|
#include <scsi/scsi_device.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
struct request_queue;
|
2008-09-14 20:55:09 +08:00
|
|
|
struct request;
|
2005-04-17 06:20:36 +08:00
|
|
|
struct scsi_cmnd;
|
|
|
|
struct scsi_device;
|
[SCSI] implement runtime Power Management
This patch (as1398b) adds runtime PM support to the SCSI layer. Only
the machanism is provided; use of it is up to the various high-level
drivers, and the patch doesn't change any of them. Except for sg --
the patch expicitly prevents a device from being runtime-suspended
while its sg device file is open.
The implementation is simplistic. In general, hosts and targets are
automatically suspended when all their children are asleep, but for
them the runtime-suspend code doesn't actually do anything. (A host's
runtime PM status is propagated up the device tree, though, so a
runtime-PM-aware lower-level driver could power down the host adapter
hardware at the appropriate times.) There are comments indicating
where a transport class might be notified or some other hooks added.
LUNs are runtime-suspended by calling the drivers' existing suspend
handlers (and likewise for runtime-resume). Somewhat arbitrarily, the
implementation delays for 100 ms before suspending an eligible LUN.
This is because there typically are occasions during bootup when the
same device file is opened and closed several times in quick
succession.
The way this all works is that the SCSI core increments a device's
PM-usage count when it is registered. If a high-level driver does
nothing then the device will not be eligible for runtime-suspend
because of the elevated usage count. If a high-level driver wants to
use runtime PM then it can call scsi_autopm_put_device() in its probe
routine to decrement the usage count and scsi_autopm_get_device() in
its remove routine to restore the original count.
Hosts, targets, and LUNs are not suspended while they are being probed
or removed, or while the error handler is running. In fact, a fairly
large part of the patch consists of code to make sure that things
aren't suspended at such times.
[jejb: fix up compile issues in PM config variations]
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-06-17 22:41:42 +08:00
|
|
|
struct scsi_target;
|
2005-04-17 06:20:36 +08:00
|
|
|
struct scsi_host_template;
|
|
|
|
struct Scsi_Host;
|
[SCSI] SCSI and FC Transport: add netlink support for posting of transport events
This patch formally adds support for the posting of FC events via netlink.
It is a followup to the original RFC at:
http://marc.theaimsgroup.com/?l=linux-scsi&m=114530667923464&w=2
and the initial posting at:
http://marc.theaimsgroup.com/?l=linux-scsi&m=115507374832500&w=2
The patch has been updated to optimize the send path, per the discussions
in the initial posting.
Per discussions at the Storage Summit and at OLS, we are to use netlink for
async events from transports. Also per discussions, to avoid a netlink
protocol per transport, I've create a single NETLINK_SCSITRANSPORT protocol,
which can then be used by all transports.
This patch:
- Creates new files scsi_netlink.c and scsi_netlink.h, which contains the
single and shared definitions for the SCSI Transport. It is tied into the
base SCSI subsystem intialization.
Contains a single interface routine, scsi_send_transport_event(), for a
transport to send an event (via multicast to a protocol specific group).
- Creates a new scsi_netlink_fc.h file, which contains the FC netlink event
messages
- Adds 3 new routines to the fc transport:
fc_get_event_number() - to get a FC event #
fc_host_post_event() - to send a simple FC event (32 bits of data)
fc_host_post_vendor_event() - to send a Vendor unique event, with
arbitrary amounts of data.
Note: the separation of event number allows for a LLD to send a standard
event, followed by vendor-specific data for the event.
Note: This patch assumes 2 prior fc transport patches have been installed:
http://marc.theaimsgroup.com/?l=linux-scsi&m=115555807316329&w=2
http://marc.theaimsgroup.com/?l=linux-scsi&m=115581614930261&w=2
Sorry - next time I'll do something like making these individual
patches of the same posting when I know they'll be posted closely
together.
Signed-off-by: James Smart <James.Smart@emulex.com>
Tidy up configuration not to make SCSI always select NET
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-08-19 05:30:09 +08:00
|
|
|
struct scsi_nl_hdr;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Scsi Error Handler Flags
|
|
|
|
*/
|
2013-11-11 20:44:54 +08:00
|
|
|
#define SCSI_EH_ABORT_SCHEDULED 0x0002 /* Abort has been scheduled */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define SCSI_SENSE_VALID(scmd) \
|
|
|
|
(((scmd)->sense_buffer[0] & 0x70) == 0x70)
|
|
|
|
|
|
|
|
/* hosts.c */
|
|
|
|
extern int scsi_init_hosts(void);
|
|
|
|
extern void scsi_exit_hosts(void);
|
|
|
|
|
|
|
|
/* scsi.c */
|
2016-09-23 05:20:54 +08:00
|
|
|
extern bool scsi_use_blk_mq;
|
2017-01-03 13:28:41 +08:00
|
|
|
int scsi_init_sense_cache(struct Scsi_Host *shost);
|
2017-01-03 02:55:26 +08:00
|
|
|
void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd);
|
2005-04-17 06:20:36 +08:00
|
|
|
#ifdef CONFIG_SCSI_LOGGING
|
|
|
|
void scsi_log_send(struct scsi_cmnd *cmd);
|
|
|
|
void scsi_log_completion(struct scsi_cmnd *cmd, int disposition);
|
|
|
|
#else
|
|
|
|
static inline void scsi_log_send(struct scsi_cmnd *cmd)
|
|
|
|
{ };
|
|
|
|
static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
|
|
|
|
{ };
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* scsi_devinfo.c */
|
2009-06-18 03:01:58 +08:00
|
|
|
|
|
|
|
/* list of keys for the lists */
|
2017-12-05 02:36:33 +08:00
|
|
|
enum scsi_devinfo_key {
|
2009-06-18 03:01:58 +08:00
|
|
|
SCSI_DEVINFO_GLOBAL = 0,
|
2009-06-18 03:05:05 +08:00
|
|
|
SCSI_DEVINFO_SPI,
|
2009-06-18 03:01:58 +08:00
|
|
|
};
|
|
|
|
|
2017-11-15 19:07:30 +08:00
|
|
|
extern blist_flags_t scsi_get_device_flags(struct scsi_device *sdev,
|
|
|
|
const unsigned char *vendor,
|
|
|
|
const unsigned char *model);
|
|
|
|
extern blist_flags_t scsi_get_device_flags_keyed(struct scsi_device *sdev,
|
|
|
|
const unsigned char *vendor,
|
|
|
|
const unsigned char *model,
|
2017-12-05 02:36:33 +08:00
|
|
|
enum scsi_devinfo_key key);
|
2009-06-18 03:01:58 +08:00
|
|
|
extern int scsi_dev_info_list_add_keyed(int compatible, char *vendor,
|
|
|
|
char *model, char *strflags,
|
2017-12-05 02:36:33 +08:00
|
|
|
blist_flags_t flags,
|
|
|
|
enum scsi_devinfo_key key);
|
|
|
|
extern int scsi_dev_info_list_del_keyed(char *vendor, char *model,
|
|
|
|
enum scsi_devinfo_key key);
|
|
|
|
extern int scsi_dev_info_add_list(enum scsi_devinfo_key key, const char *name);
|
|
|
|
extern int scsi_dev_info_remove_list(enum scsi_devinfo_key key);
|
2009-06-18 03:01:58 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
extern int __init scsi_init_devinfo(void);
|
|
|
|
extern void scsi_exit_devinfo(void);
|
|
|
|
|
|
|
|
/* scsi_error.c */
|
2013-11-11 20:44:54 +08:00
|
|
|
extern void scmd_eh_abort_handler(struct work_struct *work);
|
2008-09-14 20:55:09 +08:00
|
|
|
extern enum blk_eh_timer_return scsi_times_out(struct request *req);
|
2005-04-17 06:20:36 +08:00
|
|
|
extern int scsi_error_handler(void *host);
|
|
|
|
extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
|
|
|
|
extern void scsi_eh_wakeup(struct Scsi_Host *shost);
|
2017-04-06 21:36:35 +08:00
|
|
|
extern void scsi_eh_scmd_add(struct scsi_cmnd *);
|
2007-01-27 06:08:49 +08:00
|
|
|
void scsi_eh_ready_devs(struct Scsi_Host *shost,
|
|
|
|
struct list_head *work_q,
|
|
|
|
struct list_head *done_q);
|
|
|
|
int scsi_eh_get_sense(struct list_head *work_q,
|
|
|
|
struct list_head *done_q);
|
2008-08-20 07:45:31 +08:00
|
|
|
int scsi_noretry_cmd(struct scsi_cmnd *scmd);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* scsi_lib.c */
|
2017-06-03 05:21:58 +08:00
|
|
|
extern void scsi_add_cmd_to_list(struct scsi_cmnd *cmd);
|
|
|
|
extern void scsi_del_cmd_from_list(struct scsi_cmnd *cmd);
|
2005-04-17 06:20:36 +08:00
|
|
|
extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
|
|
|
|
extern void scsi_device_unbusy(struct scsi_device *sdev);
|
2012-06-29 23:35:05 +08:00
|
|
|
extern void scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
|
Revert "scsi: revert "[SCSI] Get rid of scsi_cmnd->done""
This reverts commit ac40532ef0b8649e6f7f83859ea0de1c4ed08a19, which gets
us back the original cleanup of 6f5391c283d7fdcf24bf40786ea79061919d1e1d.
It turns out that the bug that was triggered by that commit was
apparently not actually triggered by that commit at all, and just the
testing conditions had changed enough to make it appear to be due to it.
The real problem seems to have been found by Peter Osterlund:
"pktcdvd sets it [block device size] when opening the /dev/pktcdvd
device, but when the drive is later opened as /dev/scd0, there is
nothing that sets it back. (Btw, 40944 is possible if the disk is a
CDRW that was formatted with "cdrwtool -m 10236".)
The problem is that pktcdvd opens the cd device in non-blocking mode
when pktsetup is run, and doesn't close it again until pktsetup -d is
run. The effect is that if you meanwhile open the cd device,
blkdev.c:do_open() doesn't call bd_set_size() because
bdev->bd_openers is non-zero."
In particular, to repeat the bug (regardless of whether commit
6f5391c283d7fdcf24bf40786ea79061919d1e1d is applied or not):
" 1. Start with an empty drive.
2. pktsetup 0 /dev/scd0
3. Insert a CD containing an isofs filesystem.
4. mount /dev/pktcdvd/0 /mnt/tmp
5. umount /mnt/tmp
6. Press the eject button.
7. Insert a DVD containing a non-writable filesystem.
8. mount /dev/scd0 /mnt/tmp
9. find /mnt/tmp -type f -print0 | xargs -0 sha1sum >/dev/null
10. If the DVD contains data beyond the physical size of a CD, you
get I/O errors in the terminal, and dmesg reports lots of
"attempt to access beyond end of device" errors."
which in turn is because the nested open after the media change won't
cause the size to be set properly (because the original open still holds
the block device, and we only do the bd_set_size() when we don't have
other people holding the device open).
The proper fix for that is probably to just do something like
bdev->bd_inode->i_size = (loff_t)get_capacity(disk)<<9;
in fs/block_dev.c:do_open() even for the cases where we're not the
original opener (but *not* call bd_set_size(), since that will also
change the block size of the device).
Cc: Peter Osterlund <petero2@telia.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-01-07 02:17:12 +08:00
|
|
|
extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
|
2005-04-17 06:20:36 +08:00
|
|
|
extern void scsi_run_host_queues(struct Scsi_Host *shost);
|
2016-08-30 19:26:00 +08:00
|
|
|
extern void scsi_requeue_run_queue(struct work_struct *work);
|
2014-01-17 19:06:53 +08:00
|
|
|
extern struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev);
|
2017-06-03 05:21:56 +08:00
|
|
|
extern void scsi_start_queue(struct scsi_device *sdev);
|
2014-01-17 19:06:53 +08:00
|
|
|
extern int scsi_mq_setup_tags(struct Scsi_Host *shost);
|
|
|
|
extern void scsi_mq_destroy_tags(struct Scsi_Host *shost);
|
2005-04-17 06:20:36 +08:00
|
|
|
extern int scsi_init_queue(void);
|
|
|
|
extern void scsi_exit_queue(void);
|
2016-08-30 19:26:00 +08:00
|
|
|
extern void scsi_evt_thread(struct work_struct *work);
|
2008-01-03 01:14:30 +08:00
|
|
|
struct request_queue;
|
|
|
|
struct request;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* scsi_proc.c */
|
|
|
|
#ifdef CONFIG_SCSI_PROC_FS
|
|
|
|
extern void scsi_proc_hostdir_add(struct scsi_host_template *);
|
|
|
|
extern void scsi_proc_hostdir_rm(struct scsi_host_template *);
|
|
|
|
extern void scsi_proc_host_add(struct Scsi_Host *);
|
|
|
|
extern void scsi_proc_host_rm(struct Scsi_Host *);
|
|
|
|
extern int scsi_init_procfs(void);
|
|
|
|
extern void scsi_exit_procfs(void);
|
|
|
|
#else
|
|
|
|
# define scsi_proc_hostdir_add(sht) do { } while (0)
|
|
|
|
# define scsi_proc_hostdir_rm(sht) do { } while (0)
|
|
|
|
# define scsi_proc_host_add(shost) do { } while (0)
|
|
|
|
# define scsi_proc_host_rm(shost) do { } while (0)
|
|
|
|
# define scsi_init_procfs() (0)
|
|
|
|
# define scsi_exit_procfs() do { } while (0)
|
|
|
|
#endif /* CONFIG_PROC_FS */
|
|
|
|
|
|
|
|
/* scsi_scan.c */
|
2014-04-11 06:30:35 +08:00
|
|
|
extern char scsi_scan_type[];
|
[SCSI] scsi_pm: Fix bug in the SCSI power management handler
This patch (as1520) fixes a bug in the SCSI layer's power management
implementation.
LUN scanning can be carried out asynchronously in do_scan_async(), and
sd uses an asynchronous thread for the time-consuming parts of disk
probing in sd_probe_async(). Currently nothing coordinates these
async threads with system sleep transitions; they can and do attempt
to continue scanning/probing SCSI devices even after the host adapter
has been suspended. As one might expect, the outcome is not ideal.
This is what the "prepare" stage of system suspend was created for.
After the prepare callback has been called for a host, target, or
device, drivers are not allowed to register any children underneath
them. Currently the SCSI prepare callback is not implemented; this
patch rectifies that omission.
For SCSI hosts, the prepare routine calls scsi_complete_async_scans()
to wait until async scanning is finished. It might be slightly more
efficient to wait only until the host in question has been scanned,
but there's currently no way to do that. Besides, during a sleep
transition we will ultimately have to wait until all the host scanning
has finished anyway.
For SCSI devices, the prepare routine calls async_synchronize_full()
to wait until sd probing is finished. The routine does nothing for
SCSI targets, because asynchronous target scanning is done only as
part of host scanning.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@kernel.org>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-02-18 05:25:08 +08:00
|
|
|
extern int scsi_complete_async_scans(void);
|
2005-04-17 06:20:36 +08:00
|
|
|
extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int,
|
2016-03-17 15:39:45 +08:00
|
|
|
unsigned int, u64, enum scsi_scan_mode);
|
2005-04-17 06:20:36 +08:00
|
|
|
extern void scsi_forget_host(struct Scsi_Host *);
|
|
|
|
extern void scsi_rescan_device(struct device *);
|
|
|
|
|
|
|
|
/* scsi_sysctl.c */
|
|
|
|
#ifdef CONFIG_SYSCTL
|
|
|
|
extern int scsi_init_sysctl(void);
|
|
|
|
extern void scsi_exit_sysctl(void);
|
|
|
|
#else
|
|
|
|
# define scsi_init_sysctl() (0)
|
|
|
|
# define scsi_exit_sysctl() do { } while (0)
|
|
|
|
#endif /* CONFIG_SYSCTL */
|
|
|
|
|
|
|
|
/* scsi_sysfs.c */
|
|
|
|
extern int scsi_sysfs_add_sdev(struct scsi_device *);
|
|
|
|
extern int scsi_sysfs_add_host(struct Scsi_Host *);
|
|
|
|
extern int scsi_sysfs_register(void);
|
|
|
|
extern void scsi_sysfs_unregister(void);
|
|
|
|
extern void scsi_sysfs_device_initialize(struct scsi_device *);
|
|
|
|
extern int scsi_sysfs_target_initialize(struct scsi_device *);
|
|
|
|
extern struct scsi_transport_template blank_transport_template;
|
2005-07-26 22:20:53 +08:00
|
|
|
extern void __scsi_remove_device(struct scsi_device *);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
extern struct bus_type scsi_bus_type;
|
2009-06-25 01:06:31 +08:00
|
|
|
extern const struct attribute_group *scsi_sysfs_shost_attr_groups[];
|
2005-04-17 06:20:36 +08:00
|
|
|
|
[SCSI] SCSI and FC Transport: add netlink support for posting of transport events
This patch formally adds support for the posting of FC events via netlink.
It is a followup to the original RFC at:
http://marc.theaimsgroup.com/?l=linux-scsi&m=114530667923464&w=2
and the initial posting at:
http://marc.theaimsgroup.com/?l=linux-scsi&m=115507374832500&w=2
The patch has been updated to optimize the send path, per the discussions
in the initial posting.
Per discussions at the Storage Summit and at OLS, we are to use netlink for
async events from transports. Also per discussions, to avoid a netlink
protocol per transport, I've create a single NETLINK_SCSITRANSPORT protocol,
which can then be used by all transports.
This patch:
- Creates new files scsi_netlink.c and scsi_netlink.h, which contains the
single and shared definitions for the SCSI Transport. It is tied into the
base SCSI subsystem intialization.
Contains a single interface routine, scsi_send_transport_event(), for a
transport to send an event (via multicast to a protocol specific group).
- Creates a new scsi_netlink_fc.h file, which contains the FC netlink event
messages
- Adds 3 new routines to the fc transport:
fc_get_event_number() - to get a FC event #
fc_host_post_event() - to send a simple FC event (32 bits of data)
fc_host_post_vendor_event() - to send a Vendor unique event, with
arbitrary amounts of data.
Note: the separation of event number allows for a LLD to send a standard
event, followed by vendor-specific data for the event.
Note: This patch assumes 2 prior fc transport patches have been installed:
http://marc.theaimsgroup.com/?l=linux-scsi&m=115555807316329&w=2
http://marc.theaimsgroup.com/?l=linux-scsi&m=115581614930261&w=2
Sorry - next time I'll do something like making these individual
patches of the same posting when I know they'll be posted closely
together.
Signed-off-by: James Smart <James.Smart@emulex.com>
Tidy up configuration not to make SCSI always select NET
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-08-19 05:30:09 +08:00
|
|
|
/* scsi_netlink.c */
|
|
|
|
#ifdef CONFIG_SCSI_NETLINK
|
|
|
|
extern void scsi_netlink_init(void);
|
|
|
|
extern void scsi_netlink_exit(void);
|
|
|
|
extern struct sock *scsi_nl_sock;
|
|
|
|
#else
|
|
|
|
static inline void scsi_netlink_init(void) {}
|
|
|
|
static inline void scsi_netlink_exit(void) {}
|
|
|
|
#endif
|
|
|
|
|
2010-06-17 22:36:49 +08:00
|
|
|
/* scsi_pm.c */
|
2011-02-11 07:06:54 +08:00
|
|
|
#ifdef CONFIG_PM
|
2010-06-17 22:36:49 +08:00
|
|
|
extern const struct dev_pm_ops scsi_bus_pm_ops;
|
2014-12-15 06:13:55 +08:00
|
|
|
|
[SCSI] implement runtime Power Management
This patch (as1398b) adds runtime PM support to the SCSI layer. Only
the machanism is provided; use of it is up to the various high-level
drivers, and the patch doesn't change any of them. Except for sg --
the patch expicitly prevents a device from being runtime-suspended
while its sg device file is open.
The implementation is simplistic. In general, hosts and targets are
automatically suspended when all their children are asleep, but for
them the runtime-suspend code doesn't actually do anything. (A host's
runtime PM status is propagated up the device tree, though, so a
runtime-PM-aware lower-level driver could power down the host adapter
hardware at the appropriate times.) There are comments indicating
where a transport class might be notified or some other hooks added.
LUNs are runtime-suspended by calling the drivers' existing suspend
handlers (and likewise for runtime-resume). Somewhat arbitrarily, the
implementation delays for 100 ms before suspending an eligible LUN.
This is because there typically are occasions during bootup when the
same device file is opened and closed several times in quick
succession.
The way this all works is that the SCSI core increments a device's
PM-usage count when it is registered. If a high-level driver does
nothing then the device will not be eligible for runtime-suspend
because of the elevated usage count. If a high-level driver wants to
use runtime PM then it can call scsi_autopm_put_device() in its probe
routine to decrement the usage count and scsi_autopm_get_device() in
its remove routine to restore the original count.
Hosts, targets, and LUNs are not suspended while they are being probed
or removed, or while the error handler is running. In fact, a fairly
large part of the patch consists of code to make sure that things
aren't suspended at such times.
[jejb: fix up compile issues in PM config variations]
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-06-17 22:41:42 +08:00
|
|
|
extern void scsi_autopm_get_target(struct scsi_target *);
|
|
|
|
extern void scsi_autopm_put_target(struct scsi_target *);
|
|
|
|
extern int scsi_autopm_get_host(struct Scsi_Host *);
|
|
|
|
extern void scsi_autopm_put_host(struct Scsi_Host *);
|
|
|
|
#else
|
|
|
|
static inline void scsi_autopm_get_target(struct scsi_target *t) {}
|
|
|
|
static inline void scsi_autopm_put_target(struct scsi_target *t) {}
|
|
|
|
static inline int scsi_autopm_get_host(struct Scsi_Host *h) { return 0; }
|
|
|
|
static inline void scsi_autopm_put_host(struct Scsi_Host *h) {}
|
2014-12-15 06:13:55 +08:00
|
|
|
#endif /* CONFIG_PM */
|
2010-06-17 22:36:49 +08:00
|
|
|
|
2014-04-11 06:30:35 +08:00
|
|
|
extern struct async_domain scsi_sd_pm_domain;
|
2012-03-23 08:05:11 +08:00
|
|
|
|
2015-08-27 20:16:57 +08:00
|
|
|
/* scsi_dh.c */
|
|
|
|
#ifdef CONFIG_SCSI_DH
|
2017-09-20 15:18:52 +08:00
|
|
|
void scsi_dh_add_device(struct scsi_device *sdev);
|
2015-10-06 12:32:57 +08:00
|
|
|
void scsi_dh_release_device(struct scsi_device *sdev);
|
2015-08-27 20:16:57 +08:00
|
|
|
#else
|
2017-09-20 15:18:52 +08:00
|
|
|
static inline void scsi_dh_add_device(struct scsi_device *sdev) { }
|
2015-10-06 12:32:57 +08:00
|
|
|
static inline void scsi_dh_release_device(struct scsi_device *sdev) { }
|
2015-08-27 20:16:57 +08:00
|
|
|
#endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* internal scsi timeout functions: for use by mid-layer and transport
|
|
|
|
* classes.
|
|
|
|
*/
|
|
|
|
|
2006-05-17 04:13:36 +08:00
|
|
|
#define SCSI_DEVICE_BLOCK_MAX_TIMEOUT 600 /* units in seconds */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#endif /* _SCSI_PRIV_H */
|