diff mbox series

[01/11] btrfs-progs: fix kerncompat.h include ordering for libbtrfs

Message ID e135e7ccca0e52de2326d446b06271796ec4d4a1.1681938648.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: prep work for syncing files into kernel-shared | expand

Commit Message

Josef Bacik April 19, 2023, 9:13 p.m. UTC
We're keeping a libbtrfs compatible kerncompat.h around to make it
easier to modify the rest of btrfs-progs.  Unfortunately we also use
some of kernel-lib in libbtrfs, and those also include kerncompat.h.
Those getting included first means we'll pull include/kerncompat.h
instead of libbtrfs/kerncompat.h, which will mess things up.

Fix this by making sure we include our local copy of kerncompat.h first
before we include any other header in btrfs-progs.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 libbtrfs/ctree.h      | 4 ++--
 libbtrfs/send-utils.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libbtrfs/ctree.h b/libbtrfs/ctree.h
index e7a51c4b..ea2a680e 100644
--- a/libbtrfs/ctree.h
+++ b/libbtrfs/ctree.h
@@ -22,14 +22,14 @@ 
 #include <stdbool.h>
 
 #if BTRFS_FLAT_INCLUDES
+#include "libbtrfs/kerncompat.h"
 #include "kernel-lib/list.h"
 #include "kernel-lib/rbtree.h"
-#include "libbtrfs/kerncompat.h"
 #include "libbtrfs/ioctl.h"
 #else
+#include <btrfs/kerncompat.h>
 #include <btrfs/list.h>
 #include <btrfs/rbtree.h>
-#include <btrfs/kerncompat.h>
 #include <btrfs/ioctl.h>
 #endif /* BTRFS_FLAT_INCLUDES */
 
diff --git a/libbtrfs/send-utils.c b/libbtrfs/send-utils.c
index 831ec0dc..eb0ed5af 100644
--- a/libbtrfs/send-utils.c
+++ b/libbtrfs/send-utils.c
@@ -24,10 +24,10 @@ 
 #include <fcntl.h>
 #include <limits.h>
 #include <errno.h>
-#include "kernel-lib/rbtree.h"
 #include "libbtrfs/ctree.h"
 #include "libbtrfs/send-utils.h"
 #include "libbtrfs/ioctl.h"
+#include "kernel-lib/rbtree.h"
 
 static int btrfs_subvolid_resolve_sub(int fd, char *path, size_t *path_len,
 				      u64 subvol_id);