btrfs-progs: move fs features declarations to own header from utils
authorDavid Sterba <dsterba@suse.com>
Thu, 26 Jan 2017 12:13:36 +0000 (13:13 +0100)
committerDavid Sterba <dsterba@suse.com>
Wed, 8 Mar 2017 12:00:45 +0000 (13:00 +0100)
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-fi-du.c
convert/main.c
fsfeatures.h [new file with mode: 0644]
mkfs/main.c
utils.c
utils.h

index ef43259d1ccdf5b0d2334e60d954149ac52781d8..f106f45ba3d16d46c6e926409818b65322648236 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "interval_tree_generic.h"
 #include "help.h"
+#include "fsfeatures.h"
 
 static int summarize = 0;
 static unsigned unit_mode = UNITS_RAW;
index 48fb2f95cf9ee8137137478aa0189150e68d0040..39c6eeb41b59500edc71a841caee29afc586a25c 100644 (file)
@@ -40,6 +40,7 @@
 #include "help.h"
 #include "mkfs/common.h"
 #include "convert/common.h"
+#include "fsfeatures.h"
 
 #if BTRFSCONVERT_EXT2
 #include <ext2fs/ext2_fs.h>
diff --git a/fsfeatures.h b/fsfeatures.h
new file mode 100644 (file)
index 0000000..513ed1e
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#ifndef __BTRFS_FSFEATURES_H__
+#define __BTRFS_FSFEATURES_H__
+
+#include "kerncompat.h"
+
+#define BTRFS_MKFS_DEFAULT_NODE_SIZE SZ_16K
+#define BTRFS_MKFS_DEFAULT_FEATURES                            \
+               (BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF           \
+               | BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA)
+
+/*
+ * Avoid multi-device features (RAID56) and mixed block groups
+ */
+#define BTRFS_CONVERT_ALLOWED_FEATURES                         \
+       (BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF                   \
+       | BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL                 \
+       | BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO                   \
+       | BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2                 \
+       | BTRFS_FEATURE_INCOMPAT_BIG_METADATA                   \
+       | BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF                  \
+       | BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA                \
+       | BTRFS_FEATURE_INCOMPAT_NO_HOLES)
+
+#define BTRFS_FEATURE_LIST_ALL         (1ULL << 63)
+
+void btrfs_list_all_fs_features(u64 mask_disallowed);
+char* btrfs_parse_fs_features(char *namelist, u64 *flags);
+void btrfs_process_fs_features(u64 flags);
+void btrfs_parse_features_to_string(char *buf, u64 flags);
+void print_kernel_version(FILE *stream, u32 version);
+u32 get_running_kernel_version(void);
+int btrfs_check_nodesize(u32 nodesize, u32 sectorsize, u64 features);
+
+#endif
index 1c327f1fc51b587d34bbf2fb80ac58a9fdac35f4..0823b4fbf6d95f89e0c888ba0a8067cd4b250f16 100644 (file)
@@ -45,6 +45,7 @@
 #include "list_sort.h"
 #include "help.h"
 #include "mkfs/common.h"
+#include "fsfeatures.h"
 
 static u64 index_cnt = 2;
 static int verbose = 1;
diff --git a/utils.c b/utils.c
index d24993e839a84bb99ff5509b4fcb8a4a054d80f8..9de1ca2b61742214cb6512c20053e36debd7ea42 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -50,6 +50,7 @@
 #include "volumes.h"
 #include "ioctl.h"
 #include "commands.h"
+#include "fsfeatures.h"
 
 #ifndef BLKDISCARD
 #define BLKDISCARD     _IO(0x12,119)
diff --git a/utils.h b/utils.h
index b72260c4495ce41d316a69c232ea0d7ea81535c5..c5ff19f98327b11d6aa40be0e1711a27f4b96992 100644 (file)
--- a/utils.h
+++ b/utils.h
 
 #define BTRFS_MKFS_SYSTEM_GROUP_SIZE SZ_4M
 #define BTRFS_MKFS_SMALL_VOLUME_SIZE SZ_1G
-#define BTRFS_MKFS_DEFAULT_NODE_SIZE SZ_16K
-#define BTRFS_MKFS_DEFAULT_FEATURES                            \
-               (BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF           \
-               | BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA)
-
-/*
- * Avoid multi-device features (RAID56) and mixed block groups
- */
-#define BTRFS_CONVERT_ALLOWED_FEATURES                         \
-       (BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF                   \
-       | BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL                 \
-       | BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO                   \
-       | BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2                 \
-       | BTRFS_FEATURE_INCOMPAT_BIG_METADATA                   \
-       | BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF                  \
-       | BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA                \
-       | BTRFS_FEATURE_INCOMPAT_NO_HOLES)
 
 #define BTRFS_CONVERT_META_GROUP_SIZE SZ_32M
 
-#define BTRFS_FEATURE_LIST_ALL         (1ULL << 63)
-
 #define BTRFS_SCAN_MOUNTED     (1ULL << 0)
 #define BTRFS_SCAN_LBLKID      (1ULL << 1)
 
 void units_set_mode(unsigned *units, unsigned mode);
 void units_set_base(unsigned *units, unsigned base);
 
-void btrfs_list_all_fs_features(u64 mask_disallowed);
-char* btrfs_parse_fs_features(char *namelist, u64 *flags);
-void btrfs_process_fs_features(u64 flags);
-void btrfs_parse_features_to_string(char *buf, u64 flags);
-void print_kernel_version(FILE *stream, u32 version);
-u32 get_running_kernel_version(void);
-
 #define        PREP_DEVICE_ZERO_END    (1U << 0)
 #define        PREP_DEVICE_DISCARD     (1U << 1)
 #define        PREP_DEVICE_VERBOSE     (1U << 2)
@@ -223,7 +197,6 @@ static inline u64 div_factor(u64 num, int factor)
 }
 
 int btrfs_tree_search2_ioctl_supported(int fd);
-int btrfs_check_nodesize(u32 nodesize, u32 sectorsize, u64 features);
 
 unsigned int get_unit_mode_from_arg(int *argc, char *argv[], int df_mode);
 int string_is_numerical(const char *str);