cluster: RHEL57 - gfs2_edit: Move more functions to extended.c

Bob Peterson rpeterso at fedoraproject.org
Wed Feb 2 21:15:58 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=45ae3105ed65d7d5d08118ae1f1061b435edd258
Commit:        45ae3105ed65d7d5d08118ae1f1061b435edd258
Parent:        4e825e58684ed45936cf885b4393c915933270a5
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Mon Dec 13 12:43:58 2010 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Wed Feb 2 14:36:09 2011 -0600

gfs2_edit: Move more functions to extended.c

This patch moves more code to the new extended.c source.

rhbz#656371
---
 gfs2/edit/hexedit.c |  134 +--------------------------------------------------
 gfs2/edit/hexedit.h |    2 +
 2 files changed, 4 insertions(+), 132 deletions(-)

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 17a2962..f930ef3 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -966,134 +966,6 @@ int has_indirect_blocks(void)
 }
 
 /* ------------------------------------------------------------------------ */
-/* print_inode_type                                                         */
-/* ------------------------------------------------------------------------ */
-static void print_inode_type(__be16 de_type)
-{
-	if (gfs1) {
-		switch(de_type) {
-		case GFS_FILE_NON:
-			print_gfs2("Unknown");
-			break;
-		case GFS_FILE_REG:
-			print_gfs2("File   ");
-			break;
-		case GFS_FILE_DIR:
-			print_gfs2("Dir    ");
-			break;
-		case GFS_FILE_LNK:
-			print_gfs2("Symlink");
-			break;
-		case GFS_FILE_BLK:
-			print_gfs2("BlkDev ");
-			break;
-		case GFS_FILE_CHR:
-			print_gfs2("ChrDev ");
-			break;
-		case GFS_FILE_FIFO:
-			print_gfs2("Fifo   ");
-			break;
-		case GFS_FILE_SOCK:
-			print_gfs2("Socket ");
-			break;
-		default:
-			print_gfs2("%04x   ", de_type);
-			break;
-		}
-		return;
-	}
-	switch(de_type) {
-	case DT_UNKNOWN:
-		print_gfs2("Unknown");
-		break;
-	case DT_REG:
-		print_gfs2("File   ");
-		break;
-	case DT_DIR:
-		print_gfs2("Dir    ");
-		break;
-	case DT_LNK:
-		print_gfs2("Symlink");
-		break;
-	case DT_BLK:
-		print_gfs2("BlkDev ");
-		break;
-	case DT_CHR:
-		print_gfs2("ChrDev ");
-		break;
-	case DT_FIFO:
-		print_gfs2("Fifo   ");
-		break;
-	case DT_SOCK:
-		print_gfs2("Socket ");
-		break;
-	default:
-		print_gfs2("%04x   ", de_type);
-		break;
-	}
-}
-
-/* ------------------------------------------------------------------------ */
-/* display_leaf - display directory leaf                                    */
-/* ------------------------------------------------------------------------ */
-int display_leaf(struct iinfo *ind)
-{
-	int start_line, total_dirents = start_row[dmode];
-	int d;
-
-	eol(0);
-	if (gfs2_struct_type == GFS2_METATYPE_SB)
-		print_gfs2("The superblock has 2 directories");
-	else
-		print_gfs2("Directory block: lf_depth:%d, lf_entries:%d,"
-			   "fmt:%d next=0x%llx (%d dirents).",
-			   ind->ii[0].lf_depth, ind->ii[0].lf_entries,
-			   ind->ii[0].lf_dirent_format,
-			   ind->ii[0].lf_next,
-			   ind->ii[0].dirents);
-
-	start_line = line;
-	for (d = start_row[dmode]; d < ind->ii[0].dirents; d++) {
-		if (termlines && d >= termlines - start_line - 2
-		    + start_row[dmode])
-			break;
-		total_dirents++;
-		if (ind->ii[0].dirents >= 1) {
-			eol(5);
-			if (termlines) {
-				if (edit_row[dmode] >=0 &&
-				    line - start_line - 1 ==
-				    edit_row[dmode] - start_row[dmode]) {
-					COLORS_HIGHLIGHT;
-					sprintf(estring, "%"PRIx64,
-						ind->ii[0].dirent[d].block);
-					strcpy(edit_fmt, "%"PRIx64);
-				}
-			}
-			print_gfs2("%d. (%d). %lld (0x%llx): ",
-				   total_dirents, d + 1,
-				   ind->ii[0].dirent[d].block,
-				   ind->ii[0].dirent[d].block);
-		}
-		print_inode_type(ind->ii[0].dirent[d].dirent.de_type);
-		print_gfs2(" %s", ind->ii[0].dirent[d].filename);
-		if (termlines) {
-			if (edit_row[dmode] >= 0 &&
-			    line - start_line - 1 == edit_row[dmode] -
-			    start_row[dmode])
-				COLORS_NORMAL;
-		}
-	}
-	if (line >= 4)
-		last_entry_onscreen[dmode] = line - 4;
-	eol(0);
-	end_row[dmode] = ind->ii[0].dirents;
-	if (end_row[dmode] < last_entry_onscreen[dmode])
-		end_row[dmode] = last_entry_onscreen[dmode];
-	return 0;
-}
-
-/* ------------------------------------------------------------------------ */
 /* block_is_rindex                                                          */
 /* ------------------------------------------------------------------------ */
 int block_is_rindex(void)
@@ -1835,8 +1707,7 @@ static void pageup(void)
 					sbd.bsize - screen_chunk_size;
 			else
 				offset = 0;
-		}
-		else
+		} else
 			offset -= screen_chunk_size;
 	}
 }
@@ -1864,8 +1735,7 @@ static void pagedn(void)
 		    offset + screen_chunk_size >= sbd.bsize) {
 			block++;
 			offset = 0;
-		}
-		else
+		} else
 			offset += screen_chunk_size;
 	}
 }
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 8d2e9b8..81637bc 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -111,6 +111,8 @@ extern uint64_t temp_blk;
 extern uint64_t starting_blk;
 extern const char *block_type_str[15];
 extern int dsplines;
+extern int dsp_lines[DMODES];
+extern int combined_display;
 
 struct gfs_jindex {
         uint64_t ji_addr;       /* starting block of the journal */


More information about the cluster-commits mailing list