Skip to content

Commit e5203cf

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: scsi_debug: allow to specify inquiry vendor and model
For testing purposes we need to be able to pass in the inquiry vendor and model. Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Acked-by: Doug Gilbert <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 4a10903 commit e5203cf

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

drivers/scsi/scsi_debug.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -953,9 +953,9 @@ static int fetch_to_dev_buffer(struct scsi_cmnd *scp, unsigned char *arr,
953953
}
954954

955955

956-
static const char * inq_vendor_id = "Linux ";
957-
static const char * inq_product_id = "scsi_debug ";
958-
static const char *inq_product_rev = "0186"; /* version less '.' */
956+
static char sdebug_inq_vendor_id[9] = "Linux ";
957+
static char sdebug_inq_product_id[17] = "scsi_debug ";
958+
static char sdebug_inq_product_rev[5] = "0186"; /* version less '.' */
959959
/* Use some locally assigned NAAs for SAS addresses. */
960960
static const u64 naa3_comp_a = 0x3222222000000000ULL;
961961
static const u64 naa3_comp_b = 0x3333333000000000ULL;
@@ -975,8 +975,8 @@ static int inquiry_vpd_83(unsigned char *arr, int port_group_id,
975975
arr[0] = 0x2; /* ASCII */
976976
arr[1] = 0x1;
977977
arr[2] = 0x0;
978-
memcpy(&arr[4], inq_vendor_id, 8);
979-
memcpy(&arr[12], inq_product_id, 16);
978+
memcpy(&arr[4], sdebug_inq_vendor_id, 8);
979+
memcpy(&arr[12], sdebug_inq_product_id, 16);
980980
memcpy(&arr[28], dev_id_str, dev_id_str_len);
981981
num = 8 + 16 + dev_id_str_len;
982982
arr[3] = num;
@@ -1408,9 +1408,9 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
14081408
arr[6] = 0x10; /* claim: MultiP */
14091409
/* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */
14101410
arr[7] = 0xa; /* claim: LINKED + CMDQUE */
1411-
memcpy(&arr[8], inq_vendor_id, 8);
1412-
memcpy(&arr[16], inq_product_id, 16);
1413-
memcpy(&arr[32], inq_product_rev, 4);
1411+
memcpy(&arr[8], sdebug_inq_vendor_id, 8);
1412+
memcpy(&arr[16], sdebug_inq_product_id, 16);
1413+
memcpy(&arr[32], sdebug_inq_product_rev, 4);
14141414
/* version descriptors (2 bytes each) follow */
14151415
put_unaligned_be16(0xc0, arr + 58); /* SAM-6 no version claimed */
14161416
put_unaligned_be16(0x5c0, arr + 60); /* SPC-5 no version claimed */
@@ -4151,6 +4151,12 @@ module_param_named(every_nth, sdebug_every_nth, int, S_IRUGO | S_IWUSR);
41514151
module_param_named(fake_rw, sdebug_fake_rw, int, S_IRUGO | S_IWUSR);
41524152
module_param_named(guard, sdebug_guard, uint, S_IRUGO);
41534153
module_param_named(host_lock, sdebug_host_lock, bool, S_IRUGO | S_IWUSR);
4154+
module_param_string(inq_vendor, sdebug_inq_vendor_id,
4155+
sizeof(sdebug_inq_vendor_id), S_IRUGO|S_IWUSR);
4156+
module_param_string(inq_product, sdebug_inq_product_id,
4157+
sizeof(sdebug_inq_product_id), S_IRUGO|S_IWUSR);
4158+
module_param_string(inq_rev, sdebug_inq_product_rev,
4159+
sizeof(sdebug_inq_product_rev), S_IRUGO|S_IWUSR);
41544160
module_param_named(lbpu, sdebug_lbpu, int, S_IRUGO);
41554161
module_param_named(lbpws, sdebug_lbpws, int, S_IRUGO);
41564162
module_param_named(lbpws10, sdebug_lbpws10, int, S_IRUGO);
@@ -4202,6 +4208,9 @@ MODULE_PARM_DESC(every_nth, "timeout every nth command(def=0)");
42024208
MODULE_PARM_DESC(fake_rw, "fake reads/writes instead of copying (def=0)");
42034209
MODULE_PARM_DESC(guard, "protection checksum: 0=crc, 1=ip (def=0)");
42044210
MODULE_PARM_DESC(host_lock, "host_lock is ignored (def=0)");
4211+
MODULE_PARM_DESC(inq_vendor, "SCSI INQUIRY vendor string (def=\"Linux\")");
4212+
MODULE_PARM_DESC(inq_product, "SCSI INQUIRY product string (def=\"scsi_debug\")");
4213+
MODULE_PARM_DESC(inq_rev, "SCSI INQUIRY revision string (def=\"0186\")");
42054214
MODULE_PARM_DESC(lbpu, "enable LBP, support UNMAP command (def=0)");
42064215
MODULE_PARM_DESC(lbpws, "enable LBP, support WRITE SAME(16) with UNMAP bit (def=0)");
42074216
MODULE_PARM_DESC(lbpws10, "enable LBP, support WRITE SAME(10) with UNMAP bit (def=0)");

0 commit comments

Comments
 (0)