From c6e55537977d4ab14d03eaf0cd19c35922c796b4 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 26 Aug 2014 03:21:07 +0000 Subject: [PATCH] scst_vdisk: Make vdisk_sup_vpd() easier to extend This patch doesn't change any functionality. Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5729 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index e2cc89025..9eed6eda7 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -3259,20 +3259,21 @@ out: static int vdisk_sup_vpd(uint8_t *buf, struct scst_cmd *cmd, struct scst_vdisk_dev *virt_dev) { - buf[3] = 4; - buf[4] = 0x0; /* this page */ - buf[5] = 0x80; /* unit serial number */ - buf[6] = 0x83; /* device identification */ - buf[7] = 0x86; /* extended inquiry */ + char *page_list = &buf[4], *p = page_list; + + *p++ = 0x0; /* this page */ + *p++ = 0x80; /* unit serial number */ + *p++ = 0x83; /* device identification */ + *p++ = 0x86; /* extended inquiry */ if (cmd->dev->type == TYPE_DISK) { - buf[3] += 2; - buf[8] = 0xB0; /* block limits */ - buf[9] = 0xB1; /* block device charachteristics */ + *p++ = 0xB0; /* block limits */ + *p++ = 0xB1; /* block device charachteristics */ if (virt_dev->thin_provisioned) { - buf[3] += 1; - buf[10] = 0xB2; /* thin provisioning */ + *p++ = 0xB2; /* thin provisioning */ } } + buf[3] = p - page_list; /* page length */ + return buf[3] + 4; }