]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - fs/aufs/dirren.h
net: hns3: Fix for information of phydev lost problem when down/up
[mirror_ubuntu-bionic-kernel.git] / fs / aufs / dirren.h
1 /*
2 * Copyright (C) 2017 Junjiro R. Okajima
3 *
4 * This program, aufs is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 /*
19 * renamed dir info
20 */
21
22 #ifndef __AUFS_DIRREN_H__
23 #define __AUFS_DIRREN_H__
24
25 #ifdef __KERNEL__
26
27 #include <linux/dcache.h>
28 #include <linux/statfs.h>
29 #include <linux/uuid.h>
30 #include "hbl.h"
31
32 #define AuDirren_NHASH 100
33
34 #ifdef CONFIG_AUFS_DIRREN
35 enum au_brid_type {
36 AuBrid_Unset,
37 AuBrid_UUID,
38 AuBrid_FSID,
39 AuBrid_DEV
40 };
41
42 struct au_dr_brid {
43 enum au_brid_type type;
44 union {
45 uuid_t uuid; /* unimplemented yet */
46 fsid_t fsid;
47 dev_t dev;
48 };
49 };
50
51 /* 20 is the max digits length of ulong 64 */
52 /* brid-type "_" uuid "_" inum */
53 #define AUFS_DIRREN_FNAME_SZ (1 + 1 + UUID_STRING_LEN + 20)
54 #define AUFS_DIRREN_ENV_VAL_SZ (AUFS_DIRREN_FNAME_SZ + 1 + 20)
55
56 struct au_dr_hino {
57 struct hlist_bl_node dr_hnode;
58 ino_t dr_h_ino;
59 };
60
61 struct au_dr_br {
62 struct hlist_bl_head dr_h_ino[AuDirren_NHASH];
63 struct au_dr_brid dr_brid;
64 };
65
66 struct au_dr_lookup {
67 /* dr_name is pointed by struct au_do_lookup_args.name */
68 struct qstr dr_name; /* subset of dr_info */
69 aufs_bindex_t ninfo;
70 struct au_drinfo **drinfo;
71 };
72 #else
73 struct au_dr_hino;
74 /* empty */
75 struct au_dr_br { };
76 struct au_dr_lookup { };
77 #endif
78
79 /* ---------------------------------------------------------------------- */
80
81 struct au_branch;
82 struct au_do_lookup_args;
83 struct au_hinode;
84 #ifdef CONFIG_AUFS_DIRREN
85 int au_dr_hino_test_add(struct au_dr_br *dr, ino_t h_ino,
86 struct au_dr_hino *add_ent);
87 void au_dr_hino_free(struct au_dr_br *dr);
88 int au_dr_br_init(struct super_block *sb, struct au_branch *br,
89 const struct path *path);
90 int au_dr_br_fin(struct super_block *sb, struct au_branch *br);
91 int au_dr_rename(struct dentry *src, aufs_bindex_t bindex,
92 struct qstr *dst_name, void *_rev);
93 void au_dr_rename_fin(struct dentry *src, aufs_bindex_t btgt, void *rev);
94 void au_dr_rename_rev(struct dentry *src, aufs_bindex_t bindex, void *rev);
95 int au_dr_lkup(struct au_do_lookup_args *lkup, struct dentry *dentry,
96 aufs_bindex_t bindex);
97 int au_dr_lkup_name(struct au_do_lookup_args *lkup, aufs_bindex_t btgt);
98 int au_dr_lkup_h_ino(struct au_do_lookup_args *lkup, aufs_bindex_t bindex,
99 ino_t h_ino);
100 void au_dr_lkup_fin(struct au_do_lookup_args *lkup);
101 int au_dr_opt_set(struct super_block *sb);
102 int au_dr_opt_flush(struct super_block *sb);
103 int au_dr_opt_clr(struct super_block *sb, int no_flush);
104 #else
105 AuStubInt0(au_dr_hino_test_add, struct au_dr_br *dr, ino_t h_ino,
106 struct au_dr_hino *add_ent);
107 AuStubVoid(au_dr_hino_free, struct au_dr_br *dr);
108 AuStubInt0(au_dr_br_init, struct super_block *sb, struct au_branch *br,
109 const struct path *path);
110 AuStubInt0(au_dr_br_fin, struct super_block *sb, struct au_branch *br);
111 AuStubInt0(au_dr_rename, struct dentry *src, aufs_bindex_t bindex,
112 struct qstr *dst_name, void *_rev);
113 AuStubVoid(au_dr_rename_fin, struct dentry *src, aufs_bindex_t btgt, void *rev);
114 AuStubVoid(au_dr_rename_rev, struct dentry *src, aufs_bindex_t bindex,
115 void *rev);
116 AuStubInt0(au_dr_lkup, struct au_do_lookup_args *lkup, struct dentry *dentry,
117 aufs_bindex_t bindex);
118 AuStubInt0(au_dr_lkup_name, struct au_do_lookup_args *lkup, aufs_bindex_t btgt);
119 AuStubInt0(au_dr_lkup_h_ino, struct au_do_lookup_args *lkup,
120 aufs_bindex_t bindex, ino_t h_ino);
121 AuStubVoid(au_dr_lkup_fin, struct au_do_lookup_args *lkup);
122 AuStubInt0(au_dr_opt_set, struct super_block *sb);
123 AuStubInt0(au_dr_opt_flush, struct super_block *sb);
124 AuStubInt0(au_dr_opt_clr, struct super_block *sb, int no_flush);
125 #endif
126
127 /* ---------------------------------------------------------------------- */
128
129 #ifdef CONFIG_AUFS_DIRREN
130 static inline int au_dr_ihash(ino_t h_ino)
131 {
132 return h_ino % AuDirren_NHASH;
133 }
134 #else
135 AuStubInt0(au_dr_ihash, ino_t h_ino);
136 #endif
137
138 #endif /* __KERNEL__ */
139 #endif /* __AUFS_DIRREN_H__ */