aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/romfs/inode.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index 00b6f0a518c8..3f13d491c7c7 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -340,8 +340,9 @@ static struct dentry *
340romfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) 340romfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
341{ 341{
342 unsigned long offset, maxoff; 342 unsigned long offset, maxoff;
343 int fslen, res; 343 long res;
344 struct inode *inode; 344 int fslen;
345 struct inode *inode = NULL;
345 char fsname[ROMFS_MAXFN]; /* XXX dynamic? */ 346 char fsname[ROMFS_MAXFN]; /* XXX dynamic? */
346 struct romfs_inode ri; 347 struct romfs_inode ri;
347 const char *name; /* got from dentry */ 348 const char *name; /* got from dentry */
@@ -351,7 +352,7 @@ romfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
351 offset = dir->i_ino & ROMFH_MASK; 352 offset = dir->i_ino & ROMFH_MASK;
352 lock_kernel(); 353 lock_kernel();
353 if (romfs_copyfrom(dir, &ri, offset, ROMFH_SIZE) <= 0) 354 if (romfs_copyfrom(dir, &ri, offset, ROMFH_SIZE) <= 0)
354 goto out; 355 goto error;
355 356
356 maxoff = romfs_maxsize(dir->i_sb); 357 maxoff = romfs_maxsize(dir->i_sb);
357 offset = be32_to_cpu(ri.spec) & ROMFH_MASK; 358 offset = be32_to_cpu(ri.spec) & ROMFH_MASK;
@@ -364,9 +365,9 @@ romfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
364 365
365 for(;;) { 366 for(;;) {
366 if (!offset || offset >= maxoff) 367 if (!offset || offset >= maxoff)
367 goto out0; 368 goto success; /* negative success */
368 if (romfs_copyfrom(dir, &ri, offset, ROMFH_SIZE) <= 0) 369 if (romfs_copyfrom(dir, &ri, offset, ROMFH_SIZE) <= 0)
369 goto out; 370 goto error;
370 371
371 /* try to match the first 16 bytes of name */ 372 /* try to match the first 16 bytes of name */
372 fslen = romfs_strnlen(dir, offset+ROMFH_SIZE, ROMFH_SIZE); 373 fslen = romfs_strnlen(dir, offset+ROMFH_SIZE, ROMFH_SIZE);
@@ -397,23 +398,14 @@ romfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
397 inode = romfs_iget(dir->i_sb, offset); 398 inode = romfs_iget(dir->i_sb, offset);
398 if (IS_ERR(inode)) { 399 if (IS_ERR(inode)) {
399 res = PTR_ERR(inode); 400 res = PTR_ERR(inode);
400 goto out; 401 goto error;
401 } 402 }
402 403
403 /* 404success:
404 * it's a bit funky, _lookup needs to return an error code 405 d_add(dentry, inode);
405 * (negative) or a NULL, both as a dentry. ENOENT should not
406 * be returned, instead we need to create a negative dentry by
407 * d_add(dentry, NULL); and return 0 as no error.
408 * (Although as I see, it only matters on writable file
409 * systems).
410 */
411
412out0: inode = NULL;
413 res = 0; 406 res = 0;
414 d_add (dentry, inode); 407error:
415 408 unlock_kernel();
416out: unlock_kernel();
417 return ERR_PTR(res); 409 return ERR_PTR(res);
418} 410}
419 411