~ubuntu-branches/ubuntu/vivid/aufs/vivid

« back to all changes in this revision

Viewing changes to fs/aufs/opts.h

  • Committer: Bazaar Package Importer
  • Author(s): Julian Andres Klode
  • Date: 2008-05-06 18:35:50 UTC
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20080506183550-7y7mrzkzkh2tjlfu
Tags: upstream-0+20080506
ImportĀ upstreamĀ versionĀ 0+20080506

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 */
18
18
 
19
19
/*
20
 
 * mount option/flags
 
20
 * mount options/flags
21
21
 *
22
 
 * $Id: opts.h,v 1.29 2008/03/31 07:45:32 sfjro Exp $
 
22
 * $Id: opts.h,v 1.31 2008/04/13 23:44:15 sfjro Exp $
23
23
 */
24
24
 
25
25
#ifndef __AUFS_OPTS_H__
42
42
/* mount flags */
43
43
 
44
44
/* external inode number bitmap and translation table */
45
 
enum {
46
 
        AuXino_NONE,
47
 
        AuXino_XINO,
48
 
        AuXino_XIB
49
 
};
50
 
 
51
 
/* users direct branch access */
52
 
enum {
53
 
        AuUdba_NONE,
54
 
        AuUdba_REVAL,
55
 
        AuUdba_INOTIFY
56
 
};
57
 
 
58
 
/* copyup on open */
59
 
enum {
60
 
        AuCoo_NONE,
61
 
        AuCoo_LEAF,
62
 
        AuCoo_ALL
63
 
};
 
45
#define AuOpt_XINO              1
 
46
#define AuOpt_TRUNC_XINO        (1 << 1)
 
47
#define AuOpt_LINO              (1 << 2)
 
48
#define AuOpt_UDBA_NONE         (1 << 3)        /* users direct branch access */
 
49
#define AuOpt_UDBA_REVAL        (1 << 4)
 
50
#define AuOpt_UDBA_INOTIFY      (1 << 5)
 
51
#define AuOpt_SHWH              (1 << 6)
 
52
#define AuOpt_PLINK             (1 << 7)
 
53
#define AuOpt_WARN_PERM         (1 << 8)
 
54
#define AuOpt_DIRPERM1          (1 << 9)
 
55
#define AuOpt_DLGT              (1 << 10)
 
56
#define AuOpt_COO_NONE          (1 << 11)       /* copyup on open */
 
57
#define AuOpt_COO_LEAF          (1 << 12)
 
58
#define AuOpt_COO_ALL           (1 << 13)
 
59
#define AuOpt_ALWAYS_DIROPQ     (1 << 14)
 
60
#define AuOpt_REFROF            (1 << 15)
 
61
#define AuOpt_VERBOSE           (1 << 16)
 
62
#ifndef CONFIG_AUFS_HINOTIFY
 
63
#undef AuOpt_UDBA_INOTIFY
 
64
#define AuOpt_UDBA_INOTIFY      0
 
65
#endif
 
66
#ifndef CONFIG_AUFS_SHWH
 
67
#undef AuOpt_SHWH
 
68
#define AuOpt_SHWH              0
 
69
#endif
 
70
#ifndef CONFIG_AUFS_DLGT
 
71
#undef AuOpt_DIRPERM1
 
72
#define AuOpt_DIRPERM1          0
 
73
#undef AuOpt_DLGT
 
74
#define AuOpt_DLGT              0
 
75
#endif
64
76
 
65
77
/* policies to select one among multiple writable branches */
66
78
enum {
72
84
        AuWbrCreate_MFSRRV,     /* mfs then rr with seconds */
73
85
        AuWbrCreate_PMFS,       /* parent and mfs */
74
86
        AuWbrCreate_PMFSV,      /* parent and mfs with seconds */
75
 
        AuWbrCreate_Last
 
87
 
 
88
        AuWbrCreate_Def = AuWbrCreate_TDP
76
89
};
77
90
 
78
91
enum {
79
92
        AuWbrCopyup_TDP,        /* top down parent */
80
93
        AuWbrCopyup_BUP,        /* bottom up parent */
81
 
        AuWbrCopyup_BU          /* bottom up */
82
 
};
83
 
 
84
 
/* revert it to bit-shift? */
85
 
//todo: stop usgin bit-fields.
86
 
struct au_opts_flags {
87
 
        unsigned int    f_xino:2;
88
 
        unsigned int    f_lino:1;
89
 
        unsigned int    f_trunc_xino:1;
90
 
        unsigned int    f_dirperm1:1;
91
 
        unsigned int    f_udba:2;
92
 
        unsigned int    f_shwh:1;
93
 
        unsigned int    f_dlgt:1;
94
 
        unsigned int    f_plink:1;
95
 
        unsigned int    f_warn_perm:1;
96
 
        unsigned int    f_coo:2;
97
 
        unsigned int    f_always_diropq:1;
98
 
        unsigned int    f_refrof:1;
99
 
        unsigned int    f_verbose:1;
100
 
        unsigned int    f_wbr_copyup:2;
101
 
        unsigned int    f_wbr_create:3;
102
 
};
 
94
        AuWbrCopyup_BU,         /* bottom up */
 
95
 
 
96
        AuWbrCopyup_Def = AuWbrCopyup_TDP
 
97
};
 
98
 
 
99
#define AuOptMask_COO           (AuOpt_COO_NONE \
 
100
                                 | AuOpt_COO_LEAF \
 
101
                                 | AuOpt_COO_ALL)
 
102
#define AuOptMask_UDBA          (AuOpt_UDBA_NONE \
 
103
                                 | AuOpt_UDBA_REVAL \
 
104
                                 | AuOpt_UDBA_INOTIFY)
 
105
 
 
106
/* ---------------------------------------------------------------------- */
 
107
 
 
108
#define au_opt_test(flags, name)        ((flags) & AuOpt_##name)
 
109
#define au_opt_set(flags, name)         { ((flags) |= AuOpt_##name); }
 
110
#define au_opt_clr(flags, name)         { ((flags) &= ~AuOpt_##name); }
 
111
 
 
112
#define au_opt_set_coo(flags, name) do { \
 
113
        (flags) &= ~AuOptMask_COO; \
 
114
        au_opt_set(flags, name); \
 
115
} while(0)
 
116
 
 
117
#define au_opt_set_udba(flags, name) do { \
 
118
        (flags) &= ~AuOptMask_UDBA; \
 
119
        au_opt_set(flags, name); \
 
120
} while(0)
 
121
 
 
122
/* ---------------------------------------------------------------------- */
 
123
 
 
124
#ifdef CONFIG_AUFS_COMPAT
 
125
#define AuOpt_DefExtra1 AuOpt_ALWAYS_DIROPQ
 
126
#else
 
127
#define AuOpt_DefExtra1 0
 
128
#endif
 
129
 
 
130
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
 
131
#define AuOpt_DefExtra2 AuOpt_PLINK
 
132
#else
 
133
#define AuOpt_DefExtra2 0
 
134
#endif
 
135
 
 
136
#define AuOpt_Def       (AuOpt_XINO \
 
137
                         | AuOpt_UDBA_REVAL \
 
138
                         | AuOpt_WARN_PERM \
 
139
                         | AuOpt_COO_NONE \
 
140
                         | AuOpt_DefExtra1 \
 
141
                         | AuOpt_DefExtra2)
103
142
 
104
143
/* ---------------------------------------------------------------------- */
105
144
 
173
212
        struct au_opt   *opt;
174
213
        int             max_opt;
175
214
 
176
 
        struct au_opts_flags given;
 
215
        unsigned int    given_udba;
177
216
        unsigned int    flags;
178
217
};
179
218
 
180
219
/* ---------------------------------------------------------------------- */
181
220
 
182
 
void au_opts_flags_def(struct au_opts_flags *flags);
183
221
au_parser_pattern_t au_optstr_br_perm(int brperm);
184
222
au_parser_pattern_t au_optstr_udba(int udba);
185
223
au_parser_pattern_t au_optstr_coo(int coo);
192
230
int au_opts_mount(struct super_block *sb, struct au_opts *opts);
193
231
int au_opts_remount(struct super_block *sb, struct au_opts *opts);
194
232
 
 
233
/* ---------------------------------------------------------------------- */
 
234
 
 
235
static inline unsigned int au_opt_test_dlgt(unsigned int flags)
 
236
{
 
237
        return !!(au_opt_test(flags, DLGT) && !au_test_wkq(current));
 
238
}
 
239
 
 
240
static inline unsigned int au_opt_test_dirperm1(unsigned int flags)
 
241
{
 
242
        return !!(au_opt_test(flags, DIRPERM1) && !au_test_wkq(current));
 
243
}
 
244
 
195
245
#endif /* __KERNEL__ */
196
246
#endif /* __AUFS_OPTS_H__ */