Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263879
b: refs/heads/master
c: 784eb99
h: refs/heads/master
i:
  263877: 5aa16dc
  263875: 2ea235f
  263871: ff48cdc
v: v3
  • Loading branch information
Nicholas Bellinger committed Sep 16, 2011
1 parent 72375f0 commit ffab23c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 58fc73d10f3e92bfcd1e9a8391eb3e49b68df8e5
refs/heads/master: 784eb99ebad91db4c8c231c4b17f203147ab827b
35 changes: 33 additions & 2 deletions trunk/drivers/target/target_core_cdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/

#include <linux/kernel.h>
#include <linux/ctype.h>
#include <asm/unaligned.h>
#include <scsi/scsi.h>

Expand Down Expand Up @@ -154,6 +155,37 @@ target_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf)
return 0;
}

static void
target_parse_naa_6h_vendor_specific(struct se_device *dev, unsigned char *buf_off)
{
unsigned char *p = &dev->se_sub_dev->t10_wwn.unit_serial[0];
unsigned char *buf = buf_off;
int cnt = 0, next = 1;
/*
* Generate up to 36 bits of VENDOR SPECIFIC IDENTIFIER starting on
* byte 3 bit 3-0 for NAA IEEE Registered Extended DESIGNATOR field
* format, followed by 64 bits of VENDOR SPECIFIC IDENTIFIER EXTENSION
* to complete the payload. These are based from VPD=0x80 PRODUCT SERIAL
* NUMBER set via vpd_unit_serial in target_core_configfs.c to ensure
* per device uniqeness.
*/
while (*p != '\0') {
if (cnt >= 13)
break;
if (!isxdigit(*p)) {
p++;
continue;
}
if (next != 0) {
buf[cnt++] |= hex_to_bin(*p++);
next = 0;
} else {
buf[cnt] = hex_to_bin(*p++) << 4;
next = 1;
}
}
}

/*
* Device identification VPD, for a complete list of
* DESIGNATOR TYPEs see spc4r17 Table 459.
Expand Down Expand Up @@ -219,8 +251,7 @@ target_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf)
* VENDOR_SPECIFIC_IDENTIFIER and
* VENDOR_SPECIFIC_IDENTIFIER_EXTENTION
*/
buf[off++] |= hex_to_bin(dev->se_sub_dev->t10_wwn.unit_serial[0]);
hex2bin(&buf[off], &dev->se_sub_dev->t10_wwn.unit_serial[1], 12);
target_parse_naa_6h_vendor_specific(dev, &buf[off]);

len = 20;
off = (len + 4);
Expand Down

0 comments on commit ffab23c

Please sign in to comment.