opts.h 2.13 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2005-2019 Junjiro R. Okajima
 */

/*
 * mount options/flags
 */

#ifndef __AUFS_OPTS_H__
#define __AUFS_OPTS_H__

#ifdef __KERNEL__

#include <linux/path.h>

J. R. Okajima's avatar
J. R. Okajima committed
17
18
struct file;

J. R. Okajima's avatar
J. R. Okajima committed
19
20
21
22
23
/* ---------------------------------------------------------------------- */

/* mount flags */
#define AuOpt_XINO		1		/* external inode number bitmap
						   and translation table */
J. R. Okajima's avatar
J. R. Okajima committed
24
#define AuOpt_TRUNC_XINO	(1 << 1)	/* truncate xino files */
25
#define AuOpt_PLINK		(1 << 6)	/* pseudo-link */
J. R. Okajima's avatar
J. R. Okajima committed
26

27
28
#define AuOpt_Def	(AuOpt_XINO \
			 | AuOpt_PLINK)
J. R. Okajima's avatar
J. R. Okajima committed
29
30
31
32
33
34
35
36
37

#define au_opt_test(flags, name)	(flags & AuOpt_##name)
#define au_opt_set(flags, name) do { \
	((flags) |= AuOpt_##name); \
} while (0)
#define au_opt_clr(flags, name) do { \
	((flags) &= ~AuOpt_##name); \
} while (0)

38
39
40
41
42
43
44
45
46
static inline unsigned int au_opts_plink(unsigned int mntflags)
{
#ifdef CONFIG_PROC_FS
	return mntflags;
#else
	return mntflags & ~AuOpt_PLINK;
#endif
}

J. R. Okajima's avatar
J. R. Okajima committed
47
48
/* ---------------------------------------------------------------------- */

49
50
51
52
53
54
55
struct au_opt_add {
	aufs_bindex_t	bindex;
	char		*pathname;
	int		perm;
	struct path	path;
};

J. R. Okajima's avatar
J. R. Okajima committed
56
57
58
59
60
struct au_opt_xino {
	char		*path;
	struct file	*file;
};

J. R. Okajima's avatar
J. R. Okajima committed
61
62
63
64
struct au_opt_xino_itrunc {
	aufs_bindex_t	bindex;
};

65
66
67
struct au_opt {
	int type;
	union {
J. R. Okajima's avatar
J. R. Okajima committed
68
		struct au_opt_xino	xino;
J. R. Okajima's avatar
J. R. Okajima committed
69
		struct au_opt_xino_itrunc xino_itrunc;
70
71
72
73
74
		struct au_opt_add	add;
		/* add more later */
	};
};

J. R. Okajima's avatar
J. R. Okajima committed
75
76
77
78
79
80
81
82
/* opts flags */
#define AuOpts_TRUNC_XIB	(1 << 2)
#define au_ftest_opts(flags, name)	((flags) & AuOpts_##name)
#define au_fset_opts(flags, name) \
	do { (flags) |= AuOpts_##name; } while (0)
#define au_fclr_opts(flags, name) \
	do { (flags) &= ~AuOpts_##name; } while (0)

83
84
85
struct au_opts {
	struct au_opt	*opt;
	int		max_opt;
86

J. R. Okajima's avatar
J. R. Okajima committed
87
	unsigned int	flags;
88
	unsigned long	sb_flags;
89
90
};

91
92
93
94
95
96
97
98
99
100
/* ---------------------------------------------------------------------- */

/* opts.c */
void au_optstr_br_perm(au_br_perm_str_t *str, int perm);

void au_opts_free(struct au_opts *opts);
struct super_block;
int au_opts_parse(struct super_block *sb, char *str, struct au_opts *opts);
int au_opts_mount(struct super_block *sb, struct au_opts *opts);

101
102
#endif /* __KERNEL__ */
#endif /* __AUFS_OPTS_H__ */