From 26e95110f6d667fde21b316d0131e11986075900 Mon Sep 17 00:00:00 2001 From: Liu Aleaxander Date: Fri, 4 Jun 2010 23:32:35 +0800 Subject: [PATCH] cleanup for tfs Signed-off-by: Liu Aleaxander --- fs/tfs/balloc.c | 47 ----------------------------------------------- fs/tfs/dir.c | 12 ------------ fs/tfs/ialloc.c | 47 ----------------------------------------------- fs/tfs/inode.c | 7 ------- fs/tfs/tfs_cmd.c | 5 ----- gen-test.sh | 3 +++ 6 files changed, 3 insertions(+), 118 deletions(-) diff --git a/fs/tfs/balloc.c b/fs/tfs/balloc.c index 06fb2f5..206a362 100644 --- a/fs/tfs/balloc.c +++ b/fs/tfs/balloc.c @@ -45,50 +45,3 @@ int tfs_alloc_block(struct tfs_sb_info *sbi, uint32_t block) free(bitmap); return block; } - -#if 0 /* the deubg part */ -#include -int main(int argc, char *argv[]) -{ - int i; - int block; - struct tfs_sb_info *sbi; - char *fs = argv[1]; - char *command = argv[2]; - char **blocks = argv + 3; - int count = argc - 3; - - if (argc < 4) { - printk("Usage: balloc tfs.img command blocks...\n"); - printk(" alloc, to alloc blocks\n"); - printk(" feee, to free blocks\n"); - return 1; - } - - sbi = tfs_mount_by_fsname(fs); - if (!sbi) { - printk("tfs mount failed!\n"); - return 1; - } - - if (strcmp(command, "alloc") == 0) { - for (i = 0; i < count; i++) { - block = atoi(blocks[i]); - printk("trying to alloc block %u\n", block); - block = tfs_alloc_block(sbi, block); - printk("block number: %u allocated\n", block); - } - } else if (strcmp(command, "free") == 0) { - for (i = 0; i < count; i++) { - block = atoi(blocks[i]); - printk("trying to free block %u\n", block); - block = tfs_free_block(sbi, block); - printk("block number: %u freed\n", block); - } - } else { - printk("Unknown command!\n"); - } - - return 0; -} -#endif diff --git a/fs/tfs/dir.c b/fs/tfs/dir.c index 89fe075..8a7e06a 100644 --- a/fs/tfs/dir.c +++ b/fs/tfs/dir.c @@ -308,12 +308,6 @@ struct dirent * tfs_readdir(DIR *dir) cs = get_cache_block(sbi, block); de = (struct tfs_dir_entry *)(cs->data + (file->offset & (sbi->s_block_size- 1))); -#ifdef TFS_DEBUG - #include - if (de->d_inode) - hexdump(de, sizeof(*de)); -#endif - if (!(dirent = malloc(sizeof(*dirent)))) { printk("malloc dirent structure in tfs_readdir error!\n"); return NULL; @@ -345,9 +339,3 @@ void tfs_closedir(DIR *dir) free(dir); } } - -#if 0 /* the debug part */ -int main(int argc, char *argv[]) -{ -} -#endif diff --git a/fs/tfs/ialloc.c b/fs/tfs/ialloc.c index 42f5211..74c6c12 100644 --- a/fs/tfs/ialloc.c +++ b/fs/tfs/ialloc.c @@ -53,50 +53,3 @@ int tfs_alloc_inode(struct tfs_sb_info *sbi, int inr) free(bitmap); return inr; } - -#if 0 /* the deubg part */ -#include -int main(int argc, char *argv[]) -{ - int i; - int inr; - struct tfs_sb_info *sbi; - char *fs = argv[1]; - char *command = argv[2]; - char **inodes = argv + 3; - int count = argc - 3; - - if (argc < 4) { - printk("Usage: ialloc tfs.img command inodes...\n"); - printk(" alloc, to alloc inodes\n"); - printk(" feee, to free inodes\n"); - return 1; - } - - sbi = tfs_mount_by_fsname(fs); - if (!sbi) { - printk("tfs mount failed!\n"); - return 1; - } - - if (strcmp(command, "alloc") == 0) { - for (i = 0; i < count; i++) { - inr = atoi(inodes[i]); - printk("trying to alloc inode %u\n", inr); - inr = tfs_alloc_inode(sbi, inr); - printk("inode number: %u allocated\n", inr); - } - } else if (strcmp(command, "free") == 0) { - for (i = 0; i < count; i++) { - inr = atoi(inodes[i]); - printk("trying to free inode %u\n", inr); - inr = tfs_free_inode(sbi, inr); - printk("inode number: %d freed\n", inr); - } - } else { - printk("Unknown command!\n"); - } - - return 0; -} -#endif diff --git a/fs/tfs/inode.c b/fs/tfs/inode.c index 3653f7e..b78d18a 100644 --- a/fs/tfs/inode.c +++ b/fs/tfs/inode.c @@ -356,10 +356,3 @@ struct inode * tfs_mknod(struct tfs_sb_info *sbi, const char *filename, int mode return inode; } - - -#if 0 /* the debug part */ -int main(int argc, char *argv[]) -{ -} -#endif diff --git a/fs/tfs/tfs_cmd.c b/fs/tfs/tfs_cmd.c index 5c9fca0..24d2639 100644 --- a/fs/tfs/tfs_cmd.c +++ b/fs/tfs/tfs_cmd.c @@ -72,11 +72,6 @@ void ls(struct tfs_sb_info *sbi, char *filename) return; } - -#ifdef TFS_DEBUG - #include - hexdump(dir->dd_dir->inode->i_data, TFS_N_BLOCKS * sizeof(uint32_t *)); -#endif while (de = tfs_readdir(dir)) { printk("%6d\t %s\n", de->d_ino, de->d_name); free(de); diff --git a/gen-test.sh b/gen-test.sh index 7573741..2192429 100755 --- a/gen-test.sh +++ b/gen-test.sh @@ -32,6 +32,9 @@ touch help touch hello touch halt touch reboot +cd .. +cp_in gen-test.sh +cp_in README quit EOF -- 2.11.4.GIT