Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v2.6.18 71 lines 1.1 kB view raw
1/* 2 * Copyright (C) 2004 Red Hat UK Ltd. 3 * 4 * This file is released under the GPL. 5 */ 6 7#ifndef DM_BIO_LIST_H 8#define DM_BIO_LIST_H 9 10#include <linux/bio.h> 11 12struct bio_list { 13 struct bio *head; 14 struct bio *tail; 15}; 16 17static inline void bio_list_init(struct bio_list *bl) 18{ 19 bl->head = bl->tail = NULL; 20} 21 22static inline void bio_list_add(struct bio_list *bl, struct bio *bio) 23{ 24 bio->bi_next = NULL; 25 26 if (bl->tail) 27 bl->tail->bi_next = bio; 28 else 29 bl->head = bio; 30 31 bl->tail = bio; 32} 33 34static inline void bio_list_merge(struct bio_list *bl, struct bio_list *bl2) 35{ 36 if (!bl2->head) 37 return; 38 39 if (bl->tail) 40 bl->tail->bi_next = bl2->head; 41 else 42 bl->head = bl2->head; 43 44 bl->tail = bl2->tail; 45} 46 47static inline struct bio *bio_list_pop(struct bio_list *bl) 48{ 49 struct bio *bio = bl->head; 50 51 if (bio) { 52 bl->head = bl->head->bi_next; 53 if (!bl->head) 54 bl->tail = NULL; 55 56 bio->bi_next = NULL; 57 } 58 59 return bio; 60} 61 62static inline struct bio *bio_list_get(struct bio_list *bl) 63{ 64 struct bio *bio = bl->head; 65 66 bl->head = bl->tail = NULL; 67 68 return bio; 69} 70 71#endif