File: rootdir.h

package info (click to toggle)
btrfs-progs 6.17.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,612 kB
  • sloc: ansic: 127,282; sh: 7,915; python: 1,384; makefile: 900; asm: 296
file content (78 lines) | stat: -rw-r--r-- 2,426 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * 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.
 */

/*
 * Defines and functions declarations for mkfs --rootdir
 */

#ifndef __BTRFS_MKFS_ROOTDIR_H__
#define __BTRFS_MKFS_ROOTDIR_H__

#include "kerncompat.h"
#include <sys/types.h>
#include <stdbool.h>
#include <limits.h>
#include "kernel-lib/list.h"
#include "kernel-shared/compression.h"

#define ZLIB_BTRFS_DEFAULT_LEVEL		3
#define ZLIB_BTRFS_MAX_LEVEL			9

#define ZSTD_BTRFS_DEFAULT_LEVEL		3
#define ZSTD_BTRFS_MAX_LEVEL			15

struct btrfs_fs_info;
struct btrfs_root;

struct rootdir_subvol {
	struct list_head list;
	/* The path inside the source_dir. */
	char dir[PATH_MAX];
	/* st_dev and st_ino is going to uniquely determine an inode inside the host fs. */
	dev_t st_dev;
	ino_t st_ino;
	bool is_default;
	bool readonly;
};

/*
 * Represent a flag for specified inode at "$source_dir/$inode_path".
 */
struct rootdir_inode_flags_entry {
	struct list_head list;
	/* Path inside the source directory. */
	char inode_path[PATH_MAX];
	/* st_dev and st_ino is going to uniquely determine an inode inside the host fs. */
	dev_t st_dev;
	ino_t st_ino;

	bool nodatacow;
	bool nodatasum;
};

int btrfs_mkfs_validate_subvols(const char *source_dir, struct list_head *subvols);
int btrfs_mkfs_validate_inode_flags(const char *source_dir, struct list_head *inode_flags);
int btrfs_mkfs_fill_dir(struct btrfs_trans_handle *trans, const char *source_dir,
			struct btrfs_root *root, struct list_head *subvols,
			struct list_head *inode_flags_list,
			enum btrfs_compression_type compression,
			unsigned int compression_level, bool do_reflink);
u64 btrfs_mkfs_size_dir(const char *dir_name, u32 sectorsize, u64 min_dev_size,
			u64 meta_profile, u64 data_profile);
int btrfs_mkfs_shrink_fs(struct btrfs_fs_info *fs_info, u64 *new_size_ret,
			 bool shrink_file_size);

#endif