btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / src / add-ons / kernel / file_systems / googlefs / ringbuff.h
blob58347c495d010ba84a928b9bab9a8acef91121ad
1 /*
2 * Copyright 2004-2008, François Revol, <revol@free.fr>.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _RINGBUFF_H
6 #define _RINGBUFF_H
8 struct ring_buffer {
9 size_t size;
10 size_t current; /* index of next byte to read */
11 size_t avail; /* number of bytes in */
12 unsigned char data[0];
15 void rb_init(struct ring_buffer *rb, size_t size);
16 void rb_clear(struct ring_buffer *rb);
17 size_t rb_can_write(struct ring_buffer *rb);
18 size_t rb_can_read(struct ring_buffer *rb);
19 size_t rb_write(struct ring_buffer *rb, void *data, size_t len);
20 size_t rb_read(struct ring_buffer *rb, void *data, size_t len);
22 #endif