[Ocfs2-tools-devel] [PATCH 07/11] Ocfs2-tools: Adjust corrupt handlers for fswreck's group.c
Tristan Ye
tristan.ye at oracle.com
Mon Jun 8 03:50:21 PDT 2009
Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
fswreck/group.c | 33 ++++++++++++---------------------
fswreck/include/group.h | 12 ++++++++----
2 files changed, 20 insertions(+), 25 deletions(-)
diff --git a/fswreck/group.c b/fswreck/group.c
index 7f17b62..aa0298c 100644
--- a/fswreck/group.c
+++ b/fswreck/group.c
@@ -206,17 +206,13 @@ bail:
}
static void mess_up_group_desc(ocfs2_filesys *fs, uint16_t slotnum,
- enum fsck_type *types, int num)
+ enum fsck_type type)
{
errcode_t ret;
char sysfile[OCFS2_MAX_FILENAME_LEN];
uint64_t blkno;
- int i;
struct ocfs2_super_block *sb = OCFS2_RAW_SB(fs->fs_super);
- if (num <= 0)
- FSWRK_FATAL("Invalid num %d", num);
-
if (slotnum == UINT16_MAX)
snprintf(sysfile, sizeof(sysfile),
ocfs2_system_inodes[GLOBAL_BITMAP_SYSTEM_INODE].si_name);
@@ -230,39 +226,34 @@ static void mess_up_group_desc(ocfs2_filesys *fs, uint16_t slotnum,
if (ret)
FSWRK_COM_FATAL(progname, ret);
- for(i = 0; i < num; i++)
- damage_group_desc(fs, blkno, types[i]);
+ damage_group_desc(fs, blkno, type);
return ;
}
-void mess_up_group_minor(ocfs2_filesys *fs, uint16_t slotnum)
+void mess_up_group_minor(ocfs2_filesys *fs, enum fsck_type type,
+ uint16_t slotnum)
{
- enum fsck_type types[] = { GROUP_PARENT, GROUP_BLKNO,
- GROUP_CHAIN, GROUP_FREE_BITS };
-
- mess_up_group_desc(fs, slotnum, types, ARRAY_ELEMENTS(types));
+ mess_up_group_desc(fs, slotnum, type);
}
-void mess_up_group_gen(ocfs2_filesys *fs, uint16_t slotnum)
+void mess_up_group_gen(ocfs2_filesys *fs, enum fsck_type type, uint16_t slotnum)
{
- enum fsck_type types[] = { GROUP_GEN };
-
- mess_up_group_desc(fs, slotnum, types, ARRAY_ELEMENTS(types));
+ mess_up_group_desc(fs, slotnum, type);
}
-void mess_up_group_list(ocfs2_filesys *fs, uint16_t slotnum)
+void mess_up_group_list(ocfs2_filesys *fs, enum fsck_type type,
+ uint16_t slotnum)
{
- enum fsck_type types[] = { GROUP_EXPECTED_DESC, GROUP_UNEXPECTED_DESC };
-
- mess_up_group_desc(fs, slotnum, types, ARRAY_ELEMENTS(types));
+ mess_up_group_desc(fs, slotnum, type);
}
/* We will allocate some clusters and corrupt the group descriptor
* which stores the clusters and makes fsck run into error.
*/
-void mess_up_cluster_group_desc(ocfs2_filesys *fs, uint16_t slotnum)
+void mess_up_cluster_group_desc(ocfs2_filesys *fs, enum fsck_type type,
+ uint16_t slotnum)
{
errcode_t ret;
uint32_t found, start_cluster, old_free_bits, request = 100;
diff --git a/fswreck/include/group.h b/fswreck/include/group.h
index 09cf38f..0af524a 100644
--- a/fswreck/include/group.h
+++ b/fswreck/include/group.h
@@ -25,9 +25,13 @@
#ifndef __GROUP_H
#define __GROUP_H
-void mess_up_group_minor(ocfs2_filesys *fs, uint16_t slotnum);
-void mess_up_group_gen(ocfs2_filesys *fs, uint16_t slotnum);
-void mess_up_group_list(ocfs2_filesys *fs, uint16_t slotnum);
-void mess_up_cluster_group_desc(ocfs2_filesys *fs, uint16_t slotnum);
+void mess_up_group_minor(ocfs2_filesys *fs, enum fsck_type type,
+ uint16_t slotnum);
+void mess_up_group_gen(ocfs2_filesys *fs, enum fsck_type type,
+ uint16_t slotnum);
+void mess_up_group_list(ocfs2_filesys *fs, enum fsck_type type,
+ uint16_t slotnum);
+void mess_up_cluster_group_desc(ocfs2_filesys *fs, enum fsck_type type,
+ uint16_t slotnum);
#endif /* __GROUP_H */
--
1.5.5
More information about the Ocfs2-tools-devel
mailing list