PREFIX=/usr
INSTALL=install
CFLAGS+=-std=gnu99 -O2 -g -MMD -Wall \
- -Wno-unused-but-set-variable \
-Wno-pointer-sign \
-fno-strict-aliasing \
-I. -Iinclude -Ilibbcachefs \
$(EXTRA_CFLAGS)
LDFLAGS+=-O2 -g
-ifdef D
- CFLAGS+=-Werror
-else
+CC_VERSION=$(shell $(CC) -v 2>&1|grep -E '(gcc|clang) version')
+
+ifneq (,$(findstring gcc,$(CC_VERSION)))
+ CFLAGS+=-Wno-unused-but-set-variable
+ifndef D
CFLAGS+=-flto
LDFLAGS+=-flto
endif
+endif
+
+ifneq (,$(findstring clang,$(CC_VERSION)))
+ CFLAGS+=-Wno-missing-braces
+endif
+
+ifdef D
+ CFLAGS+=-Werror
+endif
PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib"
CFLAGS+=`pkg-config --cflags ${PKGCONFIG_LIBS}`
char *s = buf;
char *inode = strsep(&s, ":");
char *offset = strsep(&s, ":");
- struct bpos ret = { 0 };
+ u64 inode_v, offset_v;
if (!inode || !offset || s ||
- kstrtoull(inode, 10, &ret.inode) ||
- kstrtoull(offset, 10, &ret.offset))
+ kstrtoull(inode, 10, &inode_v) ||
+ kstrtoull(offset, 10, &offset_v))
die("invalid bpos %s", buf);
- return ret;
+ return (struct bpos) { .inode = inode_v, .offset = offset_v };
}
static void list_keys_usage(void)
if (argc != 2)
die("Please supply a filesystem");
+#if 0
struct bcache_handle fs = bcache_fs_open(argv[1]);
+#endif
- fs = fs;
return 0;
}
if (argc != 2)
die("Please supply a filesystem");
+#if 0
struct bcache_handle fs = bcache_fs_open(argv[1]);
+#endif
- fs = fs;
return 0;
}
#include <linux/backing-dev.h>
#include <linux/blk_types.h>
#include <linux/kobject.h>
+#include <linux/types.h>
-typedef u64 sector_t;
typedef unsigned fmode_t;
struct bio;
#define WARN(cond, ...) assert(!(cond))
#define WARN_ON(condition) ({ \
- int __ret_warn_on = !!(condition); \
- if (unlikely(__ret_warn_on)) \
+ int __ret_warn_on = unlikely(!!(condition)); \
+ if (__ret_warn_on) \
__WARN(); \
- unlikely(__ret_warn_on); \
+ __ret_warn_on; \
})
#endif /* __TOOLS_LINUX_BUG_H */
#define raw_spin_lock_irqsave(lock, flags) \
do { \
- (void) flags; \
+ flags = 0; \
raw_spin_lock(lock); \
} while (0)