2 * Copyright (C) 2005-2016 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, see <http://www.gnu.org/licenses/>.
19 * directory operations
22 #ifndef __AUFS_DIR_H__
23 #define __AUFS_DIR_H__
29 /* ---------------------------------------------------------------------- */
31 /* need to be faster and smaller */
35 struct hlist_head
*nh_head
;
38 struct au_vdir_destr
{
40 unsigned char name
[0];
43 struct au_vdir_dehstr
{
44 struct hlist_node hash
;
46 struct au_vdir_destr
*str
;
47 struct llist_node lnode
; /* delayed free */
49 } ____cacheline_aligned_in_smp
;
53 unsigned char de_type
;
55 struct au_vdir_destr de_str
;
59 struct hlist_node wh_hash
;
60 #ifdef CONFIG_AUFS_SHWH
62 aufs_bindex_t wh_bindex
;
63 unsigned char wh_type
;
65 aufs_bindex_t wh_bindex
;
68 struct au_vdir_destr wh_str
;
71 union au_vdir_deblk_p
{
73 struct au_vdir_de
*de
;
77 unsigned char **vd_deblk
;
78 unsigned long vd_nblk
;
81 union au_vdir_deblk_p p
;
84 unsigned long vd_version
;
85 unsigned int vd_deblk_sz
;
87 unsigned long vd_jiffy
;
88 struct llist_node vd_lnode
; /* delayed free */
90 } ____cacheline_aligned_in_smp
;
92 /* ---------------------------------------------------------------------- */
95 extern const struct file_operations aufs_dir_fop
;
96 void au_add_nlink(struct inode
*dir
, struct inode
*h_dir
);
97 void au_sub_nlink(struct inode
*dir
, struct inode
*h_dir
);
98 loff_t
au_dir_size(struct file
*file
, struct dentry
*dentry
);
99 void au_dir_ts(struct inode
*dir
, aufs_bindex_t bsrc
);
100 int au_test_empty_lower(struct dentry
*dentry
);
101 int au_test_empty(struct dentry
*dentry
, struct au_nhash
*whlist
);
104 unsigned int au_rdhash_est(loff_t sz
);
105 int au_nhash_alloc(struct au_nhash
*nhash
, unsigned int num_hash
, gfp_t gfp
);
106 void au_nhash_wh_free(struct au_nhash
*whlist
);
107 int au_nhash_test_longer_wh(struct au_nhash
*whlist
, aufs_bindex_t btgt
,
109 int au_nhash_test_known_wh(struct au_nhash
*whlist
, char *name
, int nlen
);
110 int au_nhash_append_wh(struct au_nhash
*whlist
, char *name
, int nlen
, ino_t ino
,
111 unsigned int d_type
, aufs_bindex_t bindex
,
113 void au_vdir_free(struct au_vdir
*vdir
, int atonce
);
114 int au_vdir_init(struct file
*file
);
115 int au_vdir_fill_de(struct file
*file
, struct dir_context
*ctx
);
118 long aufs_ioctl_dir(struct file
*file
, unsigned int cmd
, unsigned long arg
);
120 #ifdef CONFIG_AUFS_RDU
122 long au_rdu_ioctl(struct file
*file
, unsigned int cmd
, unsigned long arg
);
124 long au_rdu_compat_ioctl(struct file
*file
, unsigned int cmd
,
128 AuStub(long, au_rdu_ioctl
, return -EINVAL
, struct file
*file
,
129 unsigned int cmd
, unsigned long arg
)
131 AuStub(long, au_rdu_compat_ioctl
, return -EINVAL
, struct file
*file
,
132 unsigned int cmd
, unsigned long arg
)
136 #endif /* __KERNEL__ */
137 #endif /* __AUFS_DIR_H__ */