From mboxrd@z Thu Jan 1 00:00:00 1970 From: rpeterso@sourceware.org Date: 14 Nov 2006 20:13:37 -0000 Subject: [Cluster-devel] cluster/gfs2/edit gfs2hex.c hexedit.c hexedit.h Message-ID: <20061114201337.32146.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Branch: RHEL5 Changes by: rpeterso at sourceware.org 2006-11-14 20:13:36 Modified files: gfs2/edit : gfs2hex.c hexedit.c hexedit.h Log message: Ability for gfs2_edit to handle gfs1 indirect metapointers. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/edit/gfs2hex.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5.2.1&r2=1.5.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/edit/hexedit.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6.2.1&r2=1.6.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/edit/hexedit.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.1&r2=1.4.2.2 --- cluster/gfs2/edit/gfs2hex.c 2006/11/09 15:31:01 1.5.2.1 +++ cluster/gfs2/edit/gfs2hex.c 2006/11/14 20:13:36 1.5.2.2 @@ -291,23 +291,20 @@ unsigned int x, y; uint64_t p; - eol(0); - printf("Pointers"); - eol(0); - eol(0); - - for (x = sizeof(struct gfs2_meta_header), y = 0; x < bufsize; x += 8, y++) - { + indirect_blocks = 0; + memset(&indirect, 0, sizeof(indirect)); + for (x = sizeof(struct gfs_indirect), y = 0; + x < bufsize; + x += sizeof(uint64_t), y++) { p = be64_to_cpu(*(uint64_t *)(buf + x)); - if (p) { - printf(" %u -> %" PRIu64, y, p); - eol(0); + indirect[indirect_blocks].block = p; + indirect[indirect_blocks].is_dir = FALSE; + indirect_blocks++; } } } - /****************************************************************************** ******************************************************************************* ** --- cluster/gfs2/edit/hexedit.c 2006/11/09 15:31:01 1.6.2.1 +++ cluster/gfs2/edit/hexedit.c 2006/11/14 20:13:36 1.6.2.2 @@ -44,6 +44,7 @@ int display(enum dsp_mode display_mode, int identify_only); extern void eol(int col); +extern void do_indirect_extended(char *buf); /* ------------------------------------------------------------------------ */ /* UpdateSize - screen size changed, so update it */ @@ -684,10 +685,11 @@ move(line, 1); } if (indir_blocks == indirect_blocks) { - print_gfs2("%d => ", e + 1); + print_gfs2("%d => ", e); if (termlines) move(line,9); - print_gfs2("0x%llx", indirect[e].block); + print_gfs2("0x%llx / %lld", indirect[e].block, + indirect[e].block); if (termlines) { if (edit_row[display_mode] >= 0 && line - start_line - 2 == edit_row[display_mode]) { @@ -893,6 +895,9 @@ gfs2_dinode_in(&di, buf); /* parse disk inode into structure */ do_dinode_extended(&di, buf); /* get extended data, if any */ } + else if (gfs2_struct_type == GFS2_METATYPE_IN) { /* indirect block list */ + do_indirect_extended(buf); + } else if (gfs2_struct_type == GFS2_METATYPE_LF) { /* directory leaf */ int x; struct gfs2_dirent de; --- cluster/gfs2/edit/hexedit.h 2006/11/09 15:31:01 1.4.2.1 +++ cluster/gfs2/edit/hexedit.h 2006/11/14 20:13:36 1.4.2.2 @@ -106,6 +106,12 @@ struct gfs2_dirents dirent[64]; }; +struct gfs_indirect { + struct gfs2_meta_header in_header; + + char in_reserved[64]; +}; + struct blkstack_info { uint64_t block; int edit_row[DISPLAY_MODES];