]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs.h
New upstream release
[bcachefs-tools-debian] / libbcachefs.h
index 17e8eef3d9998d037c2787e2c431647e5e17e933..ba5d380768e48db25daa2438e6240ccaccc8e530 100644 (file)
@@ -32,7 +32,7 @@ void bch2_opts_usage(unsigned);
 
 struct format_opts {
        char            *label;
-       uuid_le         uuid;
+       __uuid_t        uuid;
        unsigned        version;
        unsigned        superblock_size;
        bool            encrypted;
@@ -41,8 +41,12 @@ struct format_opts {
 
 static inline struct format_opts format_opts_default()
 {
+       unsigned version = !access(   "/sys/module/bcachefs/parameters/version", R_OK)
+           ? read_file_u64(AT_FDCWD, "/sys/module/bcachefs/parameters/version")
+           : bcachefs_metadata_version_current;
+
        return (struct format_opts) {
-               .version                = bcachefs_metadata_version_current,
+               .version                = version,
                .superblock_size        = SUPERBLOCK_SIZE_DEFAULT,
        };
 }
@@ -84,9 +88,9 @@ struct bch_sb *__bch2_super_read(int, u64);
 int bcachectl_open(void);
 
 struct bchfs_handle {
-       uuid_le uuid;
-       int     ioctl_fd;
-       int     sysfs_fd;
+       __uuid_t        uuid;
+       int             ioctl_fd;
+       int             sysfs_fd;
 };
 
 void bcache_fs_close(struct bchfs_handle);
@@ -235,7 +239,7 @@ struct dev_name {
        unsigned        idx;
        char            *dev;
        char            *label;
-       uuid_le         uuid;
+       uuid_         uuid;
 };
 typedef DARRAY(struct dev_name) dev_names;