diff options
| author | Manuel Bentele | 2020-12-02 13:08:58 +0100 |
|---|---|---|
| committer | Manuel Bentele | 2020-12-02 13:08:58 +0100 |
| commit | 9fc030ed9bffec9f9715595dd5a205a353912d3c (patch) | |
| tree | 8137142e94abf7cd4eefd3b591c487d034b57e50 /src/utils/include/buffer.h | |
| parent | Setup xloop device with XLOOP_CONFIGURE ioctl call (diff) | |
| download | xloop-9fc030ed9bffec9f9715595dd5a205a353912d3c.tar.gz xloop-9fc030ed9bffec9f9715595dd5a205a353912d3c.tar.xz xloop-9fc030ed9bffec9f9715595dd5a205a353912d3c.zip | |
Update xlosetup's 'lib' and 'libsmartcol' from util-linux 2.36.1
Diffstat (limited to 'src/utils/include/buffer.h')
| -rw-r--r-- | src/utils/include/buffer.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/utils/include/buffer.h b/src/utils/include/buffer.h new file mode 100644 index 0000000..5bc7037 --- /dev/null +++ b/src/utils/include/buffer.h @@ -0,0 +1,28 @@ +#ifndef UTIL_LINUX_BUFFER +#define UTIL_LINUX_BUFFER + +#include "c.h" + +struct ul_buffer { + char *begin; /* begin of the data */ + char *end; /* current end of data */ + + size_t sz; /* allocated space for data */ + size_t chunksize; +}; + +#define UL_INIT_BUFFER { .begin = NULL } + +void ul_buffer_reset_data(struct ul_buffer *buf); +void ul_buffer_free_data(struct ul_buffer *buf); +int ul_buffer_is_empty(struct ul_buffer *buf); +void ul_buffer_set_chunksize(struct ul_buffer *buf, size_t sz); +void ul_buffer_refer_string(struct ul_buffer *buf, char *str); +int ul_buffer_alloc_data(struct ul_buffer *buf, size_t sz); +int ul_buffer_append_data(struct ul_buffer *buf, const char *data, size_t sz); +int ul_buffer_append_string(struct ul_buffer *buf, const char *str); +int ul_buffer_append_ntimes(struct ul_buffer *buf, size_t n, const char *str); +int ul_buffer_set_data(struct ul_buffer *buf, const char *data, size_t sz); +char *ul_buffer_get_data(struct ul_buffer *buf); + +#endif /* UTIL_LINUX_BUFFER */ |
