aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/cam_periph.c
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2018-11-01 21:51:41 +0000
committerWarner Losh <imp@FreeBSD.org>2018-11-01 21:51:41 +0000
commit9385e92b259bbb5e87c6a4be71c9602cb4d35d0f (patch)
tree61b015e788e551697f94a02384e668f415e1d5a0 /sys/cam/cam_periph.c
parent7890b5c14ea9732dfc2d6507e19b1d9d2e071127 (diff)
downloadsrc-9385e92b259bbb5e87c6a4be71c9602cb4d35d0f.tar.gz
src-9385e92b259bbb5e87c6a4be71c9602cb4d35d0f.zip
Add comments explaining what hold/unhold do
They act as a simple one-deep semaphore to keep open/close/probe from running at the same time to avoid races that creates.
Notes
Notes: svn path=/head/; revision=340024
Diffstat (limited to 'sys/cam/cam_periph.c')
-rw-r--r--sys/cam/cam_periph.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index d814c0ef6d89..cc069325748c 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -470,6 +470,12 @@ cam_periph_release(struct cam_periph *periph)
mtx_unlock(mtx);
}
+/*
+ * hold/unhold act as mutual exclusion for sections of the code that
+ * need to sleep and want to make sure that other sections that
+ * will interfere are held off. This only protects exclusive sections
+ * from each other.
+ */
int
cam_periph_hold(struct cam_periph *periph, int priority)
{