File 0001-fswreck-Create-a-loop-in-group-chains.patch of Package ocfs2-tools

From 57a0a528f35d2b540d4ed533b6274586056664ce Mon Sep 17 00:00:00 2001
From: Goldwyn Rodrigues <rgoldwyn@suse.de>
Date: Thu, 20 Sep 2012 19:39:17 -0500
Subject: [PATCH 1/2] fswreck: Create a loop in group chains

---
 fswreck/corrupt.c           |    3 +++
 fswreck/group.c             |    6 ++++++
 fswreck/include/fsck_type.h |    1 +
 fswreck/main.c              |    2 ++
 4 files changed, 12 insertions(+)

Index: ocfs2-tools/fswreck/corrupt.c
===================================================================
--- ocfs2-tools.orig/fswreck/corrupt.c	2012-08-24 10:02:19.000000000 -0500
+++ ocfs2-tools/fswreck/corrupt.c	2012-09-25 11:12:35.000000000 -0500
@@ -331,6 +331,9 @@ void corrupt_group_desc(ocfs2_filesys *f
 	case GROUP_FREE_BITS:
 		func = mess_up_group_minor;
 		break;
+	case GROUP_CHAIN_LOOP:
+		func = mess_up_group_minor;
+		break;
 	case GROUP_GEN:
 		func = mess_up_group_gen;
 		break;
Index: ocfs2-tools/fswreck/group.c
===================================================================
--- ocfs2-tools.orig/fswreck/group.c	2012-08-24 10:02:19.000000000 -0500
+++ ocfs2-tools/fswreck/group.c	2012-09-25 11:12:35.000000000 -0500
@@ -176,6 +176,12 @@ static void damage_group_desc(ocfs2_file
 			bg->bg_chain, (bg->bg_chain + 10));
 		bg->bg_chain += 10;
 		break;
+	case GROUP_CHAIN_LOOP:
+		fprintf(stdout, "Corrput GROUP_LOOP: "
+			"change group next from %"PRIu64" to %"PRIu64"\n",
+			bg->bg_next_group, cr->c_blkno);
+		bg->bg_next_group = cpu_to_le64(cr->c_blkno);
+		break;
 	case GROUP_FREE_BITS:
 		fprintf(stdout, "Corrput GROUP_FREE_BITS: "
 			"change group free bits from %u to %u\n",
Index: ocfs2-tools/fswreck/include/fsck_type.h
===================================================================
--- ocfs2-tools.orig/fswreck/include/fsck_type.h	2012-08-24 10:02:19.000000000 -0500
+++ ocfs2-tools/fswreck/include/fsck_type.h	2012-09-25 11:12:35.000000000 -0500
@@ -57,6 +57,7 @@ enum fsck_type
 	GROUP_BLKNO,
 	GROUP_CHAIN,
 	GROUP_FREE_BITS,
+	GROUP_CHAIN_LOOP,
 	CHAIN_COUNT,
 	CHAIN_NEXT_FREE,
 	CHAIN_EMPTY,
Index: ocfs2-tools/fswreck/main.c
===================================================================
--- ocfs2-tools.orig/fswreck/main.c	2012-08-24 10:02:19.000000000 -0500
+++ ocfs2-tools/fswreck/main.c	2012-09-25 11:12:35.000000000 -0500
@@ -102,6 +102,8 @@ static struct prompt_code prompt_codes[N
 			   "Corrupt chain group's blkno"),
 	define_prompt_code(GROUP_CHAIN, corrupt_group_desc, "", 1,
 			   "Corrupt chain group's chain where it was in"),
+	define_prompt_code(GROUP_CHAIN_LOOP, corrupt_group_desc, "", 1,
+			   "Corrupt group's chain to form a loop"),
 	define_prompt_code(GROUP_FREE_BITS, corrupt_group_desc, "", 1,
 			   "Corrupt chain group's free bits"),
 	define_prompt_code(CHAIN_COUNT, corrupt_sys_file, "", 1,
openSUSE Build Service is sponsored by