]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/platform-bionic.git/blob - libc/kernel/common/linux/circ_buf.h
auto import from //depot/cupcake/@132589
[android-sdk/platform-bionic.git] / libc / kernel / common / linux / circ_buf.h
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
15 struct circ_buf {
16  char *buf;
17  int head;
18  int tail;
19 };
21 #define CIRC_CNT(head,tail,size) (((head) - (tail)) & ((size)-1))
23 #define CIRC_SPACE(head,tail,size) CIRC_CNT((tail),((head)+1),(size))
25 #define CIRC_CNT_TO_END(head,tail,size)   ({int end = (size) - (tail);   int n = ((head) + end) & ((size)-1);   n < end ? n : end;})
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;})
29 #endif