X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fscsi%2Fscsi_host.h;h=916144be208b93b948f867d04599608fa6b5981f;hb=f8e38dde33b839bb9e9f98e88688bfac1811d57a;hp=db9914adeac94b510b5f51a9cde33331f5f93d4d;hpb=5696c1944a33b4434a9a1ebb6383b906afd43a10;p=linux-2.6 diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index db9914adea..916144be20 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -429,12 +429,15 @@ struct scsi_host_template { }; /* - * shost states + * shost state: If you alter this, you also need to alter scsi_sysfs.c + * (for the ascii descriptions) and the state model enforcer: + * scsi_host_set_state() */ -enum { - SHOST_ADD, - SHOST_DEL, +enum scsi_host_state { + SHOST_CREATED = 1, + SHOST_RUNNING, SHOST_CANCEL, + SHOST_DEL, SHOST_RECOVERY, }; @@ -464,12 +467,10 @@ struct Scsi_Host { struct task_struct * ehandler; /* Error recovery thread. */ struct semaphore * eh_wait; /* The error recovery thread waits on this. */ - struct completion * eh_notify; /* wait for eh to begin or end */ struct semaphore * eh_action; /* Wait for specific actions on the host. */ unsigned int eh_active:1; /* Indicates the eh thread is awake and active if this is true. */ - unsigned int eh_kill:1; /* set when killing the eh thread */ wait_queue_head_t host_wait; struct scsi_host_template *hostt; struct scsi_transport_template *transportt; @@ -575,7 +576,7 @@ struct Scsi_Host { unsigned int irq; - unsigned long shost_state; + enum scsi_host_state shost_state; /* ldm bits */ struct device shost_gendev; @@ -633,6 +634,7 @@ extern void scsi_remove_host(struct Scsi_Host *); extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); extern void scsi_host_put(struct Scsi_Host *t); extern struct Scsi_Host *scsi_host_lookup(unsigned short); +extern const char *scsi_host_state_name(enum scsi_host_state); extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); @@ -641,15 +643,18 @@ static inline void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock) shost->host_lock = lock; } -static inline void scsi_set_device(struct Scsi_Host *shost, - struct device *dev) +static inline struct device *scsi_get_device(struct Scsi_Host *shost) { - shost->shost_gendev.parent = dev; + return shost->shost_gendev.parent; } -static inline struct device *scsi_get_device(struct Scsi_Host *shost) +/** + * scsi_host_scan_allowed - Is scanning of this host allowed + * @shost: Pointer to Scsi_Host. + **/ +static inline int scsi_host_scan_allowed(struct Scsi_Host *shost) { - return shost->shost_gendev.parent; + return shost->shost_state == SHOST_RUNNING; } extern void scsi_unblock_requests(struct Scsi_Host *); @@ -669,5 +674,6 @@ extern struct scsi_device *scsi_get_host_dev(struct Scsi_Host *); /* legacy interfaces */ extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int); extern void scsi_unregister(struct Scsi_Host *); +extern int scsi_host_set_state(struct Scsi_Host *, enum scsi_host_state); #endif /* _SCSI_SCSI_HOST_H */