diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 387b5bd24..c488ddea8 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -95,6 +95,8 @@ static void q2t_clear_tgt_db(struct q2t_tgt *tgt, bool local_only); static void q2t_on_hw_pending_cmd_timeout(struct scst_cmd *scst_cmd); static int q2t_unreg_sess(struct q2t_sess *sess); +#ifndef CONFIG_SCST_PROC + /** SYSFS **/ static ssize_t q2t_version_show(struct kobject *kobj, @@ -122,6 +124,8 @@ static const struct attribute *q2t_tgt_attrs[] = { NULL, }; +#endif /* CONFIG_SCST_PROC */ + static ssize_t q2t_enable_tgt(struct scst_tgt *tgt, const char *buf, size_t size); static bool q2t_is_tgt_enabled(struct scst_tgt *tgt); @@ -156,8 +160,10 @@ static struct scst_tgt_template tgt2x_template = { .on_hw_pending_cmd_timeout = q2t_on_hw_pending_cmd_timeout, .enable_tgt = q2t_enable_tgt, .is_tgt_enabled = q2t_is_tgt_enabled, +#ifndef CONFIG_SCST_PROC .tgtt_attrs = q2t_attrs, .tgt_attrs = q2t_tgt_attrs, +#endif #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) .default_trace_flags = Q2T_DEFAULT_LOG_FLAGS, .trace_flags = &trace_flag, @@ -5201,6 +5207,8 @@ static bool q2t_is_tgt_enabled(struct scst_tgt *scst_tgt) return qla_tgt_mode_enabled(ha); } +#ifndef CONFIG_SCST_PROC + static ssize_t q2t_show_expl_conf_enabled(struct kobject *kobj, struct kobj_attribute *attr, char *buffer) { @@ -5281,7 +5289,7 @@ static ssize_t q2t_version_show(struct kobject *kobj, return strlen(buf); } -#ifdef CONFIG_SCST_PROC +#else /* CONFIG_SCST_PROC */ #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) diff --git a/scst/include/scst.h b/scst/include/scst.h index 2514515e6..a7fc97361 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -41,6 +41,10 @@ #include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) +#define kobj_attribute device_attribute +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) #ifndef RHEL_RELEASE_CODE typedef _Bool bool; @@ -859,11 +863,13 @@ struct scst_tgt_template { /* Optional local trace table help string */ const char *trace_tbl_help; +#ifndef CONFIG_SCST_PROC /* Optional sysfs attributes */ const struct attribute **tgtt_attrs; /* Optional sysfs target attributes */ const struct attribute **tgt_attrs; +#endif /** Private, must be inited to 0 by memset() **/ @@ -1055,11 +1061,13 @@ struct scst_dev_type { /* Optional local trace table help string */ const char *trace_tbl_help; +#ifndef CONFIG_SCST_PROC /* Optional sysfs attributes */ const struct attribute **devt_attrs; /* Optional sysfs device attributes */ const struct attribute **dev_attrs; +#endif /* Pointer to dev handler's private data */ void *devt_priv; diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 70d9536d5..feafd1a5a 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -182,11 +182,11 @@ 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 + static int dev_user_read_proc(struct seq_file *seq, struct scst_dev_type *dev_type); -#endif -static int dev_usr_parse(struct scst_cmd *cmd); +#else /* CONFIG_SCST_PROC */ static ssize_t dev_user_sysfs_commands_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf); @@ -199,6 +199,10 @@ static const struct attribute *dev_user_dev_attrs[] = { NULL, }; +#endif /* CONFIG_SCST_PROC */ + +static int dev_usr_parse(struct scst_cmd *cmd); + /** Data **/ static struct kmem_cache *user_cmd_cachep; @@ -2787,8 +2791,9 @@ static int dev_user_register_dev(struct file *file, dev->devtype.dev_done_atomic = 1; #ifdef CONFIG_SCST_PROC dev->devtype.no_proc = 1; -#endif +#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; @@ -3373,6 +3378,8 @@ out: return res; } +#ifndef CONFIG_SCST_PROC + static ssize_t dev_user_sysfs_commands_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -3414,7 +3421,8 @@ static ssize_t dev_user_sysfs_commands_show(struct kobject *kobj, return pos; } -#ifdef CONFIG_SCST_PROC +#else /* CONFIG_SCST_PROC */ + /* * Called when a file in the /proc/scsi_tgt/scst_user is read */ diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 3694c4b5b..aa94ce74b 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -370,6 +370,8 @@ static int vdisk_task_mgmt_fn(struct scst_mgmt_cmd *mcmd, /** SYSFS **/ +#ifndef CONFIG_SCST_PROC + static ssize_t vdisk_mgmt_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf); static ssize_t vdisk_mgmt_store(struct kobject *kobj, @@ -459,6 +461,8 @@ static const struct attribute *vcdrom_attrs[] = { NULL, }; +#endif /* CONFIG_SCST_PROC */ + static DEFINE_MUTEX(scst_vdisk_mutex); /* Both protected by scst_vdisk_mutex */ @@ -487,13 +491,14 @@ static struct scst_dev_type vdisk_file_devtype = { .detach_tgt = vdisk_detach_tgt, .parse = vdisk_parse, .exec = vdisk_do_job, + .task_mgmt_fn = vdisk_task_mgmt_fn, #ifdef CONFIG_SCST_PROC .read_proc = vdisk_read_proc, .write_proc = vdisk_write_proc, -#endif - .task_mgmt_fn = vdisk_task_mgmt_fn, +#else .devt_attrs = vdisk_attrs, .dev_attrs = vdisk_fileio_attrs, +#endif #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) .default_trace_flags = SCST_DEFAULT_DEV_LOG_FLAGS, .trace_flags = &trace_flag, @@ -522,8 +527,10 @@ static struct scst_dev_type vdisk_blk_devtype = { .parse = vdisk_parse, .exec = vdisk_do_job, .task_mgmt_fn = vdisk_task_mgmt_fn, +#ifndef CONFIG_SCST_PROC .devt_attrs = vdisk_attrs, .dev_attrs = vdisk_blockio_attrs, +#endif #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) .default_trace_flags = SCST_DEFAULT_DEV_LOG_FLAGS, .trace_flags = &trace_flag, @@ -550,8 +557,10 @@ static struct scst_dev_type vdisk_null_devtype = { .parse = vdisk_parse, .exec = vdisk_do_job, .task_mgmt_fn = vdisk_task_mgmt_fn, +#ifndef CONFIG_SCST_PROC .devt_attrs = vdisk_attrs, .dev_attrs = vdisk_nullio_attrs, +#endif #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) .default_trace_flags = SCST_DEFAULT_DEV_LOG_FLAGS, .trace_flags = &trace_flag, @@ -575,13 +584,14 @@ static struct scst_dev_type vcdrom_devtype = { .detach_tgt = vdisk_detach_tgt, .parse = vcdrom_parse, .exec = vcdrom_exec, + .task_mgmt_fn = vdisk_task_mgmt_fn, #ifdef CONFIG_SCST_PROC .read_proc = vcdrom_read_proc, .write_proc = vcdrom_write_proc, -#endif - .task_mgmt_fn = vdisk_task_mgmt_fn, +#else .devt_attrs = vdisk_attrs, .dev_attrs = vcdrom_attrs, +#endif #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) .default_trace_flags = SCST_DEFAULT_DEV_LOG_FLAGS, .trace_flags = &trace_flag, @@ -3656,6 +3666,8 @@ static int vcdrom_perform_cmd(struct vdev_type *vdt, int action, char *p, return res; } +#ifndef CONFIG_SCST_PROC + static int vdisk_mgmt_cmd(const char *buffer, int length, struct vdev_type *vdt) { @@ -3953,7 +3965,7 @@ out: return res; } -#ifdef CONFIG_SCST_PROC +#else /* CONFIG_SCST_PROC */ /* * ProcFS