1/****************************************************************************
2 ****************************************************************************
3 ***
4 ***   This header was automatically generated from a Linux kernel header
5 ***   of the same name, to make information necessary for userspace to
6 ***   call into the kernel available to libc.  It contains only constants,
7 ***   structures, and macros generated from the original header, and thus,
8 ***   contains no copyrightable information.
9 ***
10 ****************************************************************************
11 ****************************************************************************/
12#ifndef _LINUX_CIRC_BUF_H
13#define _LINUX_CIRC_BUF_H 1
14
15struct circ_buf {
16 char *buf;
17 int head;
18 int tail;
19};
20
21#define CIRC_CNT(head,tail,size) (((head) - (tail)) & ((size)-1))
22
23#define CIRC_SPACE(head,tail,size) CIRC_CNT((tail),((head)+1),(size))
24
25#define CIRC_CNT_TO_END(head,tail,size)   ({int end = (size) - (tail);   int n = ((head) + end) & ((size)-1);   n < end ? n : end;})
26
27#define CIRC_SPACE_TO_END(head,tail,size)   ({int end = (size) - 1 - (head);   int n = (end + (tail)) & ((size)-1);   n <= end ? n : end+1;})
28
29#endif
30