From 997bb216aa37010826067d0cfa33b4fde5aaa225 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Sun, 26 Nov 2017 19:29:00 -0600 Subject: [PATCH] build: require explicit include paths for libbcachefs/ This removes the implicit `-I libbcachefs` argument to $(CC), which in turn requires a set of minor changes throughout the tools. There are two advantages to this setup: 1) It is (arguably) easier to read, since the location of bcachefs includes are easier to understand at a glance ("where does util.h live?") 2) It removes the need for a hack to include glibc's copy of dirent.h explicitly via '/usr/include/dirent.h', because libbcachefs/ *also* has a dirent.h file and the compiler cannot disambiguate them. This has some ramifications on systems where /usr/include may not exist, such as NixOS. Signed-off-by: Austin Seipp --- Makefile | 2 +- cmd_assemble.c | 2 +- cmd_debug.c | 16 ++++++++-------- cmd_device.c | 4 ++-- cmd_format.c | 6 +++--- cmd_fsck.c | 4 ++-- cmd_key.c | 2 +- cmd_migrate.c | 22 +++++++++++----------- cmd_run.c | 2 +- crypto.c | 2 +- libbcachefs.c | 8 ++++---- libbcachefs.h | 4 ++-- tools-util.c | 4 ++-- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index 6538fe78..f1e0da25 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ INSTALL=install CFLAGS+=-std=gnu89 -O2 -g -MMD -Wall \ -Wno-pointer-sign \ -fno-strict-aliasing \ - -I. -Iinclude -Ilibbcachefs \ + -I. -Iinclude \ -D_FILE_OFFSET_BITS=64 \ -D_GNU_SOURCE \ -D_LGPL_SOURCE \ diff --git a/cmd_assemble.c b/cmd_assemble.c index 051c32f8..5fbabdd9 100644 --- a/cmd_assemble.c +++ b/cmd_assemble.c @@ -7,7 +7,7 @@ #include #include -#include "bcachefs_ioctl.h" +#include "libbcachefs/bcachefs_ioctl.h" #include "cmds.h" int cmd_assemble(int argc, char *argv[]) diff --git a/cmd_debug.c b/cmd_debug.c index 7ee4e1f2..b1bdda8c 100644 --- a/cmd_debug.c +++ b/cmd_debug.c @@ -8,14 +8,14 @@ #include "qcow2.h" #include "tools-util.h" -#include "bcachefs.h" -#include "alloc.h" -#include "btree_cache.h" -#include "btree_iter.h" -#include "buckets.h" -#include "error.h" -#include "journal.h" -#include "super.h" +#include "libbcachefs/bcachefs.h" +#include "libbcachefs/alloc.h" +#include "libbcachefs/btree_cache.h" +#include "libbcachefs/btree_iter.h" +#include "libbcachefs/buckets.h" +#include "libbcachefs/error.h" +#include "libbcachefs/journal.h" +#include "libbcachefs/super.h" static void dump_usage(void) { diff --git a/cmd_device.c b/cmd_device.c index e5a2f09e..f2d751c5 100644 --- a/cmd_device.c +++ b/cmd_device.c @@ -12,10 +12,10 @@ #include #include -#include "bcachefs_ioctl.h" +#include "libbcachefs/bcachefs_ioctl.h" #include "cmds.h" #include "libbcachefs.h" -#include "opts.h" +#include "libbcachefs/opts.h" #include "tools-util.h" /* This code belongs under show_fs */ diff --git a/cmd_format.c b/cmd_format.c index 9cc56a5f..b22fe946 100644 --- a/cmd_format.c +++ b/cmd_format.c @@ -24,9 +24,9 @@ #include "cmds.h" #include "libbcachefs.h" #include "crypto.h" -#include "opts.h" -#include "super-io.h" -#include "util.h" +#include "libbcachefs/opts.h" +#include "libbcachefs/super-io.h" +#include "libbcachefs/util.h" #define OPTS \ t("bcachefs format - create a new bcachefs filesystem on one or more devices") \ diff --git a/cmd_fsck.c b/cmd_fsck.c index 22422233..9b01524a 100644 --- a/cmd_fsck.c +++ b/cmd_fsck.c @@ -1,8 +1,8 @@ #include "cmds.h" -#include "error.h" +#include "libbcachefs/error.h" #include "libbcachefs.h" -#include "super.h" +#include "libbcachefs/super.h" #include "tools-util.h" static void usage(void) diff --git a/cmd_key.c b/cmd_key.c index b5bacf1c..879163f1 100644 --- a/cmd_key.c +++ b/cmd_key.c @@ -3,7 +3,7 @@ #include #include "cmds.h" -#include "checksum.h" +#include "libbcachefs/checksum.h" #include "crypto.h" #include "libbcachefs.h" diff --git a/cmd_migrate.c b/cmd_migrate.c index ec6c8314..d683a5f2 100644 --- a/cmd_migrate.c +++ b/cmd_migrate.c @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -24,16 +24,16 @@ #include #include #include -#include "bcachefs.h" -#include "btree_update.h" -#include "buckets.h" -#include "dirent.h" -#include "fs.h" -#include "inode.h" -#include "io.h" -#include "str_hash.h" -#include "super.h" -#include "xattr.h" +#include "libbcachefs/bcachefs.h" +#include "libbcachefs/btree_update.h" +#include "libbcachefs/buckets.h" +#include "libbcachefs/dirent.h" +#include "libbcachefs/fs.h" +#include "libbcachefs/inode.h" +#include "libbcachefs/io.h" +#include "libbcachefs/str_hash.h" +#include "libbcachefs/super.h" +#include "libbcachefs/xattr.h" static char *dev_t_to_path(dev_t dev) { diff --git a/cmd_run.c b/cmd_run.c index cffc54b8..bbb37e5d 100644 --- a/cmd_run.c +++ b/cmd_run.c @@ -11,7 +11,7 @@ #include -#include "bcachefs_ioctl.h" +#include "libbcachefs/bcachefs_ioctl.h" #include "cmds.h" int cmd_run(int argc, char *argv[]) diff --git a/crypto.c b/crypto.c index 306071f9..0e18b36f 100644 --- a/crypto.c +++ b/crypto.c @@ -15,7 +15,7 @@ #include #include -#include "checksum.h" +#include "libbcachefs/checksum.h" #include "crypto.h" char *read_passphrase(const char *prompt) diff --git a/libbcachefs.c b/libbcachefs.c index b9c3d57a..bb2aee57 100644 --- a/libbcachefs.c +++ b/libbcachefs.c @@ -12,12 +12,12 @@ #include -#include "bcachefs_format.h" -#include "checksum.h" +#include "libbcachefs/bcachefs_format.h" +#include "libbcachefs/checksum.h" #include "crypto.h" #include "libbcachefs.h" -#include "opts.h" -#include "super-io.h" +#include "libbcachefs/opts.h" +#include "libbcachefs/super-io.h" #define NSEC_PER_SEC 1000000000L diff --git a/libbcachefs.h b/libbcachefs.h index 99a4c132..2e49edd8 100644 --- a/libbcachefs.h +++ b/libbcachefs.h @@ -4,9 +4,9 @@ #include #include -#include "bcachefs_format.h" +#include "libbcachefs/bcachefs_format.h" #include "tools-util.h" -#include "vstructs.h" +#include "libbcachefs/vstructs.h" struct format_opts { char *label; diff --git a/tools-util.c b/tools-util.c index 7c88c9d4..90bbda2a 100644 --- a/tools-util.c +++ b/tools-util.c @@ -16,10 +16,10 @@ #include #include -#include "bcachefs_ioctl.h" +#include "libbcachefs/bcachefs_ioctl.h" #include "linux/sort.h" #include "tools-util.h" -#include "util.h" +#include "libbcachefs/util.h" void die(const char *fmt, ...) {