diff options
-rw-r--r-- | Documentation/scsi/st.txt | 7 | ||||
-rw-r--r-- | drivers/scsi/st.c | 43 |
2 files changed, 49 insertions, 1 deletions
diff --git a/Documentation/scsi/st.txt b/Documentation/scsi/st.txt index 38f81188def0..40752602c050 100644 --- a/Documentation/scsi/st.txt +++ b/Documentation/scsi/st.txt | |||
@@ -2,7 +2,7 @@ This file contains brief information about the SCSI tape driver. | |||
2 | The driver is currently maintained by Kai Mäkisara (email | 2 | The driver is currently maintained by Kai Mäkisara (email |
3 | Kai.Makisara@kolumbus.fi) | 3 | Kai.Makisara@kolumbus.fi) |
4 | 4 | ||
5 | Last modified: Thu Feb 21 21:54:16 2008 by kai.makisara | 5 | Last modified: Sun Feb 24 21:59:07 2008 by kai.makisara |
6 | 6 | ||
7 | 7 | ||
8 | BASICS | 8 | BASICS |
@@ -133,6 +133,11 @@ the defaults set by the user. The value -1 means the default is not set. The | |||
133 | file 'dev' contains the device numbers corresponding to this device. The links | 133 | file 'dev' contains the device numbers corresponding to this device. The links |
134 | 'device' and 'driver' point to the SCSI device and driver entries. | 134 | 'device' and 'driver' point to the SCSI device and driver entries. |
135 | 135 | ||
136 | Each directory also contains the entry 'options' which shows the currently | ||
137 | enabled driver and mode options. The value in the file is a bit mask where the | ||
138 | bit definitions are the same as those used with MTSETDRVBUFFER in setting the | ||
139 | options. | ||
140 | |||
136 | A link named 'tape' is made from the SCSI device directory to the class | 141 | A link named 'tape' is made from the SCSI device directory to the class |
137 | directory corresponding to the mode 0 auto-rewind device (e.g., st0). | 142 | directory corresponding to the mode 0 auto-rewind device (e.g., st0). |
138 | 143 | ||
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 | ||
4366 | CLASS_DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL); | 4366 | CLASS_DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL); |
4367 | 4367 | ||
4368 | static 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 | |||
4406 | CLASS_DEVICE_ATTR(options, S_IRUGO, st_options_show, NULL); | ||
4407 | |||
4368 | static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode) | 4408 | static 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, |