diff options
Diffstat (limited to 'include/scsi/scsi_host.h')
-rw-r--r-- | include/scsi/scsi_host.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 81d5234f6771..ac1b6125e3ae 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -429,12 +429,15 @@ struct scsi_host_template { | |||
429 | }; | 429 | }; |
430 | 430 | ||
431 | /* | 431 | /* |
432 | * shost states | 432 | * shost state: If you alter this, you also need to alter scsi_sysfs.c |
433 | * (for the ascii descriptions) and the state model enforcer: | ||
434 | * scsi_host_set_state() | ||
433 | */ | 435 | */ |
434 | enum { | 436 | enum scsi_host_state { |
435 | SHOST_ADD, | 437 | SHOST_CREATED = 1, |
436 | SHOST_DEL, | 438 | SHOST_RUNNING, |
437 | SHOST_CANCEL, | 439 | SHOST_CANCEL, |
440 | SHOST_DEL, | ||
438 | SHOST_RECOVERY, | 441 | SHOST_RECOVERY, |
439 | }; | 442 | }; |
440 | 443 | ||
@@ -575,7 +578,7 @@ struct Scsi_Host { | |||
575 | unsigned int irq; | 578 | unsigned int irq; |
576 | 579 | ||
577 | 580 | ||
578 | unsigned long shost_state; | 581 | enum scsi_host_state shost_state; |
579 | 582 | ||
580 | /* ldm bits */ | 583 | /* ldm bits */ |
581 | struct device shost_gendev; | 584 | struct device shost_gendev; |
@@ -633,6 +636,7 @@ extern void scsi_remove_host(struct Scsi_Host *); | |||
633 | extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); | 636 | extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); |
634 | extern void scsi_host_put(struct Scsi_Host *t); | 637 | extern void scsi_host_put(struct Scsi_Host *t); |
635 | extern struct Scsi_Host *scsi_host_lookup(unsigned short); | 638 | extern struct Scsi_Host *scsi_host_lookup(unsigned short); |
639 | extern const char *scsi_host_state_name(enum scsi_host_state); | ||
636 | 640 | ||
637 | extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); | 641 | extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); |
638 | 642 | ||
@@ -646,6 +650,15 @@ static inline struct device *scsi_get_device(struct Scsi_Host *shost) | |||
646 | return shost->shost_gendev.parent; | 650 | return shost->shost_gendev.parent; |
647 | } | 651 | } |
648 | 652 | ||
653 | /** | ||
654 | * scsi_host_scan_allowed - Is scanning of this host allowed | ||
655 | * @shost: Pointer to Scsi_Host. | ||
656 | **/ | ||
657 | static inline int scsi_host_scan_allowed(struct Scsi_Host *shost) | ||
658 | { | ||
659 | return shost->shost_state == SHOST_RUNNING; | ||
660 | } | ||
661 | |||
649 | extern void scsi_unblock_requests(struct Scsi_Host *); | 662 | extern void scsi_unblock_requests(struct Scsi_Host *); |
650 | extern void scsi_block_requests(struct Scsi_Host *); | 663 | extern void scsi_block_requests(struct Scsi_Host *); |
651 | 664 | ||
@@ -663,5 +676,6 @@ extern struct scsi_device *scsi_get_host_dev(struct Scsi_Host *); | |||
663 | /* legacy interfaces */ | 676 | /* legacy interfaces */ |
664 | extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int); | 677 | extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int); |
665 | extern void scsi_unregister(struct Scsi_Host *); | 678 | extern void scsi_unregister(struct Scsi_Host *); |
679 | extern int scsi_host_set_state(struct Scsi_Host *, enum scsi_host_state); | ||
666 | 680 | ||
667 | #endif /* _SCSI_SCSI_HOST_H */ | 681 | #endif /* _SCSI_SCSI_HOST_H */ |