Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89656
b: refs/heads/master
c: b174be0
h: refs/heads/master
v: v3
  • Loading branch information
Kai Makisara authored and James Bottomley committed Apr 7, 2008
1 parent 66d187f commit 4924651
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 40f6b36c6243462fb95d0343237331c423494b03
refs/heads/master: b174be02f3634460ac215d249617dee5ae446ae1
7 changes: 6 additions & 1 deletion trunk/Documentation/scsi/st.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This file contains brief information about the SCSI tape driver.
The driver is currently maintained by Kai Mäkisara (email
Kai.Makisara@kolumbus.fi)

Last modified: Thu Feb 21 21:54:16 2008 by kai.makisara
Last modified: Sun Feb 24 21:59:07 2008 by kai.makisara


BASICS
Expand Down Expand Up @@ -133,6 +133,11 @@ the defaults set by the user. The value -1 means the default is not set. The
file 'dev' contains the device numbers corresponding to this device. The links
'device' and 'driver' point to the SCSI device and driver entries.

Each directory also contains the entry 'options' which shows the currently
enabled driver and mode options. The value in the file is a bit mask where the
bit definitions are the same as those used with MTSETDRVBUFFER in setting the
options.

A link named 'tape' is made from the SCSI device directory to the class
directory corresponding to the mode 0 auto-rewind device (e.g., st0).

Expand Down
43 changes: 43 additions & 0 deletions trunk/drivers/scsi/st.c
Original file line number Diff line number Diff line change
Expand Up @@ -4365,6 +4365,46 @@ static ssize_t st_defcompression_show(struct class_device *class_dev, char *buf)

CLASS_DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL);

static ssize_t st_options_show(struct class_device *class_dev, char *buf)
{
struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev);
struct scsi_tape *STp;
int i, j, options;
ssize_t l = 0;

for (i=0; i < st_dev_max; i++) {
for (j=0; j < ST_NBR_MODES; j++)
if (&scsi_tapes[i]->modes[j] == STm)
break;
if (j < ST_NBR_MODES)
break;
}
if (i == st_dev_max)
return 0; /* should never happen */

STp = scsi_tapes[i];

options = STm->do_buffer_writes ? MT_ST_BUFFER_WRITES : 0;
options |= STm->do_async_writes ? MT_ST_ASYNC_WRITES : 0;
options |= STm->do_read_ahead ? MT_ST_READ_AHEAD : 0;
DEB( options |= debugging ? MT_ST_DEBUGGING : 0 );
options |= STp->two_fm ? MT_ST_TWO_FM : 0;
options |= STp->fast_mteom ? MT_ST_FAST_MTEOM : 0;
options |= STm->defaults_for_writes ? MT_ST_DEF_WRITES : 0;
options |= STp->can_bsr ? MT_ST_CAN_BSR : 0;
options |= STp->omit_blklims ? MT_ST_NO_BLKLIMS : 0;
options |= STp->can_partitions ? MT_ST_CAN_PARTITIONS : 0;
options |= STp->scsi2_logical ? MT_ST_SCSI2LOGICAL : 0;
options |= STm->sysv ? MT_ST_SYSV : 0;
options |= STp->immediate ? MT_ST_NOWAIT : 0;
options |= STp->sili ? MT_ST_SILI : 0;

l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options);
return l;
}

CLASS_DEVICE_ATTR(options, S_IRUGO, st_options_show, NULL);

static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode)
{
int i, rew, error;
Expand Down Expand Up @@ -4402,6 +4442,9 @@ static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode)
error = class_device_create_file(st_class_member,
&class_device_attr_default_compression);
if (error) goto out;
error = class_device_create_file(st_class_member,
&class_device_attr_options);
if (error) goto out;

if (mode == 0 && rew == 0) {
error = sysfs_create_link(&STp->device->sdev_gendev.kobj,
Expand Down

0 comments on commit 4924651

Please sign in to comment.