libfuse: fuse-3.17.4/lib/util.h Source File

libfuse

util.h
1#ifndef FUSE_UTIL_H_
2#define FUSE_UTIL_H_
3
4#include <stdint.h>
5#include <stdbool.h>
6
7#define ROUND_UP(val, round_to) (((val) + (round_to - 1)) & ~(round_to - 1))
8
9#define likely(x) __builtin_expect(!!(x), 1)
10#define unlikely(x) __builtin_expect(!!(x), 0)
11
12struct fuse_conn_info;
13
14int libfuse_strtol(const char *str, long *res);
15
19static inline uint32_t fuse_lower_32_bits(uint64_t nr)
20{
21 return (uint32_t)(nr & 0xffffffff);
22}
23
27static inline uint64_t fuse_higher_32_bits(uint64_t nr)
28{
29 return nr & ~0xffffffffULL;
30}
31
32#ifndef FUSE_VAR_UNUSED
33#define FUSE_VAR_UNUSED(var) (__attribute__((unused)) var)
34#endif
35
36#define container_of(ptr, type, member) \
37 ({ \
38 unsigned long __mptr = (unsigned long)(ptr); \
39 ((type *)(__mptr - offsetof(type, member))); \
40 })
41
42#endif
fuse_conn_info
Definition fuse_common.h:538