diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-10-29 17:15:22 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-11-03 22:23:02 -0400 |
commit | a341cd0f6a0fde1f85fec9aa8f81f824ea4a3f92 (patch) | |
tree | e96b2ab04c94cb1a29d972b135dd6b2bdfac0f78 /include/scsi/scsi_device.h | |
parent | b4f555081fdd27d13e6ff39d455d5aefae9d2c0c (diff) |
SCSI: add asynchronous event notification API
Originally based on a patch by Kristen Carlson Accardi @ Intel.
Copious input from James Bottomley.
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'include/scsi/scsi_device.h')
-rw-r--r-- | include/scsi/scsi_device.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index d5057bc338ff..66e9058357e0 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
@@ -46,6 +46,22 @@ enum scsi_device_state { | |||
46 | * to the scsi lld. */ | 46 | * to the scsi lld. */ |
47 | }; | 47 | }; |
48 | 48 | ||
49 | enum scsi_device_event { | ||
50 | SDEV_EVT_MEDIA_CHANGE = 1, /* media has changed */ | ||
51 | |||
52 | SDEV_EVT_LAST = SDEV_EVT_MEDIA_CHANGE, | ||
53 | SDEV_EVT_MAXBITS = SDEV_EVT_LAST + 1 | ||
54 | }; | ||
55 | |||
56 | struct scsi_event { | ||
57 | enum scsi_device_event evt_type; | ||
58 | struct list_head node; | ||
59 | |||
60 | /* put union of data structures, for non-simple event types, | ||
61 | * here | ||
62 | */ | ||
63 | }; | ||
64 | |||
49 | struct scsi_device { | 65 | struct scsi_device { |
50 | struct Scsi_Host *host; | 66 | struct Scsi_Host *host; |
51 | struct request_queue *request_queue; | 67 | struct request_queue *request_queue; |
@@ -127,6 +143,10 @@ struct scsi_device { | |||
127 | unsigned guess_capacity:1; /* READ_CAPACITY might be too high by 1 */ | 143 | unsigned guess_capacity:1; /* READ_CAPACITY might be too high by 1 */ |
128 | unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */ | 144 | unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */ |
129 | 145 | ||
146 | DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */ | ||
147 | struct list_head event_list; /* asserted events */ | ||
148 | struct work_struct event_work; | ||
149 | |||
130 | unsigned int device_blocked; /* Device returned QUEUE_FULL. */ | 150 | unsigned int device_blocked; /* Device returned QUEUE_FULL. */ |
131 | 151 | ||
132 | unsigned int max_device_blocked; /* what device_blocked counts down from */ | 152 | unsigned int max_device_blocked; /* what device_blocked counts down from */ |
@@ -275,6 +295,11 @@ extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, | |||
275 | int retries); | 295 | int retries); |
276 | extern int scsi_device_set_state(struct scsi_device *sdev, | 296 | extern int scsi_device_set_state(struct scsi_device *sdev, |
277 | enum scsi_device_state state); | 297 | enum scsi_device_state state); |
298 | extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, | ||
299 | gfp_t gfpflags); | ||
300 | extern void sdev_evt_send(struct scsi_device *sdev, struct scsi_event *evt); | ||
301 | extern void sdev_evt_send_simple(struct scsi_device *sdev, | ||
302 | enum scsi_device_event evt_type, gfp_t gfpflags); | ||
278 | extern int scsi_device_quiesce(struct scsi_device *sdev); | 303 | extern int scsi_device_quiesce(struct scsi_device *sdev); |
279 | extern void scsi_device_resume(struct scsi_device *sdev); | 304 | extern void scsi_device_resume(struct scsi_device *sdev); |
280 | extern void scsi_target_quiesce(struct scsi_target *); | 305 | extern void scsi_target_quiesce(struct scsi_target *); |