Commit 21eb047c authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] split private and public scsi headers

Two new headers:

  scsi_priv.h - for macros/declarations private to the scsi midlayer
		  (= not EXPORT_SYMBOL()ed)
  scsi_logging.h - for SCSI_LOG_* and friends, semi-private to the
  		midlayer and the upper drivers.  One abuse of this
		in dpt_i2o killed.
parent 30ec75cc
...@@ -2495,8 +2495,6 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba) ...@@ -2495,8 +2495,6 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
pDev->pScsi_dev->online = FALSE; pDev->pScsi_dev->online = FALSE;
if (pDev->pScsi_dev->access_count) { if (pDev->pScsi_dev->access_count) {
// A drive that was mounted is no longer there... bad! // A drive that was mounted is no longer there... bad!
SCSI_LOG_ERROR_RECOVERY(1, printk ("%s:Rescan: Previously "
"mounted drive not found!\n",pHba->name));
printk(KERN_WARNING"%s:Mounted drive taken offline\n",pHba->name); printk(KERN_WARNING"%s:Mounted drive taken offline\n",pHba->name);
} }
} }
......
...@@ -32,20 +32,20 @@ ...@@ -32,20 +32,20 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/proc_fs.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/completion.h> #include <linux/completion.h>
#define __KERNEL_SYSCALLS__
#include <linux/unistd.h> #include <linux/unistd.h>
#include <asm/dma.h> #include <asm/dma.h>
#include "scsi.h" #include "scsi.h"
#include "hosts.h" #include "hosts.h"
#include "scsi_priv.h"
#include "scsi_logging.h"
static LIST_HEAD(scsi_host_list); static LIST_HEAD(scsi_host_list);
static spinlock_t scsi_host_list_lock = SPIN_LOCK_UNLOCKED; static spinlock_t scsi_host_list_lock = SPIN_LOCK_UNLOCKED;
......
...@@ -527,13 +527,6 @@ static inline struct device *scsi_get_device(struct Scsi_Host *shost) ...@@ -527,13 +527,6 @@ static inline struct device *scsi_get_device(struct Scsi_Host *shost)
return shost->host_gendev; return shost->host_gendev;
} }
/*
* Prototypes for functions/data in scsi_scan.c
*/
extern void scsi_scan_host(struct Scsi_Host *);
extern void scsi_forget_host(struct Scsi_Host *);
struct Scsi_Device_Template struct Scsi_Device_Template
{ {
struct list_head list; struct list_head list;
...@@ -572,16 +565,8 @@ extern int scsi_remove_host(struct Scsi_Host *); ...@@ -572,16 +565,8 @@ extern int scsi_remove_host(struct Scsi_Host *);
extern int scsi_register_host(Scsi_Host_Template *); extern int scsi_register_host(Scsi_Host_Template *);
extern int scsi_unregister_host(Scsi_Host_Template *); extern int scsi_unregister_host(Scsi_Host_Template *);
extern struct Scsi_Host *scsi_host_get_next(struct Scsi_Host *);
extern struct Scsi_Host *scsi_host_hn_get(unsigned short); extern struct Scsi_Host *scsi_host_hn_get(unsigned short);
extern void scsi_host_put(struct Scsi_Host *); extern void scsi_host_put(struct Scsi_Host *);
extern void scsi_host_init(void);
/*
* host_busy inc/dec/test functions
*/
extern void scsi_host_busy_inc(struct Scsi_Host *, Scsi_Device *);
extern void scsi_host_busy_dec_and_test(struct Scsi_Host *, Scsi_Device *);
/** /**
* scsi_find_device - find a device given the host * scsi_find_device - find a device given the host
...@@ -610,21 +595,3 @@ extern void scsi_upper_driver_unregister(struct Scsi_Device_Template *); ...@@ -610,21 +595,3 @@ extern void scsi_upper_driver_unregister(struct Scsi_Device_Template *);
extern struct device_class shost_devclass; extern struct device_class shost_devclass;
#endif #endif
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-indent-level: 4
* c-brace-imaginary-offset: 0
* c-brace-offset: -4
* c-argdecl-indent: 4
* c-label-offset: -4
* c-continued-statement-offset: 4
* c-continued-brace-offset: 0
* indent-tabs-mode: nil
* tab-width: 8
* End:
*/
...@@ -56,6 +56,9 @@ ...@@ -56,6 +56,9 @@
#include "scsi.h" #include "scsi.h"
#include "hosts.h" #include "hosts.h"
#include "scsi_priv.h"
#include "scsi_logging.h"
/* /*
* Definitions and constants. * Definitions and constants.
......
This diff is collapsed.
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <linux/version.h> #include <linux/version.h>
#endif #endif
#include "scsi_logging.h"
#include "scsi_debug.h" #include "scsi_debug.h"
static const char * scsi_debug_version_str = "Version: 1.69 (20030329)"; static const char * scsi_debug_version_str = "Version: 1.69 (20030329)";
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#include "scsi.h" #include "scsi.h"
#include "hosts.h" #include "hosts.h"
#include "scsi_priv.h"
#include "scsi_logging.h"
#ifdef DEBUG #ifdef DEBUG
#define SENSE_TIMEOUT SCSI_TIMEOUT #define SENSE_TIMEOUT SCSI_TIMEOUT
#else #else
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include "hosts.h" #include "hosts.h"
#include <scsi/scsi_ioctl.h> #include <scsi/scsi_ioctl.h>
#include "scsi_logging.h"
#define NORMAL_RETRIES 5 #define NORMAL_RETRIES 5
#define IOCTL_NORMAL_TIMEOUT (10 * HZ) #define IOCTL_NORMAL_TIMEOUT (10 * HZ)
#define FORMAT_UNIT_TIMEOUT (2 * 60 * 60 * HZ) #define FORMAT_UNIT_TIMEOUT (2 * 60 * 60 * HZ)
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
#include "scsi.h" #include "scsi.h"
#include "hosts.h" #include "hosts.h"
#include "scsi_priv.h"
#include "scsi_logging.h"
#define SG_MEMPOOL_NR 5 #define SG_MEMPOOL_NR 5
#define SG_MEMPOOL_SIZE 32 #define SG_MEMPOOL_SIZE 32
......
#ifndef _SCSI_LOGGING_H
#define _SCSI_LOGGING_H
#include <linux/config.h>
/*
* This defines the scsi logging feature. It is a means by which the user
* can select how much information they get about various goings on, and it
* can be really useful for fault tracing. The logging word is divided into
* 8 nibbles, each of which describes a loglevel. The division of things is
* somewhat arbitrary, and the division of the word could be changed if it
* were really needed for any reason. The numbers below are the only place
* where these are specified. For a first go-around, 3 bits is more than
* enough, since this gives 8 levels of logging (really 7, since 0 is always
* off). Cutting to 2 bits might be wise at some point.
*/
#define SCSI_LOG_ERROR_SHIFT 0
#define SCSI_LOG_TIMEOUT_SHIFT 3
#define SCSI_LOG_SCAN_SHIFT 6
#define SCSI_LOG_MLQUEUE_SHIFT 9
#define SCSI_LOG_MLCOMPLETE_SHIFT 12
#define SCSI_LOG_LLQUEUE_SHIFT 15
#define SCSI_LOG_LLCOMPLETE_SHIFT 18
#define SCSI_LOG_HLQUEUE_SHIFT 21
#define SCSI_LOG_HLCOMPLETE_SHIFT 24
#define SCSI_LOG_IOCTL_SHIFT 27
#define SCSI_LOG_ERROR_BITS 3
#define SCSI_LOG_TIMEOUT_BITS 3
#define SCSI_LOG_SCAN_BITS 3
#define SCSI_LOG_MLQUEUE_BITS 3
#define SCSI_LOG_MLCOMPLETE_BITS 3
#define SCSI_LOG_LLQUEUE_BITS 3
#define SCSI_LOG_LLCOMPLETE_BITS 3
#define SCSI_LOG_HLQUEUE_BITS 3
#define SCSI_LOG_HLCOMPLETE_BITS 3
#define SCSI_LOG_IOCTL_BITS 3
#ifdef CONFIG_SCSI_LOGGING
extern unsigned int scsi_logging_level;
#define SCSI_CHECK_LOGGING(SHIFT, BITS, LEVEL, CMD) \
{ \
unsigned int mask = (1 << (BITS)) - 1; \
if (((scsi_logging_level >> (SHIFT)) & mask) > (LEVEL)) \
(CMD); \
}
#define SCSI_SET_LOGGING(SHIFT, BITS, LEVEL) \
{ \
unsigned int mask = ((1 << (BITS)) - 1) << SHIFT; \
scsi_logging_level = ((scsi_logging_level & ~mask) \
| ((LEVEL << SHIFT) & mask)); \
}
#else
/*
* With no logging enabled, stub these out so they don't do anything.
*/
#define SCSI_CHECK_LOGGING(SHIFT, BITS, LEVEL, CMD)
#define SCSI_SET_LOGGING(SHIFT, BITS, LEVEL)
#endif /* CONFIG_SCSI_LOGGING */
/*
* These are the macros that are actually used throughout the code to
* log events. If logging isn't enabled, they are no-ops and will be
* completely absent from the user's code.
*
* The 'set' versions of the macros are really intended to only be called
* from the /proc filesystem, and in production kernels this will be about
* all that is ever used. It could be useful in a debugging environment to
* bump the logging level when certain strange events are detected, however.
*/
#define SCSI_LOG_ERROR_RECOVERY(LEVEL,CMD) \
SCSI_CHECK_LOGGING(SCSI_LOG_ERROR_SHIFT, SCSI_LOG_ERROR_BITS, LEVEL,CMD);
#define SCSI_LOG_TIMEOUT(LEVEL,CMD) \
SCSI_CHECK_LOGGING(SCSI_LOG_TIMEOUT_SHIFT, SCSI_LOG_TIMEOUT_BITS, LEVEL,CMD);
#define SCSI_LOG_SCAN_BUS(LEVEL,CMD) \
SCSI_CHECK_LOGGING(SCSI_LOG_SCAN_SHIFT, SCSI_LOG_SCAN_BITS, LEVEL,CMD);
#define SCSI_LOG_MLQUEUE(LEVEL,CMD) \
SCSI_CHECK_LOGGING(SCSI_LOG_MLQUEUE_SHIFT, SCSI_LOG_MLQUEUE_BITS, LEVEL,CMD);
#define SCSI_LOG_MLCOMPLETE(LEVEL,CMD) \
SCSI_CHECK_LOGGING(SCSI_LOG_MLCOMPLETE_SHIFT, SCSI_LOG_MLCOMPLETE_BITS, LEVEL,CMD);
#define SCSI_LOG_LLQUEUE(LEVEL,CMD) \
SCSI_CHECK_LOGGING(SCSI_LOG_LLQUEUE_SHIFT, SCSI_LOG_LLQUEUE_BITS, LEVEL,CMD);
#define SCSI_LOG_LLCOMPLETE(LEVEL,CMD) \
SCSI_CHECK_LOGGING(SCSI_LOG_LLCOMPLETE_SHIFT, SCSI_LOG_LLCOMPLETE_BITS, LEVEL,CMD);
#define SCSI_LOG_HLQUEUE(LEVEL,CMD) \
SCSI_CHECK_LOGGING(SCSI_LOG_HLQUEUE_SHIFT, SCSI_LOG_HLQUEUE_BITS, LEVEL,CMD);
#define SCSI_LOG_HLCOMPLETE(LEVEL,CMD) \
SCSI_CHECK_LOGGING(SCSI_LOG_HLCOMPLETE_SHIFT, SCSI_LOG_HLCOMPLETE_BITS, LEVEL,CMD);
#define SCSI_LOG_IOCTL(LEVEL,CMD) \
SCSI_CHECK_LOGGING(SCSI_LOG_IOCTL_SHIFT, SCSI_LOG_IOCTL_BITS, LEVEL,CMD);
#define SCSI_SET_ERROR_RECOVERY_LOGGING(LEVEL) \
SCSI_SET_LOGGING(SCSI_LOG_ERROR_SHIFT, SCSI_LOG_ERROR_BITS, LEVEL);
#define SCSI_SET_TIMEOUT_LOGGING(LEVEL) \
SCSI_SET_LOGGING(SCSI_LOG_TIMEOUT_SHIFT, SCSI_LOG_TIMEOUT_BITS, LEVEL);
#define SCSI_SET_SCAN_BUS_LOGGING(LEVEL) \
SCSI_SET_LOGGING(SCSI_LOG_SCAN_SHIFT, SCSI_LOG_SCAN_BITS, LEVEL);
#define SCSI_SET_MLQUEUE_LOGGING(LEVEL) \
SCSI_SET_LOGGING(SCSI_LOG_MLQUEUE_SHIFT, SCSI_LOG_MLQUEUE_BITS, LEVEL);
#define SCSI_SET_MLCOMPLETE_LOGGING(LEVEL) \
SCSI_SET_LOGGING(SCSI_LOG_MLCOMPLETE_SHIFT, SCSI_LOG_MLCOMPLETE_BITS, LEVEL);
#define SCSI_SET_LLQUEUE_LOGGING(LEVEL) \
SCSI_SET_LOGGING(SCSI_LOG_LLQUEUE_SHIFT, SCSI_LOG_LLQUEUE_BITS, LEVEL);
#define SCSI_SET_LLCOMPLETE_LOGGING(LEVEL) \
SCSI_SET_LOGGING(SCSI_LOG_LLCOMPLETE_SHIFT, SCSI_LOG_LLCOMPLETE_BITS, LEVEL);
#define SCSI_SET_HLQUEUE_LOGGING(LEVEL) \
SCSI_SET_LOGGING(SCSI_LOG_HLQUEUE_SHIFT, SCSI_LOG_HLQUEUE_BITS, LEVEL);
#define SCSI_SET_HLCOMPLETE_LOGGING(LEVEL) \
SCSI_SET_LOGGING(SCSI_LOG_HLCOMPLETE_SHIFT, SCSI_LOG_HLCOMPLETE_BITS, LEVEL);
#define SCSI_SET_IOCTL_LOGGING(LEVEL) \
SCSI_SET_LOGGING(SCSI_LOG_IOCTL_SHIFT, SCSI_LOG_IOCTL_BITS, LEVEL);
#endif /* _SCSI_LOGGING_H */
#ifndef _SCSI_PRIV_H
#define _SCSI_PRIV_H
/*
* These are the values that the owner field can take.
* They are used as an indication of who the command belongs to.
*/
#define SCSI_OWNER_HIGHLEVEL 0x100
#define SCSI_OWNER_MIDLEVEL 0x101
#define SCSI_OWNER_LOWLEVEL 0x102
#define SCSI_OWNER_ERROR_HANDLER 0x103
#define SCSI_OWNER_BH_HANDLER 0x104
#define SCSI_OWNER_NOBODY 0x105
/*
* Magic values for certain scsi structs. Shouldn't ever be used.
*/
#define SCSI_CMND_MAGIC 0xE25C23A5
#define SCSI_REQ_MAGIC 0x75F6D354
/*
* Flag bit for the internal_timeout array
*/
#define NORMAL_TIMEOUT 0
/*
* Scsi Error Handler Flags
*/
#define scsi_eh_eflags_chk(scp, flags) \
((scp)->eh_eflags & (flags))
#define scsi_eh_eflags_set(scp, flags) \
do { (scp)->eh_eflags |= (flags); } while(0)
#define scsi_eh_eflags_clr(scp, flags) \
do { (scp)->eh_eflags &= ~(flags); } while(0)
#define scsi_eh_eflags_clr_all(scp) \
(scp->eh_eflags = 0)
#define SCSI_EH_CANCEL_CMD 0x0001 /* Cancel this cmd */
#define SCSI_EH_REC_TIMEOUT 0x0002 /* EH retry timed out */
#define SCSI_SENSE_VALID(scmd) \
(((scmd)->sense_buffer[0] & 0x70) == 0x70)
/*
* scsi_target: representation of a scsi target, for now, this is only
* used for single_lun devices. If no one has active IO to the target,
* starget_sdev_user is NULL, else it points to the active sdev.
*/
struct scsi_target {
struct scsi_device *starget_sdev_user;
unsigned int starget_refcnt;
};
/* hosts.c */
extern void scsi_host_busy_inc(struct Scsi_Host *, Scsi_Device *);
extern void scsi_host_busy_dec_and_test(struct Scsi_Host *, Scsi_Device *);
extern struct Scsi_Host *scsi_host_get_next(struct Scsi_Host *);
extern void scsi_host_init(void);
/* scsi.c */
extern int scsi_dispatch_cmd(struct scsi_cmnd *cmd);
extern int scsi_setup_command_freelist(struct Scsi_Host *shost);
extern void scsi_destroy_command_freelist(struct Scsi_Host *shost);
extern void scsi_done(struct scsi_cmnd *cmd);
extern void scsi_finish_command(struct scsi_cmnd *cmd);
extern int scsi_retry_command(struct scsi_cmnd *cmd);
extern int scsi_attach_device(struct scsi_device *sdev);
extern void scsi_detach_device(struct scsi_device *sdev);
extern void scsi_rescan_device(struct scsi_device *sdev);
extern int scsi_get_device_flags(unsigned char *vendor, unsigned char *model);
extern int scsi_insert_special_req(struct scsi_request *sreq, int);
extern void scsi_init_cmd_from_req(struct scsi_cmnd *cmd,
struct scsi_request *sreq);
/* scsi_error.c */
extern void scsi_times_out(struct scsi_cmnd *cmd);
extern void scsi_error_handler(void *host);
extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
extern int scsi_eh_scmd_add(struct scsi_cmnd *, int);
/* scsi_lib.c */
extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
extern void scsi_setup_cmd_retry(struct scsi_cmnd *cmd);
extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
extern void scsi_queue_next_request(struct request_queue *q,
struct scsi_cmnd *cmd);
extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
extern void scsi_free_queue(struct request_queue *q);
extern int scsi_init_queue(void);
extern void scsi_exit_queue(void);
/* scsi_proc.c */
#ifdef CONFIG_PROC_FS
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_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 */
extern void scsi_scan_host(struct Scsi_Host *shost);
extern void scsi_forget_host(struct Scsi_Host *shost);
/* scsi_sysfs.c */
extern int scsi_device_register(struct scsi_device *);
extern void scsi_device_unregister(struct scsi_device *);
extern int scsi_upper_driver_register(struct Scsi_Device_Template *);
extern void scsi_upper_driver_unregister(struct Scsi_Device_Template *);
extern int scsi_sysfs_register(void);
extern void scsi_sysfs_unregister(void);
/*
* dev_info: for the black/white list in the old scsi_static_device_list
*/
struct dev_info {
char *vendor;
char *model;
char *revision; /* revision known to be bad, unused */
unsigned flags;
};
extern struct dev_info scsi_static_device_list[];
/*
* 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];
unsigned flags;
unsigned compatible; /* for use with scsi_static_device_list entries */
};
extern struct list_head scsi_dev_info_list;
extern int scsi_dev_info_list_add_str(char *);
#endif /* _SCSI_PRIV_H */
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
#include "scsi.h" #include "scsi.h"
#include "hosts.h" #include "hosts.h"
#include "scsi_priv.h"
#include "scsi_logging.h"
/* 4K page size, but our output routines, use some slack for overruns */ /* 4K page size, but our output routines, use some slack for overruns */
#define PROC_BLOCK_SIZE (3*1024) #define PROC_BLOCK_SIZE (3*1024)
......
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
#include "scsi.h" #include "scsi.h"
#include "hosts.h" #include "hosts.h"
#ifdef CONFIG_KMOD #include "scsi_priv.h"
#include <linux/kmod.h> #include "scsi_logging.h"
#endif
/* /*
* Flags for SCSI devices that need special treatment * Flags for SCSI devices that need special treatment
......
...@@ -104,8 +104,6 @@ EXPORT_SYMBOL(scsi_calculate_bounce_limit); ...@@ -104,8 +104,6 @@ EXPORT_SYMBOL(scsi_calculate_bounce_limit);
/* /*
* Externalize timers so that HBAs can safely start/restart commands. * Externalize timers so that HBAs can safely start/restart commands.
*/ */
extern void scsi_add_timer(Scsi_Cmnd *, int, void ((*) (Scsi_Cmnd *)));
extern int scsi_delete_timer(Scsi_Cmnd *);
EXPORT_SYMBOL(scsi_add_timer); EXPORT_SYMBOL(scsi_add_timer);
EXPORT_SYMBOL(scsi_delete_timer); EXPORT_SYMBOL(scsi_delete_timer);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "scsi.h" #include "scsi.h"
#include "hosts.h" #include "hosts.h"
#include "scsi_priv.h"
/* /*
* shost_show_function: macro to create an attr function that can be used to * shost_show_function: macro to create an attr function that can be used to
......
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
#include <scsi/scsi_ioctl.h> #include <scsi/scsi_ioctl.h>
#include <scsi/scsicam.h> #include <scsi/scsicam.h>
#include "scsi_logging.h"
/* /*
* Remaining dev_t-handling stuff * Remaining dev_t-handling stuff
*/ */
......
...@@ -67,6 +67,8 @@ static int sg_version_num = 30528; /* 2 digits for each component */ ...@@ -67,6 +67,8 @@ static int sg_version_num = 30528; /* 2 digits for each component */
#include <scsi/scsi_ioctl.h> #include <scsi/scsi_ioctl.h>
#include <scsi/sg.h> #include <scsi/sg.h>
#include "scsi_logging.h"
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
static int sg_proc_init(void); static int sg_proc_init(void);
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "hosts.h" #include "hosts.h"
#include <scsi/scsi_ioctl.h> /* For the door lock/unlock commands */ #include <scsi/scsi_ioctl.h> /* For the door lock/unlock commands */
#include "scsi_logging.h"
#include "sr.h" #include "sr.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment