Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 221467
b: refs/heads/master
c: 518fa8e
h: refs/heads/master
i:
  221465: 0413725
  221463: 1b57c3c
v: v3
  • Loading branch information
Martin K. Petersen authored and James Bottomley committed Oct 25, 2010
1 parent a25b9d7 commit b5a4a0c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 349ed5a060397fcccc542a0314f236b420bd4ad1
refs/heads/master: 518fa8e39bafd2431c28adb8822bb6c3e4d1a390
23 changes: 23 additions & 0 deletions trunk/drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,28 @@ sd_show_protection_type(struct device *dev, struct device_attribute *attr,
return snprintf(buf, 20, "%u\n", sdkp->protection_type);
}

static ssize_t
sd_show_protection_mode(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct scsi_disk *sdkp = to_scsi_disk(dev);
struct scsi_device *sdp = sdkp->device;
unsigned int dif, dix;

dif = scsi_host_dif_capable(sdp->host, sdkp->protection_type);
dix = scsi_host_dix_capable(sdp->host, sdkp->protection_type);

if (!dix && scsi_host_dix_capable(sdp->host, SD_DIF_TYPE0_PROTECTION)) {
dif = 0;
dix = 1;
}

if (!dif && !dix)
return snprintf(buf, 20, "none\n");

return snprintf(buf, 20, "%s%u\n", dix ? "dix" : "dif", dif);
}

static ssize_t
sd_show_app_tag_own(struct device *dev, struct device_attribute *attr,
char *buf)
Expand Down Expand Up @@ -285,6 +307,7 @@ static struct device_attribute sd_disk_attrs[] = {
__ATTR(manage_start_stop, S_IRUGO|S_IWUSR, sd_show_manage_start_stop,
sd_store_manage_start_stop),
__ATTR(protection_type, S_IRUGO, sd_show_protection_type, NULL),
__ATTR(protection_mode, S_IRUGO, sd_show_protection_mode, NULL),
__ATTR(app_tag_own, S_IRUGO, sd_show_app_tag_own, NULL),
__ATTR(thin_provisioning, S_IRUGO, sd_show_thin_provisioning, NULL),
__ATTR_NULL,
Expand Down

0 comments on commit b5a4a0c

Please sign in to comment.