aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-29 17:15:22 -0400
committerJeff Garzik <jeff@garzik.org>2007-11-03 22:23:02 -0400
commita341cd0f6a0fde1f85fec9aa8f81f824ea4a3f92 (patch)
treee96b2ab04c94cb1a29d972b135dd6b2bdfac0f78 /include
parentb4f555081fdd27d13e6ff39d455d5aefae9d2c0c (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')
-rw-r--r--include/scsi/scsi_device.h25
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
49enum 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
56struct 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
49struct scsi_device { 65struct 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);
276extern int scsi_device_set_state(struct scsi_device *sdev, 296extern int scsi_device_set_state(struct scsi_device *sdev,
277 enum scsi_device_state state); 297 enum scsi_device_state state);
298extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type,
299 gfp_t gfpflags);
300extern void sdev_evt_send(struct scsi_device *sdev, struct scsi_event *evt);
301extern void sdev_evt_send_simple(struct scsi_device *sdev,
302 enum scsi_device_event evt_type, gfp_t gfpflags);
278extern int scsi_device_quiesce(struct scsi_device *sdev); 303extern int scsi_device_quiesce(struct scsi_device *sdev);
279extern void scsi_device_resume(struct scsi_device *sdev); 304extern void scsi_device_resume(struct scsi_device *sdev);
280extern void scsi_target_quiesce(struct scsi_target *); 305extern void scsi_target_quiesce(struct scsi_target *);