aboutsummaryrefslogtreecommitdiff
path: root/sys/cam
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2014-06-15 06:56:10 +0000
committerAlexander Motin <mav@FreeBSD.org>2014-06-15 06:56:10 +0000
commit0c934f7f896c77a3ff7c969eded334785934d0f5 (patch)
tree2f6d54164775624a1353361c4df56083b86b778c /sys/cam
parent7627c2446ae9a76aefca92d760e980b45d27e7db (diff)
downloadsrc-0c934f7f896c77a3ff7c969eded334785934d0f5.tar.gz
src-0c934f7f896c77a3ff7c969eded334785934d0f5.zip
Add "vendor", "product" and "revision" options to control inquiry data.
MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=267496
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/ctl/ctl.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index 4e6e338e1722..95a0f49c770a 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -9634,6 +9634,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio)
struct scsi_inquiry *cdb;
struct ctl_softc *ctl_softc;
struct ctl_lun *lun;
+ char *val;
uint32_t alloc_len;
int is_fc;
@@ -9778,10 +9779,16 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio)
* We have 8 bytes for the vendor name, and 16 bytes for the device
* name and 4 bytes for the revision.
*/
- strncpy(inq_ptr->vendor, CTL_VENDOR, sizeof(inq_ptr->vendor));
+ if (lun == NULL || (val = ctl_get_opt(lun->be_lun, "vendor")) == NULL) {
+ strcpy(inq_ptr->vendor, CTL_VENDOR);
+ } else {
+ memset(inq_ptr->vendor, ' ', sizeof(inq_ptr->vendor));
+ strncpy(inq_ptr->vendor, val,
+ min(sizeof(inq_ptr->vendor), strlen(val)));
+ }
if (lun == NULL) {
strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT);
- } else {
+ } else if ((val = ctl_get_opt(lun->be_lun, "product")) == NULL) {
switch (lun->be_lun->lun_type) {
case T_DIRECT:
strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT);
@@ -9793,13 +9800,23 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio)
strcpy(inq_ptr->product, CTL_UNKNOWN_PRODUCT);
break;
}
+ } else {
+ memset(inq_ptr->product, ' ', sizeof(inq_ptr->product));
+ strncpy(inq_ptr->product, val,
+ min(sizeof(inq_ptr->product), strlen(val)));
}
/*
* XXX make this a macro somewhere so it automatically gets
* incremented when we make changes.
*/
- strncpy(inq_ptr->revision, "0001", sizeof(inq_ptr->revision));
+ if (lun == NULL || (val = ctl_get_opt(lun->be_lun, "revision")) == NULL) {
+ strncpy(inq_ptr->revision, "0001", sizeof(inq_ptr->revision));
+ } else {
+ memset(inq_ptr->revision, ' ', sizeof(inq_ptr->revision));
+ strncpy(inq_ptr->revision, val,
+ min(sizeof(inq_ptr->revision), strlen(val)));
+ }
/*
* For parallel SCSI, we support double transition and single