@@ -546,6 +546,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_removable);
#define DEF_CONFIGFS_ATTRIB_STORE_U32(_name) \
static ssize_t _name##_store(struct config_item *item, const char *page,\
@@ -589,6 +590,7 @@ DEF_CONFIGFS_ATTRIB_STORE_BOOL(emulate_3pc);
DEF_CONFIGFS_ATTRIB_STORE_BOOL(emulate_pr);
DEF_CONFIGFS_ATTRIB_STORE_BOOL(enforce_pr_isids);
DEF_CONFIGFS_ATTRIB_STORE_BOOL(is_nonrot);
+DEF_CONFIGFS_ATTRIB_STORE_BOOL(emulate_removable);
#define DEF_CONFIGFS_ATTRIB_STORE_STUB(_name) \
static ssize_t _name##_store(struct config_item *item, const char *page,\
@@ -1178,6 +1180,7 @@ CONFIGFS_ATTR(, emulate_tpws);
CONFIGFS_ATTR(, emulate_caw);
CONFIGFS_ATTR(, emulate_3pc);
CONFIGFS_ATTR(, emulate_pr);
+CONFIGFS_ATTR(, emulate_removable);
CONFIGFS_ATTR(, pi_prot_type);
CONFIGFS_ATTR_RO(, hw_pi_prot_type);
CONFIGFS_ATTR(, pi_prot_format);
@@ -1241,6 +1244,7 @@ struct configfs_attribute *sbc_attrib_attrs[] = {
&attr_max_write_same_len,
&attr_alua_support,
&attr_pgr_support,
+ &attr_emulate_removable,
NULL,
};
EXPORT_SYMBOL(sbc_attrib_attrs);
@@ -54,6 +54,8 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf)
struct se_device *dev = cmd->se_dev;
struct se_session *sess = cmd->se_sess;
+ if (dev->dev_attrib.emulate_removable)
+ buf[1] = 0x80;
/* Set RMB (removable media) for tape devices */
if (dev->transport->get_device_type(dev) == TYPE_TAPE)
buf[1] = 0x80;
@@ -692,6 +692,7 @@ struct se_dev_attrib {
bool is_nonrot;
bool emulate_rest_reord;
bool unmap_zeroes_data;
+ bool emulate_removable;
u32 hw_block_size;
u32 block_size;
u32 hw_max_sectors;