aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2017-05-25 12:48:27 -0700
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2017-05-25 12:48:27 -0700
commit8641db4af724682fb1c922cbecf6c7e1dfe1a71c (patch)
tree9cd0a67a03c112a9b003cec8ebb02c8dd3af876e /example
parent179fa13b40387645e722089873079488f9dbe3d8 (diff)
passthrough_ll: document that fuse_ino_t and uintptr_t sizes must match
We can consider changing the code to drop the requirement if it turns out that there's a system where this isn't given. Fixes issue #167.
Diffstat (limited to 'example')
-rw-r--r--example/passthrough_ll.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c
index ac566ad..772a822 100644
--- a/example/passthrough_ll.c
+++ b/example/passthrough_ll.c
@@ -47,6 +47,19 @@
#include <errno.h>
#include <err.h>
+/* We are re-using pointers to our `struct lo_inode` and `struct
+ lo_dirp` elements as inodes. This means that we require uintptr_t
+ and fuse_ino_t to have the same size. The following incantation
+ defines a compile time assert for this requirement. */
+#if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 6) && !defined __cplusplus
+_Static_assert(sizeof(fuse_ino_t) == sizeof(uintptr_t), "fuse: off_t must be 64bit");
+#else
+struct _uintptr_to_must_hold_fuse_ino_t_dummy_struct \
+ { unsigned _uintptr_to_must_hold_fuse_ino_t:
+ ((sizeof(fuse_ino_t) == sizeof(uintptr_t)) ? 1 : -1); };
+#endif
+
+
/* Compat stuff. Doesn't make it work, just makes it compile. */
#ifndef HAVE_FSTATAT
#warning fstatat(2) needed by this program