]>
Commit | Line | Data |
---|---|---|
c088e31d SF |
1 | /* |
2 | * Copyright (C) 2005-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 | * directory operations | |
20 | */ | |
21 | ||
22 | #ifndef __AUFS_DIR_H__ | |
23 | #define __AUFS_DIR_H__ | |
24 | ||
25 | #ifdef __KERNEL__ | |
26 | ||
27 | #include <linux/fs.h> | |
28 | ||
29 | /* ---------------------------------------------------------------------- */ | |
30 | ||
31 | /* need to be faster and smaller */ | |
32 | ||
33 | struct au_nhash { | |
34 | unsigned int nh_num; | |
35 | struct hlist_head *nh_head; | |
36 | }; | |
37 | ||
38 | struct au_vdir_destr { | |
39 | unsigned char len; | |
40 | unsigned char name[0]; | |
41 | } __packed; | |
42 | ||
43 | struct au_vdir_dehstr { | |
44 | struct hlist_node hash; | |
45 | struct au_vdir_destr *str; | |
46 | } ____cacheline_aligned_in_smp; | |
47 | ||
48 | struct au_vdir_de { | |
49 | ino_t de_ino; | |
50 | unsigned char de_type; | |
51 | /* caution: packed */ | |
52 | struct au_vdir_destr de_str; | |
53 | } __packed; | |
54 | ||
55 | struct au_vdir_wh { | |
56 | struct hlist_node wh_hash; | |
57 | #ifdef CONFIG_AUFS_SHWH | |
58 | ino_t wh_ino; | |
59 | aufs_bindex_t wh_bindex; | |
60 | unsigned char wh_type; | |
61 | #else | |
62 | aufs_bindex_t wh_bindex; | |
63 | #endif | |
64 | /* caution: packed */ | |
65 | struct au_vdir_destr wh_str; | |
66 | } __packed; | |
67 | ||
68 | union au_vdir_deblk_p { | |
69 | unsigned char *deblk; | |
70 | struct au_vdir_de *de; | |
71 | }; | |
72 | ||
73 | struct au_vdir { | |
74 | unsigned char **vd_deblk; | |
75 | unsigned long vd_nblk; | |
76 | struct { | |
77 | unsigned long ul; | |
78 | union au_vdir_deblk_p p; | |
79 | } vd_last; | |
80 | ||
81 | unsigned long vd_version; | |
82 | unsigned int vd_deblk_sz; | |
83 | unsigned long vd_jiffy; | |
84 | } ____cacheline_aligned_in_smp; | |
85 | ||
86 | /* ---------------------------------------------------------------------- */ | |
87 | ||
88 | /* dir.c */ | |
89 | extern const struct file_operations aufs_dir_fop; | |
90 | void au_add_nlink(struct inode *dir, struct inode *h_dir); | |
91 | void au_sub_nlink(struct inode *dir, struct inode *h_dir); | |
92 | loff_t au_dir_size(struct file *file, struct dentry *dentry); | |
93 | void au_dir_ts(struct inode *dir, aufs_bindex_t bsrc); | |
94 | int au_test_empty_lower(struct dentry *dentry); | |
95 | int au_test_empty(struct dentry *dentry, struct au_nhash *whlist); | |
96 | ||
97 | /* vdir.c */ | |
98 | unsigned int au_rdhash_est(loff_t sz); | |
99 | int au_nhash_alloc(struct au_nhash *nhash, unsigned int num_hash, gfp_t gfp); | |
100 | void au_nhash_wh_free(struct au_nhash *whlist); | |
101 | int au_nhash_test_longer_wh(struct au_nhash *whlist, aufs_bindex_t btgt, | |
102 | int limit); | |
103 | int au_nhash_test_known_wh(struct au_nhash *whlist, char *name, int nlen); | |
104 | int au_nhash_append_wh(struct au_nhash *whlist, char *name, int nlen, ino_t ino, | |
105 | unsigned int d_type, aufs_bindex_t bindex, | |
106 | unsigned char shwh); | |
107 | void au_vdir_free(struct au_vdir *vdir); | |
108 | int au_vdir_init(struct file *file); | |
109 | int au_vdir_fill_de(struct file *file, struct dir_context *ctx); | |
110 | ||
111 | /* ioctl.c */ | |
112 | long aufs_ioctl_dir(struct file *file, unsigned int cmd, unsigned long arg); | |
113 | ||
114 | #ifdef CONFIG_AUFS_RDU | |
115 | /* rdu.c */ | |
116 | long au_rdu_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | |
117 | #ifdef CONFIG_COMPAT | |
118 | long au_rdu_compat_ioctl(struct file *file, unsigned int cmd, | |
119 | unsigned long arg); | |
120 | #endif | |
121 | #else | |
122 | AuStub(long, au_rdu_ioctl, return -EINVAL, struct file *file, | |
123 | unsigned int cmd, unsigned long arg) | |
124 | #ifdef CONFIG_COMPAT | |
125 | AuStub(long, au_rdu_compat_ioctl, return -EINVAL, struct file *file, | |
126 | unsigned int cmd, unsigned long arg) | |
127 | #endif | |
128 | #endif | |
129 | ||
130 | #endif /* __KERNEL__ */ | |
131 | #endif /* __AUFS_DIR_H__ */ |