]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - fs/overlayfs/ovl_entry.h
ovl: use struct copy_up_ctx as function argument
[mirror_ubuntu-hirsute-kernel.git] / fs / overlayfs / ovl_entry.h
CommitLineData
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
11struct ovl_config {
12 char *lowerdir;
13 char *upperdir;
14 char *workdir;
15 bool default_permissions;
a6c60655 16 bool redirect_dir;
02bcd157 17 bool index;
bbb1e54d
MS
18};
19
20/* private information held for overlayfs's superblock */
21struct ovl_fs {
22 struct vfsmount *upper_mnt;
23 unsigned numlower;
24 struct vfsmount **lower_mnt;
2cac0c00
AG
25 /* workbasedir is the path at workdir= mount option */
26 struct dentry *workbasedir;
27 /* workdir is the 'work' directory under workbasedir */
bbb1e54d 28 struct dentry *workdir;
02bcd157
AG
29 /* index directory listing overlay inodes by origin file handle */
30 struct dentry *indexdir;
6b2d5fe4 31 long namelen;
bbb1e54d
MS
32 /* pathnames of lower and upper dirs, for show_options */
33 struct ovl_config config;
34 /* creds of process who forced instantiation of super block */
35 const struct cred *creator_cred;
e7f52429 36 bool tmpfile;
82b749b2 37 bool noxattr;
7bcd74b9
AG
38 /* sb common to all layers */
39 struct super_block *same_sb;
bbb1e54d
MS
40};
41
42/* private information held for every overlayfs dentry */
43struct ovl_entry {
bbb1e54d 44 union {
04a01ac7 45 bool opaque;
bbb1e54d
MS
46 struct rcu_head rcu;
47 };
48 unsigned numlower;
49 struct path lowerstack[];
50};
51
52struct ovl_entry *ovl_alloc_entry(unsigned int numlower);
53
13cf199d 54struct ovl_inode {
04a01ac7 55 struct ovl_dir_cache *cache;
cf31c463 56 const char *redirect;
04a01ac7 57 u64 version;
13c72075 58 unsigned long flags;
13cf199d 59 struct inode vfs_inode;
09d8b586 60 struct dentry *__upperdentry;
25b7713a 61 struct inode *lower;
a015dafc
AG
62
63 /* synchronize copy up and more */
64 struct mutex lock;
13cf199d
AG
65};
66
67static inline struct ovl_inode *OVL_I(struct inode *inode)
68{
69 return container_of(inode, struct ovl_inode, vfs_inode);
70}
09d8b586
MS
71
72static inline struct dentry *ovl_upperdentry_dereference(struct ovl_inode *oi)
73{
74 return lockless_dereference(oi->__upperdentry);
75}