2 * Copyright (C) 2005-2013 Junjiro R. Okajima
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.
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.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * directory operations
23 #ifndef __AUFS_DIR_H__
24 #define __AUFS_DIR_H__
30 /* ---------------------------------------------------------------------- */
32 /* need to be faster and smaller */
36 struct hlist_head *nh_head;
39 struct au_vdir_destr {
41 unsigned char name[0];
44 struct au_vdir_dehstr {
45 struct hlist_node hash;
46 struct au_vdir_destr *str;
47 } ____cacheline_aligned_in_smp;
51 unsigned char de_type;
53 struct au_vdir_destr de_str;
57 struct hlist_node wh_hash;
58 #ifdef CONFIG_AUFS_SHWH
60 aufs_bindex_t wh_bindex;
61 unsigned char wh_type;
63 aufs_bindex_t wh_bindex;
66 struct au_vdir_destr wh_str;
69 union au_vdir_deblk_p {
71 struct au_vdir_de *de;
75 unsigned char **vd_deblk;
76 unsigned long vd_nblk;
79 union au_vdir_deblk_p p;
82 unsigned long vd_version;
83 unsigned int vd_deblk_sz;
84 unsigned long vd_jiffy;
85 } ____cacheline_aligned_in_smp;
87 /* ---------------------------------------------------------------------- */
90 extern const struct file_operations aufs_dir_fop;
91 void au_add_nlink(struct inode *dir, struct inode *h_dir);
92 void au_sub_nlink(struct inode *dir, struct inode *h_dir);
93 loff_t au_dir_size(struct file *file, struct dentry *dentry);
94 int au_test_empty_lower(struct dentry *dentry);
95 int au_test_empty(struct dentry *dentry, struct au_nhash *whlist);
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,
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,
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, void *dirent, filldir_t filldir);
112 long aufs_ioctl_dir(struct file *file, unsigned int cmd, unsigned long arg);
114 #ifdef CONFIG_AUFS_RDU
116 long au_rdu_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
118 long au_rdu_compat_ioctl(struct file *file, unsigned int cmd,
122 static inline long au_rdu_ioctl(struct file *file, unsigned int cmd,
128 static inline long au_rdu_compat_ioctl(struct file *file, unsigned int cmd,
136 #endif /* __KERNEL__ */
137 #endif /* __AUFS_DIR_H__ */