Hide the implementation (the structure definition is now in cbuf.c).

Changed return types to status_t where appropriate.
Now usable from C++.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3691 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2003-06-27 16:40:53 +00:00
parent 749df8aa6b
commit 7f14e583d0

View File

@ -5,47 +5,46 @@
#ifndef _KERNEL_CBUF_H
#define _KERNEL_CBUF_H
#include <kernel.h>
#define CBUF_LEN 2048
#define CBUF_FLAG_CHAIN_HEAD 1
#define CBUF_FLAG_CHAIN_TAIL 2
typedef struct cbuf cbuf;
typedef struct cbuf {
struct cbuf *next;
size_t len;
size_t total_len;
void *data;
int flags;
char dat[CBUF_LEN - sizeof(struct cbuf *) - 2*sizeof(int) - sizeof(void *) - sizeof(int)];
} cbuf;
int cbuf_init(void);
#ifdef __cplusplus
extern "C" {
#endif
status_t cbuf_init(void);
cbuf *cbuf_get_chain(size_t len);
cbuf *cbuf_get_chain_noblock(size_t len);
void cbuf_free_chain_noblock(cbuf *buf);
void cbuf_free_chain(cbuf *buf);
size_t cbuf_get_len(cbuf *buf);
size_t cbuf_get_length(cbuf *buf);
void *cbuf_get_ptr(cbuf *buf, size_t offset);
int cbuf_is_contig_region(cbuf *buf, size_t start, size_t end);
bool cbuf_is_contig_region(cbuf *buf, size_t start, size_t end);
int cbuf_memcpy_to_chain(cbuf *chain, size_t offset, const void *_src, size_t len);
int cbuf_memcpy_from_chain(void *dest, cbuf *chain, size_t offset, size_t len);
status_t cbuf_memcpy_to_chain(cbuf *chain, size_t offset, const void *_src, size_t len);
status_t cbuf_memcpy_from_chain(void *dest, cbuf *chain, size_t offset, size_t len);
int cbuf_user_memcpy_to_chain(cbuf *chain, size_t offset, const void *_src, size_t len);
int cbuf_user_memcpy_from_chain(void *dest, cbuf *chain, size_t offset, size_t len);
status_t cbuf_user_memcpy_to_chain(cbuf *chain, size_t offset, const void *_src, size_t len);
status_t cbuf_user_memcpy_from_chain(void *dest, cbuf *chain, size_t offset, size_t len);
uint16 cbuf_ones_cksum16(cbuf *chain, size_t offset, size_t len);
cbuf *cbuf_merge_chains(cbuf *chain1, cbuf *chain2);
cbuf *cbuf_duplicate_chain(cbuf *chain, size_t offset, size_t len);
int cbuf_truncate_head(cbuf *chain, size_t trunc_bytes);
int cbuf_truncate_tail(cbuf *chain, size_t trunc_bytes);
status_t cbuf_truncate_head(cbuf *chain, size_t trunc_bytes);
status_t cbuf_truncate_tail(cbuf *chain, size_t trunc_bytes);
void cbuf_test(void);
// ToDo: to be removed...
#ifdef __cplusplus
}
#endif
#endif /* _KERNEL_CBUF_H */