diff options
Diffstat (limited to 'include/fuse_common.h')
-rw-r--r-- | include/fuse_common.h | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/include/fuse_common.h b/include/fuse_common.h index ea8974d..233a0b4 100644 --- a/include/fuse_common.h +++ b/include/fuse_common.h @@ -368,14 +368,11 @@ struct fuse_buf { * * An array of data buffers, each containing a memory pointer or a * file descriptor. + * + * Allocate dynamically to add more than one buffer. */ struct fuse_bufvec { /** - * Array of buffers - */ - const struct fuse_buf *buf; - - /** * Number of buffers in the array */ size_t count; @@ -389,8 +386,28 @@ struct fuse_bufvec { * Current offset within the current buffer */ size_t off; + + /** + * Array of buffers + */ + struct fuse_buf buf[1]; }; +/* Initialize bufvec with a single buffer of given size */ +#define FUSE_BUFVEC_INIT(size__) \ + ((struct fuse_bufvec) { \ + /* .count= */ 1, \ + /* .idx = */ 0, \ + /* .off = */ 0, \ + /* .buf = */ { /* [0] = */ { \ + /* .size = */ (size__), \ + /* .flags = */ (enum fuse_buf_flags) 0, \ + /* .mem = */ NULL, \ + /* .fd = */ -1, \ + /* .pos = */ 0, \ + } } \ + } ) + /** * Get total size of data in a fuse buffer vector * |