1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32#ifndef __XFS_DIR_H__
33#define __XFS_DIR_H__
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50struct uio;
51struct xfs_bmap_free;
52struct xfs_da_args;
53struct xfs_dinode;
54struct xfs_inode;
55struct xfs_mount;
56struct xfs_trans;
57
58
59
60
61
62typedef void (*xfs_dir_mount_t)(struct xfs_mount *mp);
63typedef int (*xfs_dir_isempty_t)(struct xfs_inode *dp);
64typedef int (*xfs_dir_init_t)(struct xfs_trans *tp,
65 struct xfs_inode *dp,
66 struct xfs_inode *pdp);
67typedef int (*xfs_dir_createname_t)(struct xfs_trans *tp,
68 struct xfs_inode *dp,
69 char *name,
70 int namelen,
71 xfs_ino_t inum,
72 xfs_fsblock_t *first,
73 struct xfs_bmap_free *flist,
74 xfs_extlen_t total);
75typedef int (*xfs_dir_lookup_t)(struct xfs_trans *tp,
76 struct xfs_inode *dp,
77 char *name,
78 int namelen,
79 xfs_ino_t *inum);
80typedef int (*xfs_dir_removename_t)(struct xfs_trans *tp,
81 struct xfs_inode *dp,
82 char *name,
83 int namelen,
84 xfs_ino_t ino,
85 xfs_fsblock_t *first,
86 struct xfs_bmap_free *flist,
87 xfs_extlen_t total);
88typedef int (*xfs_dir_getdents_t)(struct xfs_trans *tp,
89 struct xfs_inode *dp,
90 struct uio *uio,
91 int *eofp);
92typedef int (*xfs_dir_replace_t)(struct xfs_trans *tp,
93 struct xfs_inode *dp,
94 char *name,
95 int namelen,
96 xfs_ino_t inum,
97 xfs_fsblock_t *first,
98 struct xfs_bmap_free *flist,
99 xfs_extlen_t total);
100typedef int (*xfs_dir_canenter_t)(struct xfs_trans *tp,
101 struct xfs_inode *dp,
102 char *name,
103 int namelen);
104typedef int (*xfs_dir_shortform_validate_ondisk_t)(struct xfs_mount *mp,
105 struct xfs_dinode *dip);
106typedef int (*xfs_dir_shortform_to_single_t)(struct xfs_da_args *args);
107
108typedef struct xfs_dirops {
109 xfs_dir_mount_t xd_mount;
110 xfs_dir_isempty_t xd_isempty;
111 xfs_dir_init_t xd_init;
112 xfs_dir_createname_t xd_createname;
113 xfs_dir_lookup_t xd_lookup;
114 xfs_dir_removename_t xd_removename;
115 xfs_dir_getdents_t xd_getdents;
116 xfs_dir_replace_t xd_replace;
117 xfs_dir_canenter_t xd_canenter;
118 xfs_dir_shortform_validate_ondisk_t xd_shortform_validate_ondisk;
119 xfs_dir_shortform_to_single_t xd_shortform_to_single;
120} xfs_dirops_t;
121
122
123
124
125void xfs_dir_startup(void);
126
127#define XFS_DIR_MOUNT(mp) \
128 ((mp)->m_dirops.xd_mount(mp))
129#define XFS_DIR_ISEMPTY(mp,dp) \
130 ((mp)->m_dirops.xd_isempty(dp))
131#define XFS_DIR_INIT(mp,tp,dp,pdp) \
132 ((mp)->m_dirops.xd_init(tp,dp,pdp))
133#define XFS_DIR_CREATENAME(mp,tp,dp,name,namelen,inum,first,flist,total) \
134 ((mp)->m_dirops.xd_createname(tp,dp,name,namelen,inum,first,flist,\
135 total))
136#define XFS_DIR_LOOKUP(mp,tp,dp,name,namelen,inum) \
137 ((mp)->m_dirops.xd_lookup(tp,dp,name,namelen,inum))
138#define XFS_DIR_REMOVENAME(mp,tp,dp,name,namelen,ino,first,flist,total) \
139 ((mp)->m_dirops.xd_removename(tp,dp,name,namelen,ino,first,flist,total))
140#define XFS_DIR_GETDENTS(mp,tp,dp,uio,eofp) \
141 ((mp)->m_dirops.xd_getdents(tp,dp,uio,eofp))
142#define XFS_DIR_REPLACE(mp,tp,dp,name,namelen,inum,first,flist,total) \
143 ((mp)->m_dirops.xd_replace(tp,dp,name,namelen,inum,first,flist,total))
144#define XFS_DIR_CANENTER(mp,tp,dp,name,namelen) \
145 ((mp)->m_dirops.xd_canenter(tp,dp,name,namelen))
146#define XFS_DIR_SHORTFORM_VALIDATE_ONDISK(mp,dip) \
147 ((mp)->m_dirops.xd_shortform_validate_ondisk(mp,dip))
148#define XFS_DIR_SHORTFORM_TO_SINGLE(mp,args) \
149 ((mp)->m_dirops.xd_shortform_to_single(args))
150
151#define XFS_DIR_IS_V1(mp) ((mp)->m_dirversion == 1)
152extern xfs_dirops_t xfsv1_dirops;
153
154#endif
155