summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_bio.c18
-rw-r--r--sys/sys/buf.h1
-rw-r--r--sys/sys/conf.h19
-rw-r--r--sys/sys/linedisc.h19
4 files changed, 21 insertions, 36 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 0c8d130..939f968 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bio.h>
+#include <sys/conf.h>
#include <sys/buf.h>
#include <sys/devicestat.h>
#include <sys/eventhandler.h>
@@ -3054,7 +3055,7 @@ bufwait(register struct buf * bp)
* Call back function from struct bio back up to struct buf.
* The corresponding initialization lives in sys/conf.h:DEV_STRATEGY().
*/
-void
+static void
bufdonebio(struct bio *bp)
{
@@ -3064,6 +3065,21 @@ bufdonebio(struct bio *bp)
mtx_unlock(&Giant);
}
+void
+dev_strategy(struct buf *bp)
+{
+
+ if ((!bp->b_iocmd) || (bp->b_iocmd & (bp->b_iocmd - 1)))
+ panic("b_iocmd botch");
+ if (bp->b_flags & B_PHYS)
+ bp->b_io.bio_offset = bp->b_offset;
+ else
+ bp->b_io.bio_offset = dbtob(bp->b_blkno);
+ bp->b_io.bio_done = bufdonebio;
+ bp->b_io.bio_caller2 = bp;
+ (*devsw(bp->b_io.bio_dev)->d_strategy)(&bp->b_io);
+}
+
/*
* bufdone:
*
diff --git a/sys/sys/buf.h b/sys/sys/buf.h
index 78ef55b..0942761 100644
--- a/sys/sys/buf.h
+++ b/sys/sys/buf.h
@@ -501,7 +501,6 @@ struct buf *getblk(struct vnode *, daddr_t, int, int, int, int);
struct buf *geteblk(int);
int bufwait(struct buf *);
void bufdone(struct buf *);
-void bufdonebio(struct bio *);
void cluster_callback(struct buf *);
int cluster_read(struct vnode *, u_quad_t, daddr_t, long,
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index e4f0eab..fb39f08 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -175,23 +175,7 @@ typedef int dumper_t(
off_t offset, /* Byte-offset to write at. */
size_t length); /* Number of bytes to dump. */
-#define BIO_STRATEGY(bp) \
- do { \
- if ((!(bp)->bio_cmd) || ((bp)->bio_cmd & ((bp)->bio_cmd - 1))) \
- Debugger("bio_cmd botch"); \
- (*devsw((bp)->bio_dev)->d_strategy)(bp); \
- } while (0)
-
-#define DEV_STRATEGY(bp) \
- do { \
- if ((bp)->b_flags & B_PHYS) \
- (bp)->b_io.bio_offset = (bp)->b_offset; \
- else \
- (bp)->b_io.bio_offset = dbtob((bp)->b_blkno); \
- (bp)->b_io.bio_done = bufdonebio; \
- (bp)->b_io.bio_caller2 = (bp); \
- BIO_STRATEGY(&(bp)->b_io); \
- } while (0)
+#define DEV_STRATEGY(bp) dev_strategy(bp)
#endif /* _KERNEL */
@@ -296,6 +280,7 @@ struct cdevsw *devsw(dev_t _dev);
const char *devtoname(dev_t _dev);
int dev_named(dev_t _pdev, const char *_name);
void dev_depends(dev_t _pdev, dev_t _cdev);
+void dev_strategy(struct buf *bp);
void freedev(dev_t _dev);
dev_t makebdev(int _maj, int _min);
dev_t make_dev(struct cdevsw *_devsw, int _minor, uid_t _uid, gid_t _gid,
diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h
index e4f0eab..fb39f08 100644
--- a/sys/sys/linedisc.h
+++ b/sys/sys/linedisc.h
@@ -175,23 +175,7 @@ typedef int dumper_t(
off_t offset, /* Byte-offset to write at. */
size_t length); /* Number of bytes to dump. */
-#define BIO_STRATEGY(bp) \
- do { \
- if ((!(bp)->bio_cmd) || ((bp)->bio_cmd & ((bp)->bio_cmd - 1))) \
- Debugger("bio_cmd botch"); \
- (*devsw((bp)->bio_dev)->d_strategy)(bp); \
- } while (0)
-
-#define DEV_STRATEGY(bp) \
- do { \
- if ((bp)->b_flags & B_PHYS) \
- (bp)->b_io.bio_offset = (bp)->b_offset; \
- else \
- (bp)->b_io.bio_offset = dbtob((bp)->b_blkno); \
- (bp)->b_io.bio_done = bufdonebio; \
- (bp)->b_io.bio_caller2 = (bp); \
- BIO_STRATEGY(&(bp)->b_io); \
- } while (0)
+#define DEV_STRATEGY(bp) dev_strategy(bp)
#endif /* _KERNEL */
@@ -296,6 +280,7 @@ struct cdevsw *devsw(dev_t _dev);
const char *devtoname(dev_t _dev);
int dev_named(dev_t _pdev, const char *_name);
void dev_depends(dev_t _pdev, dev_t _cdev);
+void dev_strategy(struct buf *bp);
void freedev(dev_t _dev);
dev_t makebdev(int _maj, int _min);
dev_t make_dev(struct cdevsw *_devsw, int _minor, uid_t _uid, gid_t _gid,
OpenPOWER on IntegriCloud