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