aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/st.c')
-rw-r--r--drivers/scsi/st.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index a4361a8c6ac6..d204aad2e683 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4365,6 +4365,46 @@ static ssize_t st_defcompression_show(struct class_device *class_dev, char *buf)
4365 4365
4366CLASS_DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL); 4366CLASS_DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL);
4367 4367
4368static ssize_t st_options_show(struct class_device *class_dev, char *buf)
4369{
4370 struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev);
4371 struct scsi_tape *STp;
4372 int i, j, options;
4373 ssize_t l = 0;
4374
4375 for (i=0; i < st_dev_max; i++) {
4376 for (j=0; j < ST_NBR_MODES; j++)
4377 if (&scsi_tapes[i]->modes[j] == STm)
4378 break;
4379 if (j < ST_NBR_MODES)
4380 break;
4381 }
4382 if (i == st_dev_max)
4383 return 0; /* should never happen */
4384
4385 STp = scsi_tapes[i];
4386
4387 options = STm->do_buffer_writes ? MT_ST_BUFFER_WRITES : 0;
4388 options |= STm->do_async_writes ? MT_ST_ASYNC_WRITES : 0;
4389 options |= STm->do_read_ahead ? MT_ST_READ_AHEAD : 0;
4390 DEB( options |= debugging ? MT_ST_DEBUGGING : 0 );
4391 options |= STp->two_fm ? MT_ST_TWO_FM : 0;
4392 options |= STp->fast_mteom ? MT_ST_FAST_MTEOM : 0;
4393 options |= STm->defaults_for_writes ? MT_ST_DEF_WRITES : 0;
4394 options |= STp->can_bsr ? MT_ST_CAN_BSR : 0;
4395 options |= STp->omit_blklims ? MT_ST_NO_BLKLIMS : 0;
4396 options |= STp->can_partitions ? MT_ST_CAN_PARTITIONS : 0;
4397 options |= STp->scsi2_logical ? MT_ST_SCSI2LOGICAL : 0;
4398 options |= STm->sysv ? MT_ST_SYSV : 0;
4399 options |= STp->immediate ? MT_ST_NOWAIT : 0;
4400 options |= STp->sili ? MT_ST_SILI : 0;
4401
4402 l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options);
4403 return l;
4404}
4405
4406CLASS_DEVICE_ATTR(options, S_IRUGO, st_options_show, NULL);
4407
4368static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode) 4408static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode)
4369{ 4409{
4370 int i, rew, error; 4410 int i, rew, error;
@@ -4402,6 +4442,9 @@ static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode)
4402 error = class_device_create_file(st_class_member, 4442 error = class_device_create_file(st_class_member,
4403 &class_device_attr_default_compression); 4443 &class_device_attr_default_compression);
4404 if (error) goto out; 4444 if (error) goto out;
4445 error = class_device_create_file(st_class_member,
4446 &class_device_attr_options);
4447 if (error) goto out;
4405 4448
4406 if (mode == 0 && rew == 0) { 4449 if (mode == 0 && rew == 0) {
4407 error = sysfs_create_link(&STp->device->sdev_gendev.kobj, 4450 error = sysfs_create_link(&STp->device->sdev_gendev.kobj,