forked from Ninals-GitHub/Learning-Ext2-Filesystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathme2fs_dir.h
186 lines (156 loc) · 5.35 KB
/
me2fs_dir.h
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*********************************************************************************
File : me2fs_dir.h
Description : Definitions for Directory Operations
*********************************************************************************/
#ifndef __ME2FS_DIR_H__
#define __ME2FS_DIR_H__
/*
==================================================================================
Prototype Statement
==================================================================================
*/
extern const struct file_operations me2fs_dir_operations;
/*
==================================================================================
DEFINES
==================================================================================
*/
/*
==================================================================================
Management
==================================================================================
*/
/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
< Open Functions >
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
/*
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Function :me2fsGetInoByName
Input :struct inode *dir
< vfs inode of directory >
struct qstr *child
< query name which is child of the directory >
Output :void
Return :ino_t
< inode number >
Description :lookup by name in directory and return its inode number
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/
ino_t me2fsGetInoByName( struct inode *dir, struct qstr *child );
/*
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Function :me2fsFindDirEntry
Input :struct inode *dir
< vfs inode of directory >
struct qstr *child
< query;child of directory >
struct page **res_page
< output >
Output :struct page **res_page
< the entry was found in >
Return :struct ext2_dir_entry *
< found entry >
Description :find an entry in the directory, ouput the page in which the
entry was found( **res_page ) and return entry.
page is returned mapped and unlocked. the entry is guaranteed
to be valid.
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/
struct ext2_dir_entry*
me2fsFindDirEntry( struct inode *dir,
struct qstr *child,
struct page **res_page );
/*
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Function :me2fsMakeEmpty
Input :struct inode *inode
< vfs inode >
struct inode *parent
< parent inode >
Output :void
Return :int
< result >
Description :make empty entry
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/
int me2fsMakeEmpty( struct inode *inode, struct inode *parent );
/*
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Function :me2fsAddLink
Input :struct dentry *dentry
< vfs dentry >
struct inode *inode
< vfs inode >
Output :void
Return :void
Description :add link
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/
int me2fsAddLink( struct dentry *dentry, struct inode *inode );
/*
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Function :me2fsIsEmptyDir
Input :struct inode *inode
< vfs inode >
Output :void
Return :int
< 0:false 1:true >
Description :check if the directory is empty or not
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/
int me2fsIsEmptyDir( struct inode *inode );
/*
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Function :me2fsDeleteDirEntry
Input :struct ext2_dir_entry *dir
< directory entry to delete >
struct page *page
< page cache the directory belongs to >
Output :void
Return :void
Description :delete a directory entry
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/
int me2fsDeleteDirEntry( struct ext2_dir_entry *dir, struct page *page );
/*
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Function :me2fsGetDotDotEntry
Input :struct inode *dir
< vfs inode of directory >
struct page **p
< page to which dot dot entry belongs to >
Output :struct page **p
< page to which dot dot entry belongs to >
Return :struct ext2_dir_entry*
< dot dot entry >
Description :get dot dot entry
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/
struct ext2_dir_entry*
me2fsGetDotDotEntry( struct inode *dir, struct page **p );
/*
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Function :me2fsSetLink
Input :struct inode *dir
< vfs inode >
struct ext2_dir_entry *dent
< directory entry to set link >
struct page *page
< directory page cache >
struct inode *inode
< vfs inode to be linked >
int update_times
< flag to update times >
Output :void
Return :void
Description :set link
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/
void me2fsSetLink( struct inode *dir,
struct ext2_dir_entry *dent,
struct page *page,
struct inode *inode,
int update_times );
#endif // __ME2FS_DIR_H__