btrfs-progs: fix kerncompat.h include ordering for libbtrfs

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>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2023-04-19 17:13:43 -04:00 committed by David Sterba
parent 54afdeecda
commit 78e5887fea
2 changed files with 3 additions and 3 deletions

View File

@ -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 */

View File

@ -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);