aboutsummaryrefslogtreecommitdiffstats
path: root/lib/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.h')
-rw-r--r--lib/util.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/util.h b/lib/util.h
index 74ce748..0c4c258 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -1,3 +1,30 @@
+#ifndef FUSE_UTIL_H_
+#define FUSE_UTIL_H_
+
+#include <stdint.h>
+
#define ROUND_UP(val, round_to) (((val) + (round_to - 1)) & ~(round_to - 1))
int libfuse_strtol(const char *str, long *res);
+
+/**
+ * Return the low bits of a number
+ */
+static inline uint32_t fuse_lower_32_bits(uint64_t nr)
+{
+ return (uint32_t)(nr & 0xffffffff);
+}
+
+/**
+ * Return the high bits of a number
+ */
+static inline uint64_t fuse_higher_32_bits(uint64_t nr)
+{
+ return nr & ~0xffffffffULL;
+}
+
+#ifndef FUSE_VAR_UNUSED
+#define FUSE_VAR_UNUSED(var) (__attribute__((unused)) var)
+#endif
+
+#endif