2 ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
8 #include <kernel/kernel.h>
12 #define CBUF_FLAG_CHAIN_HEAD 1
13 #define CBUF_FLAG_CHAIN_TAIL 2
21 char dat
[CBUF_LEN
- sizeof(struct cbuf
*) - 2*sizeof(int) - sizeof(void *) - sizeof(int)];
25 cbuf
*cbuf_get_chain(size_t len
);
26 cbuf
*cbuf_get_chain_noblock(size_t len
);
27 void cbuf_free_chain_noblock(cbuf
*buf
);
28 void cbuf_free_chain(cbuf
*buf
);
30 size_t cbuf_get_len(cbuf
*buf
);
31 void *cbuf_get_ptr(cbuf
*buf
, size_t offset
);
32 int cbuf_is_contig_region(cbuf
*buf
, size_t start
, size_t end
);
34 int cbuf_memcpy_to_chain(cbuf
*chain
, size_t offset
, const void *_src
, size_t len
);
35 int cbuf_memcpy_from_chain(void *dest
, cbuf
*chain
, size_t offset
, size_t len
);
37 int cbuf_user_memcpy_to_chain(cbuf
*chain
, size_t offset
, const void *_src
, size_t len
);
38 int cbuf_user_memcpy_from_chain(void *dest
, cbuf
*chain
, size_t offset
, size_t len
);
40 uint16
cbuf_ones_cksum16(cbuf
*chain
, size_t offset
, size_t len
);
42 cbuf
*cbuf_merge_chains(cbuf
*chain1
, cbuf
*chain2
);
43 cbuf
*cbuf_duplicate_chain(cbuf
*chain
, size_t offset
, size_t len
);
45 int cbuf_truncate_head(cbuf
*chain
, size_t trunc_bytes
);
46 int cbuf_truncate_tail(cbuf
*chain
, size_t trunc_bytes
);