diff options
Diffstat (limited to 'include/scsi/scsi_device.h')
-rw-r--r-- | include/scsi/scsi_device.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 80b2e93c2936..b49e725be039 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
@@ -42,9 +42,11 @@ enum scsi_device_state { | |||
42 | * originate in the mid-layer) */ | 42 | * originate in the mid-layer) */ |
43 | SDEV_OFFLINE, /* Device offlined (by error handling or | 43 | SDEV_OFFLINE, /* Device offlined (by error handling or |
44 | * user request */ | 44 | * user request */ |
45 | SDEV_BLOCK, /* Device blocked by scsi lld. No scsi | 45 | SDEV_BLOCK, /* Device blocked by scsi lld. No |
46 | * commands from user or midlayer should be issued | 46 | * scsi commands from user or midlayer |
47 | * to the scsi lld. */ | 47 | * should be issued to the scsi |
48 | * lld. */ | ||
49 | SDEV_CREATED_BLOCK, /* same as above but for created devices */ | ||
48 | }; | 50 | }; |
49 | 51 | ||
50 | enum scsi_device_event { | 52 | enum scsi_device_event { |
@@ -384,10 +386,23 @@ static inline unsigned int sdev_id(struct scsi_device *sdev) | |||
384 | #define scmd_id(scmd) sdev_id((scmd)->device) | 386 | #define scmd_id(scmd) sdev_id((scmd)->device) |
385 | #define scmd_channel(scmd) sdev_channel((scmd)->device) | 387 | #define scmd_channel(scmd) sdev_channel((scmd)->device) |
386 | 388 | ||
389 | /* | ||
390 | * checks for positions of the SCSI state machine | ||
391 | */ | ||
387 | static inline int scsi_device_online(struct scsi_device *sdev) | 392 | static inline int scsi_device_online(struct scsi_device *sdev) |
388 | { | 393 | { |
389 | return sdev->sdev_state != SDEV_OFFLINE; | 394 | return sdev->sdev_state != SDEV_OFFLINE; |
390 | } | 395 | } |
396 | static inline int scsi_device_blocked(struct scsi_device *sdev) | ||
397 | { | ||
398 | return sdev->sdev_state == SDEV_BLOCK || | ||
399 | sdev->sdev_state == SDEV_CREATED_BLOCK; | ||
400 | } | ||
401 | static inline int scsi_device_created(struct scsi_device *sdev) | ||
402 | { | ||
403 | return sdev->sdev_state == SDEV_CREATED || | ||
404 | sdev->sdev_state == SDEV_CREATED_BLOCK; | ||
405 | } | ||
391 | 406 | ||
392 | /* accessor functions for the SCSI parameters */ | 407 | /* accessor functions for the SCSI parameters */ |
393 | static inline int scsi_device_sync(struct scsi_device *sdev) | 408 | static inline int scsi_device_sync(struct scsi_device *sdev) |