/* 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 struct file; /* ---------------------------------------------------------------------- */ /* mount flags */ #define AuOpt_XINO 1 /* external inode number bitmap and translation table */ #define AuOpt_TRUNC_XINO (1 << 1) /* truncate xino files */ #define AuOpt_PLINK (1 << 6) /* pseudo-link */ #define AuOpt_Def (AuOpt_XINO \ | AuOpt_PLINK) #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) static inline unsigned int au_opts_plink(unsigned int mntflags) { #ifdef CONFIG_PROC_FS return mntflags; #else return mntflags & ~AuOpt_PLINK; #endif } /* ---------------------------------------------------------------------- */ /* policies to select one among multiple writable branches */ enum { AuWbrCreate_TDP, /* top down parent */ /* add more later */ AuWbrCreate_Def = AuWbrCreate_TDP }; enum { AuWbrCopyup_TDP, /* top down parent */ /* add more later */ AuWbrCopyup_Def = AuWbrCopyup_TDP }; /* ---------------------------------------------------------------------- */ struct au_opt_add { aufs_bindex_t bindex; char *pathname; int perm; struct path path; }; struct au_opt_xino { char *path; struct file *file; }; struct au_opt_xino_itrunc { aufs_bindex_t bindex; }; struct au_opt_wbr_create { int wbr_create; /* add more later */ }; struct au_opt { int type; union { struct au_opt_xino xino; struct au_opt_xino_itrunc xino_itrunc; struct au_opt_add add; struct au_opt_wbr_create wbr_create; int wbr_copyup; /* add more later */ }; }; /* 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) struct au_opts { struct au_opt *opt; int max_opt; unsigned int flags; unsigned long sb_flags; }; /* ---------------------------------------------------------------------- */ /* opts.c */ void au_optstr_br_perm(au_br_perm_str_t *str, int perm); const char *au_optstr_wbr_copyup(int wbr_copyup); const char *au_optstr_wbr_create(int wbr_create); 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_verify(struct super_block *sb, unsigned long sb_flags, unsigned int pending); int au_opts_mount(struct super_block *sb, struct au_opts *opts); #endif /* __KERNEL__ */ #endif /* __AUFS_OPTS_H__ */