aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/dir.c118
1 files changed, 56 insertions, 62 deletions
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index 4d9b2153f686..4b44e23caa12 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -36,68 +36,8 @@
36#include "udf_i.h" 36#include "udf_i.h"
37#include "udf_sb.h" 37#include "udf_sb.h"
38 38
39/* Prototypes for file operations */ 39static int do_udf_readdir(struct inode *dir, struct file *filp,
40static int udf_readdir(struct file *, void *, filldir_t); 40 filldir_t filldir, void *dirent)
41static int do_udf_readdir(struct inode *, struct file *, filldir_t, void *);
42
43/* readdir and lookup functions */
44
45const struct file_operations udf_dir_operations = {
46 .read = generic_read_dir,
47 .readdir = udf_readdir,
48 .ioctl = udf_ioctl,
49 .fsync = udf_fsync_file,
50};
51
52/*
53 * udf_readdir
54 *
55 * PURPOSE
56 * Read a directory entry.
57 *
58 * DESCRIPTION
59 * Optional - sys_getdents() will return -ENOTDIR if this routine is not
60 * available.
61 *
62 * Refer to sys_getdents() in fs/readdir.c
63 * sys_getdents() -> .
64 *
65 * PRE-CONDITIONS
66 * filp Pointer to directory file.
67 * buf Pointer to directory entry buffer.
68 * filldir Pointer to filldir function.
69 *
70 * POST-CONDITIONS
71 * <return> >=0 on success.
72 *
73 * HISTORY
74 * July 1, 1997 - Andrew E. Mileski
75 * Written, tested, and released.
76 */
77
78int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)
79{
80 struct inode *dir = filp->f_path.dentry->d_inode;
81 int result;
82
83 lock_kernel();
84
85 if (filp->f_pos == 0) {
86 if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR) < 0) {
87 unlock_kernel();
88 return 0;
89 }
90 filp->f_pos++;
91 }
92
93 result = do_udf_readdir(dir, filp, filldir, dirent);
94 unlock_kernel();
95 return result;
96}
97
98static int
99do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
100 void *dirent)
101{ 41{
102 struct udf_fileident_bh fibh; 42 struct udf_fileident_bh fibh;
103 struct fileIdentDesc *fi = NULL; 43 struct fileIdentDesc *fi = NULL;
@@ -247,3 +187,57 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
247 187
248 return 0; 188 return 0;
249} 189}
190
191/*
192 * udf_readdir
193 *
194 * PURPOSE
195 * Read a directory entry.
196 *
197 * DESCRIPTION
198 * Optional - sys_getdents() will return -ENOTDIR if this routine is not
199 * available.
200 *
201 * Refer to sys_getdents() in fs/readdir.c
202 * sys_getdents() -> .
203 *
204 * PRE-CONDITIONS
205 * filp Pointer to directory file.
206 * buf Pointer to directory entry buffer.
207 * filldir Pointer to filldir function.
208 *
209 * POST-CONDITIONS
210 * <return> >=0 on success.
211 *
212 * HISTORY
213 * July 1, 1997 - Andrew E. Mileski
214 * Written, tested, and released.
215 */
216
217static int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)
218{
219 struct inode *dir = filp->f_path.dentry->d_inode;
220 int result;
221
222 lock_kernel();
223
224 if (filp->f_pos == 0) {
225 if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR) < 0) {
226 unlock_kernel();
227 return 0;
228 }
229 filp->f_pos++;
230 }
231
232 result = do_udf_readdir(dir, filp, filldir, dirent);
233 unlock_kernel();
234 return result;
235}
236
237/* readdir and lookup functions */
238const struct file_operations udf_dir_operations = {
239 .read = generic_read_dir,
240 .readdir = udf_readdir,
241 .ioctl = udf_ioctl,
242 .fsync = udf_fsync_file,
243};