summaryrefslogtreecommitdiffstats
path: root/sys/gnu/fs/ext2fs/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/gnu/fs/ext2fs/fs.h')
-rw-r--r--sys/gnu/fs/ext2fs/fs.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/gnu/fs/ext2fs/fs.h b/sys/gnu/fs/ext2fs/fs.h
index 03f137c..3cb4fc0 100644
--- a/sys/gnu/fs/ext2fs/fs.h
+++ b/sys/gnu/fs/ext2fs/fs.h
@@ -155,3 +155,23 @@ extern u_char *fragtbl[];
#define lock_super(devvp) vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, curproc)
#define unlock_super(devvp) VOP_UNLOCK(devvp, 0, curproc)
+/*
+ * To lock a buffer, set the B_LOCKED flag and then brelse() it. To unlock,
+ * reset the B_LOCKED flag and brelse() the buffer back on the LRU list
+ */
+#define LCK_BUF(bp) { \
+ int s; \
+ s = splbio(); \
+ (bp)->b_flags |= B_LOCKED; \
+ splx(s); \
+ brelse(bp); \
+}
+
+#define ULCK_BUF(bp) { \
+ int s; \
+ s = splbio(); \
+ (bp)->b_flags &= ~B_LOCKED; \
+ splx(s); \
+ bremfree(bp); \
+ brelse(bp); \
+}
OpenPOWER on IntegriCloud