diff options
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 57d1e3e1bd44..b9ab3a590e4b 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -259,6 +259,28 @@ sd_show_protection_type(struct device *dev, struct device_attribute *attr, | |||
259 | } | 259 | } |
260 | 260 | ||
261 | static ssize_t | 261 | static ssize_t |
262 | sd_show_protection_mode(struct device *dev, struct device_attribute *attr, | ||
263 | char *buf) | ||
264 | { | ||
265 | struct scsi_disk *sdkp = to_scsi_disk(dev); | ||
266 | struct scsi_device *sdp = sdkp->device; | ||
267 | unsigned int dif, dix; | ||
268 | |||
269 | dif = scsi_host_dif_capable(sdp->host, sdkp->protection_type); | ||
270 | dix = scsi_host_dix_capable(sdp->host, sdkp->protection_type); | ||
271 | |||
272 | if (!dix && scsi_host_dix_capable(sdp->host, SD_DIF_TYPE0_PROTECTION)) { | ||
273 | dif = 0; | ||
274 | dix = 1; | ||
275 | } | ||
276 | |||
277 | if (!dif && !dix) | ||
278 | return snprintf(buf, 20, "none\n"); | ||
279 | |||
280 | return snprintf(buf, 20, "%s%u\n", dix ? "dix" : "dif", dif); | ||
281 | } | ||
282 | |||
283 | static ssize_t | ||
262 | sd_show_app_tag_own(struct device *dev, struct device_attribute *attr, | 284 | sd_show_app_tag_own(struct device *dev, struct device_attribute *attr, |
263 | char *buf) | 285 | char *buf) |
264 | { | 286 | { |
@@ -285,6 +307,7 @@ static struct device_attribute sd_disk_attrs[] = { | |||
285 | __ATTR(manage_start_stop, S_IRUGO|S_IWUSR, sd_show_manage_start_stop, | 307 | __ATTR(manage_start_stop, S_IRUGO|S_IWUSR, sd_show_manage_start_stop, |
286 | sd_store_manage_start_stop), | 308 | sd_store_manage_start_stop), |
287 | __ATTR(protection_type, S_IRUGO, sd_show_protection_type, NULL), | 309 | __ATTR(protection_type, S_IRUGO, sd_show_protection_type, NULL), |
310 | __ATTR(protection_mode, S_IRUGO, sd_show_protection_mode, NULL), | ||
288 | __ATTR(app_tag_own, S_IRUGO, sd_show_app_tag_own, NULL), | 311 | __ATTR(app_tag_own, S_IRUGO, sd_show_app_tag_own, NULL), |
289 | __ATTR(thin_provisioning, S_IRUGO, sd_show_thin_provisioning, NULL), | 312 | __ATTR(thin_provisioning, S_IRUGO, sd_show_thin_provisioning, NULL), |
290 | __ATTR_NULL, | 313 | __ATTR_NULL, |