btrfs-progs: mkfs: use const char for label
[platform/upstream/btrfs-progs.git] / mkfs / common.h
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public
4  * License v2 as published by the Free Software Foundation.
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9  * General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the
13  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
14  * Boston, MA 021110-1307, USA.
15  */
16
17 /*
18  * Defines and function declarations for users of the mkfs API, no internal
19  * defintions.
20  */
21
22 #ifndef __BTRFS_MKFS_COMMON_H__
23 #define __BTRFS_MKFS_COMMON_H__
24
25 #include "kerncompat.h"
26 #include "common-defs.h"
27
28 #define BTRFS_MKFS_SYSTEM_GROUP_SIZE SZ_4M
29 #define BTRFS_MKFS_SMALL_VOLUME_SIZE SZ_1G
30
31 struct btrfs_mkfs_config {
32         /* Label of the new filesystem */
33         const char *label;
34         /* Blck sizes */
35         u32 nodesize;
36         u32 sectorsize;
37         u32 stripesize;
38         /* Bitfield of incompat features, BTRFS_FEATURE_INCOMPAT_* */
39         u64 features;
40         /* Size of the filesystem in bytes */
41         u64 num_bytes;
42
43         /* Output fields, set during creation */
44
45         /* Logical addresses of superblock [0] and other tree roots */
46         u64 blocks[8];
47         char fs_uuid[BTRFS_UUID_UNPARSED_SIZE];
48         char chunk_uuid[BTRFS_UUID_UNPARSED_SIZE];
49
50         /* Superblock offset after make_btrfs */
51         u64 super_bytenr;
52 };
53
54 int make_btrfs(int fd, struct btrfs_mkfs_config *cfg);
55 u64 btrfs_min_dev_size(u32 nodesize);
56 u64 btrfs_min_global_blk_rsv_size(u32 nodesize);
57 int test_minimum_size(const char *file, u32 nodesize);
58 int is_vol_small(const char *file);
59 int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
60         u64 dev_cnt, int mixed, int ssd);
61 int test_dev_for_mkfs(const char *file, int force_overwrite);
62
63 #endif