diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2010-11-10 11:41:21 +0100 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2010-11-10 11:41:21 +0100 |
commit | 42bcaf301e9e06836e0a504b211b7fa95260493f (patch) | |
tree | fe6e85e7217530956edb94c27034350c44269d34 /include | |
parent | 1c5b7a861255be681e954373a6ee853ad7cee6b9 (diff) | |
download | android_external_fuse-42bcaf301e9e06836e0a504b211b7fa95260493f.tar.gz android_external_fuse-42bcaf301e9e06836e0a504b211b7fa95260493f.tar.bz2 android_external_fuse-42bcaf301e9e06836e0a504b211b7fa95260493f.zip |
store fuse_buf inside fuse_bufvec
Store the first fuse_buf inside fuse_bufvec. This makes
initialization of fuse_bufvec simpler for the common case of a single
fuse_buf. If multiple fuse_buf's are needed then fuse_bufvec needs to
be dynamically allocated.
Diffstat (limited to 'include')
-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 * |