Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2019-03-02 12:06:36 -08:00
49 changed files with 16 additions and 2998 deletions
+2 -8
View File
@@ -38,10 +38,7 @@ compiler complains about redefinition of some symbol, you should either
switch to vanilla kernel, or add or change as necessary the
corresponding to that symbol "#if LINUX_VERSION_CODE" statement.
Default sysfs interface supports only kernels 2.6.26 and higher, because
in 2.6.26 internal kernel's sysfs interface had a major change, which
made it heavily incompatible with pre-2.6.26 version. But with the
obsolete procfs interface kernels 2.6.16+ are supported.
Kernel versions 2.6.26 and higher are supported.
If during compilation you see message like "*** No rule to make target
`xxx.h', needed by `yyy.o'. Stop.", then your autogenerated
@@ -162,12 +159,9 @@ ietd.conf files for us to play with).
Sysfs interface
---------------
Starting from 2.0.0 iSCSI-SCST uses sysfs interface. The procfs
interface is obsolete and will be removed in one of the next versions.
The sysfs build supports only kernels 2.6.26 and higher, because in
2.6.26 internal kernel's sysfs interface had a major change, which made
it heavily incompatible with pre-2.6.26 version. But with the obsolete
procfs interface kernels 2.6.16+ are supported.
it heavily incompatible with pre-2.6.26 version.
Root of SCST sysfs interface is /sys/kernel/scst_tgt. Root of iSCSI-SCST
is /sys/kernel/scst_tgt/targets/iscsi. It has the following entries:
-7
View File
@@ -97,9 +97,6 @@ struct iscsi_kern_session_info {
u32 tid;
aligned_u64 sid;
char initiator_name[ISCSI_NAME_LEN];
#ifdef CONFIG_SCST_PROC
char user_name[ISCSI_NAME_LEN];
#endif
char full_initiator_name[ISCSI_FULL_NAME_LEN];
u32 exp_cmd_sn;
s32 session_params[session_key_last];
@@ -145,7 +142,6 @@ struct iscsi_kern_params_info {
};
enum iscsi_kern_event_code {
#ifndef CONFIG_SCST_PROC
E_ADD_TARGET,
E_DEL_TARGET,
E_MGMT_CMD,
@@ -153,7 +149,6 @@ enum iscsi_kern_event_code {
E_DISABLE_TARGET,
E_GET_ATTR_VALUE,
E_SET_ATTR_VALUE,
#endif
E_CONN_CLOSE,
};
@@ -217,11 +212,9 @@ struct iscsi_kern_initiator_info {
#define ISCSI_PARAM_SET _IOW('s', 7, struct iscsi_kern_params_info)
#define ISCSI_PARAM_GET _IOWR('s', 8, struct iscsi_kern_params_info)
#ifndef CONFIG_SCST_PROC
#define ISCSI_ATTR_ADD _IOW('s', 9, struct iscsi_kern_attr_info)
#define ISCSI_ATTR_DEL _IOW('s', 10, struct iscsi_kern_attr_info)
#define MGMT_CMD_CALLBACK _IOW('s', 11, struct iscsi_kern_mgmt_cmd_res_info)
#endif
#define ISCSI_INITIATOR_ALLOWED _IOW('s', 12, struct iscsi_kern_initiator_info)
-4
View File
@@ -15,10 +15,6 @@
/* #define CONFIG_SCST_PROC */
#ifdef CONFIG_SCST_PROC
#define ISCSI_VERSION_STRING_SUFFIX "-procfs"
#else
#define ISCSI_VERSION_STRING_SUFFIX
#endif
#define ISCSI_VERSION_STRING "3.4.0-pre1" ISCSI_VERSION_STRING_SUFFIX
-252
View File
@@ -20,231 +20,6 @@
/* Protected by target_mgmt_mutex */
int ctr_open_state;
#ifdef CONFIG_SCST_PROC
#include <linux/proc_fs.h>
#define ISCSI_PROC_VERSION_NAME "version"
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
#define ISCSI_PROC_LOG_ENTRY_NAME "trace_level"
static struct scst_trace_log iscsi_local_trace_tbl[] = {
{ TRACE_D_WRITE, "d_write" },
{ TRACE_CONN_OC, "conn" },
{ TRACE_CONN_OC_DBG, "conn_dbg" },
{ TRACE_D_IOV, "iov" },
{ TRACE_D_DUMP_PDU, "pdu" },
{ TRACE_NET_PG, "net_page" },
{ 0, NULL }
};
static int iscsi_log_info_show(struct seq_file *seq, void *v)
{
int res = 0;
TRACE_ENTRY();
res = scst_proc_log_entry_read(seq, trace_flag,
iscsi_local_trace_tbl);
TRACE_EXIT_RES(res);
return res;
}
static ssize_t iscsi_proc_log_entry_write(struct file *file,
const char __user *buf, size_t length, loff_t *off)
{
int res = 0;
TRACE_ENTRY();
res = scst_proc_log_entry_write(file, buf, length, &trace_flag,
ISCSI_DEFAULT_LOG_FLAGS, iscsi_local_trace_tbl);
TRACE_EXIT_RES(res);
return res;
}
#endif /* DEBUG or TRACE */
static int iscsi_version_info_show(struct seq_file *seq, void *v)
{
TRACE_ENTRY();
seq_printf(seq, "%s\n", ISCSI_VERSION_STRING);
#ifdef CONFIG_SCST_EXTRACHECKS
seq_printf(seq, "EXTRACHECKS\n");
#endif
#ifdef CONFIG_SCST_TRACING
seq_printf(seq, "TRACING\n");
#endif
#ifdef CONFIG_SCST_DEBUG
seq_printf(seq, "DEBUG\n");
#endif
#ifdef CONFIG_SCST_ISCSI_DEBUG_DIGEST_FAILURES
seq_printf(seq, "DEBUG_DIGEST_FAILURES\n");
#endif
TRACE_EXIT();
return 0;
}
static struct scst_proc_data iscsi_version_proc_data = {
SCST_DEF_RW_SEQ_OP(NULL)
.show = iscsi_version_info_show,
};
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
static struct scst_proc_data iscsi_log_proc_data = {
SCST_DEF_RW_SEQ_OP(iscsi_proc_log_entry_write)
.show = iscsi_log_info_show,
};
#endif
static __init int iscsi_proc_log_entry_build(struct scst_tgt_template *templ)
{
int res = 0;
struct proc_dir_entry *p, *root;
TRACE_ENTRY();
root = scst_proc_get_tgt_root(templ);
if (root) {
p = scst_create_proc_entry(root, ISCSI_PROC_VERSION_NAME,
&iscsi_version_proc_data);
if (p == NULL) {
PRINT_ERROR("Not enough memory to register "
"target driver %s entry %s in /proc",
templ->name, ISCSI_PROC_VERSION_NAME);
res = -ENOMEM;
goto out;
}
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
/* create the proc file entry for the device */
iscsi_log_proc_data.data = (void *)templ->name;
p = scst_create_proc_entry(root, ISCSI_PROC_LOG_ENTRY_NAME,
&iscsi_log_proc_data);
if (p == NULL) {
PRINT_ERROR("Not enough memory to register "
"target driver %s entry %s in /proc",
templ->name, ISCSI_PROC_LOG_ENTRY_NAME);
res = -ENOMEM;
goto out_remove_ver;
}
#endif
}
out:
TRACE_EXIT_RES(res);
return res;
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
out_remove_ver:
remove_proc_entry(ISCSI_PROC_VERSION_NAME, root);
goto out;
#endif
}
static void iscsi_proc_log_entry_clean(struct scst_tgt_template *templ)
{
struct proc_dir_entry *root;
TRACE_ENTRY();
root = scst_proc_get_tgt_root(templ);
if (root) {
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
remove_proc_entry(ISCSI_PROC_LOG_ENTRY_NAME, root);
#endif
remove_proc_entry(ISCSI_PROC_VERSION_NAME, root);
}
TRACE_EXIT();
return;
}
struct proc_entries {
const char *name;
const struct file_operations *const fops;
};
static struct proc_entries iscsi_proc_entries[] = {
{"session", &session_seq_fops},
};
static struct proc_dir_entry *proc_iscsi_dir;
void iscsi_procfs_exit(void)
{
unsigned int i;
if (!proc_iscsi_dir)
return;
for (i = 0; i < ARRAY_SIZE(iscsi_proc_entries); i++)
remove_proc_entry(iscsi_proc_entries[i].name, proc_iscsi_dir);
iscsi_proc_log_entry_clean(&iscsi_template);
}
int __init iscsi_procfs_init(void)
{
unsigned int i;
int err = 0;
struct proc_dir_entry *ent;
proc_iscsi_dir = scst_proc_get_tgt_root(&iscsi_template);
if (proc_iscsi_dir == NULL) {
err = -ESRCH;
goto out;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
proc_iscsi_dir->owner = THIS_MODULE;
#endif
err = iscsi_proc_log_entry_build(&iscsi_template);
if (err < 0)
goto out;
for (i = 0; i < ARRAY_SIZE(iscsi_proc_entries); i++) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
ent = proc_create(iscsi_proc_entries[i].name, 0, proc_iscsi_dir,
iscsi_proc_entries[i].fops);
#else
/*
* proc_create() was introduced via commit "proc: fix
* ->open'less usage due to ->proc_fops flip"
* (2d3a4e3666325a9709cc8ea2e88151394e8f20fc).
*/
ent = create_proc_entry(iscsi_proc_entries[i].name, 0,
proc_iscsi_dir);
if (ent)
ent->proc_fops = iscsi_proc_entries[i].fops;
#endif
if (!ent) {
err = -ENOMEM;
goto err;
}
}
out:
return err;
err:
if (proc_iscsi_dir)
iscsi_procfs_exit();
goto out;
}
#else /* CONFIG_SCST_PROC */
/* Protected by target_mgmt_mutex */
static LIST_HEAD(iscsi_attrs_list);
@@ -309,7 +84,6 @@ const struct attribute *iscsi_attrs[] = {
NULL,
};
#endif /* CONFIG_SCST_PROC */
/* target_mgmt_mutex supposed to be locked */
static int add_conn(void __user *ptr)
@@ -425,9 +199,6 @@ static int add_session(void __user *ptr)
}
info->initiator_name[sizeof(info->initiator_name)-1] = '\0';
#ifdef CONFIG_SCST_PROC
info->user_name[sizeof(info->user_name)-1] = '\0';
#endif
info->full_initiator_name[sizeof(info->full_initiator_name)-1] = '\0';
target = target_lookup_by_id(info->tid);
@@ -471,9 +242,6 @@ static int del_session(void __user *ptr)
}
info->initiator_name[sizeof(info->initiator_name)-1] = '\0';
#ifdef CONFIG_SCST_PROC
info->user_name[sizeof(info->user_name)-1] = '\0';
#endif
target = target_lookup_by_id(info->tid);
if (target == NULL) {
@@ -571,7 +339,6 @@ out:
return err;
}
#ifndef CONFIG_SCST_PROC
/* target_mgmt_mutex supposed to be locked */
static int mgmt_cmd_callback(void __user *ptr)
@@ -926,16 +693,13 @@ out:
return err;
}
#endif /* CONFIG_SCST_PROC */
/* target_mgmt_mutex supposed to be locked */
static int add_target(void __user *ptr)
{
int err, rc;
struct iscsi_kern_target_info *info;
#ifndef CONFIG_SCST_PROC
struct scst_sysfs_user_info *uinfo;
#endif
TRACE_ENTRY();
@@ -961,7 +725,6 @@ static int add_target(void __user *ptr)
info->name[sizeof(info->name)-1] = '\0';
#ifndef CONFIG_SCST_PROC
if (info->cookie != 0) {
uinfo = scst_sysfs_user_get_info(info->cookie);
TRACE_DBG("cookie %u, uinfo %p", info->cookie, uinfo);
@@ -971,16 +734,13 @@ static int add_target(void __user *ptr)
}
} else
uinfo = NULL;
#endif
err = __add_target(info);
#ifndef CONFIG_SCST_PROC
if (uinfo != NULL) {
uinfo->info_status = err;
complete(&uinfo->info_completion);
}
#endif
out_free:
kfree(info);
@@ -995,9 +755,7 @@ static int del_target(void __user *ptr)
{
int err, rc;
struct iscsi_kern_target_info info;
#ifndef CONFIG_SCST_PROC
struct scst_sysfs_user_info *uinfo;
#endif
TRACE_ENTRY();
@@ -1010,7 +768,6 @@ static int del_target(void __user *ptr)
info.name[sizeof(info.name)-1] = '\0';
#ifndef CONFIG_SCST_PROC
if (info.cookie != 0) {
uinfo = scst_sysfs_user_get_info(info.cookie);
TRACE_DBG("cookie %u, uinfo %p", info.cookie, uinfo);
@@ -1020,16 +777,13 @@ static int del_target(void __user *ptr)
}
} else
uinfo = NULL;
#endif
err = __del_target(info.tid);
#ifndef CONFIG_SCST_PROC
if (uinfo != NULL) {
uinfo->info_status = err;
complete(&uinfo->info_completion);
}
#endif
out:
TRACE_EXIT_RES(err);
@@ -1119,7 +873,6 @@ static long iscsi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
err = del_target((void __user *)arg);
break;
#ifndef CONFIG_SCST_PROC
case ISCSI_ATTR_ADD:
case ISCSI_ATTR_DEL:
err = iscsi_attr_cmd((void __user *)arg, cmd);
@@ -1128,7 +881,6 @@ static long iscsi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case MGMT_CMD_CALLBACK:
err = mgmt_cmd_callback((void __user *)arg);
break;
#endif
case ISCSI_INITIATOR_ALLOWED:
err = iscsi_initiator_allowed((void __user *)arg);
@@ -1192,9 +944,7 @@ static int iscsi_open(struct inode *inode, struct file *file)
static int iscsi_release(struct inode *inode, struct file *filp)
{
#ifndef CONFIG_SCST_PROC
struct iscsi_attr *attr, *t;
#endif
TRACE(TRACE_MGMT, "%s", "Releasing allocated resources");
@@ -1206,12 +956,10 @@ static int iscsi_release(struct inode *inode, struct file *filp)
mutex_lock(&target_mgmt_mutex);
#ifndef CONFIG_SCST_PROC
list_for_each_entry_safe(attr, t, &iscsi_attrs_list,
attrs_list_entry) {
__iscsi_del_attr(NULL, attr);
}
#endif
ctr_open_state = ISCSI_CTR_OPEN_STATE_CLOSED;
-72
View File
@@ -73,73 +73,6 @@ out:
return pos;
}
#ifdef CONFIG_SCST_PROC
static int print_digest_state(char *p, size_t size, unsigned long flags)
{
int pos;
if (DIGEST_NONE & flags)
pos = scnprintf(p, size, "%s", "none");
else if (DIGEST_CRC32C & flags)
pos = scnprintf(p, size, "%s", "crc32c");
else
pos = scnprintf(p, size, "%s", "unknown");
return pos;
}
/* target_mutex supposed to be locked */
void conn_info_show(struct seq_file *seq, struct iscsi_session *session)
{
struct iscsi_conn *conn;
struct sock *sk;
char buf[64];
lockdep_assert_held(&session->target->target_mutex);
list_for_each_entry(conn, &session->conn_list, conn_list_entry) {
sk = conn->sock->sk;
switch (sk->sk_family) {
case AF_INET:
snprintf(buf, sizeof(buf),
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
"%u.%u.%u.%u", NIPQUAD(inet_sk(sk)->daddr));
#else
"%pI4", &inet_sk(sk)->inet_daddr);
#endif
break;
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
case AF_INET6:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
snprintf(buf, sizeof(buf),
"[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]",
NIP6(inet6_sk(sk)->daddr));
#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
snprintf(buf, sizeof(buf), "[%pI6]",
&inet6_sk(sk)->daddr);
#else
snprintf(buf, sizeof(buf), "[%pI6]",
&sk->sk_v6_daddr);
#endif
break;
#endif
default:
snprintf(buf, sizeof(buf), "Unknown family %d",
sk->sk_family);
break;
}
seq_printf(seq, "\t\tcid:%u ip:%s ", conn->cid, buf);
print_conn_state(buf, sizeof(buf), conn);
seq_printf(seq, "state:%s ", buf);
print_digest_state(buf, sizeof(buf), conn->hdigest_type);
seq_printf(seq, "hd:%s ", buf);
print_digest_state(buf, sizeof(buf), conn->ddigest_type);
seq_printf(seq, "dd:%s\n", buf);
}
}
#else /* CONFIG_SCST_PROC */
static void iscsi_conn_release(struct kobject *kobj)
{
@@ -382,7 +315,6 @@ out_err:
}
EXPORT_SYMBOL(conn_sysfs_add);
#endif /* CONFIG_SCST_PROC */
/* target_mutex supposed to be locked */
struct iscsi_conn *conn_lookup(struct iscsi_session *session, u16 cid)
@@ -889,9 +821,7 @@ void conn_free(struct iscsi_conn *conn)
del_timer_sync(&conn->rsp_timer);
#ifndef CONFIG_SCST_PROC
conn_sysfs_del(conn);
#endif
sBUG_ON(atomic_read(&conn->conn_ref_cnt) != 0);
sBUG_ON(!list_empty(&conn->cmd_list));
@@ -1022,11 +952,9 @@ int iscsi_conn_alloc(struct iscsi_session *session,
if (res != 0)
goto out_fput;
#ifndef CONFIG_SCST_PROC
res = conn_sysfs_add(conn);
if (res != 0)
goto out_fput;
#endif
list_add_tail(&conn->conn_list_entry, &session->conn_list);
-19
View File
@@ -4025,7 +4025,6 @@ out_err:
return;
}
#ifndef CONFIG_SCST_PROC
static int iscsi_close_sess(struct scst_session *scst_sess)
{
struct iscsi_session *sess = scst_sess_get_tgt_priv(scst_sess);
@@ -4043,7 +4042,6 @@ static int iscsi_close_sess(struct scst_session *scst_sess)
out:
return res;
}
#endif
static int iscsi_target_release(struct scst_tgt *scst_tgt)
{
@@ -4077,7 +4075,6 @@ struct scst_tgt_template iscsi_template = {
.threads_num = 0,
.no_clustering = 1,
.xmit_response_atomic = 0,
#ifndef CONFIG_SCST_PROC
.tgtt_attrs = iscsi_attrs,
.tgt_attrs = iscsi_tgt_attrs,
.sess_attrs = iscsi_sess_attrs,
@@ -4090,7 +4087,6 @@ struct scst_tgt_template iscsi_template = {
.close_session = iscsi_close_sess,
.tgtt_optional_attributes = "IncomingUser, OutgoingUser",
.tgt_optional_attributes = "IncomingUser, OutgoingUser, allowed_portal",
#endif
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
.default_trace_flags = ISCSI_DEFAULT_LOG_FLAGS,
.trace_flags = &trace_flag,
@@ -4370,13 +4366,7 @@ static int __init iscsi_init(void)
if (err < 0)
goto out_kmem;
#ifdef CONFIG_SCST_PROC
err = iscsi_procfs_init();
if (err < 0)
goto out_reg_tmpl;
#else
iscsi_conn_ktype.sysfs_ops = scst_sysfs_get_sysfs_ops();
#endif
err = iscsi_threads_pool_get(false, NULL, &iscsi_main_thread_pool);
if (err != 0)
@@ -4386,13 +4376,7 @@ out:
return err;
out_thr:
#ifdef CONFIG_SCST_PROC
iscsi_procfs_exit();
#endif
#ifdef CONFIG_SCST_PROC
out_reg_tmpl:
#endif
scst_unregister_target_template(&iscsi_template);
out_kmem:
@@ -4429,9 +4413,6 @@ static void __exit iscsi_exit(void)
unregister_chrdev(ctr_major, ctr_name);
#ifdef CONFIG_SCST_PROC
iscsi_procfs_exit();
#endif
event_exit();
kmem_cache_destroy(iscsi_sess_cache);
-22
View File
@@ -102,14 +102,12 @@ struct iscsi_thread_pool {
struct iscsi_target;
struct iscsi_cmnd;
#ifndef CONFIG_SCST_PROC
struct iscsi_attr {
struct list_head attrs_list_entry;
struct kobj_attribute attr;
struct iscsi_target *target;
const char *name;
};
#endif
struct iscsi_target {
struct scst_tgt *scst_tgt;
@@ -123,10 +121,8 @@ struct iscsi_target {
unsigned int tgt_enabled:1;
#ifndef CONFIG_SCST_PROC
/* Protected by target_mutex */
struct list_head attrs_list;
#endif
char name[ISCSI_NAME_LEN];
};
@@ -329,11 +325,9 @@ struct iscsi_conn {
spinlock_t nop_req_list_lock;
u32 nop_in_ttt;
#ifndef CONFIG_SCST_PROC
/* Don't need any protection */
struct kobject conn_kobj;
struct completion *conn_kobj_release_cmpl;
#endif /* CONFIG_SCST_PROC */
};
struct iscsi_pdu {
@@ -566,9 +560,7 @@ extern int iscsi_threads_pool_get(bool dedicated, const cpumask_t *cpu_mask,
extern void iscsi_threads_pool_put(struct iscsi_thread_pool *p);
/* conn.c */
#ifndef CONFIG_SCST_PROC
extern struct kobj_type iscsi_conn_ktype;
#endif
extern struct iscsi_conn *conn_lookup(struct iscsi_session *session, u16 cid);
extern void conn_reinst_finished(struct iscsi_conn *conn);
extern int __add_conn(struct iscsi_session *session,
@@ -582,9 +574,6 @@ extern void iscsi_make_conn_rd_active(struct iscsi_conn *conn);
extern void __mark_conn_closed(struct iscsi_conn *conn, int flags);
extern void mark_conn_closed(struct iscsi_conn *conn);
extern void iscsi_make_conn_wr_active(struct iscsi_conn *conn);
#ifdef CONFIG_SCST_PROC
extern void conn_info_show(struct seq_file *seq, struct iscsi_session *session);
#endif
extern void iscsi_check_tm_data_wait_timeouts(struct iscsi_conn *conn,
bool force);
extern void __iscsi_write_space_ready(struct iscsi_conn *conn);
@@ -597,16 +586,12 @@ extern void iscsi_task_mgmt_affected_cmds_done(struct scst_mgmt_cmd *scst_mcmd);
extern void req_add_to_write_timeout_list(struct iscsi_cmnd *req);
/* target.c */
#ifdef CONFIG_SCST_PROC
extern const struct seq_operations iscsi_seq_op;
#else
extern const struct attribute *iscsi_tgt_attrs[];
extern int iscsi_enable_target(struct scst_tgt *scst_tgt, bool enable);
extern bool iscsi_is_target_enabled(struct scst_tgt *scst_tgt);
extern ssize_t iscsi_sysfs_send_event(uint32_t tid,
enum iscsi_kern_event_code code,
const char *param1, const char *param2, void **data);
#endif
extern struct iscsi_target *target_lookup_by_id(u32 id);
extern int __add_target(struct iscsi_kern_target_info *info);
extern int __del_target(u32 id);
@@ -619,23 +604,16 @@ extern void target_del_all_sess(struct iscsi_target *target, int flags);
extern void target_del_all(void);
/* config.c */
#ifdef CONFIG_SCST_PROC
extern int iscsi_procfs_init(void);
extern void iscsi_procfs_exit(void);
#else
extern int conn_sysfs_add(struct iscsi_conn *conn);
extern const struct attribute *iscsi_attrs[];
extern int iscsi_add_attr(struct iscsi_target *target,
const struct iscsi_kern_attr *user_info);
extern void __iscsi_del_attr(struct iscsi_target *target,
struct iscsi_attr *tgt_attr);
#endif
/* session.c */
#ifndef CONFIG_SCST_PROC
extern const struct attribute *iscsi_sess_attrs[];
extern const struct attribute *iscsi_acg_attrs[];
#endif
extern const struct file_operations session_seq_fops;
extern struct iscsi_session *session_lookup(struct iscsi_target *target,
u64 sid);
@@ -263,11 +263,9 @@ int isert_conn_alloc(struct iscsi_session *session,
if (unlikely(res))
goto cleanup_iscsi_conn;
#ifndef CONFIG_SCST_PROC
res = conn_sysfs_add(conn);
if (unlikely(res))
goto cleanup_iscsi_conn;
#endif
list_add_tail(&conn->conn_list_entry, &session->conn_list);
-66
View File
@@ -65,21 +65,7 @@ static int iscsi_session_alloc(struct iscsi_target *target,
goto err;
}
#ifdef CONFIG_SCST_PROC
name = kmalloc(strlen(info->user_name) + strlen(info->initiator_name) +
2, GFP_KERNEL); /* +1 (for '\0') +1 (for '@') */
if (name == NULL) {
err = -ENOMEM;
goto err;
}
if (info->user_name[0] != '\0')
sprintf(name, "%s@%s", info->user_name, info->initiator_name);
else
sprintf(name, "%s", info->initiator_name);
#else
name = info->full_initiator_name;
#endif
INIT_LIST_HEAD(&session->conn_list);
INIT_LIST_HEAD(&session->pending_list);
@@ -109,9 +95,6 @@ static int iscsi_session_alloc(struct iscsi_target *target,
goto err_unreg;
}
#ifdef CONFIG_SCST_PROC
kfree(name);
#endif
TRACE(TRACE_MGMT, "Session %p created: target %p, tid %u, sid %#Lx, "
"initiator %s", session, target, target->tid, info->sid,
@@ -127,9 +110,6 @@ err:
if (session) {
kfree(session->initiator_name);
kmem_cache_free(iscsi_sess_cache, session);
#ifdef CONFIG_SCST_PROC
kfree(name);
#endif
}
return err;
}
@@ -410,51 +390,6 @@ void iscsi_sess_force_close(struct iscsi_session *sess)
return;
}
#ifdef CONFIG_SCST_PROC
/* target_mutex supposed to be locked */
static void iscsi_session_info_show(struct seq_file *seq,
struct iscsi_target *target)
{
struct iscsi_session *session;
lockdep_assert_held(&target->target_mutex);
list_for_each_entry(session, &target->session_list,
session_list_entry) {
seq_printf(seq, "\tsid:%llx initiator:%s (reinstating %s)\n",
(unsigned long long)session->sid,
session->initiator_name,
session->sess_reinstating ? "yes" : "no");
conn_info_show(seq, session);
}
return;
}
static int iscsi_session_seq_open(struct inode *inode, struct file *file)
{
int res;
#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 <= 5
res = seq_open(file, (struct seq_operations *)&iscsi_seq_op);
#else
res = seq_open(file, &iscsi_seq_op);
#endif
if (!res)
((struct seq_file *)file->private_data)->private =
iscsi_session_info_show;
return res;
}
const struct file_operations session_seq_fops = {
.owner = THIS_MODULE,
.open = iscsi_session_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#else /* CONFIG_SCST_PROC */
#define ISCSI_SESS_BOOL_PARAM_ATTR(name, exported_name) \
static ssize_t iscsi_sess_show_##name(struct kobject *kobj, \
@@ -615,4 +550,3 @@ const struct attribute *iscsi_sess_attrs[] = {
NULL,
};
#endif /* CONFIG_SCST_PROC */
-83
View File
@@ -93,9 +93,7 @@ static int iscsi_target_create(struct iscsi_kern_target_info *info, u32 tid,
mutex_init(&target->target_mutex);
INIT_LIST_HEAD(&target->session_list);
#ifndef CONFIG_SCST_PROC
INIT_LIST_HEAD(&target->attrs_list);
#endif
target->scst_tgt = scst_register_target(&iscsi_template, target->name);
if (!target->scst_tgt) {
@@ -132,11 +130,9 @@ int __add_target(struct iscsi_kern_target_info *info)
struct iscsi_kern_params_info params_info;
struct iscsi_kern_attr attr_info;
} *add_info;
#ifndef CONFIG_SCST_PROC
int i, rc;
unsigned long attrs_ptr_long;
struct iscsi_kern_attr __user *attrs_ptr;
#endif
lockdep_assert_held(&target_mgmt_mutex);
@@ -180,7 +176,6 @@ int __add_target(struct iscsi_kern_target_info *info)
nr_targets++;
#ifndef CONFIG_SCST_PROC
{
struct iscsi_kern_attr *attr_info = &add_info->attr_info;
@@ -210,7 +205,6 @@ int __add_target(struct iscsi_kern_target_info *info)
mutex_unlock(&target->target_mutex);
}
#endif
err = tid;
@@ -220,28 +214,22 @@ out_free:
out:
return err;
#ifndef CONFIG_SCST_PROC
out_del_unlock:
mutex_unlock(&target->target_mutex);
__del_target(tid);
goto out_free;
#endif
}
static void target_destroy(struct iscsi_target *target)
{
#ifndef CONFIG_SCST_PROC
struct iscsi_attr *attr, *t;
#endif
TRACE_MGMT_DBG("Destroying target tid %u", target->tid);
#ifndef CONFIG_SCST_PROC
list_for_each_entry_safe(attr, t, &target->attrs_list,
attrs_list_entry) {
__iscsi_del_attr(target, attr);
}
#endif
scst_unregister_target(target->scst_tgt);
@@ -408,76 +396,6 @@ void target_del_all(void)
return;
}
#ifdef CONFIG_SCST_PROC
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 <= 5 && RHEL_MINOR -0 <= 6)
static struct list_head *seq_list_start(struct list_head *head, loff_t pos)
{
struct list_head *lh;
list_for_each(lh, head)
if (pos-- == 0)
return lh;
return NULL;
}
static struct list_head *seq_list_next(void *v, struct list_head *head,
loff_t *ppos)
{
struct list_head *lh;
lh = ((struct list_head *)v)->next;
++*ppos;
return lh == head ? NULL : lh;
}
#endif
static void *iscsi_seq_start(struct seq_file *m, loff_t *pos)
{
int err;
err = mutex_lock_interruptible(&target_mgmt_mutex);
if (err < 0)
return ERR_PTR(err);
return seq_list_start(&target_list, *pos);
}
static void *iscsi_seq_next(struct seq_file *m, void *v, loff_t *pos)
{
return seq_list_next(v, &target_list, pos);
}
static void iscsi_seq_stop(struct seq_file *m, void *v)
{
mutex_unlock(&target_mgmt_mutex);
}
static int iscsi_seq_show(struct seq_file *m, void *p)
{
iscsi_show_info_t *func = (iscsi_show_info_t *)m->private;
struct iscsi_target *target =
list_entry(p, struct iscsi_target, target_list_entry);
seq_printf(m, "tid:%u name:%s\n", target->tid, target->name);
mutex_lock(&target->target_mutex);
func(m, target);
mutex_unlock(&target->target_mutex);
return 0;
}
const struct seq_operations iscsi_seq_op = {
.start = iscsi_seq_start,
.next = iscsi_seq_next,
.stop = iscsi_seq_stop,
.show = iscsi_seq_show,
};
#else /* CONFIG_SCST_PROC */
static ssize_t iscsi_tgt_tid_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
@@ -710,4 +628,3 @@ const struct attribute *iscsi_acg_attrs[] = {
NULL,
};
#endif /* CONFIG_SCST_PROC */
-10
View File
@@ -449,11 +449,9 @@ int config_account_del(u32 tid, int dir, char *name, u32 cookie)
ISCSI_USER_NAME(user), user, target ? target->name : "discovery",
user->sysfs_name);
#ifndef CONFIG_SCST_PROC
res = kernel_user_del(target, user, cookie);
if (res != 0)
goto out;
#endif
account_destroy(user);
@@ -528,13 +526,11 @@ int __config_account_add(struct target *target, int dir, char *name, char *pass,
if (err != 0)
goto out;
#ifndef CONFIG_SCST_PROC
if (send_to_kern && (sysfs_name != NULL)) {
err = kernel_user_add(target, user, cookie);
if (err != 0)
goto out_destroy;
}
#endif
log_debug(1, "User %s (%p, sysfs name %s) added to target %s "
"(direction %s)", ISCSI_USER_NAME(user), user, user->sysfs_name,
@@ -544,9 +540,7 @@ int __config_account_add(struct target *target, int dir, char *name, char *pass,
out:
return err;
#ifndef CONFIG_SCST_PROC
out_destroy:
#endif
account_destroy(user);
goto out;
}
@@ -1093,10 +1087,6 @@ int config_load(const char *config_name)
config = open(cname, O_RDONLY);
if (config == -1) {
if ((errno == ENOENT) && (config_name == NULL)) {
#ifdef CONFIG_SCST_PROC
log_debug(3, "Default config file %s not found",
CONFIG_FILE);
#endif
goto out;
} else {
err = -errno;
-8
View File
@@ -190,7 +190,6 @@ int kernel_target_destroy(u32 tid, u32 cookie)
return res;
}
#ifndef CONFIG_SCST_PROC
int kernel_attr_add(struct target *target, const char *name, u32 mode,
u32 cookie)
@@ -242,7 +241,6 @@ int kernel_user_del(struct target *target, struct iscsi_attr *user, u32 cookie)
return kernel_attr_del(target, user->sysfs_name, cookie);
}
#endif /* CONFIG_SCST_PROC */
int kernel_initiator_allowed(u32 tid, const char *full_initiator_name)
{
@@ -369,12 +367,6 @@ int kernel_session_create(struct connection *conn)
info.exp_cmd_sn = conn->exp_cmd_sn;
strlcpy(info.initiator_name, conn->sess->initiator, sizeof(info.initiator_name));
#ifdef CONFIG_SCST_PROC
if (conn->user != NULL)
strlcpy(info.user_name, conn->user, sizeof(info.user_name));
else
info.user_name[0] = '\0';
#endif
iscsi_make_full_initiator_name(target->per_portal_acl,
conn->sess->initiator, conn->target_portal,
-6
View File
@@ -97,7 +97,6 @@ static int nl_read(int fd, void *data, int len, bool wait)
return res;
}
#ifndef CONFIG_SCST_PROC
static int strncasecmp_numwild(const char *name, const char *mask)
{
@@ -1039,16 +1038,13 @@ out_free_server:
goto out;
}
#endif /* CONFIG_SCST_PROC */
int handle_iscsi_events(int fd, bool wait)
{
struct session *session;
struct connection *conn;
struct iscsi_kern_event event;
#ifndef CONFIG_SCST_PROC
struct target *target;
#endif
int rc;
/*
@@ -1089,7 +1085,6 @@ retry:
*/
switch (event.code) {
#ifndef CONFIG_SCST_PROC
case E_ADD_TARGET:
rc = handle_e_add_target(fd, &event);
if (rc != 0)
@@ -1147,7 +1142,6 @@ retry:
if (rc != 0)
send_mgmt_cmd_res(event.tid, event.cookie, E_SET_ATTR_VALUE, rc, NULL);
break;
#endif /* CONFIG_SCST_PROC */
case E_CONN_CLOSE:
session = session_find_id(event.tid, event.sid);
-5
View File
@@ -834,9 +834,6 @@ int main(int argc, char **argv)
gid_t gid = 0;
int err;
#ifdef CONFIG_SCST_PROC
iscsi_enabled = 1;
#endif
if (pipe(init_report_pipe) == -1) {
perror("pipe failed");
@@ -904,7 +901,6 @@ int main(int argc, char **argv)
exit(-1);
};
#ifndef CONFIG_SCST_PROC
err = kernel_attr_add(NULL, ISCSI_ISNS_SERVER_ATTR_NAME,
S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR, 0);
if (err != 0)
@@ -918,7 +914,6 @@ int main(int argc, char **argv)
S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR, 0);
if (err != 0)
exit(err);
#endif
if ((ipc_fd = iscsi_adm_request_listen()) < 0) {
perror("Opening AF_LOCAL socket failed");
-2
View File
@@ -332,7 +332,6 @@ extern int kernel_params_set(u32 tid, u64 sid, int type, u32 partial,
const struct iscsi_param *params);
extern int kernel_target_create(struct target *target, u32 *tid, u32 cookie);
extern int kernel_target_destroy(u32 tid, u32 cookie);
#ifndef CONFIG_SCST_PROC
extern int kernel_user_add(struct target *target, struct iscsi_attr *attr,
u32 cookie);
extern int kernel_user_del(struct target *target, struct iscsi_attr *attr,
@@ -340,7 +339,6 @@ extern int kernel_user_del(struct target *target, struct iscsi_attr *attr,
extern int kernel_attr_add(struct target *target, const char *name,
u32 mode, u32 cookie);
extern int kernel_attr_del(struct target *target, const char *name, u32 cookie);
#endif
extern int kernel_initiator_allowed(u32 tid, const char *initiator_name);
extern int kernel_session_create(struct connection *conn);
extern int kernel_session_destroy(u32 tid, u64 sid);
-6
View File
@@ -447,14 +447,8 @@ int target_add(struct target *target, u32 *tid, u32 cookie)
if (err != 0)
goto out;
#ifdef CONFIG_SCST_PROC
target->tgt_enabled = 1;
#endif
list_add_tail(&target->tlist, &targets_list);
#ifdef CONFIG_SCST_PROC
isns_target_register(target->name);
#endif
out:
return err;
+1 -3
View File
@@ -244,9 +244,7 @@ in/out in Makefile:
Sysfs interface
---------------
Starting from 2.0.0 this driver has sysfs interface. The procfs
interface from version 2.0.0 is obsolete and will be removed in one of
the next versions.
Starting from 2.0.0 this driver has sysfs interface.
Root of SCST sysfs interface is /sys/kernel/scst_tgt. Root of this
driver is /sys/kernel/scst_tgt/targets/qla2x00t. It has the following
-173
View File
@@ -107,7 +107,6 @@ static int q2t_close_session(struct scst_session *scst_sess);
static uint16_t q2t_get_scsi_transport_version(struct scst_tgt *scst_tgt);
static uint16_t q2t_get_phys_transport_version(struct scst_tgt *scst_tgt);
#ifndef CONFIG_SCST_PROC
/** SYSFS **/
@@ -191,7 +190,6 @@ static const struct attribute *q2t_npiv_tgt_attrs[] = {
NULL,
};
#endif /* CONFIG_SCST_PROC */
static int q2t_enable_tgt(struct scst_tgt *tgt, bool enable);
static bool q2t_is_tgt_enabled(struct scst_tgt *tgt);
@@ -220,11 +218,7 @@ static unsigned long q2t_trace_flag = Q2T_DEFAULT_LOG_FLAGS;
#endif
static struct scst_tgt_template tgt2x_template = {
#ifdef CONFIG_SCST_PROC
.name = "qla2x00tgt",
#else
.name = "qla2x00t",
#endif
.sg_tablesize = 0,
.use_clustering = 1,
#ifdef CONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD
@@ -248,7 +242,6 @@ static struct scst_tgt_template tgt2x_template = {
.enable_target = q2t_enable_tgt,
.is_target_enabled = q2t_is_tgt_enabled,
#if ENABLE_NPIV
#ifndef CONFIG_SCST_PROC
#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) || \
defined(FC_VPORT_CREATE_DEFINED))
.add_target = q2t_add_vtarget,
@@ -256,11 +249,8 @@ static struct scst_tgt_template tgt2x_template = {
#endif /*((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) || \
defined(FC_VPORT_CREATE_DEFINED))*/
.add_target_parameters = "node_name, parent_host",
.tgtt_attrs = q2tt_attrs,
#endif
#elif !defined(CONFIG_SCST_PROC)
.tgtt_attrs = q2tt_attrs,
#endif
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
.default_trace_flags = Q2T_DEFAULT_LOG_FLAGS,
.trace_flags = &trace_flag,
@@ -6173,9 +6163,7 @@ out_unlock:
static int q2t_add_target(scsi_qla_host_t *vha)
{
int res;
#ifndef CONFIG_SCST_PROC
int rc;
#endif
char *wwn;
int sg_tablesize;
struct q2t_tgt *tgt;
@@ -6249,7 +6237,6 @@ static int q2t_add_target(scsi_qla_host_t *vha)
}
}
#ifndef CONFIG_SCST_PROC
rc = sysfs_create_link(scst_sysfs_get_tgt_kobj(tgt->scst_tgt),
&vha->host->shost_dev.kobj, "host");
if (rc != 0)
@@ -6289,7 +6276,6 @@ static int q2t_add_target(scsi_qla_host_t *vha)
i++;
}
}
#endif
scst_tgt_set_sg_tablesize(tgt->scst_tgt, sg_tablesize);
scst_tgt_set_tgt_priv(tgt->scst_tgt, tgt);
@@ -6437,9 +6423,6 @@ static bool q2t_is_tgt_enabled(struct scst_tgt *scst_tgt)
return qla_tgt_mode_enabled(tgt->vha);
}
#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) || \
defined(FC_VPORT_CREATE_DEFINED)) || \
!defined(CONFIG_SCST_PROC)
static int q2t_parse_wwn(const char *ns, u64 *nm)
{
unsigned int i, j;
@@ -6473,7 +6456,6 @@ static int q2t_parse_wwn(const char *ns, u64 *nm)
return 0;
}
#endif
#if ENABLE_NPIV
#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) || \
@@ -6634,7 +6616,6 @@ out:
return res;
}
#ifndef CONFIG_SCST_PROC
static ssize_t q2t_show_expl_conf_enabled(struct kobject *kobj,
struct kobj_attribute *attr, char *buffer)
@@ -7001,147 +6982,6 @@ out:
return res;
}
#else /* CONFIG_SCST_PROC */
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
#define Q2T_PROC_LOG_ENTRY_NAME "trace_level"
#include <linux/proc_fs.h>
static int q2t_log_info_show(struct seq_file *seq, void *v)
{
int res = 0;
TRACE_ENTRY();
res = scst_proc_log_entry_read(seq, trace_flag, NULL);
TRACE_EXIT_RES(res);
return res;
}
static ssize_t q2t_proc_log_entry_write(struct file *file,
const char __user *buf, size_t length, loff_t *off)
{
int res = 0;
TRACE_ENTRY();
res = scst_proc_log_entry_write(file, buf, length, &trace_flag,
Q2T_DEFAULT_LOG_FLAGS, NULL);
TRACE_EXIT_RES(res);
return res;
}
#endif
static int q2t_version_info_show(struct seq_file *seq, void *v)
{
TRACE_ENTRY();
seq_printf(seq, "%s\n", Q2T_VERSION_STRING);
#ifdef CONFIG_SCST_EXTRACHECKS
seq_printf(seq, "EXTRACHECKS\n");
#endif
#ifdef CONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD
seq_printf(seq, "DEBUG_WORK_IN_THREAD\n");
#endif
#ifdef CONFIG_SCST_TRACING
seq_printf(seq, "TRACING\n");
#endif
#ifdef CONFIG_SCST_DEBUG
seq_printf(seq, "DEBUG\n");
#endif
#ifdef CONFIG_QLA_TGT_DEBUG_SRR
seq_printf(seq, "DEBUG_SRR\n");
#endif
TRACE_EXIT();
return 0;
}
static struct scst_proc_data q2t_version_proc_data = {
SCST_DEF_RW_SEQ_OP(NULL)
.show = q2t_version_info_show,
};
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
static struct scst_proc_data q2t_log_proc_data = {
SCST_DEF_RW_SEQ_OP(q2t_proc_log_entry_write)
.show = q2t_log_info_show,
};
#endif
static __init int q2t_proc_log_entry_build(struct scst_tgt_template *templ)
{
int res = 0;
struct proc_dir_entry *p, *root;
TRACE_ENTRY();
root = scst_proc_get_tgt_root(templ);
if (root) {
p = scst_create_proc_entry(root, Q2T_PROC_VERSION_NAME,
&q2t_version_proc_data);
if (p == NULL) {
PRINT_ERROR("qla2x00t: Not enough memory to register "
"target driver %s entry %s in /proc",
templ->name, Q2T_PROC_VERSION_NAME);
res = -ENOMEM;
goto out;
}
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
/* create the proc file entry for the device */
q2t_log_proc_data.data = (void *)templ->name;
p = scst_create_proc_entry(root, Q2T_PROC_LOG_ENTRY_NAME,
&q2t_log_proc_data);
if (p == NULL) {
PRINT_ERROR("qla2x00t: Not enough memory to register "
"target driver %s entry %s in /proc",
templ->name, Q2T_PROC_LOG_ENTRY_NAME);
res = -ENOMEM;
goto out_remove_ver;
}
#endif
}
out:
TRACE_EXIT_RES(res);
return res;
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
out_remove_ver:
remove_proc_entry(Q2T_PROC_VERSION_NAME, root);
goto out;
#endif
}
static void q2t_proc_log_entry_clean(struct scst_tgt_template *templ)
{
struct proc_dir_entry *root;
TRACE_ENTRY();
root = scst_proc_get_tgt_root(templ);
if (root) {
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
remove_proc_entry(Q2T_PROC_LOG_ENTRY_NAME, root);
#endif
remove_proc_entry(Q2T_PROC_VERSION_NAME, root);
}
TRACE_EXIT();
return;
}
#endif /* CONFIG_SCST_PROC */
static uint16_t q2t_get_scsi_transport_version(struct scst_tgt *scst_tgt)
{
@@ -7206,21 +7046,11 @@ static int __init q2t_init(void)
qla2xxx_add_targets();
#ifdef CONFIG_SCST_PROC
res = q2t_proc_log_entry_build(&tgt2x_template);
if (res < 0)
goto out_unreg_target2x;
#endif
out:
TRACE_EXIT_RES(res);
return res;
#ifdef CONFIG_SCST_PROC
out_unreg_target2x:
scst_unregister_target_template(&tgt2x_template);
qla2xxx_tgt_unregister_driver();
#endif
out_mempool_free:
mempool_destroy(q2t_mgmt_cmd_mempool);
@@ -7249,9 +7079,6 @@ static void __exit q2t_exit(void)
/* To sync with q2t_host_action() */
down_write(&q2t_unreg_rwsem);
#ifdef CONFIG_SCST_PROC
q2t_proc_log_entry_clean(&tgt2x_template);
#endif
scst_unregister_target_template(&tgt2x_template);
-130
View File
@@ -108,132 +108,6 @@ static DEVICE_ATTR(class2_enabled,
/* #define CONFIG_SCST_PROC */
#ifdef CONFIG_SCST_PROC
static ssize_t
qla2x00_show_tgt_enabled(struct device *dev,
struct device_attribute *attr, char *buffer)
{
scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
ssize_t size;
size = scnprintf(buffer, PAGE_SIZE, "%d\n", qla_tgt_mode_enabled(vha));
return size;
}
static ssize_t
qla2x00_store_tgt_enabled(struct device *dev,
struct device_attribute *attr, const char *buffer, size_t size)
{
struct scsi_qla_host *vha = shost_priv(class_to_shost(dev));
int res = size;
if ((buffer == NULL) || (size == 0))
goto out;
if (qla_target.tgt_host_action == NULL) {
printk(KERN_INFO "%s: not acting for lack of target "
"driver\n", __func__);
res = -EINVAL;
goto out;
}
switch (buffer[0]) {
case '0':
res = qla_target.tgt_host_action(vha, DISABLE_TARGET_MODE);
break;
case '1':
res = qla_target.tgt_host_action(vha, ENABLE_TARGET_MODE);
break;
default:
printk(KERN_ERR "%s(%ld): Requested action not "
"understood: %s\n", __func__, vha->host_no, buffer);
res = -EINVAL;
goto out;
}
if (res == 0)
res = size;
if ((size > 1) && (buffer[1] == 'r')) {
struct scsi_qla_host *base_vha = pci_get_drvdata(vha->hw->pdev);
set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags);
}
out:
return res;
}
static DEVICE_ATTR(target_mode_enabled,
S_IRUGO|S_IWUSR,
qla2x00_show_tgt_enabled,
qla2x00_store_tgt_enabled);
static ssize_t
qla2x00_show_expl_conf_enabled(struct device *dev,
struct device_attribute *attr, char *buffer)
{
struct scsi_qla_host *vha = shost_priv(class_to_shost(dev));
ulong max_size = PAGE_SIZE;
ulong size;
size = scnprintf(buffer, max_size, "%d\n",
vha->hw->enable_explicit_conf);
return size;
}
static ssize_t
qla2x00_store_expl_conf_enabled(struct device *dev,
struct device_attribute *attr, const char *buffer, size_t size)
{
struct scsi_qla_host *vha = shost_priv(class_to_shost(dev));
struct qla_hw_data *ha = vha->hw;
struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
unsigned long flags;
int old = ha->enable_explicit_conf;
if (buffer == NULL)
return size;
spin_lock_irqsave(&ha->hardware_lock, flags);
switch (buffer[0]) {
case '0':
vha->hw->enable_explicit_conf = 0;
printk(KERN_INFO "qla2xxx(%ld): explicit confirmation "
"disabled\n", vha->host_no);
break;
case '1':
vha->hw->enable_explicit_conf = 1;
printk(KERN_INFO "qla2xxx(%ld): explicit confirmation "
"enabled\n", vha->host_no);
break;
default:
printk(KERN_ERR "%s(%ld): Requested action not understood: "
"%s\n", __func__, vha->host_no, buffer);
break;
}
spin_unlock_irqrestore(&ha->hardware_lock, flags);
if (ha->enable_explicit_conf != old) {
set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags);
qla2xxx_wake_dpc(vha);
qla2x00_wait_for_hba_online(vha);
}
return size;
}
static DEVICE_ATTR(explicit_conform_enabled,
S_IRUGO|S_IWUSR,
qla2x00_show_expl_conf_enabled,
qla2x00_store_expl_conf_enabled);
#endif /* CONFIG_SCST_PROC */
static ssize_t
qla2x00_show_ini_mode_force_reverse(struct device *dev,
@@ -1953,10 +1827,6 @@ struct device_attribute *qla2x00_host_attrs[] = {
&dev_attr_84xx_fw_version,
&dev_attr_class2_enabled,
#ifdef CONFIG_SCSI_QLA2XXX_TARGET
#ifdef CONFIG_SCST_PROC
&dev_attr_target_mode_enabled,
&dev_attr_explicit_conform_enabled,
#endif
&dev_attr_ini_mode_force_reverse,
&dev_attr_resource_counts,
&dev_attr_port_database,
+3 -14
View File
@@ -57,10 +57,7 @@ your compiler complains about redefinition of some symbol, you should
either switch to vanilla kernel, or add or change as necessary the
corresponding to that symbol "#if LINUX_VERSION_CODE" statement.
Default sysfs interface supports only kernels 2.6.26 and higher, because
in 2.6.26 internal kernel's sysfs interface had a major change, which
made it heavily incompatible with pre-2.6.26 version. But with the
obsolete procfs interface kernels 2.6.16+ are supported.
Kernel version 2.6.26 and higher are supported.
At first, make sure that the link "/lib/modules/`you_kernel_version`/build"
points to the source code for your currently running kernel.
@@ -413,8 +410,7 @@ SCST sysfs interface
Starting from 2.0.0 SCST has sysfs interface. It supports only kernels
2.6.26 and higher, because in 2.6.26 internal kernel's sysfs interface
had a major change, which made it heavily incompatible with pre-2.6.26
version. If you need pre-2.6.26 kernel, you need to use obsolete procfs
interface (see below).
version.
SCST sysfs interface designed to be self descriptive and self
containing. This means that a high level management tool for it can be
@@ -1101,9 +1097,7 @@ created, i.e. before the target enabled.
VDISK device handler
--------------------
Starting from 2.0.0 VDISK device handler uses sysfs interface. The
procfs interface is obsolete and will be removed in one of the next
versions.
Starting from 2.0.0 VDISK device handler uses sysfs interface.
VDISK has 4 built-in dev handlers: vdisk_fileio, vdisk_blockio,
vdisk_nullio and vcdrom. Roots of their sysfs interface are
@@ -1575,11 +1569,6 @@ failure to prevent Persistent Reservation information from corruption
during update. It is safe to assume that each of those files can be up
to 1KB big.
The "Persistence Through Power Loss" feature is not available in the
procfs build, because the SCST proc interface doesn't allow to keep
persistent Relative Target IDs of each target between reboots/reloads
(they are load and initialization order dependent).
The Persistent Reservations available on all transports implementing
get_initiator_port_transport_id() callback. Transports not implementing
this callback will act in one of 2 possible scenarios ("all or
+4 -157
View File
@@ -46,15 +46,10 @@
#define CONFIG_SCST_PER_DEVICE_CMD_COUNT_LIMIT
#endif
/* #define CONFIG_SCST_PROC */
#ifdef CONFIG_SCST_PROC
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#elif defined(RHEL_MAJOR) && RHEL_MAJOR -0 <= 5
#error The SCST sysfs interface is not supported on RHEL 5. Please run make enable_proc.
#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 <= 5
#error RHEL 5 is no longer supported. Please upgrade to RHEL 6 or later.
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
#error The SCST sysfs interface is supported from kernel version 2.6.26 on. Please run make enable_proc.
#error The SCST sysfs interface is supported from kernel version 2.6.26 on. Please upgrade to a newer kernel version.
#endif
#include <scsi/scsi_cmnd.h>
@@ -564,14 +559,6 @@ enum scst_exec_res {
/* Each initiator connected to this group will have own IO context */
#define SCST_IO_GROUPING_NEVER -2
#ifdef CONFIG_SCST_PROC
/*************************************************************
** Name of the entry in /proc
*************************************************************/
#define SCST_PROC_ENTRY_NAME "scsi_tgt"
#endif
/*************************************************************
** Valid_mask constants for scst_analyze_sense()
@@ -825,13 +812,8 @@ struct scst_tgt_template {
unsigned xmit_response_atomic:1;
unsigned rdy_to_xfer_atomic:1;
#ifdef CONFIG_SCST_PROC
/* True, if the template doesn't need the entry in /proc */
unsigned no_proc_entry:1;
#else
/* True, if this target doesn't need "enabled" attribute */
unsigned enabled_attr_not_needed:1;
#endif
/*
* True, if this target adapter can call scst_cmd_init_done() from
@@ -1123,18 +1105,6 @@ struct scst_tgt_template {
*/
int (*report_aen)(struct scst_aen *aen);
#ifdef CONFIG_SCST_PROC
/*
* Those functions can be used to export the driver's statistics and
* other infos to the world outside the kernel as well as to get some
* management commands from it.
*
* OPTIONAL
*/
int (*read_proc)(struct seq_file *seq, struct scst_tgt *tgt);
int (*write_proc)(char *buffer, char **start, off_t offset,
int length, int *eof, struct scst_tgt *tgt);
#endif
/*
* This function returns in tr_id the corresponding to sess initiator
@@ -1266,7 +1236,6 @@ struct scst_tgt_template {
/* Optional local trace table help string */
const char *trace_tbl_help;
#ifndef CONFIG_SCST_PROC
/* sysfs attributes, if any */
const struct attribute **tgtt_attrs;
@@ -1278,7 +1247,6 @@ struct scst_tgt_template {
/* sysfs ACG attributes, if any */
const struct attribute **acg_attrs;
#endif
/* Optional help string for mgmt_cmd commands */
const char *mgmt_cmd_help;
@@ -1308,13 +1276,6 @@ struct scst_tgt_template {
/* List entry of global templates list */
struct list_head scst_template_list_entry;
#ifdef CONFIG_SCST_PROC
/* The pointer to the /proc directory entry */
struct proc_dir_entry *proc_tgt_root;
/* Device number in /proc */
int proc_dev_num;
#else
struct kobject tgtt_kobj; /* target driver sysfs entry */
/* Number of currently active sysfs mgmt works (scst_sysfs_work_item) */
@@ -1322,7 +1283,6 @@ struct scst_tgt_template {
/* sysfs release completion */
struct completion *tgtt_kobj_release_cmpl;
#endif
/*
* Optional method that writes the serial number of a target device in
@@ -1373,10 +1333,6 @@ struct scst_dev_type {
unsigned dev_alloc_data_buf_atomic:1;
unsigned dev_done_atomic:1;
#ifdef CONFIG_SCST_PROC
/* True, if no /proc files should be automatically created by SCST */
unsigned no_proc:1;
#endif
/*
* Should be set if the device wants to receive notification of
@@ -1644,18 +1600,6 @@ struct scst_dev_type {
*/
void (*detach_tgt)(struct scst_tgt_dev *tgt_dev);
#ifdef CONFIG_SCST_PROC
/*
* Those functions can be used to export the handler's statistics and
* other infos to the world outside the kernel as well as to get some
* management commands from it.
*
* OPTIONAL
*/
int (*read_proc)(struct seq_file *seq, struct scst_dev_type *dev_type);
int (*write_proc)(char *buffer, char **start, off_t offset,
int length, int *eof, struct scst_dev_type *dev_type);
#else
/*
* This function adds a virtual device.
*
@@ -1692,7 +1636,6 @@ struct scst_dev_type {
* OPTIONAL.
*/
ssize_t (*mgmt_cmd)(char *cmd);
#endif
/*
* Name of the dev handler. Must be unique. MUST HAVE.
@@ -1727,7 +1670,6 @@ struct scst_dev_type {
/* Optional local trace table */
struct scst_trace_log *trace_tbl;
#ifndef CONFIG_SCST_PROC
/* Optional local trace table help string */
const char *trace_tbl_help;
@@ -1759,7 +1701,6 @@ struct scst_dev_type {
/* sysfs device attributes, if any */
const struct attribute **dev_attrs;
#endif
/* Pointer to dev handler's private data */
void *devt_priv;
@@ -1774,10 +1715,6 @@ struct scst_dev_type {
/* list entry in scst_(virtual_)dev_type_list */
struct list_head dev_type_list_entry;
#ifdef CONFIG_SCST_PROC
/* The pointer to the /proc directory entry */
struct proc_dir_entry *proc_dev_type_root;
#else
struct kobject devt_kobj; /* main handlers/driver */
/* Number of currently active sysfs mgmt works (scst_sysfs_work_item) */
@@ -1785,7 +1722,6 @@ struct scst_dev_type {
/* To wait until devt_kobj released */
struct completion *devt_kobj_release_compl;
#endif
};
/*
@@ -1806,11 +1742,9 @@ struct scst_tgt {
struct scst_tgt_template *tgtt; /* corresponding target template */
#ifndef CONFIG_SCST_PROC
struct scst_acg *default_acg; /* default acg for this target */
struct list_head tgt_acg_list; /* target ACG groups */
#endif
/*
* Set, if this target is forwarding target, i.e. does not check
@@ -1853,10 +1787,6 @@ struct scst_tgt {
/* Used to wait until session finished to unregister */
wait_queue_head_t unreg_waitQ;
#ifdef CONFIG_SCST_PROC
/* Device number in /proc */
int proc_num;
#endif
/* Name of the target */
char *tgt_name;
@@ -1871,10 +1801,6 @@ struct scst_tgt {
atomic_t tgt_dif_app_failed_scst, tgt_dif_ref_failed_scst, tgt_dif_guard_failed_scst;
atomic_t tgt_dif_app_failed_dev, tgt_dif_ref_failed_dev, tgt_dif_guard_failed_dev;
#ifdef CONFIG_SCST_PROC
/* Name of the default security group ("Default_target_name") */
char *default_group_name;
#else
/* sysfs release completion */
struct completion *tgt_kobj_release_cmpl;
@@ -1882,7 +1808,6 @@ struct scst_tgt {
struct kobject *tgt_sess_kobj; /* target/sessions/ */
struct kobject *tgt_luns_kobj; /* target/luns/ */
struct kobject *tgt_ini_grp_kobj; /* target/ini_groups/ */
#endif
};
/**
@@ -2063,12 +1988,10 @@ struct scst_session {
struct completion *sess_kobj_release_cmpl;
unsigned int sess_mq:1; /* Multi-queue session, i.e. >1 sessions per same initiator */
#ifndef CONFIG_SCST_PROC
unsigned int sess_kobj_ready:1;
struct kobject sess_kobj; /* session sysfs entry */
struct kobject *lat_kobj;
#endif
/*
* Functions and data for user callbacks from scst_register_session()
@@ -3141,7 +3064,6 @@ struct scst_device {
/* Threads pool type of the device. Valid only if threads_num > 0. */
enum scst_dev_type_threads_pool_type threads_pool_type;
#ifndef CONFIG_SCST_PROC
/* sysfs release completion */
struct completion *dev_kobj_release_cmpl;
@@ -3150,7 +3072,6 @@ struct scst_device {
/* Export number in the dev's sysfs list. Protected by scst_mutex */
int dev_exported_lun_num;
#endif
};
/*
@@ -3294,12 +3215,10 @@ struct scst_tgt_dev {
*/
int thread_index;
#ifndef CONFIG_SCST_PROC
/* sysfs release completion */
struct completion *tgt_dev_kobj_release_cmpl;
struct kobject tgt_dev_kobj; /* sessions' LUNs sysfs entry */
#endif
};
/*
@@ -3324,7 +3243,6 @@ struct scst_acg_dev {
/* List entry in acg->acg_dev_list */
struct list_head acg_dev_list_entry;
#ifndef CONFIG_SCST_PROC
struct kobject acg_dev_kobj; /* targets' LUNs sysfs entry */
/* sysfs release completion */
@@ -3332,7 +3250,6 @@ struct scst_acg_dev {
/* Name of the link to the corresponding LUN */
char acg_dev_link_name[20];
#endif
};
/*
@@ -3355,16 +3272,12 @@ struct scst_acg {
/* List of attached acn's, protected by scst_mutex */
struct list_head acn_list;
/* List entry in acg_lists (procfs) or tgt_acg_list (sysfs) */
/* List entry in tgt_acg_list */
struct list_head acg_list_entry;
/* Name of this acg */
const char *acg_name;
#ifdef CONFIG_SCST_PROC
/* The pointer to the /proc directory entry */
struct proc_dir_entry *acg_proc_root;
#endif
/* Type of I/O initiators grouping */
int acg_io_grouping_type;
@@ -3404,12 +3317,10 @@ struct scst_acg {
/* sysfs release completion */
struct completion *acg_kobj_release_cmpl;
#ifndef CONFIG_SCST_PROC
struct kobject acg_kobj; /* targets' ini_groups sysfs entry */
struct kobject *luns_kobj;
struct kobject *initiators_kobj;
#endif
/* LUNS addressing method for all LUNs in this ACG */
enum scst_lun_addr_method addr_method;
@@ -5318,65 +5229,6 @@ struct scst_trace_log {
extern struct mutex scst_mutex;
#ifdef CONFIG_SCST_PROC
/*
* Returns target driver's root entry in SCST's /proc hierarchy.
* The driver can create own files/directories here, which should
* be deleted in the driver's release().
*/
struct proc_dir_entry *scst_proc_get_tgt_root(
struct scst_tgt_template *vtt);
/*
* Returns device handler's root entry in SCST's /proc hierarchy.
* The driver can create own files/directories here, which should
* be deleted in the driver's detach()/release().
*/
struct proc_dir_entry *scst_proc_get_dev_type_root(
struct scst_dev_type *dtt);
/**
** Two library functions and the structure to help the drivers
** that use scst_debug.* facilities manage "trace_level" /proc entry.
** The functions service "standard" log levels and allow to work
** with driver specific levels, which should be passed inside as
** NULL-terminated array of struct scst_trace_log's, where:
** - val - the level's numeric value
** - token - its string representation
**/
int scst_proc_log_entry_read(struct seq_file *seq, unsigned long log_level,
const struct scst_trace_log *tbl);
int scst_proc_log_entry_write(struct file *file, const char __user *buf,
unsigned long length, unsigned long *log_level,
unsigned long default_level, const struct scst_trace_log *tbl);
/*
* helper data structure and function to create proc entry.
*/
struct scst_proc_data {
const struct file_operations seq_op;
int (*show)(struct seq_file *, void *);
void *data;
};
int scst_single_seq_open(struct inode *inode, struct file *file);
struct proc_dir_entry *scst_create_proc_entry(struct proc_dir_entry *root,
const char *name, struct scst_proc_data *pdata);
#define SCST_DEF_RW_SEQ_OP(x) \
.seq_op = { \
.owner = THIS_MODULE, \
.open = scst_single_seq_open,\
.read = seq_read, \
.write = x, \
.llseek = seq_lseek, \
.release = single_release, \
},
#else /* CONFIG_SCST_PROC */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34))
const struct sysfs_ops *scst_sysfs_get_sysfs_ops(void);
@@ -5461,7 +5313,6 @@ static inline struct kobject *scst_sysfs_get_sess_kobj(
return &sess->sess_kobj;
}
#endif /* CONFIG_SCST_PROC */
/* Returns target name */
static inline const char *scst_get_tgt_name(const struct scst_tgt *tgt)
@@ -5602,7 +5453,6 @@ static inline const char *scst_get_opcode_name(struct scst_cmd *cmd)
}
#endif
#ifndef CONFIG_SCST_PROC
/*
* Structure to match events to user space and replies on them
@@ -5716,7 +5566,6 @@ extern struct lockdep_map scst_dev_dep_map;
#endif
#endif
#endif /* CONFIG_SCST_PROC */
char *scst_get_next_lexem(char **token_str);
void scst_restore_token_str(char *prev_lexem, char *token_str);
@@ -5835,10 +5684,8 @@ struct scst_ext_copy_seg_descr {
int tgt_descr_offs;
};
#ifndef CONFIG_SCST_PROC
void scst_ext_copy_remap_done(struct scst_cmd *ec_cmd,
struct scst_ext_copy_data_descr *dds, int dds_cnt);
int scst_ext_copy_get_cur_seg_data_len(struct scst_cmd *ec_cmd);
#endif
#endif /* __SCST_H */
-12
View File
@@ -45,11 +45,7 @@
*/
#define SCST_VERSION(a, b, c, d) (((a) << 24) + ((b) << 16) + ((c) << 8) + d)
#define SCST_VERSION_CODE SCST_VERSION(3, 4, 0, 0)
#ifdef CONFIG_SCST_PROC
#define SCST_VERSION_STRING_SUFFIX "-procfs"
#else
#define SCST_VERSION_STRING_SUFFIX
#endif
#define SCST_VERSION_NAME "3.4.0-pre1"
#define SCST_VERSION_STRING SCST_VERSION_NAME SCST_VERSION_STRING_SUFFIX
@@ -249,14 +245,6 @@ typedef enum scst_data_direction {
#define SCST_DATA_DIR_MAX (SCST_DATA_NONE+1)
#ifdef CONFIG_SCST_PROC
/*************************************************************
** Name of the "Default" security group
*************************************************************/
#define SCST_DEFAULT_ACG_NAME "Default"
#endif
/*************************************************************
** Default suffix for targets with NULL names
-13
View File
@@ -221,29 +221,16 @@ static int __init cdrom_init(void)
if (res < 0)
goto out;
#ifdef CONFIG_SCST_PROC
res = scst_dev_handler_build_std_proc(&cdrom_devtype);
if (res != 0)
goto out_err;
#endif
out:
TRACE_EXIT();
return res;
#ifdef CONFIG_SCST_PROC
out_err:
scst_unregister_dev_driver(&cdrom_devtype);
goto out;
#endif
}
static void __exit cdrom_exit(void)
{
TRACE_ENTRY();
#ifdef CONFIG_SCST_PROC
scst_dev_handler_destroy_std_proc(&cdrom_devtype);
#endif
scst_unregister_dev_driver(&cdrom_devtype);
TRACE_EXIT();
return;
-13
View File
@@ -172,28 +172,15 @@ static int __init changer_init(void)
if (res < 0)
goto out;
#ifdef CONFIG_SCST_PROC
res = scst_dev_handler_build_std_proc(&changer_devtype);
if (res != 0)
goto out_err;
#endif
out:
TRACE_EXIT_RES(res);
return res;
#ifdef CONFIG_SCST_PROC
out_err:
scst_unregister_dev_driver(&changer_devtype);
goto out;
#endif
}
static void __exit changer_exit(void)
{
TRACE_ENTRY();
#ifdef CONFIG_SCST_PROC
scst_dev_handler_destroy_std_proc(&changer_devtype);
#endif
scst_unregister_dev_driver(&changer_devtype);
TRACE_EXIT();
return;
-98
View File
@@ -26,106 +26,8 @@
static unsigned long dh_trace_flag = SCST_DEFAULT_DEV_LOG_FLAGS;
#define trace_flag dh_trace_flag
#ifdef CONFIG_SCST_PROC
#define DEV_HANDLER_LOG_ENTRY_NAME "trace_level"
#ifndef trace_log_tbl
#define trace_log_tbl NULL
#endif
static struct scst_proc_data dev_handler_log_proc_data;
static int dev_handler_log_info_show(struct seq_file *seq, void *v)
{
int res = 0;
TRACE_ENTRY();
res = scst_proc_log_entry_read(seq, trace_flag, trace_log_tbl);
TRACE_EXIT_RES(res);
return res;
}
static ssize_t scst_dev_handler_proc_log_entry_write(struct file *file,
const char __user *buf, size_t length, loff_t *off)
{
int res = 0;
TRACE_ENTRY();
res = scst_proc_log_entry_write(file, buf, length, &trace_flag,
SCST_DEFAULT_DEV_LOG_FLAGS, trace_log_tbl);
TRACE_EXIT_RES(res);
return res;
}
#endif /* CONFIG_SCST_PROC */
#endif /* defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) */
#ifdef CONFIG_SCST_PROC
static int scst_dev_handler_build_std_proc(struct scst_dev_type *dev_type)
{
int res = 0;
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
struct proc_dir_entry *p, *root;
TRACE_ENTRY();
root = scst_proc_get_dev_type_root(dev_type);
if (root) {
/* Create the proc file entry for the device */
/* Workaround to keep /proc ABI intact */
const char *name;
if (strcmp(dev_type->name, "vdisk_fileio") == 0)
name = "vdisk";
else
name = dev_type->name;
dev_handler_log_proc_data.data = (void *)name;
p = scst_create_proc_entry(root, DEV_HANDLER_LOG_ENTRY_NAME,
&dev_handler_log_proc_data);
if (p == NULL) {
PRINT_ERROR("Not enough memory to register dev "
"handler %s entry %s in /proc",
name, DEV_HANDLER_LOG_ENTRY_NAME);
res = -ENOMEM;
goto out;
}
}
out:
TRACE_EXIT_RES(res);
#endif
return res;
}
static void scst_dev_handler_destroy_std_proc(struct scst_dev_type *dev_type)
{
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
struct proc_dir_entry *root;
TRACE_ENTRY();
root = scst_proc_get_dev_type_root(dev_type);
if (root)
remove_proc_entry(DEV_HANDLER_LOG_ENTRY_NAME, root);
TRACE_EXIT();
#endif
}
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
static struct scst_proc_data dev_handler_log_proc_data = {
SCST_DEF_RW_SEQ_OP(scst_dev_handler_proc_log_entry_write)
.show = dev_handler_log_info_show,
};
#endif
#endif /* CONFIG_SCST_PROC */
#endif /* __SCST_DEV_HANDLER_H */
-20
View File
@@ -569,27 +569,11 @@ static int __init init_scst_disk_driver(void)
if (res < 0)
goto out_unreg;
#ifdef CONFIG_SCST_PROC
res = scst_dev_handler_build_std_proc(&disk_devtype);
if (res != 0)
goto out_unreg1;
res = scst_dev_handler_build_std_proc(&disk_devtype_perf);
if (res != 0)
goto out_unreg2;
#endif
out:
TRACE_EXIT_RES(res);
return res;
#ifdef CONFIG_SCST_PROC
out_unreg2:
scst_dev_handler_destroy_std_proc(&disk_devtype);
out_unreg1:
scst_unregister_dev_driver(&disk_devtype_perf);
#endif
out_unreg:
scst_unregister_dev_driver(&disk_devtype);
@@ -600,10 +584,6 @@ static void __exit exit_scst_disk_driver(void)
{
TRACE_ENTRY();
#ifdef CONFIG_SCST_PROC
scst_dev_handler_destroy_std_proc(&disk_devtype_perf);
scst_dev_handler_destroy_std_proc(&disk_devtype);
#endif
scst_unregister_dev_driver(&disk_devtype_perf);
scst_unregister_dev_driver(&disk_devtype);
-20
View File
@@ -97,27 +97,11 @@ static int __init init_scst_modisk_driver(void)
if (res < 0)
goto out_unreg;
#ifdef CONFIG_SCST_PROC
res = scst_dev_handler_build_std_proc(&modisk_devtype);
if (res != 0)
goto out_unreg1;
res = scst_dev_handler_build_std_proc(&modisk_devtype_perf);
if (res != 0)
goto out_unreg2;
#endif
out:
TRACE_EXIT_RES(res);
return res;
#ifdef CONFIG_SCST_PROC
out_unreg2:
scst_dev_handler_destroy_std_proc(&modisk_devtype);
out_unreg1:
scst_unregister_dev_driver(&modisk_devtype_perf);
#endif
out_unreg:
scst_unregister_dev_driver(&modisk_devtype);
@@ -128,10 +112,6 @@ static void __exit exit_scst_modisk_driver(void)
{
TRACE_ENTRY();
#ifdef CONFIG_SCST_PROC
scst_dev_handler_destroy_std_proc(&modisk_devtype_perf);
scst_dev_handler_destroy_std_proc(&modisk_devtype);
#endif
scst_unregister_dev_driver(&modisk_devtype_perf);
scst_unregister_dev_driver(&modisk_devtype);
-13
View File
@@ -172,28 +172,15 @@ static int __init processor_init(void)
if (res < 0)
goto out;
#ifdef CONFIG_SCST_PROC
res = scst_dev_handler_build_std_proc(&processor_devtype);
if (res != 0)
goto out_err;
#endif
out:
TRACE_EXIT_RES(res);
return res;
#ifdef CONFIG_SCST_PROC
out_err:
scst_unregister_dev_driver(&processor_devtype);
goto out;
#endif
}
static void __exit processor_exit(void)
{
TRACE_ENTRY();
#ifdef CONFIG_SCST_PROC
scst_dev_handler_destroy_std_proc(&processor_devtype);
#endif
scst_unregister_dev_driver(&processor_devtype);
TRACE_EXIT();
return;
-13
View File
@@ -172,29 +172,16 @@ static int __init raid_init(void)
if (res < 0)
goto out;
#ifdef CONFIG_SCST_PROC
res = scst_dev_handler_build_std_proc(&raid_devtype);
if (res != 0)
goto out_err;
#endif
out:
TRACE_EXIT_RES(res);
return res;
#ifdef CONFIG_SCST_PROC
out_err:
scst_unregister_dev_driver(&raid_devtype);
goto out;
#endif
}
static void __exit raid_exit(void)
{
TRACE_ENTRY();
#ifdef CONFIG_SCST_PROC
scst_dev_handler_destroy_std_proc(&raid_devtype);
#endif
scst_unregister_dev_driver(&raid_devtype);
TRACE_EXIT();
return;
-20
View File
@@ -102,27 +102,11 @@ static int __init init_scst_tape_driver(void)
if (res < 0)
goto out_unreg;
#ifdef CONFIG_SCST_PROC
res = scst_dev_handler_build_std_proc(&tape_devtype);
if (res != 0)
goto out_unreg1;
res = scst_dev_handler_build_std_proc(&tape_devtype_perf);
if (res != 0)
goto out_unreg2;
#endif
out:
TRACE_EXIT_RES(res);
return res;
#ifdef CONFIG_SCST_PROC
out_unreg2:
scst_dev_handler_destroy_std_proc(&tape_devtype);
out_unreg1:
scst_unregister_dev_driver(&tape_devtype_perf);
#endif
out_unreg:
scst_unregister_dev_driver(&tape_devtype);
@@ -133,10 +117,6 @@ static void __exit exit_scst_tape_driver(void)
{
TRACE_ENTRY();
#ifdef CONFIG_SCST_PROC
scst_dev_handler_destroy_std_proc(&tape_devtype_perf);
scst_dev_handler_destroy_std_proc(&tape_devtype);
#endif
scst_unregister_dev_driver(&tape_devtype_perf);
scst_unregister_dev_driver(&tape_devtype);
-89
View File
@@ -195,14 +195,6 @@ static long dev_user_ioctl(struct file *file, unsigned int cmd,
static int dev_user_release(struct inode *inode, struct file *file);
static int dev_user_exit_dev(struct scst_user_dev *dev);
#ifdef CONFIG_SCST_PROC
#ifdef CONFIG_SCST_DEBUG
static int dev_user_read_proc(struct seq_file *seq,
struct scst_dev_type *dev_type);
#endif
#else /* CONFIG_SCST_PROC */
static ssize_t dev_user_sysfs_commands_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf);
@@ -215,7 +207,6 @@ static const struct attribute *dev_user_dev_attrs[] = {
NULL,
};
#endif /* CONFIG_SCST_PROC */
static int dev_usr_parse(struct scst_cmd *cmd);
@@ -239,9 +230,6 @@ static struct scst_dev_type dev_user_devtype = {
.name = DEV_USER_NAME,
.type = -1,
.parse = dev_usr_parse,
#if defined(CONFIG_SCST_PROC) && defined(CONFIG_SCST_DEBUG)
.read_proc = dev_user_read_proc,
#endif
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
.default_trace_flags = SCST_DEFAULT_DEV_LOG_FLAGS,
.trace_flags = &trace_flag,
@@ -962,7 +950,6 @@ static enum scst_exec_res dev_user_exec(struct scst_cmd *cmd)
return res;
}
#ifndef CONFIG_SCST_PROC
static void dev_user_ext_copy_remap(struct scst_cmd *cmd,
struct scst_ext_copy_seg_descr *seg)
{
@@ -993,7 +980,6 @@ static void dev_user_ext_copy_remap(struct scst_cmd *cmd,
TRACE_EXIT();
return;
}
#endif
static void dev_user_free_sgv(struct scst_user_cmd *ucmd)
{
@@ -1492,7 +1478,6 @@ static int dev_user_process_reply_on_cache_free(struct scst_user_cmd *ucmd)
return res;
}
#ifndef CONFIG_SCST_PROC
static int dev_user_process_reply_ext_copy_remap(struct scst_user_cmd *ucmd,
struct scst_user_reply_cmd *reply)
{
@@ -1636,7 +1621,6 @@ out_status:
scst_set_cmd_error_status(cmd, rreply->status);
goto out_done;
}
#endif
static int dev_user_process_ws_reply(struct scst_user_cmd *ucmd,
struct scst_user_scsi_cmd_reply_exec *ereply)
@@ -1967,11 +1951,9 @@ unlock_process:
res = dev_user_process_reply_on_cache_free(ucmd);
break;
#ifndef CONFIG_SCST_PROC
case UCMD_STATE_EXT_COPY_REMAPPING:
res = dev_user_process_reply_ext_copy_remap(ucmd, reply);
break;
#endif
case UCMD_STATE_TM_RECEIVED_EXECING:
case UCMD_STATE_TM_DONE_EXECING:
@@ -2691,11 +2673,7 @@ static void dev_user_unjam_cmd(struct scst_user_cmd *ucmd, int busy,
SCST_CONTEXT_THREAD);
else {
sBUG_ON(state != UCMD_STATE_EXT_COPY_REMAPPING);
#ifndef CONFIG_SCST_PROC
scst_ext_copy_remap_done(ucmd->cmd, NULL, 0);
#else
sBUG();
#endif
}
/* !! At this point cmd and ucmd can be already freed !! */
@@ -3236,10 +3214,8 @@ static void dev_user_setup_functions(struct scst_user_dev *dev)
dev->devtype.dev_done = NULL;
dev->devtype.ext_copy_remap = NULL;
#ifndef CONFIG_SCST_PROC
if (dev->ext_copy_remap_supported)
dev->devtype.ext_copy_remap = dev_user_ext_copy_remap;
#endif
if (dev->parse_type != SCST_USER_PARSE_CALL) {
switch (dev->devtype.type) {
@@ -3443,11 +3419,7 @@ static int dev_user_register_dev(struct file *file,
dev->devtype.parse_atomic = 1;
dev->devtype.dev_alloc_data_buf_atomic = 1;
dev->devtype.dev_done_atomic = 1;
#ifdef CONFIG_SCST_PROC
dev->devtype.no_proc = 1;
#else
dev->devtype.dev_attrs = dev_user_dev_attrs;
#endif
dev->devtype.attach = dev_user_attach;
dev->devtype.detach = dev_user_detach;
dev->devtype.attach_tgt = dev_user_attach_tgt;
@@ -4014,7 +3986,6 @@ out:
return res;
}
#ifndef CONFIG_SCST_PROC
static ssize_t dev_user_sysfs_commands_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
@@ -4059,50 +4030,6 @@ static ssize_t dev_user_sysfs_commands_show(struct kobject *kobj,
return pos;
}
#else /* CONFIG_SCST_PROC */
#ifdef CONFIG_SCST_DEBUG
/*
* Called when a file in the /proc/scsi_tgt/scst_user is read
*/
static int dev_user_read_proc(struct seq_file *seq, struct scst_dev_type *dev_type)
{
int res = 0;
struct scst_user_dev *dev;
unsigned long flags;
TRACE_ENTRY();
spin_lock(&dev_list_lock);
list_for_each_entry(dev, &dev_list, dev_list_entry) {
int i;
seq_printf(seq, "Device %s commands:\n", dev->name);
spin_lock_irqsave(&dev->udev_cmd_threads.cmd_list_lock, flags);
for (i = 0; i < (int)ARRAY_SIZE(dev->ucmd_hash); i++) {
struct list_head *head = &dev->ucmd_hash[i];
struct scst_user_cmd *ucmd;
list_for_each_entry(ucmd, head, hash_list_entry) {
seq_printf(seq, "ucmd %p (state %x, ref %d), "
"sent_to_user %d, seen_by_user %d, "
"aborted %d, jammed %d, scst_cmd %p\n",
ucmd, ucmd->state,
atomic_read(&ucmd->ucmd_ref),
ucmd->sent_to_user, ucmd->seen_by_user,
ucmd->aborted, ucmd->jammed, ucmd->cmd);
}
}
spin_unlock_irqrestore(&dev->udev_cmd_threads.cmd_list_lock, flags);
}
spin_unlock(&dev_list_lock);
TRACE_EXIT_RES(res);
return res;
}
#endif /* CONFIG_SCST_DEBUG */
#endif /* CONFIG_SCST_PROC */
static inline int test_cleanup_list(void)
{
@@ -4226,22 +4153,13 @@ static int __init init_scst_user(void)
if (res < 0)
goto out_cache;
#ifdef CONFIG_SCST_PROC
res = scst_dev_handler_build_std_proc(&dev_user_devtype);
if (res != 0)
goto out_unreg;
#endif
dev_user_sysfs_class = class_create(THIS_MODULE, DEV_USER_NAME);
if (IS_ERR(dev_user_sysfs_class)) {
PRINT_ERROR("%s", "Unable create sysfs class for SCST user "
"space handler");
res = PTR_ERR(dev_user_sysfs_class);
#ifdef CONFIG_SCST_PROC
goto out_proc;
#else
goto out_unreg;
#endif
}
dev_user_major = register_chrdev(0, DEV_USER_NAME, &dev_user_fops);
@@ -4296,10 +4214,6 @@ out_chrdev:
out_class:
class_destroy(dev_user_sysfs_class);
#ifdef CONFIG_SCST_PROC
out_proc:
scst_dev_handler_destroy_std_proc(&dev_user_devtype);
#endif
out_unreg:
scst_unregister_dev_driver(&dev_user_devtype);
@@ -4330,9 +4244,6 @@ static void __exit exit_scst_user(void)
#endif
class_destroy(dev_user_sysfs_class);
#ifdef CONFIG_SCST_PROC
scst_dev_handler_destroy_std_proc(&dev_user_devtype);
#endif
scst_unregister_virtual_dev_driver(&dev_user_devtype);
kmem_cache_destroy(user_cmd_cachep);
-746
View File
@@ -135,9 +135,6 @@
#define DEF_DIF_FILENAME_TMPL SCST_VAR_DIR "/dif_tags/%s.dif"
#ifdef CONFIG_SCST_PROC
#define VDISK_PROC_HELP "help"
#endif
struct scst_vdisk_dev {
uint64_t nblocks;
@@ -308,7 +305,6 @@ MODULE_PARM_DESC(num_threads, "vdisk threads count");
*/
static spinlock_t vdev_err_lock;
#ifndef CONFIG_SCST_PROC
/** SYSFS **/
@@ -323,7 +319,6 @@ static struct kobj_attribute vdev_dif_filename_attr =
__ATTR(dif_filename, S_IRUGO, vdev_dif_filename_show, NULL);
#endif /* CONFIG_SCST_PROC */
/*
* Protects vdisks addition/deletion and related activities, like search.
@@ -356,25 +351,6 @@ static struct scst_dev_type vdisk_blk_devtype;
static struct scst_dev_type vdisk_null_devtype;
static struct scst_dev_type vcdrom_devtype;
#ifdef CONFIG_SCST_PROC
static char *vdisk_proc_help_string =
"echo \"open|close|resync_size NAME [FILE_NAME [BLOCK_SIZE] "
"[WRITE_THROUGH READ_ONLY O_DIRECT NULLIO NV_CACHE BLOCKIO]]\" "
">/proc/scsi_tgt/vdisk/vdisk\n"
"echo \"set_t10_dev_id NAME t10_dev_id\" "
">/proc/scsi_tgt/vdisk/vdisk\n";
static char *vcdrom_proc_help_string =
"echo \"open|change|close NAME [FILE_NAME]\" "
">/proc/scsi_tgt/vcdrom/vcdrom\n";
static int scst_vdisk_ID;
module_param_named(scst_vdisk_ID, scst_vdisk_ID, int, S_IRUGO);
MODULE_PARM_DESC(scst_vdisk_ID, "SCST virtual disk subsystem ID");
#endif /* CONFIG_SCST_PROC */
static const char *vdev_get_filename(const struct scst_vdisk_dev *virt_dev)
{
@@ -629,7 +605,6 @@ check:
if (virt_dev->thin_provisioned) {
int block_shift = virt_dev->dev->block_shift;
#ifndef CONFIG_SCST_PROC
int rc;
rc = sysfs_create_file(&virt_dev->dev->dev_kobj,
@@ -639,7 +614,6 @@ check:
gen_tp_soft_threshold_reached_UA_attr.attr.name,
virt_dev->name);
}
#endif
if (virt_dev->blockio) {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) || \
@@ -1251,7 +1225,6 @@ next:
PRINT_WARNING("Device %s: static app tag is ignored for DIF "
"mode 2", dev->virt_name);
#ifndef CONFIG_SCST_PROC
if (virt_dev->dif_filename != NULL) {
res = scst_create_dev_attr(dev, &vdev_dif_filename_attr);
if (res != 0) {
@@ -1261,7 +1234,6 @@ next:
goto out;
}
}
#endif
if (virt_dev->zero_copy && virt_dev->o_direct_flag) {
PRINT_ERROR("%s: combining zero_copy with o_direct is not"
@@ -1278,10 +1250,6 @@ next:
dev->dev_rd_only = virt_dev->rd_only;
#ifdef CONFIG_SCST_PROC
if (virt_dev->nullio && !virt_dev->file_size)
virt_dev->file_size = VDISK_NULLIO_SIZE;
#endif
res = vdisk_reexamine(virt_dev);
if (res < 0)
@@ -3554,11 +3522,7 @@ static uint64_t vdisk_gen_dev_id_num(const char *virt_dev_name)
dev_id_num = crc32c(0, virt_dev_name, strlen(virt_dev_name)+1);
#ifdef CONFIG_SCST_PROC
return ((uint64_t)scst_vdisk_ID << 32) | dev_id_num;
#else
return ((uint64_t)scst_get_setup_id() << 32) | dev_id_num;
#endif
}
static void vdisk_exec_write_same_unmap(struct vdisk_cmd_params *p)
@@ -7120,7 +7084,6 @@ static void vdev_destroy(struct scst_vdisk_dev *virt_dev)
return;
}
#ifndef CONFIG_SCST_PROC
static void vdev_check_node(struct scst_vdisk_dev **pvirt_dev, int orig_nodeid)
{
@@ -7651,7 +7614,6 @@ out:
}
#endif /* CONFIG_SCST_PROC */
static void vdev_on_free(struct scst_device *dev, void *arg)
{
@@ -7685,7 +7647,6 @@ static void vdev_del_device(struct scst_vdisk_dev *virt_dev)
return;
}
#ifndef CONFIG_SCST_PROC
static ssize_t vdisk_del_device(const char *device_name)
{
@@ -7820,7 +7781,6 @@ out:
return res;
}
#endif /* CONFIG_SCST_PROC */
static int vcdrom_change(struct scst_vdisk_dev *virt_dev,
char *buffer)
@@ -7963,7 +7923,6 @@ out_e_unlock:
goto out_resume;
}
#ifndef CONFIG_SCST_PROC
static ssize_t vdisk_sysfs_sync_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
@@ -9794,649 +9753,7 @@ static ssize_t vdev_dif_filename_show(struct kobject *kobj,
return pos;
}
#else /* CONFIG_SCST_PROC */
/*
* ProcFS
*/
/*
* Called when a file in the /proc/VDISK_NAME/VDISK_NAME is read
*/
static int vdisk_read_proc(struct seq_file *seq, struct scst_dev_type *dev_type)
{
int res = 0;
struct scst_vdisk_dev *virt_dev;
TRACE_ENTRY();
res = mutex_lock_interruptible(&scst_vdisk_mutex);
if (res != 0)
goto out;
seq_printf(seq, "%-17s %-11s %-11s %-15s %-45s %-16s\n",
"Name", "Size(MB)", "Block size", "Options", "File name",
"T10 device id");
list_for_each_entry(virt_dev, &vdev_list, vdev_list_entry) {
int c;
sBUG_ON(!virt_dev->dev);
if (virt_dev->dev->type != TYPE_DISK)
continue;
seq_printf(seq, "%-17s %-11d %-12d", virt_dev->name,
(uint32_t)(virt_dev->file_size >> 20),
1 << virt_dev->blk_shift);
c = 0;
if (virt_dev->wt_flag) {
seq_printf(seq, "WT ");
c += 3;
}
if (virt_dev->nv_cache) {
seq_printf(seq, "NV ");
c += 3;
}
if (virt_dev->dev->dev_rd_only) {
seq_printf(seq, "RO ");
c += 3;
}
if (virt_dev->o_direct_flag) {
seq_printf(seq, "DR ");
c += 3;
}
if (virt_dev->nullio) {
seq_printf(seq, "NIO ");
c += 4;
}
if (virt_dev->blockio) {
seq_printf(seq, "BIO ");
c += 4;
}
if (virt_dev->removable) {
seq_printf(seq, "RM ");
c += 3;
}
while (c < 16) {
seq_printf(seq, " ");
c++;
}
read_lock(&vdisk_serial_rwlock);
seq_printf(seq, "%-45s %-16s\n", vdev_get_filename(virt_dev),
virt_dev->t10_dev_id);
read_unlock(&vdisk_serial_rwlock);
}
mutex_unlock(&scst_vdisk_mutex);
out:
TRACE_EXIT_RES(res);
return res;
}
/*
* Called when a file in the /proc/VDISK_NAME/VDISK_NAME is written
*/
static int vdisk_write_proc(char *buffer, char **start, off_t offset,
int length, int *eof, struct scst_dev_type *dev_type)
{
int res = 0, action;
char *p, *name, *filename, *i_buf, *t10_dev_id;
struct scst_vdisk_dev *virt_dev;
int block_shift = DEF_DISK_BLOCK_SHIFT;
uint32_t block_size = 1 << block_shift;
size_t slen;
TRACE_ENTRY();
if ((length == 0) || (buffer == NULL) || (buffer[0] == '\0'))
goto out;
i_buf = kasprintf(GFP_KERNEL, "%.*s", (int)length, buffer);
if (i_buf == NULL) {
PRINT_ERROR("Unable to alloc intermediate buffer with size %d",
length+1);
res = -ENOMEM;
goto out;
}
res = mutex_lock_interruptible(&scst_vdisk_mutex);
if (res != 0)
goto out_free;
p = i_buf;
if (p[strlen(p) - 1] == '\n')
p[strlen(p) - 1] = '\0';
if (!strncmp("close ", p, 6)) {
p += 6;
action = 0;
} else if (!strncmp("open ", p, 5)) {
p += 5;
action = 1;
} else if (!strncmp("resync_size ", p, 12)) {
p += 12;
action = 2;
} else if (!strncmp("set_t10_dev_id ", p, 15)) {
p += 15;
action = 3;
} else {
PRINT_ERROR("Unknown action \"%s\"", p);
res = -EINVAL;
goto out_up;
}
while (isspace(*p) && *p != '\0')
p++;
name = p;
while (!isspace(*p) && *p != '\0')
p++;
*p++ = '\0';
if (*name == '\0') {
PRINT_ERROR("%s", "Name required");
res = -EINVAL;
goto out_up;
} else if (strlen(name) >= sizeof(virt_dev->name)) {
PRINT_ERROR("Name is too long (max %zd "
"characters)", sizeof(virt_dev->name)-1);
res = -EINVAL;
goto out_up;
}
if (action == 1) {
/* open */
while (isspace(*p) && *p != '\0')
p++;
filename = p;
while (!isspace(*p) && *p != '\0')
p++;
*p++ = '\0';
if (*filename == '\0') {
PRINT_ERROR("%s", "File name required");
res = -EINVAL;
goto out_up;
}
res = vdev_create(dev_type, name, &virt_dev);
if (res != 0)
goto out_up;
virt_dev->wt_flag = DEF_WRITE_THROUGH;
virt_dev->nv_cache = DEF_NV_CACHE;
virt_dev->o_direct_flag = DEF_O_DIRECT;
while (isspace(*p) && *p != '\0')
p++;
if (isdigit(*p)) {
char *pp;
block_size = simple_strtoul(p, &pp, 0);
p = pp;
if ((*p != '\0') && !isspace(*p)) {
PRINT_ERROR("Parse error: \"%s\"", p);
res = -EINVAL;
goto out_free_vdev;
}
while (isspace(*p) && *p != '\0')
p++;
block_shift = scst_calc_block_shift(block_size);
if (block_shift < 9) {
PRINT_ERROR("blocksize %u too small",
block_size);
res = -EINVAL;
goto out_free_vdev;
}
}
virt_dev->blk_shift = block_shift;
while (*p != '\0') {
if (!strncmp("WRITE_THROUGH", p, 13)) {
p += 13;
virt_dev->wt_flag = 1;
TRACE_DBG("%s", "WRITE_THROUGH");
} else if (!strncmp("NV_CACHE", p, 8)) {
p += 8;
virt_dev->nv_cache = 1;
TRACE_DBG("%s", "NON-VOLATILE CACHE");
} else if (!strncmp("READ_ONLY", p, 9)) {
p += 9;
virt_dev->rd_only = 1;
TRACE_DBG("%s", "READ_ONLY");
} else if (!strncmp("O_DIRECT", p, 8)) {
p += 8;
#if 0
virt_dev->o_direct_flag = 1;
TRACE_DBG("%s", "O_DIRECT");
#else
PRINT_INFO("%s flag doesn't currently"
" work, ignoring it, use fileio_tgt "
"in O_DIRECT mode instead", "O_DIRECT");
#endif
} else if (!strncmp("NULLIO", p, 6)) {
p += 6;
virt_dev->nullio = 1;
/* Bad hack for anyway going out procfs */
virt_dev->vdev_devt = &vdisk_null_devtype;
TRACE_DBG("%s", "NULLIO");
} else if (!strncmp("BLOCKIO", p, 7)) {
p += 7;
virt_dev->blockio = 1;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
res = vdisk_create_bioset(virt_dev);
if (res != 0)
goto out_free_vdev;
#endif
/* Bad hack for anyway going out procfs */
virt_dev->vdev_devt = &vdisk_blk_devtype;
sprintf(virt_dev->t10_vend_id, "%.*s",
(int)sizeof(virt_dev->t10_vend_id) - 1,
SCST_BIO_VENDOR);
TRACE_DBG("%s", "BLOCKIO");
} else if (!strncmp("REMOVABLE", p, 9)) {
p += 9;
virt_dev->removable = 1;
TRACE_DBG("%s", "REMOVABLE");
} else {
PRINT_ERROR("Unknown flag \"%s\"", p);
res = -EINVAL;
goto out_free_vdev;
}
while (isspace(*p) && *p != '\0')
p++;
}
if (!virt_dev->nullio && (*filename != '/')) {
PRINT_ERROR("File path \"%s\" is not "
"absolute", filename);
res = -EINVAL;
goto out_free_vdev;
}
virt_dev->filename = kstrdup(filename, GFP_KERNEL);
if (virt_dev->filename == NULL) {
PRINT_ERROR("%s", "Allocation of filename failed");
res = -ENOMEM;
goto out_free_vdev;
}
list_add_tail(&virt_dev->vdev_list_entry,
&vdev_list);
vdisk_report_registering(virt_dev);
virt_dev->virt_id = scst_register_virtual_device(
virt_dev->vdev_devt, virt_dev->name);
if (virt_dev->virt_id < 0) {
res = virt_dev->virt_id;
goto out_free_vpath;
}
TRACE_DBG("Added virt_dev (name %s, file name %s, "
"id %d, block size %d) to "
"vdev_list", virt_dev->name,
vdev_get_filename(virt_dev), virt_dev->virt_id,
1 << virt_dev->blk_shift);
} else if (action == 0) { /* close */
virt_dev = vdev_find(name);
if (virt_dev == NULL) {
PRINT_ERROR("Device %s not found", name);
res = -EINVAL;
goto out_up;
}
vdev_del_device(virt_dev);
} else if (action == 2) { /* resync_size */
virt_dev = vdev_find(name);
if (virt_dev == NULL) {
PRINT_ERROR("Device %s not found", name);
res = -EINVAL;
goto out_up;
}
res = vdisk_resync_size(virt_dev);
if (res != 0)
goto out_up;
} else if (action == 3) { /* set T10 device id */
virt_dev = vdev_find(name);
if (virt_dev == NULL) {
PRINT_ERROR("Device %s not found", name);
res = -EINVAL;
goto out_up;
}
while (isspace(*p) && *p != '\0')
p++;
t10_dev_id = p;
while (*p != '\0')
p++;
*p++ = '\0';
if (*t10_dev_id == '\0') {
PRINT_ERROR("%s", "T10 device id required");
res = -EINVAL;
goto out_up;
}
write_lock(&vdisk_serial_rwlock);
slen = (strlen(t10_dev_id) <= (sizeof(virt_dev->t10_dev_id)-1) ?
strlen(t10_dev_id) :
(sizeof(virt_dev->t10_dev_id)-1));
memset(virt_dev->t10_dev_id, 0, sizeof(virt_dev->t10_dev_id));
memcpy(virt_dev->t10_dev_id, t10_dev_id, slen);
PRINT_INFO("T10 device id for device %s changed to %s",
virt_dev->name, virt_dev->t10_dev_id);
write_unlock(&vdisk_serial_rwlock);
}
res = length;
out_up:
mutex_unlock(&scst_vdisk_mutex);
out_free:
kfree(i_buf);
out:
TRACE_EXIT_RES(res);
return res;
out_free_vpath:
list_del(&virt_dev->vdev_list_entry);
kfree(virt_dev->filename);
virt_dev->filename = NULL;
out_free_vdev:
vdev_destroy(virt_dev);
goto out_up;
}
/*
* Called when a file in the /proc/VCDROM_NAME/VCDROM_NAME is read
*/
static int vcdrom_read_proc(struct seq_file *seq,
struct scst_dev_type *dev_type)
{
int res = 0;
struct scst_vdisk_dev *virt_dev;
TRACE_ENTRY();
res = mutex_lock_interruptible(&scst_vdisk_mutex);
if (res != 0)
goto out;
seq_printf(seq, "%-17s %-9s %s\n", "Name", "Size(MB)", "File name");
list_for_each_entry(virt_dev, &vdev_list, vdev_list_entry) {
if (virt_dev->dev->type != TYPE_ROM)
continue;
seq_printf(seq, "%-17s %-9d %s\n", virt_dev->name,
(uint32_t)(virt_dev->file_size >> 20),
vdev_get_filename(virt_dev));
}
mutex_unlock(&scst_vdisk_mutex);
out:
TRACE_EXIT_RES(res);
return res;
}
/* scst_vdisk_mutex supposed to be held */
static int vcdrom_open(char *p, char *name)
{
struct scst_vdisk_dev *virt_dev;
char *filename;
int res = 0;
int cdrom_empty;
while (isspace(*p) && *p != '\0')
p++;
filename = p;
while (!isspace(*p) && *p != '\0')
p++;
*p++ = '\0';
if (*filename == '\0') {
cdrom_empty = 1;
TRACE_DBG("%s", "No media");
} else if (*filename != '/') {
PRINT_ERROR("File path \"%s\" is not absolute", filename);
res = -EINVAL;
goto out;
} else
cdrom_empty = 0;
res = vdev_create(&vcdrom_devtype, name, &virt_dev);
if (res != 0)
goto out;
virt_dev->cdrom_empty = cdrom_empty;
virt_dev->rd_only = 1;
virt_dev->removable = 1;
if (!virt_dev->cdrom_empty) {
virt_dev->filename = kstrdup(filename, GFP_KERNEL);
if (virt_dev->filename == NULL) {
PRINT_ERROR("%s", "Allocation of filename failed");
res = -ENOMEM;
goto out_free_vdev;
}
}
list_add_tail(&virt_dev->vdev_list_entry, &vdev_list);
PRINT_INFO("Registering virtual CDROM %s", name);
virt_dev->virt_id =
scst_register_virtual_device(&vcdrom_devtype,
virt_dev->name);
if (virt_dev->virt_id < 0) {
res = virt_dev->virt_id;
goto out_free_vpath;
}
TRACE_DBG("Added virt_dev (name %s filename %s id %d) "
"to vdev_list", virt_dev->name,
vdev_get_filename(virt_dev), virt_dev->virt_id);
out:
return res;
out_free_vpath:
list_del(&virt_dev->vdev_list_entry);
kfree(virt_dev->filename);
virt_dev->filename = NULL;
out_free_vdev:
vdev_destroy(virt_dev);
goto out;
}
/* scst_vdisk_mutex supposed to be held */
static int vcdrom_close(char *name)
{
struct scst_vdisk_dev *virt_dev;
int res = 0;
virt_dev = vdev_find(name);
if (virt_dev == NULL) {
PRINT_ERROR("Virtual device with name "
"%s not found", name);
res = -EINVAL;
goto out;
}
vdev_del_device(virt_dev);
out:
return res;
}
/* scst_vdisk_mutex supposed to be held */
static int vcdrom_proc_change(char *p, const char *name)
{
struct scst_vdisk_dev *virt_dev;
int res;
virt_dev = vdev_find(name);
if (virt_dev == NULL) {
PRINT_ERROR("Virtual cdrom with name "
"%s not found", name);
res = -EINVAL;
goto out;
}
res = vcdrom_change(virt_dev, p);
out:
return res;
}
/*
* Called when a file in the /proc/VCDROM_NAME/VCDROM_NAME is written
*/
static int vcdrom_write_proc(char *buffer, char **start, off_t offset,
int length, int *eof, struct scst_dev_type *dev_type)
{
int res = 0, action;
char *p, *name, *i_buf;
struct scst_vdisk_dev *virt_dev;
TRACE_ENTRY();
if ((length == 0) || (buffer == NULL) || (buffer[0] == '\0'))
goto out;
i_buf = kasprintf(GFP_KERNEL, "%.*s", (int)length, buffer);
if (i_buf == NULL) {
PRINT_ERROR("Unable to alloc intermediate buffer with size %d",
length+1);
res = -ENOMEM;
goto out;
}
res = mutex_lock_interruptible(&scst_vdisk_mutex);
if (res != 0)
goto out_free;
p = i_buf;
if (p[strlen(p) - 1] == '\n')
p[strlen(p) - 1] = '\0';
if (!strncmp("close ", p, 6)) {
p += 6;
action = 0;
} else if (!strncmp("change ", p, 7)) {
p += 7;
action = 1;
} else if (!strncmp("open ", p, 5)) {
p += 5;
action = 2;
} else {
PRINT_ERROR("Unknown action \"%s\"", p);
res = -EINVAL;
goto out_up;
}
while (isspace(*p) && *p != '\0')
p++;
name = p;
while (!isspace(*p) && *p != '\0')
p++;
*p++ = '\0';
if (*name == '\0') {
PRINT_ERROR("%s", "Name required");
res = -EINVAL;
goto out_up;
} else if (strlen(name) >= sizeof(virt_dev->name)) {
PRINT_ERROR("Name is too long (max %zd "
"characters)", sizeof(virt_dev->name)-1);
res = -EINVAL;
goto out_up;
}
if (action == 2) {
/* open */
res = vcdrom_open(p, name);
if (res != 0)
goto out_up;
} else if (action == 1) {
/* change */
res = vcdrom_proc_change(p, name);
if (res != 0)
goto out_up;
} else {
/* close */
res = vcdrom_close(name);
if (res != 0)
goto out_up;
}
res = length;
out_up:
mutex_unlock(&scst_vdisk_mutex);
out_free:
kfree(i_buf);
out:
TRACE_EXIT_RES(res);
return res;
}
static int vdisk_help_info_show(struct seq_file *seq, void *v)
{
char *s = (char *)seq->private;
TRACE_ENTRY();
seq_printf(seq, "%s", s);
TRACE_EXIT();
return 0;
}
static struct scst_proc_data vdisk_help_proc_data = {
SCST_DEF_RW_SEQ_OP(NULL)
.show = vdisk_help_info_show,
};
static int vdisk_proc_help_build(struct scst_dev_type *dev_type)
{
int res = 0;
struct proc_dir_entry *p, *root;
TRACE_ENTRY();
root = scst_proc_get_dev_type_root(dev_type);
vdisk_help_proc_data.data = (dev_type->type == TYPE_DISK) ?
vdisk_proc_help_string :
vcdrom_proc_help_string;
p = scst_create_proc_entry(root, VDISK_PROC_HELP,
&vdisk_help_proc_data);
if (p == NULL) {
PRINT_ERROR("Not enough memory to register dev "
"handler %s entry %s in /proc", "vdisk", VDISK_PROC_HELP);
res = -ENOMEM;
}
TRACE_EXIT_RES(res);
return res;
}
static void vdisk_proc_help_destroy(struct scst_dev_type *dev_type)
{
struct proc_dir_entry *root;
TRACE_ENTRY();
root = scst_proc_get_dev_type_root(dev_type);
if (root)
remove_proc_entry(VDISK_PROC_HELP, root);
TRACE_EXIT();
}
#endif /* CONFIG_SCST_PROC */
#ifndef CONFIG_SCST_PROC
static struct kobj_attribute vdev_active_attr =
__ATTR(active, S_IWUSR|S_IRUGO, vdev_sysfs_active_show,
vdev_sysfs_active_store);
@@ -10532,7 +9849,6 @@ static struct kobj_attribute vdev_async_attr =
static struct kobj_attribute vcdrom_filename_attr =
__ATTR(filename, S_IRUGO|S_IWUSR, vdev_sysfs_filename_show,
vcdrom_sysfs_filename_store);
#endif
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
static struct scst_trace_log vdisk_local_trace_tbl[] = {
@@ -10545,7 +9861,6 @@ static struct scst_trace_log vdisk_local_trace_tbl[] = {
#endif
#ifndef CONFIG_SCST_PROC
static const struct attribute *vdisk_fileio_attrs[] = {
&vdev_size_ro_attr.attr,
&vdev_size_mb_ro_attr.attr,
@@ -10578,7 +9893,6 @@ static const struct attribute *vdisk_fileio_attrs[] = {
&vdev_async_attr.attr,
NULL,
};
#endif /* CONFIG_SCST_PROC */
static const char *fileio_add_dev_params[] = {
"async",
@@ -10627,26 +9941,18 @@ static struct scst_dev_type vdisk_file_devtype = {
#endif
.get_supported_opcodes = vdisk_get_supported_opcodes,
.devt_priv = (void *)fileio_ops,
#ifdef CONFIG_SCST_PROC
.read_proc = vdisk_read_proc,
.write_proc = vdisk_write_proc,
#else
.add_device = vdisk_add_fileio_device,
.del_device = vdisk_del_device,
.dev_attrs = vdisk_fileio_attrs,
.add_device_parameters = fileio_add_dev_params,
#endif
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
.default_trace_flags = SCST_DEFAULT_DEV_LOG_FLAGS,
.trace_flags = &trace_flag,
.trace_tbl = vdisk_local_trace_tbl,
#ifndef CONFIG_SCST_PROC
.trace_tbl_help = VDISK_TRACE_TBL_HELP,
#endif
#endif
};
#ifndef CONFIG_SCST_PROC
static const struct attribute *vdisk_blockio_attrs[] = {
&vdev_active_attr.attr,
&vdev_bind_alua_state_attr.attr,
@@ -10678,7 +9984,6 @@ static const struct attribute *vdisk_blockio_attrs[] = {
&vdisk_tp_attr.attr,
NULL,
};
#endif /* CONFIG_SCST_PROC */
static const char *blockio_add_dev_params[] = {
"active",
@@ -10707,9 +10012,6 @@ static struct scst_dev_type vdisk_blk_devtype = {
.threads_num = 1,
.parse_atomic = 1,
.dev_done_atomic = 1,
#ifdef CONFIG_SCST_PROC
.no_proc = 1,
#endif
.auto_cm_assignment_possible = 1,
.attach = vdisk_attach,
.detach = vdisk_detach,
@@ -10722,23 +10024,18 @@ static struct scst_dev_type vdisk_blk_devtype = {
.task_mgmt_fn_done = vdisk_task_mgmt_fn_done,
.get_supported_opcodes = vdisk_get_supported_opcodes,
.devt_priv = (void *)blockio_ops,
#ifndef CONFIG_SCST_PROC
.add_device = vdisk_add_blockio_device,
.del_device = vdisk_del_device,
.dev_attrs = vdisk_blockio_attrs,
.add_device_parameters = blockio_add_dev_params,
#endif
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
.default_trace_flags = SCST_DEFAULT_DEV_LOG_FLAGS,
.trace_flags = &trace_flag,
.trace_tbl = vdisk_local_trace_tbl,
#ifndef CONFIG_SCST_PROC
.trace_tbl_help = VDISK_TRACE_TBL_HELP,
#endif
#endif
};
#ifndef CONFIG_SCST_PROC
static const struct attribute *vdisk_nullio_attrs[] = {
&vdev_size_rw_attr.attr,
&vdev_size_mb_rw_attr.attr,
@@ -10763,7 +10060,6 @@ static const struct attribute *vdisk_nullio_attrs[] = {
&vdisk_rotational_attr.attr,
NULL,
};
#endif /* CONFIG_SCST_PROC */
static const char *nullio_add_dev_params[] = {
"blocksize",
@@ -10788,9 +10084,6 @@ static struct scst_dev_type vdisk_null_devtype = {
.threads_num = 1,
.parse_atomic = 1,
.dev_done_atomic = 1,
#ifdef CONFIG_SCST_PROC
.no_proc = 1,
#endif
.auto_cm_assignment_possible = 1,
.attach = vdisk_attach,
.detach = vdisk_detach,
@@ -10801,23 +10094,18 @@ static struct scst_dev_type vdisk_null_devtype = {
.task_mgmt_fn_done = vdisk_task_mgmt_fn_done,
.devt_priv = (void *)nullio_ops,
.get_supported_opcodes = vdisk_get_supported_opcodes,
#ifndef CONFIG_SCST_PROC
.add_device = vdisk_add_nullio_device,
.del_device = vdisk_del_device,
.dev_attrs = vdisk_nullio_attrs,
.add_device_parameters = nullio_add_dev_params,
#endif
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
.default_trace_flags = SCST_DEFAULT_DEV_LOG_FLAGS,
.trace_flags = &trace_flag,
.trace_tbl = vdisk_local_trace_tbl,
#ifndef CONFIG_SCST_PROC
.trace_tbl_help = VDISK_TRACE_TBL_HELP,
#endif
#endif
};
#ifndef CONFIG_SCST_PROC
static const struct attribute *vcdrom_attrs[] = {
&vdev_size_ro_attr.attr,
&vdev_size_mb_ro_attr.attr,
@@ -10835,7 +10123,6 @@ static const struct attribute *vcdrom_attrs[] = {
&vdev_inq_vend_specific_attr.attr,
NULL,
};
#endif /* CONFIG_SCST_PROC */
static const char *cdrom_add_dev_params[] = {
"tst",
@@ -10858,23 +10145,16 @@ static struct scst_dev_type vcdrom_devtype = {
.on_free_cmd = fileio_on_free_cmd,
.task_mgmt_fn_done = vdisk_task_mgmt_fn_done,
.get_supported_opcodes = vcdrom_get_supported_opcodes,
#ifdef CONFIG_SCST_PROC
.read_proc = vcdrom_read_proc,
.write_proc = vcdrom_write_proc,
#else
.add_device = vcdrom_add_device,
.del_device = vcdrom_del_device,
.dev_attrs = vcdrom_attrs,
.add_device_parameters = cdrom_add_dev_params,
#endif
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
.default_trace_flags = SCST_DEFAULT_DEV_LOG_FLAGS,
.trace_flags = &trace_flag,
.trace_tbl = vdisk_local_trace_tbl,
#ifndef CONFIG_SCST_PROC
.trace_tbl_help = VDISK_TRACE_TBL_HELP,
#endif
#endif
};
static int __init init_scst_vdisk(struct scst_dev_type *devtype)
@@ -10889,31 +10169,11 @@ static int __init init_scst_vdisk(struct scst_dev_type *devtype)
if (res < 0)
goto out;
#ifdef CONFIG_SCST_PROC
if (!devtype->no_proc) {
res = scst_dev_handler_build_std_proc(devtype);
if (res < 0)
goto out_unreg;
res = vdisk_proc_help_build(devtype);
if (res < 0)
goto out_destroy_proc;
}
#endif
out:
TRACE_EXIT_RES(res);
return res;
#ifdef CONFIG_SCST_PROC
out_destroy_proc:
if (!devtype->no_proc)
scst_dev_handler_destroy_std_proc(devtype);
out_unreg:
scst_unregister_virtual_dev_driver(devtype);
goto out;
#endif
}
static void exit_scst_vdisk(struct scst_dev_type *devtype)
@@ -10934,12 +10194,6 @@ static void exit_scst_vdisk(struct scst_dev_type *devtype)
}
mutex_unlock(&scst_vdisk_mutex);
#ifdef CONFIG_SCST_PROC
if (!devtype->no_proc) {
vdisk_proc_help_destroy(devtype);
scst_dev_handler_destroy_std_proc(devtype);
}
#endif
scst_unregister_virtual_dev_driver(devtype);
-10
View File
@@ -19,9 +19,6 @@
#include "scst_priv.h"
#include "scst_pres.h"
#ifdef CONFIG_SCST_PROC
#warning In the PROCFS build EXTENDED COPY not supported
#else
#define SCST_CM_NAME "copy_manager"
#define SCST_CM_TGT_NAME (SCST_CM_NAME "_tgt")
@@ -3628,7 +3625,6 @@ out:
return;
}
#ifndef CONFIG_SCST_PROC
static ssize_t scst_cm_allow_not_conn_copy_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
@@ -3678,7 +3674,6 @@ static const struct attribute *scst_cm_tgtt_attrs[] = {
NULL,
};
#endif /* #ifndef CONFIG_SCST_PROC */
static int scst_cm_get_initiator_port_transport_id(struct scst_tgt *tgt,
struct scst_session *scst_sess, uint8_t **transport_id)
@@ -3760,9 +3755,7 @@ static struct scst_tgt_template scst_cm_tgtt = {
#else
.sg_tablesize = 0xffff,
#endif
#ifndef CONFIG_SCST_PROC
.enabled_attr_not_needed = 1,
#endif
.dif_supported = 1,
.hw_dif_type1_supported = 1,
.hw_dif_type2_supported = 1,
@@ -3772,9 +3765,7 @@ static struct scst_tgt_template scst_cm_tgtt = {
.task_mgmt_fn_done = scst_cm_task_mgmt_fn_done,
.report_aen = scst_cm_report_aen,
.get_initiator_port_transport_id = scst_cm_get_initiator_port_transport_id,
#ifndef CONFIG_SCST_PROC
.tgtt_attrs = scst_cm_tgtt_attrs,
#endif
};
int __init scst_cm_init(void)
@@ -3830,4 +3821,3 @@ void __exit scst_cm_exit(void)
return;
}
#endif /* #ifndef CONFIG_SCST_PROC */
-2
View File
@@ -361,9 +361,7 @@ static int scst_copy_from_dlm(struct scst_device *dev, dlm_lockspace_t *ls,
if (reg->lksb.lksb.sb_lkid == 0)
scst_pr_remove_registrant(dev, reg);
#ifndef CONFIG_SCST_PROC
scst_pr_sync_device_file(dev);
#endif
scst_pr_write_unlock(dev);
-65
View File
@@ -3019,10 +3019,8 @@ next:
scst_get_acg(acg);
scst_put_acg(old_acg);
#ifndef CONFIG_SCST_PROC
scst_recreate_sess_luns_link(sess);
/* Ignore possible error, since we can't do anything on it */
#endif
if (luns_changed) {
scst_report_luns_changed_sess(sess);
@@ -4131,15 +4129,7 @@ int scst_alloc_tgt(struct scst_tgt_template *tgtt, struct scst_tgt **tgt)
atomic_set(&t->tgt_dif_ref_failed_dev, 0);
atomic_set(&t->tgt_dif_guard_failed_dev, 0);
#ifdef CONFIG_SCST_PROC
res = gen_relative_target_port_id(&t->rel_tgt_id);
if (res != 0) {
scst_free_tgt(t);
goto out;
}
#else
INIT_LIST_HEAD(&t->tgt_acg_list);
#endif
*tgt = t;
@@ -4155,9 +4145,6 @@ void scst_free_tgt(struct scst_tgt *tgt)
kfree(tgt->tgt_name);
kfree(tgt->tgt_comment);
#ifdef CONFIG_SCST_PROC
kfree(tgt->default_group_name);
#endif
kmem_cache_free(scst_tgt_cachep, tgt);
@@ -4710,15 +4697,6 @@ int scst_alloc_add_acg(struct scst_tgt *tgt, const char *acg_name,
if (res != 0)
goto out_undup;
#ifdef CONFIG_SCST_PROC
acg->addr_method = tgt && tgt->tgtt ? tgt->tgtt->preferred_addr_method
: SCST_LUN_ADDR_METHOD_PERIPHERAL;
TRACE_DBG("Adding acg %s to scst_acg_list", acg_name);
list_add_tail(&acg->acg_list_entry, &scst_acg_list);
scst_check_reassign_sessions();
#else
acg->addr_method = tgt->tgtt->preferred_addr_method;
if (tgt_acg) {
@@ -4733,7 +4711,6 @@ int scst_alloc_add_acg(struct scst_tgt *tgt, const char *acg_name,
}
kobject_get(&tgt->tgt_kobj);
#endif
res = 0;
@@ -4743,10 +4720,8 @@ out:
TRACE_EXIT_RES(res);
return res;
#ifndef CONFIG_SCST_PROC
out_del:
list_del(&acg->acg_list_entry);
#endif
out_undup:
kfree(acg->acg_name);
@@ -4782,9 +4757,6 @@ static void scst_del_acg(struct scst_acg *acg)
list_for_each_entry(acn, &acg->acn_list, acn_list_entry)
scst_acn_sysfs_del(acn);
#ifdef CONFIG_SCST_PROC
list_del(&acg->acg_list_entry);
#else
if (acg->tgt_acg) {
TRACE_DBG("Removing acg %s from list", acg->acg_name);
list_del(&acg->acg_list_entry);
@@ -4793,7 +4765,6 @@ static void scst_del_acg(struct scst_acg *acg)
} else {
acg->tgt->default_acg = NULL;
}
#endif
}
/*
@@ -4839,9 +4810,7 @@ static void scst_free_acg(struct scst_acg *acg)
kfree(acg->acg_name);
kfree(acg);
#ifndef CONFIG_SCST_PROC
kobject_put(&tgt->tgt_kobj);
#endif
}
static void scst_release_acg(struct kref *kref)
@@ -4943,7 +4912,6 @@ int scst_del_free_acg(struct scst_acg *acg, bool close_sessions)
return 0;
}
#ifndef CONFIG_SCST_PROC
/* The activity supposed to be suspended and scst_mutex held */
struct scst_acg *scst_tgt_find_acg(struct scst_tgt *tgt, const char *name)
@@ -4963,7 +4931,6 @@ struct scst_acg *scst_tgt_find_acg(struct scst_tgt *tgt, const char *name)
return acg_ret;
}
#endif
/* scst_mutex supposed to be held */
static struct scst_tgt_dev *scst_find_shared_io_tgt_dev(
@@ -5721,36 +5688,6 @@ out:
return acn;
}
#ifdef CONFIG_SCST_PROC
/* The activity supposed to be suspended and scst_mutex held */
int scst_acg_remove_name(struct scst_acg *acg, const char *name, bool reassign)
{
int res = -EINVAL;
struct scst_acn *acn;
TRACE_ENTRY();
list_for_each_entry(acn, &acg->acn_list, acn_list_entry) {
if (strcmp(acn->name, name) == 0) {
scst_del_free_acn(acn, false);
res = 0;
break;
}
}
if (res == 0) {
PRINT_INFO("Removed name %s from group %s (target %s)", name,
acg->acg_name, acg->tgt ? acg->tgt->tgt_name : "?");
if (reassign)
scst_check_reassign_sessions();
} else
PRINT_ERROR("Unable to find name '%s' in group '%s'", name,
acg->acg_name);
TRACE_EXIT_RES(res);
return res;
}
#endif
struct scst_cmd *__scst_create_prepare_internal_cmd(const uint8_t *cdb,
unsigned int cdb_len, enum scst_cmd_queue_type queue_type,
@@ -7140,9 +7077,7 @@ void scst_free_session(struct scst_session *sess)
mutex_unlock(&scst_mutex);
#ifndef CONFIG_SCST_PROC
scst_sess_sysfs_del(sess);
#endif
if (sess->unreg_done_fn) {
TRACE_DBG("Calling unreg_done_fn(%p)", sess);
sess->unreg_done_fn(sess);
-203
View File
@@ -101,12 +101,7 @@ struct kmem_cache *scst_sess_cachep;
struct kmem_cache *scst_acgd_cachep;
static struct kmem_cache *scst_thr_cachep;
#ifdef CONFIG_SCST_PROC
struct list_head scst_acg_list;
struct scst_acg *scst_default_acg;
#else
unsigned int scst_setup_id;
#endif
spinlock_t scst_init_lock;
wait_queue_head_t scst_init_cmd_list_waitQ;
@@ -268,7 +263,6 @@ int __scst_register_target_template(struct scst_tgt_template *vtt,
goto out;
}
#ifndef CONFIG_SCST_PROC
if ((!vtt->enable_target || !vtt->is_target_enabled) &&
!vtt->enabled_attr_not_needed)
PRINT_WARNING("Target driver %s doesn't have enable_target() "
@@ -284,7 +278,6 @@ int __scst_register_target_template(struct scst_tgt_template *vtt,
res = -EINVAL;
goto out;
}
#endif
if (vtt->rdy_to_xfer == NULL)
vtt->rdy_to_xfer_atomic = 1;
@@ -301,17 +294,9 @@ int __scst_register_target_template(struct scst_tgt_template *vtt,
}
mutex_unlock(&scst_mutex);
#ifndef CONFIG_SCST_PROC
res = scst_tgtt_sysfs_create(vtt);
if (res != 0)
goto out;
#else
if (!vtt->no_proc_entry) {
res = scst_build_proc_target_dir_entries(vtt);
if (res < 0)
goto out;
}
#endif
mutex_lock(&scst_mutex);
mutex_lock(&scst_mutex2);
@@ -335,11 +320,7 @@ out:
return res;
out_del:
#ifdef CONFIG_SCST_PROC
scst_cleanup_proc_target_dir_entries(vtt);
#else
scst_tgtt_sysfs_del(vtt);
#endif
mutex_lock(&scst_mutex);
@@ -440,14 +421,12 @@ void scst_unregister_target_template(struct scst_tgt_template *vtt)
list_del(&vtt->scst_template_list_entry);
mutex_unlock(&scst_mutex2);
#ifndef CONFIG_SCST_PROC
/* Wait for outstanding sysfs mgmt calls completed */
while (vtt->tgtt_active_sysfs_works_count > 0) {
mutex_unlock(&scst_mutex);
msleep(100);
mutex_lock(&scst_mutex);
}
#endif
while (!list_empty(&vtt->tgt_list)) {
tgt = list_first_entry(&vtt->tgt_list, typeof(*tgt),
@@ -459,11 +438,7 @@ void scst_unregister_target_template(struct scst_tgt_template *vtt)
mutex_unlock(&scst_mutex);
#ifdef CONFIG_SCST_PROC
scst_cleanup_proc_target_dir_entries(vtt);
#else
scst_tgtt_sysfs_del(vtt);
#endif
PRINT_INFO("Target template %s unregistered successfully", vtt->name);
@@ -496,18 +471,6 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt,
goto out;
if (target_name != NULL) {
#ifdef CONFIG_SCST_PROC
tgt->default_group_name = kasprintf(GFP_KERNEL, "%s_%s",
SCST_DEFAULT_ACG_NAME,
target_name);
if (tgt->default_group_name == NULL) {
PRINT_ERROR("Allocation of default "
"group name failed (tgt %s)", target_name);
rc = -ENOMEM;
goto out_free_tgt;
}
/* In case of error default_group_name will be freed in scst_free_tgt() */
#endif
tgt->tgt_name = kstrdup(target_name, GFP_KERNEL);
if (tgt->tgt_name == NULL) {
@@ -548,11 +511,6 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt,
}
}
#ifdef CONFIG_SCST_PROC
rc = scst_build_proc_target_entries(tgt);
if (rc < 0)
goto out_unlock;
#else
rc = scst_tgt_sysfs_create(tgt);
if (rc < 0)
goto out_unlock;
@@ -560,7 +518,6 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt,
rc = scst_alloc_add_acg(tgt, tgt->tgt_name, false, &tgt->default_acg);
if (rc != 0)
goto out_sysfs_del;
#endif
mutex_lock(&scst_mutex2);
list_add_tail(&tgt->tgt_list_entry, &vtt->tgt_list);
@@ -568,13 +525,8 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt,
mutex_unlock(&scst_mutex);
#ifdef CONFIG_SCST_PROC
PRINT_INFO("Target %s (relative target id %d) for template %s registered "
"successfully", tgt->tgt_name, tgt->rel_tgt_id, vtt->name);
#else
PRINT_INFO("Target %s for template %s registered successfully",
tgt->tgt_name, vtt->name);
#endif
TRACE_DBG("tgt %p", tgt);
@@ -582,12 +534,10 @@ out:
TRACE_EXIT();
return tgt;
#ifndef CONFIG_SCST_PROC
out_sysfs_del:
mutex_unlock(&scst_mutex);
scst_tgt_sysfs_del(tgt);
goto out_free_tgt;
#endif
out_unlock:
mutex_unlock(&scst_mutex);
@@ -609,9 +559,7 @@ EXPORT_SYMBOL(scst_register_target);
void scst_unregister_target(struct scst_tgt *tgt)
{
struct scst_tgt_template *vtt = tgt->tgtt;
#ifndef CONFIG_SCST_PROC
struct scst_acg *acg, *acg_tmp;
#endif
TRACE_ENTRY();
@@ -620,11 +568,7 @@ void scst_unregister_target(struct scst_tgt *tgt)
* tgt->tgtt->release(tgt) such that the "enabled" attribute can't be
* accessed during or after the tgt->tgtt->release(tgt) call.
*/
#ifdef CONFIG_SCST_PROC
scst_cleanup_proc_target_entries(tgt);
#else
scst_tgt_sysfs_del(tgt);
#endif
TRACE_DBG("%s", "Calling target driver's release()");
tgt->tgtt->release(tgt);
@@ -679,21 +623,17 @@ again:
scst_tg_tgt_remove_by_tgt(tgt);
#ifndef CONFIG_SCST_PROC
scst_del_free_acg(tgt->default_acg, false);
list_for_each_entry_safe(acg, acg_tmp, &tgt->tgt_acg_list,
acg_list_entry) {
scst_del_free_acg(acg, false);
}
#endif
mutex_unlock(&scst_mutex);
scst_resume_activity();
#ifndef CONFIG_SCST_PROC
scst_tgt_sysfs_put(tgt);
#endif
PRINT_INFO("Target %s for template %s unregistered successfully",
tgt->tgt_name, vtt->name);
@@ -1145,25 +1085,13 @@ static int scst_register_device(struct scsi_device *scsidp)
{
int res;
struct scst_device *dev, *d;
#ifdef CONFIG_SCST_PROC
struct scst_dev_type *dt;
#endif
TRACE_ENTRY();
#ifdef CONFIG_SCST_PROC
res = scst_suspend_activity(SCST_SUSPEND_TIMEOUT_USER);
if (res != 0)
goto out;
#endif
res = mutex_lock_interruptible(&scst_mutex);
if (res != 0)
#ifdef CONFIG_SCST_PROC
goto out_resume;
#else
goto out;
#endif
res = scst_alloc_device(GFP_KERNEL, NUMA_NO_NODE, &dev);
if (res != 0)
@@ -1203,29 +1131,11 @@ static int scst_register_device(struct scsi_device *scsidp)
list_add_tail(&dev->dev_list_entry, &scst_dev_list);
#ifdef CONFIG_SCST_PROC
/*
* Let's don't attach to dev handler by default, but keep this code in
* for compatibility in the proc build only.
*/
list_for_each_entry(dt, &scst_dev_type_list, dev_type_list_entry) {
if (dt->type == scsidp->type) {
res = scst_assign_dev_handler(dev, dt);
if (res != 0)
goto out_del_locked;
break;
}
}
mutex_unlock(&scst_mutex);
scst_resume_activity();
#else
mutex_unlock(&scst_mutex);
res = scst_dev_sysfs_create(dev);
if (res != 0)
goto out_del_unlocked;
#endif
PRINT_INFO("Attached to scsi%d, channel %d, id %d, lun %lld, type %d",
scsidp->host->host_no, scsidp->channel, scsidp->id,
@@ -1235,7 +1145,6 @@ out:
TRACE_EXIT_RES(res);
return res;
#ifndef CONFIG_SCST_PROC
out_del_unlocked:
mutex_lock(&scst_mutex);
list_del_init(&dev->dev_list_entry);
@@ -1243,10 +1152,6 @@ out_del_unlocked:
scst_free_device(dev);
goto out;
#else
out_del_locked:
list_del_init(&dev->dev_list_entry);
#endif
#ifdef CONFIG_SCST_FORWARD_MODE_PASS_THROUGH
scst_pr_clear_dev(dev);
@@ -1257,10 +1162,6 @@ out_free_dev:
out_unlock:
mutex_unlock(&scst_mutex);
#ifdef CONFIG_SCST_PROC
out_resume:
scst_resume_activity();
#endif
goto out;
}
@@ -1357,7 +1258,6 @@ static int scst_dev_handler_check(struct scst_dev_type *dev_handler)
goto out;
}
#ifndef CONFIG_SCST_PROC
if (((dev_handler->add_device != NULL) &&
(dev_handler->del_device == NULL)) ||
((dev_handler->add_device == NULL) &&
@@ -1368,7 +1268,6 @@ static int scst_dev_handler_check(struct scst_dev_type *dev_handler)
res = -EINVAL;
goto out;
}
#endif
if (dev_handler->dev_alloc_data_buf == NULL)
dev_handler->dev_alloc_data_buf_atomic = 1;
@@ -1486,7 +1385,6 @@ int scst_register_virtual_device_node(struct scst_dev_type *dev_handler,
if (res != 0)
goto out_free_dev;
#ifndef CONFIG_SCST_PROC
/*
* We can drop scst_mutex, because we have not yet added the dev in
* scst_dev_list, so it "doesn't exist" yet.
@@ -1498,7 +1396,6 @@ int scst_register_virtual_device_node(struct scst_dev_type *dev_handler,
goto out_lock_pr_clear_dev;
mutex_lock(&scst_mutex);
#endif
list_for_each_entry(d, &scst_dev_list, dev_list_entry) {
if (strcmp(d->virt_name, dev_name) == 0) {
@@ -1537,10 +1434,8 @@ out_unreg:
scst_assign_dev_handler(dev, &scst_null_devtype);
goto out_pr_clear_dev;
#ifndef CONFIG_SCST_PROC
out_lock_pr_clear_dev:
mutex_lock(&scst_mutex);
#endif
out_pr_clear_dev:
scst_pr_clear_dev(dev);
@@ -1645,9 +1540,6 @@ int __scst_register_dev_driver(struct scst_dev_type *dev_type,
{
int res, exist;
struct scst_dev_type *dt;
#ifdef CONFIG_SCST_PROC
struct scst_device *dev;
#endif
TRACE_ENTRY();
@@ -1675,19 +1567,10 @@ int __scst_register_dev_driver(struct scst_dev_type *dev_type,
}
#endif
#ifdef CONFIG_SCST_PROC
res = scst_suspend_activity(SCST_SUSPEND_TIMEOUT_USER);
if (res != 0)
goto out;
#endif
res = mutex_lock_interruptible(&scst_mutex);
if (res != 0)
#ifdef CONFIG_SCST_PROC
goto out_resume;
#else
goto out;
#endif
exist = 0;
list_for_each_entry(dt, &scst_dev_type_list, dev_type_list_entry) {
@@ -1703,33 +1586,11 @@ int __scst_register_dev_driver(struct scst_dev_type *dev_type,
list_add_tail(&dev_type->dev_type_list_entry, &scst_dev_type_list);
#ifdef CONFIG_SCST_PROC
if (!dev_type->no_proc) {
res = scst_build_proc_dev_handler_dir_entries(dev_type);
if (res < 0)
goto out_unlock;
}
/*
* Let's don't attach to all devices by default, but keep this code
* for compatibility in the proc build only.
*/
list_for_each_entry(dev, &scst_dev_list, dev_list_entry) {
if (dev->scsi_dev == NULL || dev->handler != &scst_null_devtype)
continue;
if (dev->scsi_dev->type == dev_type->type)
scst_assign_dev_handler(dev, dev_type);
}
mutex_unlock(&scst_mutex);
scst_resume_activity();
#else
mutex_unlock(&scst_mutex);
res = scst_devt_sysfs_create(dev_type);
if (res < 0)
goto out;
#endif
PRINT_INFO("Device handler \"%s\" for type %d registered "
"successfully", dev_type->name, dev_type->type);
@@ -1740,10 +1601,6 @@ out:
out_unlock:
mutex_unlock(&scst_mutex);
#ifdef CONFIG_SCST_PROC
out_resume:
scst_resume_activity();
#endif
goto out;
}
EXPORT_SYMBOL_GPL(__scst_register_dev_driver);
@@ -1786,11 +1643,7 @@ void scst_unregister_dev_driver(struct scst_dev_type *dev_type)
mutex_unlock(&scst_mutex);
scst_resume_activity();
#ifdef CONFIG_SCST_PROC
scst_cleanup_proc_dev_handler_dir_entries(dev_type);
#else
scst_devt_sysfs_del(dev_type);
#endif
PRINT_INFO("Device handler \"%s\" for type %d unloaded",
dev_type->name, dev_type->type);
@@ -1841,17 +1694,9 @@ int __scst_register_virtual_dev_driver(struct scst_dev_type *dev_type,
list_add_tail(&dev_type->dev_type_list_entry, &scst_virtual_dev_type_list);
mutex_unlock(&scst_mutex);
#ifdef CONFIG_SCST_PROC
if (!dev_type->no_proc) {
res = scst_build_proc_dev_handler_dir_entries(dev_type);
if (res < 0)
goto out;
}
#else
res = scst_devt_sysfs_create(dev_type);
if (res < 0)
goto out;
#endif
if (dev_type->type != -1) {
PRINT_INFO("Virtual device handler %s for type %d "
@@ -1880,23 +1725,16 @@ void scst_unregister_virtual_dev_driver(struct scst_dev_type *dev_type)
/* Disable sysfs mgmt calls (e.g. addition of new devices) */
list_del(&dev_type->dev_type_list_entry);
#ifndef CONFIG_SCST_PROC
/* Wait for outstanding sysfs mgmt calls completed */
while (dev_type->devt_active_sysfs_works_count > 0) {
mutex_unlock(&scst_mutex);
msleep(100);
mutex_lock(&scst_mutex);
}
#endif
mutex_unlock(&scst_mutex);
#ifdef CONFIG_SCST_PROC
if (!dev_type->no_proc)
scst_cleanup_proc_dev_handler_dir_entries(dev_type);
#else
scst_devt_sysfs_del(dev_type);
#endif
PRINT_INFO("Device handler \"%s\" unloaded", dev_type->name);
@@ -2359,7 +2197,6 @@ out_unlock:
return res;
}
#ifndef CONFIG_SCST_PROC
/**
* scst_get_setup_id() - return SCST setup ID
*
@@ -2371,7 +2208,6 @@ unsigned int scst_get_setup_id(void)
return scst_setup_id;
}
EXPORT_SYMBOL_GPL(scst_get_setup_id);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
static int scst_add(struct class_device *cdev, struct class_interface *intf)
@@ -2524,9 +2360,6 @@ static int __init init_scst(void)
INIT_LIST_HEAD(&scst_dev_list);
INIT_LIST_HEAD(&scst_dev_type_list);
INIT_LIST_HEAD(&scst_virtual_dev_type_list);
#ifdef CONFIG_SCST_PROC
INIT_LIST_HEAD(&scst_acg_list);
#endif
spin_lock_init(&scst_init_lock);
init_waitqueue_head(&scst_init_cmd_list_waitQ);
INIT_LIST_HEAD(&scst_init_cmd_list);
@@ -2707,21 +2540,10 @@ static int __init init_scst(void)
if (res != 0)
goto out_sysfs_cleanup;
#ifdef CONFIG_SCST_PROC
mutex_lock(&scst_mutex);
res = scst_alloc_add_acg(NULL, SCST_DEFAULT_ACG_NAME, false, &scst_default_acg);
mutex_unlock(&scst_mutex);
if (res != 0)
goto out_destroy_sgv_pool;
#endif
res = scsi_register_interface(&scst_interface);
if (res != 0)
#ifdef CONFIG_SCST_PROC
goto out_free_acg;
#else
goto out_destroy_sgv_pool;
#endif
for (i = 0; i < (int)ARRAY_SIZE(scst_percpu_infos); i++) {
atomic_set(&scst_percpu_infos[i].cpu_cmd_count, 0);
@@ -2739,19 +2561,10 @@ static int __init init_scst(void)
if (res < 0)
goto out_thread_free;
#ifdef CONFIG_SCST_PROC
res = scst_proc_init_module();
if (res != 0)
goto out_thread_free;
#endif
res = scst_cm_init();
if (res != 0)
#ifdef CONFIG_SCST_PROC
goto out_proc_cleanup;
#else
goto out_thread_free;
#endif
#ifdef CONFIG_SCST_NO_TOTAL_MEM_CHECKS
PRINT_INFO("SCST version %s loaded successfully (global max mem for commands "
@@ -2768,20 +2581,12 @@ out:
TRACE_EXIT_RES(res);
return res;
#ifdef CONFIG_SCST_PROC
out_proc_cleanup:
scst_proc_cleanup_module();
#endif
out_thread_free:
scst_stop_global_threads();
scsi_unregister_interface(&scst_interface);
#ifdef CONFIG_SCST_PROC
out_free_acg:
scst_del_free_acg(scst_default_acg, false);
#endif
out_destroy_sgv_pool:
scst_sgv_pools_deinit();
@@ -2860,9 +2665,6 @@ static void __exit exit_scst(void)
scst_cm_exit();
#ifdef CONFIG_SCST_PROC
scst_proc_cleanup_module();
#endif
scst_stop_global_threads();
@@ -2870,11 +2672,6 @@ static void __exit exit_scst(void)
scsi_unregister_interface(&scst_interface);
#ifdef CONFIG_SCST_PROC
mutex_lock(&scst_mutex);
scst_del_free_acg(scst_default_acg, false);
mutex_unlock(&scst_mutex);
#endif
scst_sgv_pools_deinit();
-107
View File
@@ -94,11 +94,9 @@ static struct kmem_cache *sgv_pool_cachep;
*/
static LIST_HEAD(sgv_pools_list);
#ifndef CONFIG_SCST_PROC
static struct kobject *scst_sgv_kobj;
static int scst_sgv_sysfs_create(struct sgv_pool *pool);
static void scst_sgv_sysfs_del(struct sgv_pool *pool);
#endif
static inline bool sgv_pool_clustered(const struct sgv_pool *pool)
{
@@ -1468,11 +1466,9 @@ static int sgv_pool_init(struct sgv_pool *pool, const char *name,
list_add_tail(&pool->sgv_pools_list_entry, &sgv_pools_list);
spin_unlock_bh(&sgv_pools_lock);
#ifndef CONFIG_SCST_PROC
res = scst_sgv_sysfs_create(pool);
if (res != 0)
goto out_del;
#endif
res = 0;
@@ -1480,14 +1476,12 @@ out:
TRACE_EXIT_RES(res);
return res;
#ifndef CONFIG_SCST_PROC
out_del:
spin_lock_bh(&sgv_pools_lock);
list_del(&pool->sgv_pools_list_entry);
spin_unlock_bh(&sgv_pools_lock);
synchronize_rcu();
#endif
out_free:
for (i = 0; i < pool->max_caches; i++) {
@@ -1567,9 +1561,7 @@ static void sgv_pool_destroy(struct sgv_pool *pool)
synchronize_rcu();
#ifndef CONFIG_SCST_PROC
scst_sgv_sysfs_del(pool);
#endif
cancel_delayed_work_sync(&pool->sgv_purge_work);
@@ -1918,104 +1910,6 @@ void scst_sgv_pools_deinit(void)
return;
}
#ifdef CONFIG_SCST_PROC
static void sgv_do_proc_read(struct seq_file *seq, const struct sgv_pool *pool)
{
int i, total = 0, hit = 0, merged = 0, allocated = 0;
int oa, om;
for (i = 0; i < pool->max_caches; i++) {
int t;
hit += atomic_read(&pool->cache_acc[i].hit_alloc);
total += atomic_read(&pool->cache_acc[i].total_alloc);
t = atomic_read(&pool->cache_acc[i].total_alloc) -
atomic_read(&pool->cache_acc[i].hit_alloc);
if (pool->single_alloc_pages == 0)
allocated += t * (1 << i);
else
allocated += t * pool->single_alloc_pages;
merged += atomic_read(&pool->cache_acc[i].merged);
}
seq_printf(seq, "\n%-30s %-11d %-11d %-11d %d/%d/%d\n", pool->name,
hit, total, (allocated != 0) ? merged*100/allocated : 0,
pool->cached_pages, pool->inactive_cached_pages,
pool->cached_entries);
for (i = 0; i < pool->max_caches; i++) {
int t = atomic_read(&pool->cache_acc[i].total_alloc) -
atomic_read(&pool->cache_acc[i].hit_alloc);
if (pool->single_alloc_pages == 0)
allocated = t * (1 << i);
else
allocated = t * pool->single_alloc_pages;
merged = atomic_read(&pool->cache_acc[i].merged);
seq_printf(seq, " %-28s %-11d %-11d %d\n",
pool->cache_names[i],
atomic_read(&pool->cache_acc[i].hit_alloc),
atomic_read(&pool->cache_acc[i].total_alloc),
(allocated != 0) ? merged*100/allocated : 0);
}
allocated = atomic_read(&pool->big_pages);
merged = atomic_read(&pool->big_merged);
oa = atomic_read(&pool->other_pages);
om = atomic_read(&pool->other_merged);
seq_printf(seq, " %-40s %d/%-9d %d/%d\n", "big/other",
atomic_read(&pool->big_alloc), atomic_read(&pool->other_alloc),
(allocated != 0) ? merged*100/allocated : 0,
(oa != 0) ? om/oa : 0);
return;
}
int sgv_procinfo_show(struct seq_file *seq, void *v)
{
struct sgv_pool *pool;
int inactive_pages = 0;
TRACE_ENTRY();
spin_lock_bh(&sgv_pools_lock);
list_for_each_entry(pool, &sgv_pools_list, sgv_pools_list_entry) {
inactive_pages += pool->inactive_cached_pages;
}
spin_unlock_bh(&sgv_pools_lock);
#ifndef CONFIG_SCST_NO_TOTAL_MEM_CHECKS
seq_printf(seq, "%-42s %d/%d\n%-42s %d/%d\n%-42s %d/%d\n\n",
"Inactive/active pages", inactive_pages,
atomic_read(&sgv_pages_total) - inactive_pages,
"Hi/lo watermarks [pages]", sgv_hi_wmk, sgv_lo_wmk,
"Hi watermark releases/failures",
atomic_read(&sgv_releases_on_hiwmk),
atomic_read(&sgv_releases_on_hiwmk_failed));
#endif
seq_printf(seq, "%-30s %-11s %-11s %-11s %-11s", "Name", "Hit", "Total",
"% merged", "Cached (P/I/O)");
mutex_lock(&sgv_pools_mutex);
list_for_each_entry(pool, &sgv_pools_list, sgv_pools_list_entry) {
sgv_do_proc_read(seq, pool);
}
mutex_unlock(&sgv_pools_mutex);
#ifndef CONFIG_SCST_NO_TOTAL_MEM_CHECKS
seq_printf(seq, "\n%-42s %-11d\n", "other",
atomic_read(&sgv_other_total_alloc));
#endif
TRACE_EXIT();
return 0;
}
#else /* CONFIG_SCST_PROC */
static ssize_t sgv_sysfs_stat_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
@@ -2268,4 +2162,3 @@ void scst_del_put_sgv_kobj(void)
scst_sgv_kobj = NULL;
}
#endif /* CONFIG_SCST_PROC */
-3
View File
@@ -145,9 +145,6 @@ static inline struct scatterlist *sgv_pool_sg(struct sgv_pool_obj *obj)
int scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmark);
void scst_sgv_pools_deinit(void);
#ifdef CONFIG_SCST_PROC
int sgv_procinfo_show(struct seq_file *seq, void *v);
#endif
void scst_sgv_pool_use_norm(struct scst_tgt_dev *tgt_dev);
void scst_sgv_pool_use_norm_clust(struct scst_tgt_dev *tgt_dev);
-36
View File
@@ -27,10 +27,6 @@
#include <linux/string.h>
#include <linux/kthread.h>
#include <linux/delay.h>
#ifdef CONFIG_SCST_PROC
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#endif
#include <linux/time.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
@@ -657,7 +653,6 @@ out:
return;
}
#ifndef CONFIG_SCST_PROC
/* Called under scst_mutex */
static int scst_pr_do_load_device_file(struct scst_device *dev,
@@ -1065,7 +1060,6 @@ write_error_close:
goto out_set_fs;
}
#endif /* CONFIG_SCST_PROC */
/**
* scst_pr_set_file_name - set name of file in which to save PR information
@@ -1206,11 +1200,9 @@ int scst_pr_init_dev(struct scst_device *dev)
sBUG_ON(!dev->pr_file_name || !dev->pr_file_name1);
#ifndef CONFIG_SCST_PROC
res = scst_pr_load_device_file(dev);
if (res == -ENOENT)
res = 0;
#endif
TRACE_EXIT_RES(res);
return res;
@@ -1714,14 +1706,6 @@ void scst_pr_register(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size)
goto out;
}
#ifdef CONFIG_SCST_PROC
if (aptpl) {
TRACE_PR("%s", "APTPL not supported");
scst_set_invalid_field_in_parm_list(cmd, 20,
SCST_INVAL_FIELD_BIT_OFFS_VALID | 0);
goto out;
}
#endif
reg = tgt_dev->registrant;
@@ -1808,14 +1792,6 @@ void scst_pr_register_and_ignore(struct scst_cmd *cmd, uint8_t *buffer,
goto out;
}
#ifdef CONFIG_SCST_PROC
if (aptpl) {
TRACE_PR("%s", "APTPL not supported");
scst_set_invalid_field_in_parm_list(cmd, 20,
SCST_INVAL_FIELD_BIT_OFFS_VALID | 0);
goto out;
}
#endif
reg = tgt_dev->registrant;
@@ -1883,14 +1859,6 @@ void scst_pr_register_and_move(struct scst_cmd *cmd, uint8_t *buffer,
unreg = (buffer[17] >> 1) & 0x01;
tid_buffer_size = get_unaligned_be32(&buffer[20]);
#ifdef CONFIG_SCST_PROC
if (aptpl) {
TRACE_PR("%s", "APTPL not supported");
scst_set_invalid_field_in_parm_list(cmd, 17,
SCST_INVAL_FIELD_BIT_OFFS_VALID | 0);
goto out;
}
#endif
if ((tid_buffer_size + 24) > buffer_size) {
TRACE_PR("Invalid buffer size %d (%d)",
@@ -2721,11 +2689,7 @@ void scst_pr_report_caps(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size)
unsigned int crh = 1;
unsigned int atp_c = 1;
unsigned int sip_c = 1;
#ifdef CONFIG_SCST_PROC
unsigned int ptpl_c = 0;
#else
unsigned int ptpl_c = 1;
#endif
struct scst_device *dev = cmd->dev;
TRACE_ENTRY();
-2
View File
@@ -147,9 +147,7 @@ void scst_pr_set_holder(struct scst_device *dev,
uint8_t type);
void scst_pr_clear_holder(struct scst_device *dev);
#ifndef CONFIG_SCST_PROC
void scst_pr_sync_device_file(struct scst_device *dev);
#endif
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
void scst_pr_dump_prs(struct scst_device *dev, bool force);
-167
View File
@@ -189,12 +189,7 @@ extern wait_queue_head_t scst_dev_cmd_waitQ;
extern const struct scst_cl_ops scst_no_dlm_cl_ops;
extern const struct scst_cl_ops scst_dlm_cl_ops;
#ifdef CONFIG_SCST_PROC
extern struct list_head scst_acg_list;
extern struct scst_acg *scst_default_acg;
#else
extern unsigned int scst_setup_id;
#endif
#define SCST_DEF_MAX_TASKLET_CMD 10
extern int scst_max_tasklet_cmd;
@@ -404,9 +399,6 @@ int scst_acg_repl_lun(struct scst_acg *acg, struct kobject *parent,
unsigned int flags);
int scst_acg_add_acn(struct scst_acg *acg, const char *name);
#ifdef CONFIG_SCST_PROC
int scst_acg_remove_name(struct scst_acg *acg, const char *name, bool reassign);
#endif
void scst_del_free_acn(struct scst_acn *acn, bool reassign);
struct scst_acn *scst_find_acn(struct scst_acg *acg, const char *name);
@@ -501,7 +493,6 @@ int scst_tg_set_preferred(struct scst_target_group *tg, bool preferred);
int scst_tg_tgt_add(struct scst_target_group *tg, const char *name);
int scst_tg_tgt_remove_by_name(struct scst_target_group *tg, const char *name);
void scst_tg_tgt_remove_by_tgt(struct scst_tgt *tgt);
#ifndef CONFIG_SCST_PROC
int scst_dg_sysfs_add(struct kobject *parent, struct scst_dev_group *dg);
void scst_dg_sysfs_del(struct scst_dev_group *dg);
void scst_tgt_sysfs_put(struct scst_tgt *tgt);
@@ -515,99 +506,7 @@ int scst_tg_tgt_sysfs_add(struct scst_target_group *tg,
struct scst_tg_tgt *tg_tgt);
void scst_tg_tgt_sysfs_del(struct scst_target_group *tg,
struct scst_tg_tgt *tg_tgt);
#else
static inline int scst_dg_sysfs_add(struct kobject *parent,
struct scst_dev_group *dg)
{
return 0;
}
static inline void scst_dg_sysfs_del(struct scst_dev_group *dg)
{
}
static inline int scst_dg_dev_sysfs_add(struct scst_dev_group *dg,
struct scst_dg_dev *dgdev)
{
return 0;
}
static inline void scst_dg_dev_sysfs_del(struct scst_dev_group *dg,
struct scst_dg_dev *dgdev)
{
}
static inline int scst_tg_sysfs_add(struct scst_dev_group *dg,
struct scst_target_group *tg)
{
return 0;
}
static inline void scst_tg_sysfs_del(struct scst_target_group *tg)
{
}
static inline int scst_tg_tgt_sysfs_add(struct scst_target_group *tg,
struct scst_tg_tgt *tg_tgt)
{
return 0;
}
static inline void scst_tg_tgt_sysfs_del(struct scst_target_group *tg,
struct scst_tg_tgt *tg_tgt)
{
}
#endif
#ifdef CONFIG_SCST_PROC
int scst_proc_init_module(void);
void scst_proc_cleanup_module(void);
int scst_build_proc_target_dir_entries(struct scst_tgt_template *vtt);
void scst_cleanup_proc_target_dir_entries(struct scst_tgt_template *vtt);
int scst_build_proc_target_entries(struct scst_tgt *vtt);
void scst_cleanup_proc_target_entries(struct scst_tgt *vtt);
int scst_build_proc_dev_handler_dir_entries(struct scst_dev_type *dev_type);
void scst_cleanup_proc_dev_handler_dir_entries(struct scst_dev_type *dev_type);
static inline int scst_sysfs_init(void)
{
return 0;
}
static inline void scst_sysfs_cleanup(void) { }
static inline int scst_devt_dev_sysfs_create(struct scst_device *dev)
{
return 0;
}
static inline void scst_devt_dev_sysfs_del(struct scst_device *dev) { }
static inline void scst_dev_sysfs_del(struct scst_device *dev) { }
static inline int scst_dev_sysfs_dif_create(struct scst_device *dev)
{
return 0;
}
static inline int scst_tgt_dev_sysfs_create(struct scst_tgt_dev *tgt_dev)
{
return 0;
}
static inline void scst_tgt_dev_sysfs_del(struct scst_tgt_dev *tgt_dev) { }
static inline int scst_sess_sysfs_create(struct scst_session *sess)
{
return 0;
}
static inline int scst_acg_dev_sysfs_create(struct scst_acg_dev *acg_dev,
struct kobject *parent)
{
return 0;
}
static inline void scst_acg_dev_sysfs_del(struct scst_acg_dev *acg_dev) { }
static inline int scst_acn_sysfs_create(struct scst_acn *acn)
{
return 0;
}
static inline void scst_acn_sysfs_del(struct scst_acn *acn) { }
#else /* CONFIG_SCST_PROC */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)
extern const struct sysfs_ops scst_sysfs_ops;
@@ -644,7 +543,6 @@ void scst_acg_dev_sysfs_del(struct scst_acg_dev *acg_dev);
int scst_acn_sysfs_create(struct scst_acn *acn);
void scst_acn_sysfs_del(struct scst_acn *acn);
#endif /* CONFIG_SCST_PROC */
/*
* Check SPC-2 reservation state.
@@ -897,7 +795,6 @@ static inline bool scst_lba1_inside_lba2(int64_t lba1,
return res;
}
#ifndef CONFIG_SCST_PROC
void scst_cm_update_dev(struct scst_device *dev);
int scst_cm_on_dev_register(struct scst_device *dev);
@@ -931,70 +828,6 @@ bool scst_cm_ec_cmd_overlap(struct scst_cmd *ec_cmd, struct scst_cmd *cmd);
int scst_cm_init(void);
void scst_cm_exit(void);
#else /* #ifndef CONFIG_SCST_PROC */
static inline void scst_cm_update_dev(struct scst_device *dev) {}
static inline int scst_cm_on_dev_register(struct scst_device *dev) { return 0; }
static inline void scst_cm_on_dev_unregister(struct scst_device *dev) {}
static inline int scst_cm_on_add_acg(struct scst_acg *acg)
{
return 0;
}
static inline void scst_cm_on_del_acg(struct scst_acg *acg)
{
}
static inline int scst_cm_on_add_lun(struct scst_acg_dev *acg_dev, uint64_t lun,
unsigned int *flags)
{
return 0;
}
static inline bool scst_cm_on_del_lun(struct scst_acg_dev *acg_dev,
bool gen_report_luns_changed)
{
return gen_report_luns_changed;
}
static inline int scst_cm_parse_descriptors(struct scst_cmd *cmd)
{
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode));
scst_set_cmd_abnormal_done_state(cmd);
return -1;
}
static inline void scst_cm_free_descriptors(struct scst_cmd *cmd) {}
static inline enum scst_exec_res scst_cm_ext_copy_exec(struct scst_cmd *cmd)
{
return SCST_EXEC_NOT_COMPLETED;
}
static inline enum scst_exec_res scst_cm_rcv_copy_res_exec(struct scst_cmd *cmd)
{
return SCST_EXEC_NOT_COMPLETED;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
static inline void sess_cm_list_id_cleanup_work_fn(void *p) {}
#else
static inline void sess_cm_list_id_cleanup_work_fn(struct work_struct *work) {}
#endif
static inline void scst_cm_free_pending_list_ids(struct scst_session *sess) {}
static inline bool scst_cm_check_block_all_devs(struct scst_cmd *cmd) { return false; }
static inline void scst_cm_abort_ec_cmd(struct scst_cmd *ec_cmd) {}
static inline bool scst_cm_ec_cmd_overlap(struct scst_cmd *ec_cmd, struct scst_cmd *cmd)
{
return false;
}
static inline int scst_cm_init(void) { return 0; }
static inline void scst_cm_exit(void) {}
#endif /* #ifndef CONFIG_SCST_PROC */
#ifdef CONFIG_SCST_DEBUG_TM
extern void tm_dbg_check_released_cmds(void);
-60
View File
@@ -3137,10 +3137,8 @@ scst_persistent_reserve_out_local(struct scst_cmd *cmd)
goto out_unlock;
}
#ifndef CONFIG_SCST_PROC
if (cmd->status == SAM_STAT_GOOD)
scst_pr_sync_device_file(dev);
#endif
if ((cmd->devt->pr_cmds_notifications) &&
(cmd->status == SAM_STAT_GOOD)) /* sync file may change status */
@@ -7921,54 +7919,6 @@ static bool wildcmp(const char *wild, const char *string)
return __wildcmp(wild, string, 0);
}
#ifdef CONFIG_SCST_PROC
/* scst_mutex supposed to be held */
static struct scst_acg *scst_find_acg_by_name_wild(const char *initiator_name)
{
struct scst_acg *acg, *res = NULL;
struct scst_acn *n;
TRACE_ENTRY();
list_for_each_entry(acg, &scst_acg_list, acg_list_entry) {
list_for_each_entry(n, &acg->acn_list, acn_list_entry) {
if (wildcmp(n->name, initiator_name)) {
TRACE_DBG("Access control group %s found",
acg->acg_name);
res = acg;
goto out;
}
}
}
out:
TRACE_EXIT_HRES(res);
return res;
}
/* scst_mutex supposed to be held */
static struct scst_acg *scst_find_acg_by_name(const char *acg_name)
{
struct scst_acg *acg, *res = NULL;
TRACE_ENTRY();
list_for_each_entry(acg, &scst_acg_list, acg_list_entry) {
if (strcmp(acg->acg_name, acg_name) == 0) {
TRACE_DBG("Access control group %s found",
acg->acg_name);
res = acg;
goto out;
}
}
out:
TRACE_EXIT_HRES(res);
return res;
}
#else /* CONFIG_SCST_PROC */
/* scst_mutex supposed to be held */
static struct scst_acg *scst_find_tgt_acg_by_name_wild(struct scst_tgt *tgt,
@@ -7998,7 +7948,6 @@ out:
return res;
}
#endif /* CONFIG_SCST_PROC */
/* Must be called under scst_mutex */
static struct scst_acg *__scst_find_acg(struct scst_tgt *tgt,
@@ -8008,18 +7957,9 @@ static struct scst_acg *__scst_find_acg(struct scst_tgt *tgt,
TRACE_ENTRY();
#ifdef CONFIG_SCST_PROC
if (initiator_name)
acg = scst_find_acg_by_name_wild(initiator_name);
if ((acg == NULL) && (tgt->default_group_name != NULL))
acg = scst_find_acg_by_name(tgt->default_group_name);
if (acg == NULL)
acg = scst_default_acg;
#else
acg = scst_find_tgt_acg_by_name_wild(tgt, initiator_name);
if (acg == NULL)
acg = tgt->default_acg;
#endif
TRACE_EXIT_HRES((unsigned long)acg);
return acg;
-6
View File
@@ -286,9 +286,7 @@ static void scst_release_tg_tgt(struct kobject *kobj)
}
static struct kobj_type scst_tg_tgt_ktype = {
#ifndef CONFIG_SCST_PROC
.sysfs_ops = &scst_sysfs_ops,
#endif
.release = scst_release_tg_tgt,
};
@@ -794,9 +792,7 @@ static void scst_release_tg(struct kobject *kobj)
}
static struct kobj_type scst_tg_ktype = {
#ifndef CONFIG_SCST_PROC
.sysfs_ops = &scst_sysfs_ops,
#endif
.release = scst_release_tg,
};
@@ -1278,9 +1274,7 @@ static void scst_release_dg(struct kobject *kobj)
}
static struct kobj_type scst_dg_ktype = {
#ifndef CONFIG_SCST_PROC
.sysfs_ops = &scst_sysfs_ops,
#endif
.release = scst_release_dg,
};
+1 -101
View File
@@ -16,9 +16,6 @@
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/init.h>
#ifdef CONFIG_SCST_PROC
#include <linux/proc_fs.h>
#endif
#include <linux/moduleparam.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
@@ -293,68 +290,6 @@ out:
return res;
}
#ifdef CONFIG_SCST_PROC
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
static int scst_local_proc_info(struct Scsi_Host *host, char *buffer,
char **start, off_t offset, int length,
int inout)
{
int len, pos, begin;
TRACE_ENTRY();
if (inout == 1)
return -EACCES;
begin = 0;
pos = len = sprintf(buffer, "scst_local adapter driver, version "
"%s [%s]\nAborts=%d, Device Resets=%d, Target Resets=%d\n",
SCST_LOCAL_VERSION, scst_local_version_date,
atomic_read(&num_aborts), atomic_read(&num_dev_resets),
atomic_read(&num_target_resets));
if (pos < offset) {
len = 0;
begin = pos;
}
if (start)
*start = buffer + (offset - begin);
len -= (offset - begin);
if (len > length)
len = length;
TRACE_EXIT_RES(len);
return len;
}
#else
static int scst_local_show_info(struct seq_file *file, struct Scsi_Host *host)
{
seq_printf(file, "scst_local adapter driver, version "
"%s [%s]\nAborts=%d, Device Resets=%d, Target Resets=%d\n",
SCST_LOCAL_VERSION, scst_local_version_date,
atomic_read(&num_aborts), atomic_read(&num_dev_resets),
atomic_read(&num_target_resets));
return 0;
}
#endif
static const char *scst_local_info(struct Scsi_Host *shp)
{
static char scst_local_info_buf[256];
TRACE_ENTRY();
sprintf(scst_local_info_buf, "scst_local, version %s [%s], "
"Aborts: %d, Device Resets: %d, Target Resets: %d",
SCST_LOCAL_VERSION, scst_local_version_date,
atomic_read(&num_aborts), atomic_read(&num_dev_resets),
atomic_read(&num_target_resets));
TRACE_EXIT();
return scst_local_info_buf;
}
#else /* CONFIG_SCST_PROC */
/*
** Tgtt attributes
@@ -805,7 +740,6 @@ out_up:
return res;
}
#endif /* CONFIG_SCST_PROC */
static int scst_local_abort(struct scsi_cmnd *scmd)
{
@@ -1582,7 +1516,6 @@ static struct scst_tgt_template scst_local_targ_tmpl = {
#endif
.xmit_response_atomic = 1,
.multithreaded_init_done = 1,
#ifndef CONFIG_SCST_PROC
.enabled_attr_not_needed = 1,
.tgtt_attrs = scst_local_tgtt_attrs,
.tgt_attrs = scst_local_tgt_attrs,
@@ -1593,7 +1526,6 @@ static struct scst_tgt_template scst_local_targ_tmpl = {
.add_target_parameters = "session_name",
.mgmt_cmd_help = " echo \"add_session target_name session_name\" >mgmt\n"
" echo \"del_session target_name session_name\" >mgmt\n",
#endif
.release = scst_local_targ_release,
.close_session = scst_local_close_session,
.pre_exec = scst_local_targ_pre_exec,
@@ -1613,19 +1545,6 @@ static struct scst_tgt_template scst_local_targ_tmpl = {
};
static struct scsi_host_template scst_lcl_ini_driver_template = {
#ifdef CONFIG_SCST_PROC
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
/*
* scsi_host_template.proc_info has been removed via commit "scsi: bury
* ->proc_info()" (70ef457dc92bdd03c0c8d640fce45909166983a1).
*/
.proc_info = scst_local_proc_info,
#else
.show_info = scst_local_show_info,
#endif
.proc_name = SCST_LOCAL_NAME,
.info = scst_local_info,
#endif
.name = SCST_LOCAL_NAME,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
.queuecommand = scst_local_queuecommand_lck,
@@ -1723,10 +1642,6 @@ static int scst_local_driver_probe(struct device *dev)
ret = -ENODEV;
scsi_host_put(hpnt);
goto out;
#ifdef CONFIG_SCST_PROC
} else {
scsi_scan_host(hpnt);
#endif
}
out:
@@ -1899,18 +1814,13 @@ static int __scst_local_add_adapter(struct scst_local_tgt *tgt,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
snprintf(sess->dev.bus_id, sizeof(sess->dev.bus_id), initiator_name);
#else
# ifdef CONFIG_SCST_PROC
sess->dev.init_name = sess->scst_sess->initiator_name;
# else
sess->dev.init_name = kobject_name(&sess->scst_sess->sess_kobj);
#endif
#endif
res = device_register(&sess->dev);
if (res != 0)
goto unregister_session;
#ifndef CONFIG_SCST_PROC
res = sysfs_create_link(scst_sysfs_get_sess_kobj(sess->scst_sess),
&sess->shost->shost_dev.kobj, "host");
if (res != 0) {
@@ -1918,7 +1828,6 @@ static int __scst_local_add_adapter(struct scst_local_tgt *tgt,
"%s", scst_get_tgt_name(tgt->scst_tgt));
goto unregister_dev;
}
#endif
if (!locked)
mutex_lock(&scst_local_mutex);
@@ -1934,11 +1843,9 @@ out:
TRACE_EXIT_RES(res);
return res;
#ifndef CONFIG_SCST_PROC
unregister_dev:
device_unregister(&sess->dev);
goto out;
#endif
unregister_session:
scst_unregister_session(sess->scst_sess, true, NULL);
@@ -2129,16 +2036,9 @@ static int __init scst_local_init(void)
goto tgt_templ_unreg;
}
#ifndef CONFIG_SCST_PROC
/*
* If we are using sysfs, then don't add a default target unless
* we are told to do so. When using procfs, we always add a default
* target because that was what the earliest versions did. Just
* remove the preprocessor directives when no longer needed.
*/
/* Don't add a default target unless we are told to do so. */
if (!scst_local_add_default_tgt)
goto out;
#endif
ret = scst_local_add_target("scst_local_tgt", &tgt);
if (ret != 0)
+4 -11
View File
@@ -8,15 +8,9 @@ The perl module SCST::SCST is very generic and tries to handle error checking as
The init script was written for debian but should work on most distributions.
scstadmin.sysfs
Use this version if you've disabled procfs support in SCST.
scstadmin.procfs
This is the default version which uses the older procfs.
scst-0.8.22 This is the SCST Perl module required by scstadmin and scst_db.
scst-0.9.00 This is the SCST Perl module to be used with SCST compiled
for sysfs. Note, the current version of scstadmin will NOT yet
work with this module.
scstadmin.sysfs scstadmin version that supports sysfs.
scst-1.0.0 This is the SCST Perl module to be used with SCST compiled
for sysfs.
scstadmin Script which can accept operations on a command line or from
a configuration file. See scst.conf. For command help,
@@ -50,8 +44,7 @@ exists.
GETTING HELP
------------
The new scstadmin has many more options than the olde procfs version to see
them, type:
To see the scstadmin command line options, type:
scstadmin --help
-4
View File
@@ -1,6 +1,2 @@
# iscsi-scstd command-line options. See also man iscsi-scstd.
# ISCSID_OPTIONS="-u0 -g0 -p3260"
# When using the procfs interface, specify all SCST target drivers in
# SCST_TARGET_MODULES. An example:
# SCST_TARGET_MODULES="scst_local iscsi_scst ib_srpt"
-14
View File
@@ -15,12 +15,6 @@ Specifies which command-line options will be passed to iscsi-scstd by the SCST
init script when SCST is started. This variable is ignored if no iSCSI target
entries have been defined in /etc/scst.conf. See also the iscsi-scstd man page
for more information about the supported command-line options.
.TP
.B SCST_TARGET_MODULES
This variable has only to be set when the procfs interface of SCST is being
used instead of the sysfs interface. It defines which target modules should be
loaded by the SCST init script when SCST is started and also which target
modules should be unloaded when SCST is stopped.
.P
The format of the /etc/default/scst file is as follows:
.br
@@ -38,14 +32,6 @@ An example:
ISCSID_OPTIONS="-u0 -g0 -p3260"
.br
.br
# When using the procfs interface, the /etc/init.d/scst script
.br
# cannot derive from /etc/scst.conf which target modules will
.br
# be used and hence these have to be specified explicitly.
.br
SCST_TARGET_MODULES="scst_local iscsi_scst ib_srpt"
.SH FILES
.IP /etc/default/scst
Configuration file that controls the behavior of some aspects of
+1 -3
View File
@@ -99,9 +99,7 @@ the scstadmin tool as follows:
Now configure SCST using scstadmin - see also the scstadmin documentation for
further information. Once finished, save the configuration to /etc/scst.conf:
scstadmin -write_config /etc/scst.conf (sysfs version)
or
scstadmin -WriteConfig /etc/scst.conf (procfs version)
scstadmin -write_config /etc/scst.conf
One can verify the contents of scst.conf e.g. as follows:
-98
View File
@@ -52,12 +52,6 @@
#else
#include <asm/atomic.h>
#endif
#if defined(CONFIG_SCST_PROC)
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#endif
#endif
#include <rdma/ib_cache.h>
#include "ib_srpt.h"
#define LOG_PREFIX "ib_srpt" /* Prefix for SCST tracing macros. */
@@ -2541,7 +2535,6 @@ static struct srpt_nexus *srpt_get_nexus(struct srpt_port *sport,
return nexus;
}
#if !defined(CONFIG_SCST_PROC)
/*
* srpt_enable_target - Set the "enabled" status of a target.
*/
@@ -2579,7 +2572,6 @@ static bool srpt_is_target_enabled(struct scst_tgt *scst_tgt)
return sport && sport->enabled;
}
#endif /* CONFIG_SCST_PROC */
/*
* srpt_next_comp_vector() - Next completion vector >= sport->comp_vector
@@ -4028,7 +4020,6 @@ static uint16_t srpt_get_scsi_transport_version(struct scst_tgt *scst_tgt)
return 0x0940; /* SRP */
}
#if !defined(CONFIG_SCST_PROC)
static ssize_t show_comp_v_mask(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
@@ -4327,7 +4318,6 @@ static const struct attribute *srpt_sess_attrs[] = {
#endif
NULL
};
#endif /* CONFIG_SCST_PROC */
/* SCST target template for the SRP target implementation. */
static struct scst_tgt_template srpt_template = {
@@ -4335,12 +4325,10 @@ static struct scst_tgt_template srpt_template = {
.sg_tablesize = 1 << 16,
.use_clustering = true,
.max_hw_pending_time = RDMA_COMPL_TIMEOUT_S,
#if !defined(CONFIG_SCST_PROC)
.enable_target = srpt_enable_target,
.is_target_enabled = srpt_is_target_enabled,
.tgt_attrs = srpt_tgt_attrs,
.sess_attrs = srpt_sess_attrs,
#endif
.release = srpt_release,
.close_session = srpt_close_session,
.xmit_response = srpt_xmit_response,
@@ -4352,28 +4340,6 @@ static struct scst_tgt_template srpt_template = {
.get_scsi_transport_version = srpt_get_scsi_transport_version,
};
#ifdef CONFIG_SCST_PROC
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
static int srpt_trace_level_show(struct seq_file *seq, void *v)
{
return scst_proc_log_entry_read(seq, trace_flag, NULL);
}
static ssize_t srpt_proc_trace_level_write(struct file *file,
const char __user *buf, size_t length, loff_t *off)
{
return scst_proc_log_entry_write(file, buf, length, &trace_flag,
DEFAULT_SRPT_TRACE_FLAGS, NULL);
}
static struct scst_proc_data srpt_log_proc_data = {
SCST_DEF_RW_SEQ_OP(srpt_proc_trace_level_write)
.show = srpt_trace_level_show,
};
#endif
#endif /* CONFIG_SCST_PROC */
/* Note: the caller must have zero-initialized *@sport. */
static void srpt_init_sport(struct srpt_port *sport, struct ib_device *ib_dev)
@@ -4651,56 +4617,6 @@ static struct ib_client srpt_client = {
.remove = srpt_remove_one
};
#ifdef CONFIG_SCST_PROC
/*
* srpt_register_procfs_entry() - Create SRPT procfs entries.
*
* Currently the only procfs entry created by this function is the
* "trace_level" entry.
*/
static int srpt_register_procfs_entry(struct scst_tgt_template *tgt)
{
int res = 0;
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
struct proc_dir_entry *p, *root;
root = scst_proc_get_tgt_root(tgt);
WARN_ON(!root);
if (root) {
/*
* Fill in the scst_proc_data::data pointer, which is used in
* a printk(KERN_INFO ...) statement in
* scst_proc_log_entry_write() in scst_proc.c.
*/
srpt_log_proc_data.data = (char *)tgt->name;
p = scst_create_proc_entry(root, SRPT_PROC_TRACE_LEVEL_NAME,
&srpt_log_proc_data);
if (!p)
res = -ENOMEM;
} else
res = -ENOMEM;
#endif
return res;
}
/*
* srpt_unregister_procfs_entry() - Unregister SRPT procfs entries.
*/
static void srpt_unregister_procfs_entry(struct scst_tgt_template *tgt)
{
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
struct proc_dir_entry *root;
root = scst_proc_get_tgt_root(tgt);
WARN_ON(!root);
if (root)
remove_proc_entry(SRPT_PROC_TRACE_LEVEL_NAME, root);
#endif
}
#endif /* CONFIG_SCST_PROC */
/**
* srpt_init_module - kernel module initialization
@@ -4789,20 +4705,9 @@ static int __init srpt_init_module(void)
}
}
#ifdef CONFIG_SCST_PROC
ret = srpt_register_procfs_entry(&srpt_template);
if (ret) {
pr_err("couldn't register procfs entry\n");
goto out_rdma_cm;
}
#endif /* CONFIG_SCST_PROC */
return 0;
#ifdef CONFIG_SCST_PROC
out_rdma_cm:
rdma_destroy_id(rdma_cm_id);
#endif /* CONFIG_SCST_PROC */
out_unregister_client:
ib_unregister_client(&srpt_client);
out_unregister_target:
@@ -4818,9 +4723,6 @@ static void __exit srpt_cleanup_module(void)
if (rdma_cm_id)
rdma_destroy_id(rdma_cm_id);
ib_unregister_client(&srpt_client);
#ifdef CONFIG_SCST_PROC
srpt_unregister_procfs_entry(&srpt_template);
#endif /* CONFIG_SCST_PROC */
scst_unregister_target_template(&srpt_template);
}