aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/dir.c
diff options
context:
space:
mode:
authorEvgeniy Dushistov <dushistov@mail.ru>2006-06-25 08:47:24 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 13:01:03 -0400
commitabf5d15fd2e52517dd56a17a846d5a1f900b7db4 (patch)
treeea537760c201cea57b468044dc733e06781ece2b /fs/ufs/dir.c
parent5afb3145c9a733166174e1f5a07c46410b5c4091 (diff)
[PATCH] ufs: easy debug
Currently to turn on debug mode "user" has to edit ~10 files, to turn off he has to do it again. This patch introduce such changes: 1)turn on(off) debug messages via ".config" 2)remove unnecessary duplication of code 3)make "UFSD" macros more similar to function 4)fix some compiler warnings Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ufs/dir.c')
-rw-r--r--fs/ufs/dir.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 9473df5bff51..732c3fd2b6f2 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -25,14 +25,6 @@
25#include "swab.h" 25#include "swab.h"
26#include "util.h" 26#include "util.h"
27 27
28#undef UFS_DIR_DEBUG
29
30#ifdef UFS_DIR_DEBUG
31#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
32#else
33#define UFSD(x)
34#endif
35
36/* 28/*
37 * NOTE! unlike strncmp, ufs_match returns 1 for success, 0 for failure. 29 * NOTE! unlike strncmp, ufs_match returns 1 for success, 0 for failure.
38 * 30 *
@@ -262,7 +254,7 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, struct dentry *dentry,
262 struct page *page = NULL; 254 struct page *page = NULL;
263 struct ufs_dir_entry *de; 255 struct ufs_dir_entry *de;
264 256
265 UFSD(("ENTER, dir_ino %lu, name %s, namlen %u\n", dir->i_ino, name, namelen)); 257 UFSD("ENTER, dir_ino %lu, name %s, namlen %u\n", dir->i_ino, name, namelen);
266 258
267 if (npages == 0 || namelen > UFS_MAXNAMLEN) 259 if (npages == 0 || namelen > UFS_MAXNAMLEN)
268 goto out; 260 goto out;
@@ -326,7 +318,7 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode)
326 unsigned from, to; 318 unsigned from, to;
327 int err; 319 int err;
328 320
329 UFSD(("ENTER, name %s, namelen %u\n", name, namelen)); 321 UFSD("ENTER, name %s, namelen %u\n", name, namelen);
330 322
331 /* 323 /*
332 * We take care of directory expansion in the same loop. 324 * We take care of directory expansion in the same loop.
@@ -442,7 +434,7 @@ ufs_readdir(struct file *filp, void *dirent, filldir_t filldir)
442 int need_revalidate = filp->f_version != inode->i_version; 434 int need_revalidate = filp->f_version != inode->i_version;
443 unsigned flags = UFS_SB(sb)->s_flags; 435 unsigned flags = UFS_SB(sb)->s_flags;
444 436
445 UFSD(("BEGIN")); 437 UFSD("BEGIN\n");
446 438
447 if (pos > inode->i_size - UFS_DIR_REC_LEN(1)) 439 if (pos > inode->i_size - UFS_DIR_REC_LEN(1))
448 return 0; 440 return 0;
@@ -484,9 +476,9 @@ ufs_readdir(struct file *filp, void *dirent, filldir_t filldir)
484 476
485 offset = (char *)de - kaddr; 477 offset = (char *)de - kaddr;
486 478
487 UFSD(("filldir(%s,%u)\n", de->d_name, 479 UFSD("filldir(%s,%u)\n", de->d_name,
488 fs32_to_cpu(sb, de->d_ino))); 480 fs32_to_cpu(sb, de->d_ino));
489 UFSD(("namlen %u\n", ufs_get_de_namlen(sb, de))); 481 UFSD("namlen %u\n", ufs_get_de_namlen(sb, de));
490 482
491 if ((flags & UFS_DE_MASK) == UFS_DE_44BSD) 483 if ((flags & UFS_DE_MASK) == UFS_DE_44BSD)
492 d_type = de->d_u.d_44.d_type; 484 d_type = de->d_u.d_44.d_type;
@@ -524,12 +516,12 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
524 struct ufs_dir_entry *de = (struct ufs_dir_entry *) (kaddr + from); 516 struct ufs_dir_entry *de = (struct ufs_dir_entry *) (kaddr + from);
525 int err; 517 int err;
526 518
527 UFSD(("ENTER\n")); 519 UFSD("ENTER\n");
528 520
529 UFSD(("ino %u, reclen %u, namlen %u, name %s\n", 521 UFSD("ino %u, reclen %u, namlen %u, name %s\n",
530 fs32_to_cpu(sb, de->d_ino), 522 fs32_to_cpu(sb, de->d_ino),
531 fs16_to_cpu(sb, de->d_reclen), 523 fs16_to_cpu(sb, de->d_reclen),
532 ufs_get_de_namlen(sb, de), de->d_name)); 524 ufs_get_de_namlen(sb, de), de->d_name);
533 525
534 while ((char*)de < (char*)dir) { 526 while ((char*)de < (char*)dir) {
535 if (de->d_reclen == 0) { 527 if (de->d_reclen == 0) {
@@ -554,7 +546,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
554 mark_inode_dirty(inode); 546 mark_inode_dirty(inode);
555out: 547out:
556 ufs_put_page(page); 548 ufs_put_page(page);
557 UFSD(("EXIT\n")); 549 UFSD("EXIT\n");
558 return err; 550 return err;
559} 551}
560 552