scsi: target: srpt: Replace enable attr with ops.enable
Remove tpg/enable attribute. Add fabric ops enable_tpg implementation instead. Link: https://lore.kernel.org/r/20210910084133.17956-6-d.bogdanov@yadro.com Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
fb00af92e5
commit
9465b4871a
1 changed files with 4 additions and 34 deletions
|
@ -3705,47 +3705,17 @@ static struct configfs_attribute *srpt_da_attrs[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t srpt_tpg_enable_show(struct config_item *item, char *page)
|
static int srpt_enable_tpg(struct se_portal_group *se_tpg, bool enable)
|
||||||
{
|
{
|
||||||
struct se_portal_group *se_tpg = to_tpg(item);
|
|
||||||
struct srpt_port *sport = srpt_tpg_to_sport(se_tpg);
|
struct srpt_port *sport = srpt_tpg_to_sport(se_tpg);
|
||||||
|
|
||||||
return sysfs_emit(page, "%d\n", sport->enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t srpt_tpg_enable_store(struct config_item *item,
|
|
||||||
const char *page, size_t count)
|
|
||||||
{
|
|
||||||
struct se_portal_group *se_tpg = to_tpg(item);
|
|
||||||
struct srpt_port *sport = srpt_tpg_to_sport(se_tpg);
|
|
||||||
unsigned long tmp;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = kstrtoul(page, 0, &tmp);
|
|
||||||
if (ret < 0) {
|
|
||||||
pr_err("Unable to extract srpt_tpg_store_enable\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((tmp != 0) && (tmp != 1)) {
|
|
||||||
pr_err("Illegal value for srpt_tpg_store_enable: %lu\n", tmp);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_lock(&sport->mutex);
|
mutex_lock(&sport->mutex);
|
||||||
srpt_set_enabled(sport, tmp);
|
srpt_set_enabled(sport, enable);
|
||||||
mutex_unlock(&sport->mutex);
|
mutex_unlock(&sport->mutex);
|
||||||
|
|
||||||
return count;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIGFS_ATTR(srpt_tpg_, enable);
|
|
||||||
|
|
||||||
static struct configfs_attribute *srpt_tpg_attrs[] = {
|
|
||||||
&srpt_tpg_attr_enable,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* srpt_make_tpg - configfs callback invoked for mkdir /sys/kernel/config/target/$driver/$port/$tpg
|
* srpt_make_tpg - configfs callback invoked for mkdir /sys/kernel/config/target/$driver/$port/$tpg
|
||||||
* @wwn: Corresponds to $driver/$port.
|
* @wwn: Corresponds to $driver/$port.
|
||||||
|
@ -3856,12 +3826,12 @@ static const struct target_core_fabric_ops srpt_template = {
|
||||||
.fabric_make_wwn = srpt_make_tport,
|
.fabric_make_wwn = srpt_make_tport,
|
||||||
.fabric_drop_wwn = srpt_drop_tport,
|
.fabric_drop_wwn = srpt_drop_tport,
|
||||||
.fabric_make_tpg = srpt_make_tpg,
|
.fabric_make_tpg = srpt_make_tpg,
|
||||||
|
.fabric_enable_tpg = srpt_enable_tpg,
|
||||||
.fabric_drop_tpg = srpt_drop_tpg,
|
.fabric_drop_tpg = srpt_drop_tpg,
|
||||||
.fabric_init_nodeacl = srpt_init_nodeacl,
|
.fabric_init_nodeacl = srpt_init_nodeacl,
|
||||||
|
|
||||||
.tfc_discovery_attrs = srpt_da_attrs,
|
.tfc_discovery_attrs = srpt_da_attrs,
|
||||||
.tfc_wwn_attrs = srpt_wwn_attrs,
|
.tfc_wwn_attrs = srpt_wwn_attrs,
|
||||||
.tfc_tpg_base_attrs = srpt_tpg_attrs,
|
|
||||||
.tfc_tpg_attrib_attrs = srpt_tpg_attrib_attrs,
|
.tfc_tpg_attrib_attrs = srpt_tpg_attrib_attrs,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue