Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 31912
b: refs/heads/master
c: a144c5a
h: refs/heads/master
v: v3
  • Loading branch information
Brian King authored and James Bottomley committed Jun 28, 2006
1 parent 24a6382 commit 2df1ad4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3bdad7bd253f17ead00b4af2e82f84e9522c95ac
refs/heads/master: a144c5ae0956fb262e6c82624c82b1110a451437
26 changes: 26 additions & 0 deletions trunk/drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,23 @@ static ssize_t sd_store_cache_type(struct class_device *cdev, const char *buf,
return count;
}

static ssize_t sd_store_allow_restart(struct class_device *cdev, const char *buf,
size_t count)
{
struct scsi_disk *sdkp = to_scsi_disk(cdev);
struct scsi_device *sdp = sdkp->device;

if (!capable(CAP_SYS_ADMIN))
return -EACCES;

if (sdp->type != TYPE_DISK)
return -EINVAL;

sdp->allow_restart = simple_strtoul(buf, NULL, 10);

return count;
}

static ssize_t sd_show_cache_type(struct class_device *cdev, char *buf)
{
struct scsi_disk *sdkp = to_scsi_disk(cdev);
Expand All @@ -223,10 +240,19 @@ static ssize_t sd_show_fua(struct class_device *cdev, char *buf)
return snprintf(buf, 20, "%u\n", sdkp->DPOFUA);
}

static ssize_t sd_show_allow_restart(struct class_device *cdev, char *buf)
{
struct scsi_disk *sdkp = to_scsi_disk(cdev);

return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart);
}

static struct class_device_attribute sd_disk_attrs[] = {
__ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type,
sd_store_cache_type),
__ATTR(FUA, S_IRUGO, sd_show_fua, NULL),
__ATTR(allow_restart, S_IRUGO|S_IWUSR, sd_show_allow_restart,
sd_store_allow_restart),
__ATTR_NULL,
};

Expand Down

0 comments on commit 2df1ad4

Please sign in to comment.