aboutsummaryrefslogtreecommitdiffstats
path: root/fs/qnx6/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/qnx6/dir.c')
-rw-r--r--fs/qnx6/dir.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c
index afa6be6fc397..15b7d92ed60d 100644
--- a/fs/qnx6/dir.c
+++ b/fs/qnx6/dir.c
@@ -65,8 +65,8 @@ static struct qnx6_long_filename *qnx6_longname(struct super_block *sb,
65 65
66static int qnx6_dir_longfilename(struct inode *inode, 66static int qnx6_dir_longfilename(struct inode *inode,
67 struct qnx6_long_dir_entry *de, 67 struct qnx6_long_dir_entry *de,
68 void *dirent, loff_t pos, 68 struct dir_context *ctx,
69 unsigned de_inode, filldir_t filldir) 69 unsigned de_inode)
70{ 70{
71 struct qnx6_long_filename *lf; 71 struct qnx6_long_filename *lf;
72 struct super_block *s = inode->i_sb; 72 struct super_block *s = inode->i_sb;
@@ -104,8 +104,7 @@ static int qnx6_dir_longfilename(struct inode *inode,
104 104
105 QNX6DEBUG((KERN_INFO "qnx6_readdir:%.*s inode:%u\n", 105 QNX6DEBUG((KERN_INFO "qnx6_readdir:%.*s inode:%u\n",
106 lf_size, lf->lf_fname, de_inode)); 106 lf_size, lf->lf_fname, de_inode));
107 if (filldir(dirent, lf->lf_fname, lf_size, pos, de_inode, 107 if (!dir_emit(ctx, lf->lf_fname, lf_size, de_inode, DT_UNKNOWN)) {
108 DT_UNKNOWN) < 0) {
109 qnx6_put_page(page); 108 qnx6_put_page(page);
110 return 0; 109 return 0;
111 } 110 }
@@ -115,18 +114,19 @@ static int qnx6_dir_longfilename(struct inode *inode,
115 return 1; 114 return 1;
116} 115}
117 116
118static int qnx6_readdir(struct file *filp, void *dirent, filldir_t filldir) 117static int qnx6_readdir(struct file *file, struct dir_context *ctx)
119{ 118{
120 struct inode *inode = file_inode(filp); 119 struct inode *inode = file_inode(file);
121 struct super_block *s = inode->i_sb; 120 struct super_block *s = inode->i_sb;
122 struct qnx6_sb_info *sbi = QNX6_SB(s); 121 struct qnx6_sb_info *sbi = QNX6_SB(s);
123 loff_t pos = filp->f_pos & ~(QNX6_DIR_ENTRY_SIZE - 1); 122 loff_t pos = ctx->pos & ~(QNX6_DIR_ENTRY_SIZE - 1);
124 unsigned long npages = dir_pages(inode); 123 unsigned long npages = dir_pages(inode);
125 unsigned long n = pos >> PAGE_CACHE_SHIFT; 124 unsigned long n = pos >> PAGE_CACHE_SHIFT;
126 unsigned start = (pos & ~PAGE_CACHE_MASK) / QNX6_DIR_ENTRY_SIZE; 125 unsigned start = (pos & ~PAGE_CACHE_MASK) / QNX6_DIR_ENTRY_SIZE;
127 bool done = false; 126 bool done = false;
128 127
129 if (filp->f_pos >= inode->i_size) 128 ctx->pos = pos;
129 if (ctx->pos >= inode->i_size)
130 return 0; 130 return 0;
131 131
132 for ( ; !done && n < npages; n++, start = 0) { 132 for ( ; !done && n < npages; n++, start = 0) {
@@ -137,11 +137,11 @@ static int qnx6_readdir(struct file *filp, void *dirent, filldir_t filldir)
137 137
138 if (IS_ERR(page)) { 138 if (IS_ERR(page)) {
139 printk(KERN_ERR "qnx6_readdir: read failed\n"); 139 printk(KERN_ERR "qnx6_readdir: read failed\n");
140 filp->f_pos = (n + 1) << PAGE_CACHE_SHIFT; 140 ctx->pos = (n + 1) << PAGE_CACHE_SHIFT;
141 return PTR_ERR(page); 141 return PTR_ERR(page);
142 } 142 }
143 de = ((struct qnx6_dir_entry *)page_address(page)) + start; 143 de = ((struct qnx6_dir_entry *)page_address(page)) + start;
144 for (; i < limit; i++, de++, pos += QNX6_DIR_ENTRY_SIZE) { 144 for (; i < limit; i++, de++, ctx->pos += QNX6_DIR_ENTRY_SIZE) {
145 int size = de->de_size; 145 int size = de->de_size;
146 u32 no_inode = fs32_to_cpu(sbi, de->de_inode); 146 u32 no_inode = fs32_to_cpu(sbi, de->de_inode);
147 147
@@ -154,8 +154,7 @@ static int qnx6_readdir(struct file *filp, void *dirent, filldir_t filldir)
154 structure / block */ 154 structure / block */
155 if (!qnx6_dir_longfilename(inode, 155 if (!qnx6_dir_longfilename(inode,
156 (struct qnx6_long_dir_entry *)de, 156 (struct qnx6_long_dir_entry *)de,
157 dirent, pos, no_inode, 157 ctx, no_inode)) {
158 filldir)) {
159 done = true; 158 done = true;
160 break; 159 break;
161 } 160 }
@@ -163,9 +162,8 @@ static int qnx6_readdir(struct file *filp, void *dirent, filldir_t filldir)
163 QNX6DEBUG((KERN_INFO "qnx6_readdir:%.*s" 162 QNX6DEBUG((KERN_INFO "qnx6_readdir:%.*s"
164 " inode:%u\n", size, de->de_fname, 163 " inode:%u\n", size, de->de_fname,
165 no_inode)); 164 no_inode));
166 if (filldir(dirent, de->de_fname, size, 165 if (!dir_emit(ctx, de->de_fname, size,
167 pos, no_inode, DT_UNKNOWN) 166 no_inode, DT_UNKNOWN)) {
168 < 0) {
169 done = true; 167 done = true;
170 break; 168 break;
171 } 169 }
@@ -173,7 +171,6 @@ static int qnx6_readdir(struct file *filp, void *dirent, filldir_t filldir)
173 } 171 }
174 qnx6_put_page(page); 172 qnx6_put_page(page);
175 } 173 }
176 filp->f_pos = pos;
177 return 0; 174 return 0;
178} 175}
179 176
@@ -282,7 +279,7 @@ found:
282const struct file_operations qnx6_dir_operations = { 279const struct file_operations qnx6_dir_operations = {
283 .llseek = generic_file_llseek, 280 .llseek = generic_file_llseek,
284 .read = generic_read_dir, 281 .read = generic_read_dir,
285 .readdir = qnx6_readdir, 282 .iterate = qnx6_readdir,
286 .fsync = generic_file_fsync, 283 .fsync = generic_file_fsync,
287}; 284};
288 285