Subject: linux-next: build failure after merge of the btrfs tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 21 Apr 2020 10:25:20 +1000

Hi all,

After merging the btrfs tree, today's linux-next build (x86_64
allmodconfig) failed like this:

In file included from <command-line>:32:
./usr/include/linux/btrfs_tree.h:1127:2: error: unknown type name 'u8'
 1127 |  u8 tree_root_level;
      |  ^~
./usr/include/linux/btrfs_tree.h:1128:2: error: unknown type name 'u8'
 1128 |  u8 chunk_root_level;
      |  ^~
./usr/include/linux/btrfs_tree.h:1129:2: error: unknown type name 'u8'
 1129 |  u8 extent_root_level;
      |  ^~
./usr/include/linux/btrfs_tree.h:1130:2: error: unknown type name 'u8'
 1130 |  u8 fs_root_level;
      |  ^~
./usr/include/linux/btrfs_tree.h:1131:2: error: unknown type name 'u8'
 1131 |  u8 dev_root_level;
      |  ^~
./usr/include/linux/btrfs_tree.h:1132:2: error: unknown type name 'u8'
 1132 |  u8 csum_root_level;
      |  ^~
./usr/include/linux/btrfs_tree.h:1134:2: error: unknown type name 'u8'
 1134 |  u8 unused_8[10];
      |  ^~
./usr/include/linux/btrfs_tree.h:1148:2: error: unknown type name 'u8'
 1148 |  u8 csum[BTRFS_CSUM_SIZE];
      |  ^~
./usr/include/linux/btrfs_tree.h:1150:2: error: unknown type name 'u8'
 1150 |  u8 fsid[BTRFS_FSID_SIZE];
      |  ^~
./usr/include/linux/btrfs_tree.h:1177:2: error: unknown type name 'u8'
 1177 |  u8 root_level;
      |  ^~
./usr/include/linux/btrfs_tree.h:1178:2: error: unknown type name 'u8'
 1178 |  u8 chunk_root_level;
      |  ^~
./usr/include/linux/btrfs_tree.h:1179:2: error: unknown type name 'u8'
 1179 |  u8 log_root_level;
      |  ^~
./usr/include/linux/btrfs_tree.h:1188:2: error: unknown type name 'u8'
 1188 |  u8 metadata_uuid[BTRFS_FSID_SIZE];
      |  ^~
./usr/include/linux/btrfs_tree.h:1192:2: error: unknown type name 'u8'
 1192 |  u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
      |  ^~
./usr/include/linux/btrfs_tree.h:1283:2: error: unknown type name 'u8'
 1283 |  u8 csum[BTRFS_CSUM_SIZE];
      |  ^~
./usr/include/linux/btrfs_tree.h:1284:2: error: unknown type name 'u8'
 1284 |  u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
      |  ^~
./usr/include/linux/btrfs_tree.h:1289:2: error: unknown type name 'u8'
 1289 |  u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
      |  ^~
./usr/include/linux/btrfs_tree.h:1293:2: error: unknown type name 'u8'
 1293 |  u8 level;
      |  ^~

Caused by commit

  8d80a063d508 ("btrfs: move on-disk structure definitions to btrfs_tree.h")

They should probably all be __u8 ...

I have applied the following patch for today.

From: Stephen Rothwell <[email-masked]>
Date: Tue, 21 Apr 2020 10:19:20 +1000
Subject: [PATCH] btrfs: uapi headers should use __<type>

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 include/uapi/linux/btrfs_tree.h | 36 ++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index a02318e4d2a9..1adf5971a966 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -1124,14 +1124,14 @@ struct btrfs_root_backup {
 	/* future */
 	__le64 unused_64[4];
 
-	u8 tree_root_level;
-	u8 chunk_root_level;
-	u8 extent_root_level;
-	u8 fs_root_level;
-	u8 dev_root_level;
-	u8 csum_root_level;
+	__u8 tree_root_level;
+	__u8 chunk_root_level;
+	__u8 extent_root_level;
+	__u8 fs_root_level;
+	__u8 dev_root_level;
+	__u8 csum_root_level;
 	/* future and to align */
-	u8 unused_8[10];
+	__u8 unused_8[10];
 } __attribute__ ((__packed__));
 
 /*
@@ -1145,9 +1145,9 @@ struct btrfs_root_backup {
 /* The super block basically lists the main trees of the FS. */
 struct btrfs_super_block {
 	/* The first 4 fields must match struct btrfs_header */
-	u8 csum[BTRFS_CSUM_SIZE];
+	__u8 csum[BTRFS_CSUM_SIZE];
 	/* FS specific UUID, visible to user */
-	u8 fsid[BTRFS_FSID_SIZE];
+	__u8 fsid[BTRFS_FSID_SIZE];
 	__le64 bytenr; /* this block number */
 	__le64 flags;
 
@@ -1174,9 +1174,9 @@ struct btrfs_super_block {
 	__le64 compat_ro_flags;
 	__le64 incompat_flags;
 	__le16 csum_type;
-	u8 root_level;
-	u8 chunk_root_level;
-	u8 log_root_level;
+	__u8 root_level;
+	__u8 chunk_root_level;
+	__u8 log_root_level;
 	struct btrfs_dev_item dev_item;
 
 	char label[BTRFS_LABEL_SIZE];
@@ -1185,11 +1185,11 @@ struct btrfs_super_block {
 	__le64 uuid_tree_generation;
 
 	/* The UUID written into btree blocks */
-	u8 metadata_uuid[BTRFS_FSID_SIZE];
+	__u8 metadata_uuid[BTRFS_FSID_SIZE];
 
 	/* Future expansion */
 	__le64 reserved[28];
-	u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
+	__u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
 	struct btrfs_root_backup super_roots[BTRFS_NUM_BACKUP_ROOTS];
 } __attribute__ ((__packed__));
 
@@ -1280,17 +1280,17 @@ struct btrfs_super_block {
 /* Every tree block (leaf or node) starts with this header. */
 struct btrfs_header {
 	/* These first four must match the super block */
-	u8 csum[BTRFS_CSUM_SIZE];
-	u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
+	__u8 csum[BTRFS_CSUM_SIZE];
+	__u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
 	__le64 bytenr; /* Which block this node is supposed to live in */
 	__le64 flags;
 
 	/* Allowed to be different from the super from here on down. */
-	u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
+	__u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
 	__le64 generation;
 	__le64 owner;
 	__le32 nritems;
-	u8 level;
+	__u8 level;
 } __attribute__ ((__packed__));
 
 /*
-- 
2.25.1

-- 
Cheers,
Stephen Rothwell