Commit 8428b10d authored by James Bottomley's avatar James Bottomley

Merge mulgrave.(none):/home/jejb/BK/scsi-host-list-2.5

into mulgrave.(none):/home/jejb/BK/scsi-for-linus-2.5
parents 40ea4c83 209287fb
......@@ -3010,14 +3010,12 @@ int acornscsi_proc_info(char *buffer, char **start, off_t offset,
int length, int host_no, int inout)
{
int pos, begin = 0, devidx;
struct Scsi_Host *instance = scsi_hostlist;
struct Scsi_Host *instance;
Scsi_Device *scd;
AS_Host *host;
char *p = buffer;
for (instance = scsi_hostlist;
instance && instance->host_no != host_no;
instance = instance->next);
instance = scsi_host_hn_get(host_no);
if (inout == 1 || !instance)
return -EINVAL;
......
......@@ -384,15 +384,11 @@ int arxescsi_proc_info(char *buffer, char **start, off_t offset,
int length, int host_no, int inout)
{
int pos, begin;
struct Scsi_Host *host = scsi_hostlist;
struct Scsi_Host *host;
ARXEScsi_Info *info;
Scsi_Device *scd;
while (host) {
if (host->host_no == host_no)
break;
host = host->next;
}
host = scsi_host_hn_get(host_no);
if (!host)
return 0;
......
......@@ -498,15 +498,11 @@ int cumanascsi_2_proc_info (char *buffer, char **start, off_t offset,
int length, int host_no, int inout)
{
int pos, begin;
struct Scsi_Host *host = scsi_hostlist;
struct Scsi_Host *host;
CumanaScsi2_Info *info;
Scsi_Device *scd;
while (host) {
if (host->host_no == host_no)
break;
host = host->next;
}
host = scsi_host_hn_get(host_no);
if (!host)
return 0;
......
......@@ -499,15 +499,11 @@ int eesoxscsi_proc_info(char *buffer, char **start, off_t offset,
int length, int host_no, int inout)
{
int pos, begin;
struct Scsi_Host *host = scsi_hostlist;
struct Scsi_Host *host;
EESOXScsi_Info *info;
Scsi_Device *scd;
while (host) {
if (host->host_no == host_no)
break;
host = host->next;
}
host = scsi_host_hn_get(host_no);
if (!host)
return 0;
......
......@@ -404,15 +404,11 @@ int powertecscsi_proc_info(char *buffer, char **start, off_t offset,
int length, int host_no, int inout)
{
int pos, begin;
struct Scsi_Host *host = scsi_hostlist;
struct Scsi_Host *host;
PowerTecScsi_Info *info;
Scsi_Device *scd;
while (host) {
if (host->host_no == host_no)
break;
host = host->next;
}
host = scsi_host_hn_get(host_no);
if (!host)
return 0;
......
......@@ -1250,8 +1250,6 @@ cciss_scsi_user_command(int ctlr, int hostno, char *buffer, int length)
return length;
}
/* It's a pity that we need this, but, we do... */
extern struct Scsi_Host *scsi_hostlist; /* from ../scsi/hosts.c */
int
cciss_scsi_proc_info(char *buffer, /* data buffer */
......@@ -1268,24 +1266,9 @@ cciss_scsi_proc_info(char *buffer, /* data buffer */
ctlr_info_t *ci;
int cntl_num;
/* Lets see if we can find our Scsi_Host...
this might be kind of "bad", searching scis_hostlist this way
but how else can we find the scsi host? I think I've seen
this coded both ways, (circular list and null terminated list)
I coded it to work either way, since I wasn't sure. */
sh = scsi_hostlist;
found=0;
do {
if (sh == NULL) break;
if (sh->host_no == hostnum) {
found++;
break;
}
sh = sh->next;
} while (sh != scsi_hostlist && sh != NULL);
if (sh == NULL || found == 0) /* This really shouldn't ever happen. */
sh = scsi_host_hn_get(hostnum);
if (sh == NULL) /* This really shouldn't ever happen. */
return -EINVAL;
ci = (ctlr_info_t *) sh->hostdata[0];
......
......@@ -1723,13 +1723,11 @@ NCR_700_proc_directory_info(char *proc_buf, char **startp,
{
static char buf[4096]; /* 1 page should be sufficient */
int len = 0;
struct Scsi_Host *host = scsi_hostlist;
struct Scsi_Host *host;
struct NCR_700_Host_Parameters *hostdata;
Scsi_Device *SDp;
while(host != NULL && host->host_no != host_no)
host = host->next;
host = scsi_host_hn_get(host_no);
if(host == NULL)
return 0;
......
......@@ -63,7 +63,6 @@ int ahc_linux_abort(Scsi_Cmnd *);
* to do with card config are filled in after the card is detected.
*/
#define AIC7XXX { \
next: NULL, \
module: NULL, \
proc_dir: NULL, \
proc_info: ahc_linux_proc_info, \
......
......@@ -938,9 +938,7 @@ int cpqfcTS_proc_info (char *buffer, char **start, off_t offset, int length,
char buf[81];
// Search the Scsi host list for our controller
for (host=scsi_hostlist; host; host=host->next)
if (host->host_no == hostno)
break;
host = scsi_host_hn_get(hostno);
if (!host) return -ESRCH;
......
......@@ -213,9 +213,7 @@ int fcal_proc_info (char *buffer, char **start, off_t offset, int length, int ho
char *pos = buffer;
int i, j;
for (host=scsi_hostlist; host; host=host->next)
if (host->host_no == hostno)
break;
host = scsi_host_hn_get(hostno);
if (!host) return -ESRCH;
......
This diff is collapsed.
......@@ -16,15 +16,14 @@
* of the same type.
*
* Jiffies wrap fixes (host->resetting), 3 Dec 1998 Andrea Arcangeli
*
* Restructured scsi_host lists and associated functions.
* September 04, 2002 Mike Anderson (andmike@us.ibm.com)
*/
#ifndef _HOSTS_H
#define _HOSTS_H
/*
$Header: /vger/u4/cvs/linux/drivers/scsi/hosts.h,v 1.6 1997/01/19 23:07:13 davem Exp $
*/
#include <linux/config.h>
#include <linux/proc_fs.h>
#include <linux/pci.h>
......@@ -58,8 +57,7 @@ typedef struct scsi_disk Disk;
typedef struct SHT
{
/* Used with loadable modules so we can construct a linked list. */
struct SHT * next;
struct list_head shtp_list;
/* Used with loadable modules so that we know when it is safe to unload */
struct module * module;
......@@ -374,7 +372,7 @@ struct Scsi_Host
* This information is private to the scsi mid-layer. Wrapping it in a
* struct private is a way of marking it in a sort of C++ type of way.
*/
struct Scsi_Host * next;
struct list_head sh_list;
Scsi_Device * host_queue;
struct list_head all_scsi_hosts;
struct list_head my_devices;
......@@ -510,28 +508,26 @@ struct Scsi_Host
* thing. This physical pseudo-device isn't real and won't be available
* from any high-level drivers.
*/
extern void scsi_free_host_dev(Scsi_Device * SDpnt);
extern Scsi_Device * scsi_get_host_dev(struct Scsi_Host * SHpnt);
extern void scsi_free_host_dev(Scsi_Device *);
extern Scsi_Device * scsi_get_host_dev(struct Scsi_Host *);
extern void scsi_unblock_requests(struct Scsi_Host * SHpnt);
extern void scsi_block_requests(struct Scsi_Host * SHpnt);
extern void scsi_report_bus_reset(struct Scsi_Host * SHpnt, int channel);
extern void scsi_unblock_requests(struct Scsi_Host *);
extern void scsi_block_requests(struct Scsi_Host *);
extern void scsi_report_bus_reset(struct Scsi_Host *, int);
typedef struct SHN
{
struct SHN * next;
char * name;
unsigned short host_no;
unsigned short host_registered;
} Scsi_Host_Name;
{
struct list_head shn_list;
char *name;
unsigned short host_no;
unsigned short host_registered;
} Scsi_Host_Name;
extern Scsi_Host_Name * scsi_host_no_list;
extern struct Scsi_Host * scsi_hostlist;
extern struct Scsi_Device_Template * scsi_devicelist;
extern Scsi_Host_Template * scsi_hosts;
extern void build_proc_dir_entries(Scsi_Host_Template *);
extern void scsi_proc_host_mkdir(Scsi_Host_Template *);
extern void scsi_proc_host_add(struct Scsi_Host *);
extern void scsi_proc_host_rm(struct Scsi_Host *);
/*
* scsi_init initializes the scsi hosts.
......@@ -540,34 +536,33 @@ extern void build_proc_dir_entries(Scsi_Host_Template *);
extern int next_scsi_host;
unsigned int scsi_init(void);
extern struct Scsi_Host * scsi_register(Scsi_Host_Template *, int j);
extern void scsi_unregister(struct Scsi_Host * i);
extern void scsi_register_blocked_host(struct Scsi_Host * SHpnt);
extern void scsi_deregister_blocked_host(struct Scsi_Host * SHpnt);
extern struct Scsi_Host * scsi_register(Scsi_Host_Template *, int);
extern void scsi_unregister(struct Scsi_Host *);
extern void scsi_register_blocked_host(struct Scsi_Host *);
extern void scsi_deregister_blocked_host(struct Scsi_Host *);
static inline void scsi_assign_lock(struct Scsi_Host *host, spinlock_t *lock)
static inline void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock)
{
host->host_lock = lock;
shost->host_lock = lock;
}
static inline void scsi_set_pci_device(struct Scsi_Host *SHpnt,
static inline void scsi_set_pci_device(struct Scsi_Host *shost,
struct pci_dev *pdev)
{
SHpnt->pci_dev = pdev;
SHpnt->host_driverfs_dev.parent=&pdev->dev;
shost->pci_dev = pdev;
shost->host_driverfs_dev.parent=&pdev->dev;
/* register parent with driverfs */
device_register(&shost->host_driverfs_dev);
}
/*
* Prototypes for functions/data in scsi_scan.c
*/
extern void scan_scsis(struct Scsi_Host *shpnt,
uint hardcoded,
uint hchannel,
uint hid,
uint hlun);
extern void scan_scsis(struct Scsi_Host *, uint, uint, uint, uint);
extern void scsi_mark_host_reset(struct Scsi_Host *Host);
extern void scsi_mark_host_reset(struct Scsi_Host *);
#define BLANK_HOST {"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
......@@ -596,7 +591,7 @@ struct Scsi_Device_Template
struct device_driver scsi_driverfs_driver;
};
void scsi_initialize_queue(Scsi_Device * SDpnt, struct Scsi_Host * SHpnt);
void scsi_initialize_queue(Scsi_Device *, struct Scsi_Host *);
/*
......@@ -607,6 +602,12 @@ extern int scsi_unregister_device(struct Scsi_Device_Template *);
extern int scsi_register_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 void scsi_host_put(struct Scsi_Host *);
extern void scsi_host_hn_init(char *);
extern void scsi_host_hn_release(void);
/*
* host_busy inc/dec/test functions
*/
......@@ -614,7 +615,6 @@ 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 void scsi_host_failed_inc_and_test(struct Scsi_Host *);
/*
* This is an ugly hack. If we expect to be able to load devices at run time,
* we need to leave extra room in some of the data structures. Doing a
......@@ -643,21 +643,22 @@ extern void scsi_host_failed_inc_and_test(struct Scsi_Host *);
/**
* scsi_find_device - find a device given the host
* @shost: SCSI host pointer
* @channel: SCSI channel (zero if only one channel)
* @pun: SCSI target number (physical unit number)
* @lun: SCSI Logical Unit Number
**/
static inline Scsi_Device *scsi_find_device(struct Scsi_Host *host,
static inline Scsi_Device *scsi_find_device(struct Scsi_Host *shost,
int channel, int pun, int lun) {
Scsi_Device *SDpnt;
Scsi_Device *sdev;
for(SDpnt = host->host_queue;
SDpnt != NULL;
SDpnt = SDpnt->next)
if(SDpnt->channel == channel && SDpnt->id == pun
&& SDpnt->lun ==lun)
for (sdev = shost->host_queue;
sdev != NULL;
sdev = sdev->next)
if (sdev->channel == channel && sdev->id == pun
&& sdev->lun ==lun)
break;
return SDpnt;
return sdev;
}
#endif
......
......@@ -407,7 +407,6 @@
*/
#if LINUX_VERSION_CODE < LinuxVersionCode(2,4,0)
#define IPS { \
next : NULL, \
module : NULL, \
proc_info : NULL, \
proc_dir : NULL, \
......@@ -437,7 +436,6 @@
}
#elif LINUX_VERSION_CODE < LinuxVersionCode(2,5,0)
#define IPS { \
next : NULL, \
module : NULL, \
proc_info : NULL, \
name : NULL, \
......@@ -466,7 +464,6 @@
}
#else
#define IPS { \
next : NULL, \
module : NULL, \
proc_info : NULL, \
name : NULL, \
......
......@@ -294,7 +294,8 @@ static void aha152x_config_cs(dev_link_t *link)
tail = &link->dev;
info->ndev = 0;
for (host = scsi_hostlist; host; host = host->next)
for (host = scsi_host_get_next(NULL); host;
host = scsi_host_get_next(host))
if (host->hostt == &driver_template)
for (dev = host->host_queue; dev; dev = dev->next) {
u_long arg[2], id;
......
......@@ -258,7 +258,8 @@ static void fdomain_config(dev_link_t *link)
tail = &link->dev;
info->ndev = 0;
for (host = scsi_hostlist; host; host = host->next)
for (host = scsi_host_get_next(NULL); host;
host = scsi_host_get_next(host))
if (host->hostt == &driver_template)
for (dev = host->host_queue; dev; dev = dev->next) {
u_long arg[2], id;
......
......@@ -1520,7 +1520,8 @@ static void nsp_cs_config(dev_link_t *link)
DEBUG(0, "GET_SCSI_INFO\n");
tail = &link->dev;
info->ndev = 0;
for (host = scsi_hostlist; host != NULL; host = host->next) {
for (host = scsi_host_get_next(NULL); host;
host = scsi_host_get_next(host))
if (host->hostt == &driver_template) {
for (dev = host->host_queue; dev != NULL; dev = dev->next) {
u_long arg[2], id;
......
......@@ -281,7 +281,8 @@ static void qlogic_config(dev_link_t *link)
tail = &link->dev;
info->ndev = 0;
for (host = scsi_hostlist; host; host = host->next)
for (host = scsi_host_get_next(NULL); host;
host = scsi_host_get_next(host))
if (host->hostt == &driver_template)
for (dev = host->host_queue; dev; dev = dev->next) {
u_long arg[2], id;
......
This diff is collapsed.
......@@ -119,35 +119,44 @@ static int proc_scsi_write(struct file * file, const char * buf,
return(ret);
}
void build_proc_dir_entries(Scsi_Host_Template * tpnt)
void scsi_proc_host_mkdir(Scsi_Host_Template *shost_tp)
{
struct Scsi_Host *hpnt;
char name[10]; /* see scsi_unregister_host() */
tpnt->proc_dir = proc_mkdir(tpnt->proc_name, proc_scsi);
if (!tpnt->proc_dir) {
printk(KERN_ERR "Unable to proc_mkdir in scsi.c/build_proc_dir_entries");
shost_tp->proc_dir = proc_mkdir(shost_tp->proc_name, proc_scsi);
if (!shost_tp->proc_dir) {
printk(KERN_ERR "%s: proc_mkdir failed for %s\n",
__FUNCTION__, shost_tp->proc_name);
return;
}
tpnt->proc_dir->owner = tpnt->module;
hpnt = scsi_hostlist;
while (hpnt) {
if (tpnt == hpnt->hostt) {
struct proc_dir_entry *p;
sprintf(name,"%d",hpnt->host_no);
p = create_proc_read_entry(name,
S_IFREG | S_IRUGO | S_IWUSR,
tpnt->proc_dir,
proc_scsi_read,
(void *)hpnt);
if (!p)
panic("Not enough memory to register SCSI HBA in /proc/scsi !\n");
p->write_proc=proc_scsi_write;
p->owner = tpnt->module;
}
hpnt = hpnt->next;
shost_tp->proc_dir->owner = shost_tp->module;
}
void scsi_proc_host_add(struct Scsi_Host *shost)
{
char name[10];
struct proc_dir_entry *p;
sprintf(name,"%d",shost->host_no);
p = create_proc_read_entry(name,
S_IFREG | S_IRUGO | S_IWUSR,
shost->hostt->proc_dir,
proc_scsi_read,
(void *)shost);
if (!p) {
printk(KERN_ERR "%s: Failed to register host %d in"
"%s\n", __FUNCTION__, shost->host_no,
shost->hostt->proc_name);
} else {
p->write_proc=proc_scsi_write;
p->owner = shost->hostt->module;
}
}
void scsi_proc_host_rm(struct Scsi_Host *shost)
{
char name[10];
sprintf(name,"%d",shost->host_no);
remove_proc_entry(name, shost->hostt->proc_dir);
}
/*
......
......@@ -91,8 +91,9 @@ EXPORT_SYMBOL(scsi_reset_provider);
/*
* These are here only while I debug the rest of the scsi stuff.
*/
EXPORT_SYMBOL(scsi_hostlist);
EXPORT_SYMBOL(scsi_hosts);
EXPORT_SYMBOL(scsi_host_get_next);
EXPORT_SYMBOL(scsi_host_hn_get);
EXPORT_SYMBOL(scsi_host_put);
EXPORT_SYMBOL(scsi_devicelist);
EXPORT_SYMBOL(scsi_device_types);
......
......@@ -3103,7 +3103,8 @@ sg_proc_host_info(char *buffer, int *len, off_t * begin, off_t offset, int size)
struct Scsi_Host *shp;
int k;
for (k = 0, shp = scsi_hostlist; shp; shp = shp->next, ++k) {
for (k = 0, shp = scsi_host_get_next(NULL); shp;
shp = scsi_host_get_next(shp), ++k) {
for (; k < shp->host_no; ++k)
PRINT_PROC("-1\t-1\t-1\t-1\t-1\t-1\n");
PRINT_PROC("%u\t%hu\t%hd\t%hu\t%d\t%d\n",
......@@ -3147,7 +3148,8 @@ sg_proc_hoststrs_info(char *buffer, int *len, off_t * begin,
char buff[SG_MAX_HOST_STR_LEN];
char *cp;
for (k = 0, shp = scsi_hostlist; shp; shp = shp->next, ++k) {
for (k = 0, shp = scsi_host_get_next(NULL); shp;
shp = scsi_host_get_next(shp), ++k) {
for (; k < shp->host_no; ++k)
PRINT_PROC("<no active host>\n");
strncpy(buff, shp->hostt->info ? shp->hostt->info(shp) :
......
......@@ -1871,10 +1871,7 @@ Scsi_Cmnd *cmd;
int x,i;
static int stop = 0;
for (instance=scsi_hostlist; instance; instance=instance->next) {
if (instance->host_no == hn)
break;
}
instance = scsi_host_hn_get(hn);
if (!instance) {
printk("*** Hmm... Can't find host #%d!\n",hn);
return (-ESRCH);
......
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