diff options
author | trasz <trasz@FreeBSD.org> | 2008-12-16 16:57:33 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2008-12-16 16:57:33 +0000 |
commit | 1aa4ea9cfb2dc8da2c82c6b4f27eee1e40c731be (patch) | |
tree | 4b0fd6e2cd5eb30999a8168d4c935eca7d284ac6 /sys/cam/cam_sim.h | |
parent | ebb77f64c32720fd23b448d19863ad50894b7919 (diff) | |
download | FreeBSD-src-1aa4ea9cfb2dc8da2c82c6b4f27eee1e40c731be.zip FreeBSD-src-1aa4ea9cfb2dc8da2c82c6b4f27eee1e40c731be.tar.gz |
Add SIM refcounting. This is slightly different from what DragonFly
does - in DragonFly, it's cam_sim_release() what actually frees the
SIM; cam_sim_free does nothing more than calling cam_sim_release().
Here, we drain in cam_sim_free, waiting for refcount to drop to zero.
We cannot do the same think DragonFly does, because after cam_sim_free
returns, client would destroy the sim->mtx, and CAM would trip over
an initialized mutex.
Reviewed by: scottl
Approved by: rwatson (mentor)
Sponsored by: FreeBSD Foundation
Diffstat (limited to 'sys/cam/cam_sim.h')
-rw-r--r-- | sys/cam/cam_sim.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/cam/cam_sim.h b/sys/cam/cam_sim.h index c2d3c5f..f37c5d5 100644 --- a/sys/cam/cam_sim.h +++ b/sys/cam/cam_sim.h @@ -61,6 +61,8 @@ struct cam_sim * cam_sim_alloc(sim_action_func sim_action, int max_tagged_dev_transactions, struct cam_devq *queue); void cam_sim_free(struct cam_sim *sim, int free_devq); +void cam_sim_hold(struct cam_sim *sim); +void cam_sim_release(struct cam_sim *sim); /* Optional sim attributes may be set with these. */ void cam_sim_set_path(struct cam_sim *sim, u_int32_t path_id); @@ -105,6 +107,7 @@ struct cam_sim { #define CAM_SIM_ON_DONEQ 0x04 struct callout callout; struct cam_devq *devq; /* Device Queue to use for this SIM */ + int refcount; /* References to the SIM. */ /* "Pool" of inactive ccbs managed by xpt_alloc_ccb and xpt_free_ccb */ SLIST_HEAD(,ccb_hdr) ccb_freeq; |