]>
Commit | Line | Data |
---|---|---|
bbb1e54d MS |
1 | /* |
2 | * | |
3 | * Copyright (C) 2011 Novell Inc. | |
4 | * Copyright (C) 2016 Red Hat, Inc. | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License version 2 as published by | |
8 | * the Free Software Foundation. | |
9 | */ | |
10 | ||
11 | struct ovl_config { | |
12 | char *lowerdir; | |
13 | char *upperdir; | |
14 | char *workdir; | |
15 | bool default_permissions; | |
a6c60655 | 16 | bool redirect_dir; |
438c84c2 MS |
17 | bool redirect_follow; |
18 | const char *redirect_mode; | |
02bcd157 | 19 | bool index; |
bbb1e54d MS |
20 | }; |
21 | ||
b9343632 CR |
22 | struct ovl_layer { |
23 | struct vfsmount *mnt; | |
2a9c6d06 | 24 | dev_t pseudo_dev; |
b9343632 CR |
25 | }; |
26 | ||
27 | struct ovl_path { | |
28 | struct ovl_layer *layer; | |
29 | struct dentry *dentry; | |
30 | }; | |
31 | ||
bbb1e54d MS |
32 | /* private information held for overlayfs's superblock */ |
33 | struct ovl_fs { | |
34 | struct vfsmount *upper_mnt; | |
35 | unsigned numlower; | |
b9343632 | 36 | struct ovl_layer *lower_layers; |
2cac0c00 AG |
37 | /* workbasedir is the path at workdir= mount option */ |
38 | struct dentry *workbasedir; | |
39 | /* workdir is the 'work' directory under workbasedir */ | |
bbb1e54d | 40 | struct dentry *workdir; |
02bcd157 AG |
41 | /* index directory listing overlay inodes by origin file handle */ |
42 | struct dentry *indexdir; | |
6b2d5fe4 | 43 | long namelen; |
bbb1e54d MS |
44 | /* pathnames of lower and upper dirs, for show_options */ |
45 | struct ovl_config config; | |
46 | /* creds of process who forced instantiation of super block */ | |
47 | const struct cred *creator_cred; | |
e7f52429 | 48 | bool tmpfile; |
82b749b2 | 49 | bool noxattr; |
7bcd74b9 AG |
50 | /* sb common to all layers */ |
51 | struct super_block *same_sb; | |
85fdee1e AG |
52 | /* Did we take the inuse lock? */ |
53 | bool upperdir_locked; | |
54 | bool workdir_locked; | |
bbb1e54d MS |
55 | }; |
56 | ||
57 | /* private information held for every overlayfs dentry */ | |
58 | struct ovl_entry { | |
bbb1e54d | 59 | union { |
55acc661 MS |
60 | struct { |
61 | unsigned long has_upper; | |
62 | bool opaque; | |
63 | }; | |
bbb1e54d MS |
64 | struct rcu_head rcu; |
65 | }; | |
66 | unsigned numlower; | |
b9343632 | 67 | struct ovl_path lowerstack[]; |
bbb1e54d MS |
68 | }; |
69 | ||
70 | struct ovl_entry *ovl_alloc_entry(unsigned int numlower); | |
71 | ||
13cf199d | 72 | struct ovl_inode { |
04a01ac7 | 73 | struct ovl_dir_cache *cache; |
cf31c463 | 74 | const char *redirect; |
04a01ac7 | 75 | u64 version; |
13c72075 | 76 | unsigned long flags; |
13cf199d | 77 | struct inode vfs_inode; |
09d8b586 | 78 | struct dentry *__upperdentry; |
25b7713a | 79 | struct inode *lower; |
a015dafc AG |
80 | |
81 | /* synchronize copy up and more */ | |
82 | struct mutex lock; | |
13cf199d AG |
83 | }; |
84 | ||
85 | static inline struct ovl_inode *OVL_I(struct inode *inode) | |
86 | { | |
87 | return container_of(inode, struct ovl_inode, vfs_inode); | |
88 | } | |
09d8b586 MS |
89 | |
90 | static inline struct dentry *ovl_upperdentry_dereference(struct ovl_inode *oi) | |
91 | { | |
506458ef | 92 | return READ_ONCE(oi->__upperdentry); |
09d8b586 | 93 | } |