Miklos Szeredi | bbb1e54 | 2016-12-16 11:02:56 +0100 | [diff] [blame] | 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; |
Miklos Szeredi | a6c6065 | 2016-12-16 11:02:56 +0100 | [diff] [blame] | 16 | bool redirect_dir; |
Miklos Szeredi | bbb1e54 | 2016-12-16 11:02:56 +0100 | [diff] [blame] | 17 | }; |
| 18 | |
| 19 | /* private information held for overlayfs's superblock */ |
| 20 | struct ovl_fs { |
| 21 | struct vfsmount *upper_mnt; |
| 22 | unsigned numlower; |
| 23 | struct vfsmount **lower_mnt; |
| 24 | struct dentry *workdir; |
Miklos Szeredi | 6b2d5fe | 2016-12-16 11:02:56 +0100 | [diff] [blame] | 25 | long namelen; |
Miklos Szeredi | bbb1e54 | 2016-12-16 11:02:56 +0100 | [diff] [blame] | 26 | /* 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; |
Amir Goldstein | e7f5242 | 2017-01-17 06:34:53 +0200 | [diff] [blame] | 30 | bool tmpfile; |
Amir Goldstein | 82b749b | 2017-05-17 00:12:40 +0300 | [diff] [blame] | 31 | bool noxattr; |
Amir Goldstein | 39d3d60 | 2017-01-17 06:34:56 +0200 | [diff] [blame] | 32 | wait_queue_head_t copyup_wq; |
Amir Goldstein | 7bcd74b | 2017-03-22 08:42:21 -0400 | [diff] [blame] | 33 | /* sb common to all layers */ |
| 34 | struct super_block *same_sb; |
Miklos Szeredi | bbb1e54 | 2016-12-16 11:02:56 +0100 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | /* private information held for every overlayfs dentry */ |
| 38 | struct ovl_entry { |
| 39 | struct dentry *__upperdentry; |
| 40 | struct ovl_dir_cache *cache; |
| 41 | union { |
| 42 | struct { |
| 43 | u64 version; |
Miklos Szeredi | 02b69b2 | 2016-12-16 11:02:56 +0100 | [diff] [blame] | 44 | const char *redirect; |
Miklos Szeredi | bbb1e54 | 2016-12-16 11:02:56 +0100 | [diff] [blame] | 45 | bool opaque; |
Amir Goldstein | ee1d6d37 | 2017-05-11 16:42:26 +0300 | [diff] [blame] | 46 | bool impure; |
Amir Goldstein | 39d3d60 | 2017-01-17 06:34:56 +0200 | [diff] [blame] | 47 | bool copying; |
Miklos Szeredi | bbb1e54 | 2016-12-16 11:02:56 +0100 | [diff] [blame] | 48 | }; |
| 49 | struct rcu_head rcu; |
| 50 | }; |
| 51 | unsigned numlower; |
| 52 | struct path lowerstack[]; |
| 53 | }; |
| 54 | |
| 55 | struct ovl_entry *ovl_alloc_entry(unsigned int numlower); |
| 56 | |
| 57 | static inline struct dentry *ovl_upperdentry_dereference(struct ovl_entry *oe) |
| 58 | { |
| 59 | return lockless_dereference(oe->__upperdentry); |
| 60 | } |