aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/bio.h
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2004-08-19 19:51:51 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2004-08-19 19:51:51 +0000
commitd298f919744a554e620c7d5a5f9c171b91678992 (patch)
treefd0cb614d638ff6fa714c3b48816580a8cca71ae /sys/sys/bio.h
parent0ce70eb477c99c415ae0c46b64a8e0dab3dbc8e9 (diff)
downloadsrc-d298f919744a554e620c7d5a5f9c171b91678992.tar.gz
src-d298f919744a554e620c7d5a5f9c171b91678992.zip
Add bioq_takefirst().
If the bioq is empty, NULL is returned. Otherwise the front element is removed and returned. This can simplify locking in many drivers from: lock() bp = bioq_first(bq); if (bp == NULL) { unlock() return } bioq_remove(bp, bq) unlock to: lock() bp = bioq_takefirst(bq); unlock() if (bp == NULL) return;
Notes
Notes: svn path=/head/; revision=134038
Diffstat (limited to 'sys/sys/bio.h')
-rw-r--r--sys/sys/bio.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/sys/bio.h b/sys/sys/bio.h
index 33ae4e7a376f..0f42cffa81c0 100644
--- a/sys/sys/bio.h
+++ b/sys/sys/bio.h
@@ -88,6 +88,7 @@ struct bio {
#define BIO_WRITE 0x02
#define BIO_DELETE 0x04
#define BIO_GETATTR 0x08
+#define BIO_CMD0 0x20 /* Available for local hacks */
#define BIO_CMD1 0x40 /* Available for local hacks */
#define BIO_CMD2 0x80 /* Available for local hacks */
@@ -113,6 +114,7 @@ int biowait(struct bio *bp, const char *wchan);
void bioq_disksort(struct bio_queue_head *ap, struct bio *bp);
struct bio *bioq_first(struct bio_queue_head *head);
+struct bio *bioq_takefirst(struct bio_queue_head *head);
void bioq_flush(struct bio_queue_head *head, struct devstat *stp, int error);
void bioq_init(struct bio_queue_head *head);
void bioq_insert_tail(struct bio_queue_head *head, struct bio *bp);