summaryrefslogtreecommitdiffstats
path: root/sys/sys/bufobj.h
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-10-24 20:03:41 +0000
committerphk <phk@FreeBSD.org>2004-10-24 20:03:41 +0000
commit1b25a5988640ac862e8e964c30aaccfd83e128cf (patch)
tree220ef3feb4e3c7063a6550b7466cbd964e346c84 /sys/sys/bufobj.h
parent27296db6a7b0487c98e7e27a7765cf3d19bdf963 (diff)
downloadFreeBSD-src-1b25a5988640ac862e8e964c30aaccfd83e128cf.zip
FreeBSD-src-1b25a5988640ac862e8e964c30aaccfd83e128cf.tar.gz
Move the buffer method vector (buf->b_op) to the bufobj.
Extend it with a strategy method. Add bufstrategy() which do the usual VOP_SPECSTRATEGY/VOP_STRATEGY song and dance. Rename ibwrite to bufwrite(). Move the two NFS buf_ops to more sensible places, add bufstrategy to them. Add inlines for bwrite() and bstrategy() which calls through buf->b_bufobj->b_ops->b_{write,strategy}(). Replace almost all VOP_STRATEGY()/VOP_SPECSTRATEGY() calls with bstrategy().
Diffstat (limited to 'sys/sys/bufobj.h')
-rw-r--r--sys/sys/bufobj.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/sys/bufobj.h b/sys/sys/bufobj.h
index 1fd61ef..7978a698 100644
--- a/sys/sys/bufobj.h
+++ b/sys/sys/bufobj.h
@@ -53,6 +53,11 @@
#include <sys/queue.h>
+struct bufobj;
+struct buf_ops;
+
+extern struct buf_ops buf_ops_bio;
+
TAILQ_HEAD(buflists, buf);
/* A Buffer splay list */
@@ -62,12 +67,22 @@ struct bufv {
int bv_cnt; /* Number of buffers */
};
+typedef void b_strategy_t(struct bufobj *, struct buf *);
+typedef int b_write_t(struct buf *);
+
+struct buf_ops {
+ char *bop_name;
+ b_write_t *bop_write;
+ b_strategy_t *bop_strategy;
+};
+
struct bufobj {
struct mtx *bo_mtx; /* Mutex which protects "i" things */
struct bufv bo_clean; /* i Clean buffers */
struct bufv bo_dirty; /* i Dirty buffers */
long bo_numoutput; /* i Writes in progress */
u_int bo_flag; /* i Flags */
+ struct buf_ops *bo_ops; /* - buffer operatoins */
};
#define BO_WWAIT (1 << 1) /* Wait for output to complete */
OpenPOWER on IntegriCloud