]>
Commit | Line | Data |
---|---|---|
86e3c28a CIK |
1 | /* |
2 | * CDDL HEADER START | |
3 | * | |
4 | * This file and its contents are supplied under the terms of the | |
5 | * Common Development and Distribution License ("CDDL"), version 1.0. | |
6 | * You may only use this file in accordance with the terms of version | |
7 | * 1.0 of the CDDL. | |
8 | * | |
9 | * A full copy of the text of the CDDL should have accompanied this | |
10 | * source. A copy of the CDDL is also available via the Internet at | |
11 | * http://www.illumos.org/license/CDDL. | |
12 | * | |
13 | * CDDL HEADER END | |
14 | */ | |
15 | /* | |
16 | * Copyright (c) 2014 by Delphix. All rights reserved. | |
17 | */ | |
18 | ||
19 | #ifndef _BQUEUE_H | |
20 | #define _BQUEUE_H | |
21 | ||
22 | #ifdef __cplusplus | |
23 | extern "C" { | |
24 | #endif | |
25 | ||
26 | #include <sys/zfs_context.h> | |
27 | ||
28 | typedef struct bqueue { | |
29 | list_t bq_list; | |
30 | kmutex_t bq_lock; | |
31 | kcondvar_t bq_add_cv; | |
32 | kcondvar_t bq_pop_cv; | |
33 | uint64_t bq_size; | |
34 | uint64_t bq_maxsize; | |
35 | size_t bq_node_offset; | |
36 | } bqueue_t; | |
37 | ||
38 | typedef struct bqueue_node { | |
39 | list_node_t bqn_node; | |
40 | uint64_t bqn_size; | |
41 | } bqueue_node_t; | |
42 | ||
43 | ||
44 | int bqueue_init(bqueue_t *, uint64_t, size_t); | |
45 | void bqueue_destroy(bqueue_t *); | |
46 | void bqueue_enqueue(bqueue_t *, void *, uint64_t); | |
47 | void *bqueue_dequeue(bqueue_t *); | |
48 | boolean_t bqueue_empty(bqueue_t *); | |
49 | ||
50 | #ifdef __cplusplus | |
51 | } | |
52 | #endif | |
53 | ||
54 | #endif /* _BQUEUE_H */ |