diff --git a/sys/kern/subr_bufq.c b/sys/kern/subr_bufq.c index affbfbb2c7c1..482fc29faa6c 100644 --- a/sys/kern/subr_bufq.c +++ b/sys/kern/subr_bufq.c @@ -1,4 +1,4 @@ -/* $NetBSD: subr_bufq.c,v 1.4 2005/10/16 00:30:03 yamt Exp $ */ +/* $NetBSD: subr_bufq.c,v 1.5 2005/10/16 02:02:23 yamt Exp $ */ /* NetBSD: subr_disk.c,v 1.70 2005/08/20 12:00:01 yamt Exp $ */ /*- @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_bufq.c,v 1.4 2005/10/16 00:30:03 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_bufq.c,v 1.5 2005/10/16 02:02:23 yamt Exp $"); #include #include @@ -157,6 +157,7 @@ bufq_alloc(struct bufq_state **bufqp, const char *strategy, int flags) *bufqp = bufq = malloc(sizeof(*bufq), M_DEVBUF, M_WAITOK | M_ZERO); bufq->bq_flags = flags; + bufq->bq_strat = bsp; (*bsp->bs_initfn)(bufq); out: @@ -214,6 +215,31 @@ bufq_free(struct bufq_state *bufq) free(bufq, M_DEVBUF); } +#if 0 +/* + * get a strategy identifier of a buffer queue. + */ +const char * +bufq_getstrategyname(struct bufq_state *bufq) +{ + + return bufq->bq_strat->bs_name; +} + +/* + * move all requests on a buffer queue to another. + */ +void +bufq_move(struct bufq_state *dst, struct bufq_state *src) +{ + struct buf *bp; + + while ((bp = BUFQ_GET(src)) != NULL) { + BUFQ_PUT(dst, bp); + } +} +#endif + /* * sysctl function that will print all bufq strategies * built in the kernel. diff --git a/sys/sys/bufq.h b/sys/sys/bufq.h index 6131d2d9e48b..dc5f3bfb7661 100644 --- a/sys/sys/bufq.h +++ b/sys/sys/bufq.h @@ -1,4 +1,4 @@ -/* $NetBSD: bufq.h,v 1.4 2005/10/15 17:29:26 yamt Exp $ */ +/* $NetBSD: bufq.h,v 1.5 2005/10/16 02:02:23 yamt Exp $ */ /* NetBSD: buf.h,v 1.75 2004/09/18 16:40:11 yamt Exp */ /*- @@ -103,6 +103,8 @@ void bufq_free(struct bufq_state *); void bufq_put(struct bufq_state *, struct buf *); struct buf *bufq_get(struct bufq_state *); struct buf *bufq_peek(struct bufq_state *); +const char *bufq_getstrategyname(struct bufq_state *); +void bufq_move(struct bufq_state *, struct bufq_state *); /* Put buffer in queue */ #define BUFQ_PUT(bufq, bp) bufq_put(bufq, bp) diff --git a/sys/sys/bufq_impl.h b/sys/sys/bufq_impl.h index e28ab4b373b0..bc3d953988cf 100644 --- a/sys/sys/bufq_impl.h +++ b/sys/sys/bufq_impl.h @@ -1,4 +1,4 @@ -/* $NetBSD: bufq_impl.h,v 1.1 2005/10/15 17:29:26 yamt Exp $ */ +/* $NetBSD: bufq_impl.h,v 1.2 2005/10/16 02:02:23 yamt Exp $ */ /* NetBSD: bufq.h,v 1.3 2005/03/31 11:28:53 yamt Exp */ /* NetBSD: buf.h,v 1.75 2004/09/18 16:40:11 yamt Exp */ @@ -79,6 +79,8 @@ #error not supposed to be exposed to userland. #endif +struct bufq_strat; + /* * Device driver buffer queue. */ @@ -87,6 +89,7 @@ struct bufq_state { struct buf *(*bq_get)(struct bufq_state *, int); void *bq_private; int bq_flags; /* Flags from bufq_alloc() */ + const struct bufq_strat *bq_strat; }; static __inline void *bufq_private(const struct bufq_state *) __unused;