ASoC: sam9x5_wm8731: Drop 'ASoC' prefix from error messages
[linux-2.6-block.git] / fs / overlayfs / ovl_entry.h
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;
16         bool redirect_dir;
17         bool index;
18 };
19
20 struct ovl_layer {
21         struct vfsmount *mnt;
22         dev_t pseudo_dev;
23 };
24
25 struct ovl_path {
26         struct ovl_layer *layer;
27         struct dentry *dentry;
28 };
29
30 /* private information held for overlayfs's superblock */
31 struct ovl_fs {
32         struct vfsmount *upper_mnt;
33         unsigned numlower;
34         struct ovl_layer *lower_layers;
35         /* workbasedir is the path at workdir= mount option */
36         struct dentry *workbasedir;
37         /* workdir is the 'work' directory under workbasedir */
38         struct dentry *workdir;
39         /* index directory listing overlay inodes by origin file handle */
40         struct dentry *indexdir;
41         long namelen;
42         /* pathnames of lower and upper dirs, for show_options */
43         struct ovl_config config;
44         /* creds of process who forced instantiation of super block */
45         const struct cred *creator_cred;
46         bool tmpfile;
47         bool noxattr;
48         /* sb common to all layers */
49         struct super_block *same_sb;
50         /* Did we take the inuse lock? */
51         bool upperdir_locked;
52         bool workdir_locked;
53 };
54
55 /* private information held for every overlayfs dentry */
56 struct ovl_entry {
57         union {
58                 struct {
59                         unsigned long has_upper;
60                         bool opaque;
61                 };
62                 struct rcu_head rcu;
63         };
64         unsigned numlower;
65         struct ovl_path lowerstack[];
66 };
67
68 struct ovl_entry *ovl_alloc_entry(unsigned int numlower);
69
70 struct ovl_inode {
71         struct ovl_dir_cache *cache;
72         const char *redirect;
73         u64 version;
74         unsigned long flags;
75         struct inode vfs_inode;
76         struct dentry *__upperdentry;
77         struct inode *lower;
78
79         /* synchronize copy up and more */
80         struct mutex lock;
81 };
82
83 static inline struct ovl_inode *OVL_I(struct inode *inode)
84 {
85         return container_of(inode, struct ovl_inode, vfs_inode);
86 }
87
88 static inline struct dentry *ovl_upperdentry_dereference(struct ovl_inode *oi)
89 {
90         return READ_ONCE(oi->__upperdentry);
91 }