struct fuse_file_info extension
authorBernd Schubert <bernd@bsbernd.com>
Sat, 28 Dec 2024 13:01:04 +0000 (14:01 +0100)
committerBernd Schubert <bernd@bsbernd.com>
Mon, 30 Dec 2024 22:04:11 +0000 (23:04 +0100)
Add a flags and reserved fields to struct fuse_file_info
and add a static assert on the size.

Also add another static assert for 'struct fuse_conn_info'

Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
include/fuse_common.h

index ee3c4e60a5e16e74e2e553ca78fdcc60e0e911d7..1999eaa4f3089fabf7ded2dce1576d0e9cef1a7e 100644 (file)
 #include "fuse_log.h"
 #include <stdint.h>
 #include <sys/types.h>
+#include <assert.h>
 
 #define FUSE_MAKE_VERSION(maj, min)  ((maj) * 100 + (min))
 #define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
 
+#if (defined(__cplusplus) && __cplusplus >= 201103L) ||        \
+       (!defined(__cplusplus) && defined(__STDC_VERSION__) && \
+        __STDC_VERSION__ >= 201112L)
+#define fuse_static_assert(condition, message) static_assert(condition, message)
+#else
+#define fuse_static_assert(condition, message)
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -116,9 +125,14 @@ struct fuse_file_info {
         * create and open.  It is used to create a passthrough connection
         * between FUSE file and backing file. */
        int32_t backing_id;
-};
 
+       /** struct fuse_file_info api and abi flags  */
+       uint64_t compat_flags;
 
+       uint64_t reserved[2];
+};
+fuse_static_assert(sizeof(struct fuse_file_info) == 64,
+                  "fuse_file_info size mismatch");
 
 /**
  * Configuration parameters passed to fuse_session_loop_mt() and
@@ -670,6 +684,8 @@ struct fuse_conn_info {
         */
        uint32_t reserved[20];
 };
+fuse_static_assert(sizeof(struct fuse_conn_info) == 128,
+                  "Size of struct fuse_conn_info must be 128 bytes");
 
 struct fuse_session;
 struct fuse_pollhandle;