From mboxrd@z Thu Jan 1 00:00:00 1970 From: rpeterso@sourceware.org Date: 10 Aug 2006 20:10:50 -0000 Subject: [Cluster-devel] cluster/gfs/gfs_fsck block_list.c block_list.h Message-ID: <20060810201050.30035.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 Changes by: rpeterso at sourceware.org 2006-08-10 20:10:48 Modified files: gfs/gfs_fsck : block_list.c block_list.h Log message: Make block_list use a consistent set of values rather than enum values in one place and #defines in another, and trying to keep them in sync. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_fsck/block_list.c.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_fsck/block_list.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 --- cluster/gfs/gfs_fsck/block_list.c 2005/02/28 15:44:46 1.2 +++ cluster/gfs/gfs_fsck/block_list.c 2006/08/10 20:10:48 1.3 @@ -20,33 +20,12 @@ #include "block_list.h" #include "fsck.h" -#define FREE (0x0) /* 0000 */ -#define BLOCK_IN_USE (0x1) /* 0001 */ - -#define DIR_INDIR_BLK (0x2) /* 0010 */ -#define DIR_INODE (0x3) /* 0011 */ -#define FILE_INODE (0x4) /* 0100 */ -#define LNK_INODE (0x5) -#define BLK_INODE (0x6) -#define CHR_INODE (0x7) -#define FIFO_INODE (0x8) -#define SOCK_INODE (0x9) -#define DIR_LEAF_INODE (0xA) /* 1010 */ -#define JOURNAL_BLK (0xB) /* 1011 */ -#define OTHER_META (0xC) /* 1100 */ -#define FREE_META (0xD) /* 1101 */ -#define EATTR_META (0xE) /* 1110 */ - -#define INVALID_META (0xF) /* 1111 */ - - /* Must be kept in sync with mark_block enum in block_list.h */ -/* FIXME: Fragile */ static int mark_to_gbmap[16] = { - FREE, BLOCK_IN_USE, DIR_INDIR_BLK, DIR_INODE, FILE_INODE, - LNK_INODE, BLK_INODE, CHR_INODE, FIFO_INODE, SOCK_INODE, - DIR_LEAF_INODE, JOURNAL_BLK, OTHER_META, FREE_META, - EATTR_META, INVALID_META + block_free, block_used, indir_blk, inode_dir, inode_file, + inode_lnk, inode_blk, inode_chr, inode_fifo, inode_sock, + leaf_blk, journal_blk, meta_other, meta_free, + meta_eattr, meta_inval }; struct block_list *block_list_create(uint64_t size, enum block_list_type type) @@ -241,8 +220,7 @@ switch(m) { case dup_block: - if(bitmap_get(&il->list.gbmap.dup_map, i, - &val)) { + if(bitmap_get(&il->list.gbmap.dup_map, i, &val)) { stack; return -1; } @@ -251,8 +229,7 @@ found = 1; break; case eattr_block: - if(bitmap_get(&il->list.gbmap.eattr_map, i, - &val)) { + if(bitmap_get(&il->list.gbmap.eattr_map, i, &val)) { stack; return -1; } --- cluster/gfs/gfs_fsck/block_list.h 2005/02/01 17:47:11 1.1 +++ cluster/gfs/gfs_fsck/block_list.h 2006/08/10 20:10:48 1.2 @@ -26,24 +26,25 @@ /* Must be kept in sync with mark_to_bitmap array in block_list.c */ enum mark_block { block_free = 0, - block_used, - indir_blk, - inode_dir, - inode_file, - inode_lnk, - inode_blk, - inode_chr, - inode_fifo, - inode_sock, - leaf_blk, - journal_blk, - meta_other, - meta_free, - meta_eattr, + block_used = 1, + indir_blk = 2, + inode_dir = 3, + inode_file = 4, + inode_lnk = 5, + inode_blk = 6, + inode_chr = 7, + inode_fifo = 8, + inode_sock = 9, + leaf_blk = 10, + journal_blk = 11, + meta_other = 12, + meta_free = 13, + meta_eattr = 14, meta_inval = 15, - bad_block, /* Contains at least one bad block */ - dup_block, /* Contains at least one duplicate block */ - eattr_block, /* Contains an eattr */ + /* above this are nibble-values 0x0-0xf */ + bad_block = 16, /* Contains at least one bad block */ + dup_block = 17, /* Contains at least one duplicate block */ + eattr_block = 18, /* Contains an eattr */ }; struct block_query {