summaryrefslogtreecommitdiff
path: root/drivers/target/target_core_configfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/target/target_core_configfs.c')
-rw-r--r--drivers/target/target_core_configfs.c49
1 files changed, 34 insertions, 15 deletions
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 416514c5c7ac..611b0424e305 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -12,6 +12,7 @@
*
****************************************************************************/
+#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <generated/utsrelease.h>
@@ -547,6 +548,7 @@ DEF_CONFIGFS_ATTRIB_SHOW(unmap_granularity);
DEF_CONFIGFS_ATTRIB_SHOW(unmap_granularity_alignment);
DEF_CONFIGFS_ATTRIB_SHOW(unmap_zeroes_data);
DEF_CONFIGFS_ATTRIB_SHOW(max_write_same_len);
+DEF_CONFIGFS_ATTRIB_SHOW(emulate_rsoc);
#define DEF_CONFIGFS_ATTRIB_STORE_U32(_name) \
static ssize_t _name##_store(struct config_item *item, const char *page,\
@@ -577,7 +579,7 @@ static ssize_t _name##_store(struct config_item *item, const char *page, \
bool flag; \
int ret; \
\
- ret = strtobool(page, &flag); \
+ ret = kstrtobool(page, &flag); \
if (ret < 0) \
return ret; \
da->_name = flag; \
@@ -637,7 +639,7 @@ static ssize_t emulate_model_alias_store(struct config_item *item,
return -EINVAL;
}
- ret = strtobool(page, &flag);
+ ret = kstrtobool(page, &flag);
if (ret < 0)
return ret;
@@ -659,7 +661,7 @@ static ssize_t emulate_write_cache_store(struct config_item *item,
bool flag;
int ret;
- ret = strtobool(page, &flag);
+ ret = kstrtobool(page, &flag);
if (ret < 0)
return ret;
@@ -711,7 +713,7 @@ static ssize_t emulate_tas_store(struct config_item *item,
bool flag;
int ret;
- ret = strtobool(page, &flag);
+ ret = kstrtobool(page, &flag);
if (ret < 0)
return ret;
@@ -736,7 +738,7 @@ static ssize_t emulate_tpu_store(struct config_item *item,
bool flag;
int ret;
- ret = strtobool(page, &flag);
+ ret = kstrtobool(page, &flag);
if (ret < 0)
return ret;
@@ -766,7 +768,7 @@ static ssize_t emulate_tpws_store(struct config_item *item,
bool flag;
int ret;
- ret = strtobool(page, &flag);
+ ret = kstrtobool(page, &flag);
if (ret < 0)
return ret;
@@ -865,7 +867,7 @@ static ssize_t pi_prot_format_store(struct config_item *item,
bool flag;
int ret;
- ret = strtobool(page, &flag);
+ ret = kstrtobool(page, &flag);
if (ret < 0)
return ret;
@@ -902,7 +904,7 @@ static ssize_t pi_prot_verify_store(struct config_item *item,
bool flag;
int ret;
- ret = strtobool(page, &flag);
+ ret = kstrtobool(page, &flag);
if (ret < 0)
return ret;
@@ -931,7 +933,7 @@ static ssize_t force_pr_aptpl_store(struct config_item *item,
bool flag;
int ret;
- ret = strtobool(page, &flag);
+ ret = kstrtobool(page, &flag);
if (ret < 0)
return ret;
if (da->da_dev->export_count) {
@@ -953,7 +955,7 @@ static ssize_t emulate_rest_reord_store(struct config_item *item,
bool flag;
int ret;
- ret = strtobool(page, &flag);
+ ret = kstrtobool(page, &flag);
if (ret < 0)
return ret;
@@ -976,7 +978,7 @@ static ssize_t unmap_zeroes_data_store(struct config_item *item,
bool flag;
int ret;
- ret = strtobool(page, &flag);
+ ret = kstrtobool(page, &flag);
if (ret < 0)
return ret;
@@ -1100,8 +1102,6 @@ static ssize_t block_size_store(struct config_item *item,
}
da->block_size = val;
- if (da->max_bytes_per_io)
- da->hw_max_sectors = da->max_bytes_per_io / val;
pr_debug("dev[%p]: SE Device block_size changed to %u\n",
da->da_dev, val);
@@ -1125,7 +1125,7 @@ static ssize_t alua_support_store(struct config_item *item,
bool flag, oldflag;
int ret;
- ret = strtobool(page, &flag);
+ ret = kstrtobool(page, &flag);
if (ret < 0)
return ret;
@@ -1164,7 +1164,7 @@ static ssize_t pgr_support_store(struct config_item *item,
bool flag, oldflag;
int ret;
- ret = strtobool(page, &flag);
+ ret = kstrtobool(page, &flag);
if (ret < 0)
return ret;
@@ -1186,6 +1186,23 @@ static ssize_t pgr_support_store(struct config_item *item,
return count;
}
+static ssize_t emulate_rsoc_store(struct config_item *item,
+ const char *page, size_t count)
+{
+ struct se_dev_attrib *da = to_attrib(item);
+ bool flag;
+ int ret;
+
+ ret = kstrtobool(page, &flag);
+ if (ret < 0)
+ return ret;
+
+ da->emulate_rsoc = flag;
+ pr_debug("dev[%p]: SE Device REPORT_SUPPORTED_OPERATION_CODES_EMULATION flag: %d\n",
+ da->da_dev, flag);
+ return count;
+}
+
CONFIGFS_ATTR(, emulate_model_alias);
CONFIGFS_ATTR(, emulate_dpo);
CONFIGFS_ATTR(, emulate_fua_write);
@@ -1198,6 +1215,7 @@ CONFIGFS_ATTR(, emulate_tpws);
CONFIGFS_ATTR(, emulate_caw);
CONFIGFS_ATTR(, emulate_3pc);
CONFIGFS_ATTR(, emulate_pr);
+CONFIGFS_ATTR(, emulate_rsoc);
CONFIGFS_ATTR(, pi_prot_type);
CONFIGFS_ATTR_RO(, hw_pi_prot_type);
CONFIGFS_ATTR(, pi_prot_format);
@@ -1261,6 +1279,7 @@ struct configfs_attribute *sbc_attrib_attrs[] = {
&attr_max_write_same_len,
&attr_alua_support,
&attr_pgr_support,
+ &attr_emulate_rsoc,
NULL,
};
EXPORT_SYMBOL(sbc_attrib_attrs);