On 12/07/12 07:55, Hannes Reinecke wrote:
On 12/06/2012 04:56 PM, Bart Van Assche wrote:
Changing the state of a SCSI device via sysfs into "cancel" or
"deleted" prevents scsi_remove_host() to remove these devices.
Hence do not allow this.

Signed-off-by: Bart Van Assche <bvanass...@acm.org>
Cc: Tejun Heo <t...@kernel.org>
Cc: James Bottomley <jbottom...@parallels.com>
Cc: Mike Christie <micha...@cs.wisc.edu>
Cc: Hannes Reinecke <h...@suse.de>
---
  drivers/scsi/scsi_sysfs.c |    7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 4348f12..b319c20 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -591,13 +591,15 @@ sdev_store_delete(struct device *dev, struct
device_attribute *attr,
  };
  static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);

+#define INVALID_SDEV_STATE 0
+
Shouldn't this become part of the enum?
Defining it outside only confuses the compiler.
And the unsuspecting user.

I can do that, but that will require changes in every switch statement on enum scsi_device_state because the kernel code is compiled with -Wswitch. From the gcc manual: <quote>-Wswitch: Warn whenever a switch statement has an index of enumerated type and lacks a case for one or more of the named codes of that enumeration. (The presence of a default label prevents this warning.)</quote>

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to