blob: d14bca1850d95a310e8637d61eeec9efcd9924ee [file] [log] [blame]
Miklos Szeredibbb1e542016-12-16 11:02:56 +01001/*
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;
Miklos Szeredia6c60652016-12-16 11:02:56 +010016 bool redirect_dir;
Miklos Szeredibbb1e542016-12-16 11:02:56 +010017};
18
19/* private information held for overlayfs's superblock */
20struct ovl_fs {
21 struct vfsmount *upper_mnt;
22 unsigned numlower;
23 struct vfsmount **lower_mnt;
24 struct dentry *workdir;
Miklos Szeredi6b2d5fe2016-12-16 11:02:56 +010025 long namelen;
Miklos Szeredibbb1e542016-12-16 11:02:56 +010026 /* pathnames of lower and upper dirs, for show_options */
27 struct ovl_config config;
28 /* creds of process who forced instantiation of super block */
29 const struct cred *creator_cred;
30};
31
32/* private information held for every overlayfs dentry */
33struct ovl_entry {
34 struct dentry *__upperdentry;
35 struct ovl_dir_cache *cache;
36 union {
37 struct {
38 u64 version;
Miklos Szeredi02b69b22016-12-16 11:02:56 +010039 const char *redirect;
Miklos Szeredibbb1e542016-12-16 11:02:56 +010040 bool opaque;
41 };
42 struct rcu_head rcu;
43 };
44 unsigned numlower;
45 struct path lowerstack[];
46};
47
48struct ovl_entry *ovl_alloc_entry(unsigned int numlower);
49
50static inline struct dentry *ovl_upperdentry_dereference(struct ovl_entry *oe)
51{
52 return lockless_dereference(oe->__upperdentry);
53}