summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-06-24 13:39:01 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-06-24 13:39:01 -0400
commit77034e4342b581b104aefc89b8c9aa183b508b0d (patch)
treecf649d6dfd6bd27951a0c7de9bd4da91f2dfd254
parentedcd38ce0ae466b9529e6a276bdc6390d00d2cf5 (diff)
bcachefs: uuid_t -> __uuid_t
The uuid_t the kernel defines is different from uuid_t as defined by libuuid, which is a problem because we need to use libuuid when building in userspace. Switch references to uuid_t to __uuid_t to fix this. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/bcachefs.h7
-rw-r--r--fs/bcachefs/bcachefs_format.h14
-rw-r--r--fs/bcachefs/bcachefs_ioctl.h2
-rw-r--r--fs/bcachefs/super-io.c4
-rw-r--r--fs/bcachefs/super-io.h4
-rw-r--r--fs/bcachefs/super.c6
-rw-r--r--fs/bcachefs/super.h2
7 files changed, 21 insertions, 18 deletions
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 1ae493d1c60c..524c36b96d1a 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -489,7 +489,7 @@ struct bch_dev {
* Committed by bch2_write_super() -> bch_fs_mi_update()
*/
struct bch_member_cpu mi;
- uuid_t uuid;
+ __uuid_t uuid;
char name[BDEVNAME_SIZE];
struct bch_sb_handle disk_sb;
@@ -707,8 +707,8 @@ struct bch_fs {
/* Updated by bch2_sb_update():*/
struct {
- uuid_t uuid;
- uuid_t user_uuid;
+ __uuid_t uuid;
+ __uuid_t user_uuid;
u16 version;
u16 version_min;
@@ -726,7 +726,6 @@ struct bch_fs {
u64 compat;
} sb;
-
struct bch_sb_handle disk_sb;
unsigned short block_bits; /* ilog2(block_size) */
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h
index b0961261c6d9..ad87cdff8544 100644
--- a/fs/bcachefs/bcachefs_format.h
+++ b/fs/bcachefs/bcachefs_format.h
@@ -78,6 +78,10 @@
#include <linux/uuid.h>
#include "vstructs.h"
+#ifdef __KERNEL__
+typedef uuid_t __uuid_t;
+#endif
+
#define BITMASK(name, type, field, offset, end) \
static const unsigned name##_OFFSET = offset; \
static const unsigned name##_BITS = (end - offset); \
@@ -1215,7 +1219,7 @@ struct bch_sb_field_journal_v2 {
#define BCH_MIN_NR_NBUCKETS (1 << 6)
struct bch_member {
- uuid_t uuid;
+ __uuid_t uuid;
__le64 nbuckets; /* device size */
__le16 first_bucket; /* index of first bucket used */
__le16 bucket_size; /* sectors */
@@ -1596,7 +1600,7 @@ static const unsigned bcachefs_metadata_required_upgrade_below = bcachefs_metada
#define BCH_SB_MEMBERS_MAX 64 /* XXX kill */
struct bch_sb_layout {
- uuid_t magic; /* bcachefs superblock UUID */
+ __uuid_t magic; /* bcachefs superblock UUID */
__u8 layout_type;
__u8 sb_max_size_bits; /* base 2 of 512 byte sectors */
__u8 nr_superblocks;
@@ -1627,9 +1631,9 @@ struct bch_sb {
__le16 version;
__le16 version_min;
__le16 pad[2];
- uuid_t magic;
- uuid_t uuid;
- uuid_t user_uuid;
+ __uuid_t magic;
+ __uuid_t uuid;
+ __uuid_t user_uuid;
__u8 label[BCH_SB_LABEL_SIZE];
__le64 offset;
__le64 seq;
diff --git a/fs/bcachefs/bcachefs_ioctl.h b/fs/bcachefs/bcachefs_ioctl.h
index 41608186198c..f05881f7e113 100644
--- a/fs/bcachefs/bcachefs_ioctl.h
+++ b/fs/bcachefs/bcachefs_ioctl.h
@@ -93,7 +93,7 @@ struct bch_ioctl_incremental {
* this UUID.
*/
struct bch_ioctl_query_uuid {
- uuid_t uuid;
+ __uuid_t uuid;
};
#if 0
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index a22f423bdb9a..6713e614b05a 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -298,12 +298,12 @@ static int bch2_sb_validate(struct bch_sb_handle *disk_sb, struct printbuf *out,
return -BCH_ERR_invalid_sb_block_size;
}
- if (bch2_is_zero(sb->user_uuid.b, sizeof(uuid_t))) {
+ if (bch2_is_zero(&sb->user_uuid, sizeof(sb->user_uuid))) {
prt_printf(out, "Bad user UUID (got zeroes)");
return -BCH_ERR_invalid_sb_uuid;
}
- if (bch2_is_zero(sb->uuid.b, sizeof(uuid_t))) {
+ if (bch2_is_zero(&sb->uuid, sizeof(sb->uuid))) {
prt_printf(out, "Bad intenal UUID (got zeroes)");
return -BCH_ERR_invalid_sb_uuid;
}
diff --git a/fs/bcachefs/super-io.h b/fs/bcachefs/super-io.h
index 6dcc0947c2ec..ab0ad3248e8f 100644
--- a/fs/bcachefs/super-io.h
+++ b/fs/bcachefs/super-io.h
@@ -79,7 +79,7 @@ static inline void bch2_check_set_feature(struct bch_fs *c, unsigned feat)
static inline bool bch2_member_exists(struct bch_member *m)
{
- return !bch2_is_zero(m->uuid.b, sizeof(uuid_t));
+ return !bch2_is_zero(&m->uuid, sizeof(m->uuid));
}
static inline bool bch2_dev_exists(struct bch_sb *sb,
@@ -104,7 +104,7 @@ static inline struct bch_member_cpu bch2_mi_to_cpu(struct bch_member *mi)
? BCH_MEMBER_DURABILITY(mi) - 1
: 1,
.freespace_initialized = BCH_MEMBER_FREESPACE_INITIALIZED(mi),
- .valid = !bch2_is_zero(mi->uuid.b, sizeof(uuid_t)),
+ .valid = bch2_member_exists(mi),
};
}
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index e31548a3bd00..99b7670511c4 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -139,20 +139,20 @@ found:
return c;
}
-static struct bch_fs *__bch2_uuid_to_fs(uuid_t uuid)
+static struct bch_fs *__bch2_uuid_to_fs(__uuid_t uuid)
{
struct bch_fs *c;
lockdep_assert_held(&bch_fs_list_lock);
list_for_each_entry(c, &bch_fs_list, list)
- if (!memcmp(&c->disk_sb.sb->uuid, &uuid, sizeof(uuid_t)))
+ if (!memcmp(&c->disk_sb.sb->uuid, &uuid, sizeof(uuid)))
return c;
return NULL;
}
-struct bch_fs *bch2_uuid_to_fs(uuid_t uuid)
+struct bch_fs *bch2_uuid_to_fs(__uuid_t uuid)
{
struct bch_fs *c;
diff --git a/fs/bcachefs/super.h b/fs/bcachefs/super.h
index 1087d88330d1..36bcb9ec2b3a 100644
--- a/fs/bcachefs/super.h
+++ b/fs/bcachefs/super.h
@@ -223,7 +223,7 @@ static inline bool is_superblock_bucket(struct bch_dev *ca, u64 b)
}
struct bch_fs *bch2_dev_to_fs(dev_t);
-struct bch_fs *bch2_uuid_to_fs(uuid_t);
+struct bch_fs *bch2_uuid_to_fs(__uuid_t);
bool bch2_dev_state_allowed(struct bch_fs *, struct bch_dev *,
enum bch_member_state, int);