git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
scsi
/
scsi_proc.c
diff --git
a/drivers/scsi/scsi_proc.c
b/drivers/scsi/scsi_proc.c
index
00e160a
..
524a5f7
100644
(file)
--- a/
drivers/scsi/scsi_proc.c
+++ b/
drivers/scsi/scsi_proc.c
@@
-25,10
+25,13
@@
#include <linux/errno.h>
#include <linux/blkdev.h>
#include <linux/seq_file.h>
#include <linux/errno.h>
#include <linux/blkdev.h>
#include <linux/seq_file.h>
+#include <linux/mutex.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_host.h>
-#include
"scsi.h"
+#include
<scsi/scsi_transport.h>
#include "scsi_priv.h"
#include "scsi_logging.h"
#include "scsi_priv.h"
#include "scsi_logging.h"
@@
-40,7
+43,7
@@
static struct proc_dir_entry *proc_scsi;
/* Protect sht->present and sht->proc_dir */
static struct proc_dir_entry *proc_scsi;
/* Protect sht->present and sht->proc_dir */
-static DE
CLARE_MUTEX(global_host_template_sem
);
+static DE
FINE_MUTEX(global_host_template_mutex
);
static int proc_scsi_read(char *buffer, char **start, off_t offset,
int length, int *eof, void *data)
static int proc_scsi_read(char *buffer, char **start, off_t offset,
int length, int *eof, void *data)
@@
-82,7
+85,7
@@
void scsi_proc_hostdir_add(struct scsi_host_template *sht)
if (!sht->proc_info)
return;
if (!sht->proc_info)
return;
-
down(&global_host_template_sem
);
+
mutex_lock(&global_host_template_mutex
);
if (!sht->present++) {
sht->proc_dir = proc_mkdir(sht->proc_name, proc_scsi);
if (!sht->proc_dir)
if (!sht->present++) {
sht->proc_dir = proc_mkdir(sht->proc_name, proc_scsi);
if (!sht->proc_dir)
@@
-91,7
+94,7
@@
void scsi_proc_hostdir_add(struct scsi_host_template *sht)
else
sht->proc_dir->owner = sht->module;
}
else
sht->proc_dir->owner = sht->module;
}
-
up(&global_host_template_sem
);
+
mutex_unlock(&global_host_template_mutex
);
}
void scsi_proc_hostdir_rm(struct scsi_host_template *sht)
}
void scsi_proc_hostdir_rm(struct scsi_host_template *sht)
@@
-99,12
+102,12
@@
void scsi_proc_hostdir_rm(struct scsi_host_template *sht)
if (!sht->proc_info)
return;
if (!sht->proc_info)
return;
-
down(&global_host_template_sem
);
+
mutex_lock(&global_host_template_mutex
);
if (!--sht->present && sht->proc_dir) {
remove_proc_entry(sht->proc_name, proc_scsi);
sht->proc_dir = NULL;
}
if (!--sht->present && sht->proc_dir) {
remove_proc_entry(sht->proc_name, proc_scsi);
sht->proc_dir = NULL;
}
-
up(&global_host_template_sem
);
+
mutex_unlock(&global_host_template_mutex
);
}
void scsi_proc_host_add(struct Scsi_Host *shost)
}
void scsi_proc_host_add(struct Scsi_Host *shost)
@@
-175,9
+178,7
@@
static int proc_print_scsidevice(struct device *dev, void *data)
seq_printf(s, "\n");
seq_printf(s, "\n");
- seq_printf(s, " Type: %s ",
- sdev->type < MAX_SCSI_DEVICE_CODE ?
- scsi_device_types[(int) sdev->type] : "Unknown ");
+ seq_printf(s, " Type: %s ", scsi_device_type(sdev->type));
seq_printf(s, " ANSI"
" SCSI revision: %02x", (sdev->scsi_level - 1) ?
sdev->scsi_level - 1 : 1);
seq_printf(s, " ANSI"
" SCSI revision: %02x", (sdev->scsi_level - 1) ?
sdev->scsi_level - 1 : 1);
@@
-198,7
+199,10
@@
static int scsi_add_single_device(uint host, uint channel, uint id, uint lun)
if (IS_ERR(shost))
return PTR_ERR(shost);
if (IS_ERR(shost))
return PTR_ERR(shost);
- error = scsi_scan_host_selected(shost, channel, id, lun, 1);
+ if (shost->transportt->user_scan)
+ error = shost->transportt->user_scan(shost, channel, id, lun);
+ else
+ error = scsi_scan_host_selected(shost, channel, id, lun, 1);
scsi_host_put(shost);
return error;
}
scsi_host_put(shost);
return error;
}
@@
-260,8
+264,6
@@
static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
lun = simple_strtoul(p + 1, &p, 0);
err = scsi_add_single_device(host, channel, id, lun);
lun = simple_strtoul(p + 1, &p, 0);
err = scsi_add_single_device(host, channel, id, lun);
- if (err >= 0)
- err = length;
/*
* Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi
/*
* Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi
@@
-278,6
+280,13
@@
static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
err = scsi_remove_single_device(host, channel, id, lun);
}
err = scsi_remove_single_device(host, channel, id, lun);
}
+ /*
+ * convert success returns so that we return the
+ * number of bytes consumed.
+ */
+ if (!err)
+ err = length;
+
out:
free_page((unsigned long)buffer);
return err;
out:
free_page((unsigned long)buffer);
return err;
@@
-311,7
+320,7
@@
int __init scsi_init_procfs(void)
{
struct proc_dir_entry *pde;
{
struct proc_dir_entry *pde;
- proc_scsi = proc_mkdir("scsi",
0
);
+ proc_scsi = proc_mkdir("scsi",
NULL
);
if (!proc_scsi)
goto err1;
if (!proc_scsi)
goto err1;
@@
-323,13
+332,13
@@
int __init scsi_init_procfs(void)
return 0;
err2:
return 0;
err2:
- remove_proc_entry("scsi",
0
);
+ remove_proc_entry("scsi",
NULL
);
err1:
return -ENOMEM;
}
void scsi_exit_procfs(void)
{
err1:
return -ENOMEM;
}
void scsi_exit_procfs(void)
{
- remove_proc_entry("scsi/scsi",
0
);
- remove_proc_entry("scsi",
0
);
+ remove_proc_entry("scsi/scsi",
NULL
);
+ remove_proc_entry("scsi",
NULL
);
}
}