summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>1998-05-06 01:44:12 +0000
committergibbs <gibbs@FreeBSD.org>1998-05-06 01:44:12 +0000
commitd4f3e52d2b2b2af854dc7de9fbadf00af23455f1 (patch)
tree89b9f3a753381067100884c726f2641512618dcf /sys
parentd0233a4f17c6d9bd423691e33cfe8a55b533e044 (diff)
downloadFreeBSD-src-d4f3e52d2b2b2af854dc7de9fbadf00af23455f1.zip
FreeBSD-src-d4f3e52d2b2b2af854dc7de9fbadf00af23455f1.tar.gz
Now that we have a TAILQ_PREV() that returns the previous object, simplify
some of the buf_queue inline functions.
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/bio.h25
-rw-r--r--sys/sys/buf.h25
2 files changed, 14 insertions, 36 deletions
diff --git a/sys/sys/bio.h b/sys/sys/bio.h
index 329a4b0..c6f05bb 100644
--- a/sys/sys/bio.h
+++ b/sys/sys/bio.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)buf.h 8.9 (Berkeley) 3/30/95
- * $Id: buf.h,v 1.49 1998/03/19 22:49:01 dyson Exp $
+ * $Id: buf.h,v 1.50 1998/03/28 10:33:21 bde Exp $
*/
#ifndef _SYS_BUF_H_
@@ -165,7 +165,7 @@ struct buf {
#define NOOFFSET (-1LL) /* No buffer offset calculated yet */
typedef struct buf_queue_head {
- TAILQ_HEAD(, buf) queue;
+ TAILQ_HEAD(buf_queue, buf) queue;
struct buf *insert_point;
struct buf *switch_point;
} buf_queue_head, *buf_queue_head_t;
@@ -201,24 +201,13 @@ bufq_insert_tail(buf_queue_head *head, struct buf *bp)
static __inline void
bufq_remove(buf_queue_head *head, struct buf *bp)
{
- if (bp == TAILQ_FIRST(&head->queue)) {
- if (bp == head->insert_point)
- head->insert_point = NULL;
- if (TAILQ_NEXT(bp, b_act) == head->switch_point)
+ if (bp == head->insert_point)
+ head->insert_point = TAILQ_PREV(bp, buf_queue, b_act);
+ if (bp == head->switch_point) {
+ if (bp == TAILQ_FIRST(&head->queue))
head->switch_point = NULL;
} else {
- if (bp == head->insert_point) {
- /*
- * Not 100% correct (we really want the
- * previous bp), but it will ensure queue
- * ordering and is less expensive than
- * using a CIRCLEQ.
- */
- head->insert_point = TAILQ_NEXT(bp, b_act);
- }
- if (bp == head->switch_point) {
- head->switch_point = TAILQ_NEXT(bp, b_act);
- }
+ head->switch_point = TAILQ_NEXT(bp, b_act);
}
TAILQ_REMOVE(&head->queue, bp, b_act);
}
diff --git a/sys/sys/buf.h b/sys/sys/buf.h
index 329a4b0..c6f05bb 100644
--- a/sys/sys/buf.h
+++ b/sys/sys/buf.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)buf.h 8.9 (Berkeley) 3/30/95
- * $Id: buf.h,v 1.49 1998/03/19 22:49:01 dyson Exp $
+ * $Id: buf.h,v 1.50 1998/03/28 10:33:21 bde Exp $
*/
#ifndef _SYS_BUF_H_
@@ -165,7 +165,7 @@ struct buf {
#define NOOFFSET (-1LL) /* No buffer offset calculated yet */
typedef struct buf_queue_head {
- TAILQ_HEAD(, buf) queue;
+ TAILQ_HEAD(buf_queue, buf) queue;
struct buf *insert_point;
struct buf *switch_point;
} buf_queue_head, *buf_queue_head_t;
@@ -201,24 +201,13 @@ bufq_insert_tail(buf_queue_head *head, struct buf *bp)
static __inline void
bufq_remove(buf_queue_head *head, struct buf *bp)
{
- if (bp == TAILQ_FIRST(&head->queue)) {
- if (bp == head->insert_point)
- head->insert_point = NULL;
- if (TAILQ_NEXT(bp, b_act) == head->switch_point)
+ if (bp == head->insert_point)
+ head->insert_point = TAILQ_PREV(bp, buf_queue, b_act);
+ if (bp == head->switch_point) {
+ if (bp == TAILQ_FIRST(&head->queue))
head->switch_point = NULL;
} else {
- if (bp == head->insert_point) {
- /*
- * Not 100% correct (we really want the
- * previous bp), but it will ensure queue
- * ordering and is less expensive than
- * using a CIRCLEQ.
- */
- head->insert_point = TAILQ_NEXT(bp, b_act);
- }
- if (bp == head->switch_point) {
- head->switch_point = TAILQ_NEXT(bp, b_act);
- }
+ head->switch_point = TAILQ_NEXT(bp, b_act);
}
TAILQ_REMOVE(&head->queue, bp, b_act);
}
OpenPOWER on IntegriCloud