File mode stored in i_mode
[akaros.git] / kern / include / ros / bcq_struct.h
1 /* Copyright (c) 2010 The Regents of the University of California
2  * Barret Rhoden <brho@cs.berkeley.edu>
3  * See LICENSE for details.
4  *
5  * Struct for the BCQ.  Needs to be in its own file so glibc doesn't try to
6  * include any of the atomics needed for the actual BCQ operations.  */
7
8 #ifndef ROS_INC_BCQ_STRUCT_H
9 #define ROS_INC_BCQ_STRUCT_H
10
11 struct bcq_header {
12         uint32_t prod_idx;              /* next to be produced in */
13         uint32_t cons_pub_idx;  /* last completely consumed */
14         uint32_t cons_pvt_idx;  /* last a consumer has dibs on */
15 };
16
17 #define DEFINE_BCQ_TYPES(__name, __elem_t, __num_elems)                        \
18                                                                                \
19 /* Wrapper, per element, with the consumption bool */                          \
20 struct __name##_bcq_wrap {                                                     \
21         __elem_t elem;                                                             \
22         bool rdy_for_cons;      /* elem is ready for consumption */                    \
23 };                                                                             \
24                                                                                \
25 /* The actual BC queue */                                                      \
26 struct __name##_bcq {                                                          \
27         struct bcq_header hdr;                                                     \
28         struct __name##_bcq_wrap wraps[__num_elems];                               \
29 };                                                                             
30                                                                                
31 #endif /* !ROS_INC_BCQ_STRUCT_H */