Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 9383e745e23602bc45f9c92184feea59 > files > 12

gfs2-utils-0.1.62-28.el5.src.rpm

commit 2040434f74cb6cd43e3b7781c7f6c11d3adfaa2b
Author: Bob Peterson <bob@ganesha.peterson>
Date:   Mon Feb 15 15:36:31 2010 -0600

    gfs2: fix build warnings spotted by paranoia cflags
    
    This is a RHEL55 crosswrite of STABLE3 commit id c091d13.
    This is done in order to make the RHEL55 branch closer to
    the STABLE3 branch for easier back-porting.
    
    rhbz#455300

diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 5223590..48b4087 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -140,7 +140,7 @@ int seconds;
 struct timeval tv;
 uint64_t dirs_fixed;
 uint64_t dirents_fixed;
-char *prog_name = "gfs2_convert"; /* needed by libgfs2 */
+const char *prog_name = "gfs2_convert"; /* needed by libgfs2 */
 struct gfs1_jindex *sd_jindex = NULL;    /* gfs1 journal index in memory */
 int gfs2_inptrs;
 uint64_t gfs2_heightsize[GFS2_MAX_META_HEIGHT];
@@ -166,7 +166,7 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...)
 /*                   Fixes all unallocated metadata bitmap states (which are */
 /*                   valid in gfs1 but invalid in gfs2).                     */
 /* ------------------------------------------------------------------------- */
-void convert_bitmaps(struct gfs2_sbd *sdp, struct rgrp_list *rgd2,
+static void convert_bitmaps(struct gfs2_sbd *sdp, struct rgrp_list *rgd2,
 					 int read_disk)
 {
 	uint32_t blk;
@@ -247,7 +247,7 @@ static int convert_rgs(struct gfs2_sbd *sbp)
 /* This is similar to calc_tree_height in libgfs2 but at the point this      */
 /* function is called, I have the wrong (gfs1 not gfs2) constants in place.  */
 /* ------------------------------------------------------------------------- */
-unsigned int calc_gfs2_tree_height(struct gfs2_inode *ip, uint64_t size)
+static unsigned int calc_gfs2_tree_height(struct gfs2_inode *ip, uint64_t size)
 {
 	uint64_t *arr;
 	unsigned int max, height;
@@ -273,7 +273,7 @@ unsigned int calc_gfs2_tree_height(struct gfs2_inode *ip, uint64_t size)
 /* ------------------------------------------------------------------------- */
 /* mp_gfs1_to_gfs2 - convert a gfs1 metapath to a gfs2 metapath.             */
 /* ------------------------------------------------------------------------- */
-void mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
+static void mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
 		     struct metapath *gfs1mp, struct metapath *gfs2mp)
 {
 	uint64_t lblock;
@@ -313,7 +313,7 @@ void mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
 /*                interested in rearranging the metadata while leaving the   */
 /*                actual data blocks intact.                                 */
 /* ------------------------------------------------------------------------- */
-void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
+static void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 		  struct blocklist *blk, uint64_t *first_nonzero_ptr,
 		  unsigned int size)
 {
@@ -427,7 +427,7 @@ void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 /*                                                                           */
 /* Adapted from gfs2_fsck metawalk.c's build_and_check_metalist              */
 /* ------------------------------------------------------------------------- */
-int adjust_indirect_blocks(struct gfs2_sbd *sbp, struct gfs2_buffer_head *dibh,
+static int adjust_indirect_blocks(struct gfs2_sbd *sbp, struct gfs2_buffer_head *dibh,
 			   struct gfs2_inode *ip)
 {
 	uint32_t gfs2_hgt;
@@ -879,7 +879,7 @@ out:
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh)
+static int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh)
 {
 	struct gfs2_inode *inode;
 	struct inode_block *fixdir;
@@ -974,7 +974,7 @@ int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh)
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr)
+static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr)
 {
 	struct rgrp_list *rgd;
 	osi_list_t *tmp;
@@ -1065,7 +1065,7 @@ int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr)
 /* ------------------------------------------------------------------------- */
 /* fetch_inum - fetch an inum entry from disk, given its block               */
 /* ------------------------------------------------------------------------- */
-int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
+static int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
 					   struct gfs2_inum *inum)
 {
 	struct gfs2_buffer_head *bh_fix;
@@ -1087,7 +1087,7 @@ int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-int process_dirent_info(struct gfs2_inode *dip, struct gfs2_sbd *sbp,
+static int process_dirent_info(struct gfs2_inode *dip, struct gfs2_sbd *sbp,
 						struct gfs2_buffer_head *bh, int dir_entries)
 {
 	int error;
@@ -1176,7 +1176,7 @@ int process_dirent_info(struct gfs2_inode *dip, struct gfs2_sbd *sbp,
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip)
+static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip)
 {
 	struct gfs2_buffer_head *bh_leaf;
 	int error;
@@ -1222,7 +1222,7 @@ int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip)
 /* fix_directory_info - sync new inode numbers with directory info           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-int fix_directory_info(struct gfs2_sbd *sbp, osi_list_t *dirs_to_fix)
+static int fix_directory_info(struct gfs2_sbd *sbp, osi_list_t *dir_to_fix)
 {
 	osi_list_t *tmp, *fix;
 	struct inode_block *dir_iblk;
@@ -1239,7 +1239,7 @@ int fix_directory_info(struct gfs2_sbd *sbp, osi_list_t *dirs_to_fix)
 	offset = 0;
 	tmp = NULL;
 	/* for every directory in the list */
-	for (fix = dirs_to_fix->next; fix != dirs_to_fix; fix = fix->next) {
+	for (fix = dir_to_fix->next; fix != dir_to_fix; fix = fix->next) {
 		if (tmp) {
 			osi_list_del(tmp);
 			free(tmp);
@@ -1280,7 +1280,7 @@ int fix_directory_info(struct gfs2_sbd *sbp, osi_list_t *dirs_to_fix)
 /* ------------------------------------------------------------------------- */
 /* Fetch gfs1 jindex structure from buffer                                   */
 /* ------------------------------------------------------------------------- */
-void gfs1_jindex_in(struct gfs1_jindex *jindex, char *buf)
+static void gfs1_jindex_in(struct gfs1_jindex *jindex, char *buf)
 {
 	struct gfs1_jindex *str = (struct gfs1_jindex *)buf;
 
@@ -1293,7 +1293,7 @@ void gfs1_jindex_in(struct gfs1_jindex *jindex, char *buf)
 /* read_gfs1_jiindex - read the gfs1 jindex file.                            */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-int read_gfs1_jiindex(struct gfs2_sbd *sdp)
+static int read_gfs1_jiindex(struct gfs2_sbd *sdp)
 {
 	struct gfs2_inode *ip = sdp->md.jiinode;
 	char buf[sizeof(struct gfs1_jindex)];
@@ -1461,7 +1461,7 @@ static int init(struct gfs2_sbd *sbp)
 /* ------------------------------------------------------------------------- */
 /* give_warning - give the all-important warning message.                    */
 /* ------------------------------------------------------------------------- */
-void give_warning(void)
+static void give_warning(void)
 {
 	printf("This program will convert a gfs1 filesystem to a "	\
 		   "gfs2 filesystem.\n");
@@ -1476,7 +1476,7 @@ void give_warning(void)
 /* ------------------------------------------------------------------------- */
 /* version  - print version information                                      */
 /* ------------------------------------------------------------------------- */
-void version(void)
+static void version(void)
 {
 	log_notice("gfs2_convert version %s (built %s %s)\n", GFS2_RELEASE_NAME,
 			   __DATE__, __TIME__);
@@ -1486,7 +1486,7 @@ void version(void)
 /* ------------------------------------------------------------------------- */
 /* usage - print usage information                                           */
 /* ------------------------------------------------------------------------- */
-void usage(const char *name)
+static void usage(const char *name)
 {
 	give_warning();
 	printf("\nUsage:\n");
@@ -1503,7 +1503,7 @@ void usage(const char *name)
 /* ------------------------------------------------------------------------- */
 /* process_parameters                                                        */
 /* ------------------------------------------------------------------------- */
-void process_parameters(int argc, char **argv, struct gfs2_options *opts)
+static void process_parameters(int argc, char **argv, struct gfs2_options *opts)
 
 {
 	int c;
@@ -1559,7 +1559,7 @@ void process_parameters(int argc, char **argv, struct gfs2_options *opts)
 /* rgrp_length - Calculate the length of a resource group                    */
 /* @size: The total size of the resource group                               */
 /* ------------------------------------------------------------------------- */
-uint64_t rgrp_length(uint64_t size, struct gfs2_sbd *sdp)
+static uint64_t rgrp_length(uint64_t size, struct gfs2_sbd *sdp)
 {
 	uint64_t bitbytes = RGRP_BITMAP_BLKS(&sdp->sd_sb) + 1;
 	uint64_t stuff = RGRP_STUFFED_BLKS(&sdp->sd_sb) + 1;
@@ -1588,7 +1588,7 @@ uint64_t rgrp_length(uint64_t size, struct gfs2_sbd *sdp)
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-int journ_space_to_rg(struct gfs2_sbd *sdp)
+static int journ_space_to_rg(struct gfs2_sbd *sdp)
 {
 	int error = 0;
 	int j, x;
@@ -1670,7 +1670,7 @@ int journ_space_to_rg(struct gfs2_sbd *sdp)
 /* ------------------------------------------------------------------------- */
 /* update_inode_file - update the inode file with the new next_inum          */
 /* ------------------------------------------------------------------------- */
-void update_inode_file(struct gfs2_sbd *sdp)
+static void update_inode_file(struct gfs2_sbd *sdp)
 {
 	struct gfs2_inode *ip = sdp->md.inum;
 	uint64_t buf;
@@ -1687,7 +1687,7 @@ void update_inode_file(struct gfs2_sbd *sdp)
 /* ------------------------------------------------------------------------- */
 /* write_statfs_file - write the statfs file                                 */
 /* ------------------------------------------------------------------------- */
-void write_statfs_file(struct gfs2_sbd *sdp)
+static void write_statfs_file(struct gfs2_sbd *sdp)
 {
 	struct gfs2_inode *ip = sdp->md.statfs;
 	struct gfs2_statfs_change sc;
@@ -1707,7 +1707,7 @@ void write_statfs_file(struct gfs2_sbd *sdp)
 /* ------------------------------------------------------------------------- */
 /* remove_obsolete_gfs1 - remove obsolete gfs1 inodes.                       */
 /* ------------------------------------------------------------------------- */
-void remove_obsolete_gfs1(struct gfs2_sbd *sbp)
+static void remove_obsolete_gfs1(struct gfs2_sbd *sbp)
 {
 	struct gfs2_inum inum;
 
@@ -1733,7 +1733,7 @@ void remove_obsolete_gfs1(struct gfs2_sbd *sbp)
 /* ------------------------------------------------------------------------- */
 /* lifted from libgfs2/structures.c                                          */
 /* ------------------------------------------------------------------------- */
-void conv_build_jindex(struct gfs2_sbd *sdp)
+static void conv_build_jindex(struct gfs2_sbd *sdp)
 {
 	struct gfs2_inode *jindex;
 	unsigned int j;
@@ -1781,10 +1781,10 @@ int main(int argc, char **argv)
 	/* Make them seal their fate.                     */
 	/* ---------------------------------------------- */
 	if (!error) {
-		int abort;
+		int do_abort;
 
 		give_warning();
-		if (!gfs2_query(&abort, &opts,
+		if (!gfs2_query(&do_abort, &opts,
 				"Convert %s from GFS1 to GFS2? (y/n)",
 				device)) {
 			log_crit("%s not converted.\n", device);
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index 7f6790d..055e227 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -113,7 +113,7 @@ void print_gfs2(const char *fmt, ...)
 	va_end(args);
 }
 
-void check_highlight(int highlight)
+static void check_highlight(int highlight)
 {
 	if (!termlines || line >= termlines) /* If printing or out of bounds */
 		return;
@@ -217,7 +217,7 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...)
 	}
 }
 
-int indirect_dirent(struct indirect_info *indir, char *ptr, int d)
+static int indirect_dirent(struct indirect_info *indir, char *ptr, int d)
 {
 	struct gfs2_dirent de;
 
@@ -253,20 +253,20 @@ int indirect_dirent(struct indirect_info *indir, char *ptr, int d)
 **
 *******************************************************************************
 ******************************************************************************/
-void do_dinode_extended(struct gfs2_dinode *di, char *buf)
+void do_dinode_extended(struct gfs2_dinode *dine, char *dinebuf)
 {
 	unsigned int x, y, ptroff = 0;
 	uint64_t p, last;
-	int isdir = !!(S_ISDIR(di->di_mode)) || 
-		(gfs1 && di->__pad1 == GFS_FILE_DIR);
+	int isdir = !!(S_ISDIR(dine->di_mode)) || 
+		(gfs1 && dine->__pad1 == GFS_FILE_DIR);
 
 	indirect_blocks = 0;
 	memset(indirect, 0, sizeof(indirect));
-	if (di->di_height > 0) {
+	if (dine->di_height > 0) {
 		/* Indirect pointers */
 		for (x = sizeof(struct gfs2_dinode); x < sbd.bsize;
 			 x += sizeof(uint64_t)) {
-			p = be64_to_cpu(*(uint64_t *)(buf + x));
+			p = be64_to_cpu(*(uint64_t *)(dinebuf + x));
 			if (p) {
 				indirect->ii[indirect_blocks].block = p;
 				indirect->ii[indirect_blocks].mp.mp_list[0] =
@@ -277,7 +277,7 @@ void do_dinode_extended(struct gfs2_dinode *di, char *buf)
 			ptroff++;
 		}
 	}
-	else if (isdir && !(di->di_flags & GFS2_DIF_EXHASH)) {
+	else if (isdir && !(dine->di_flags & GFS2_DIF_EXHASH)) {
 		int skip = 0;
 
 		/* Directory Entries: */
@@ -286,25 +286,25 @@ void do_dinode_extended(struct gfs2_dinode *di, char *buf)
 		indirect->ii[0].is_dir = TRUE;
 		for (x = sizeof(struct gfs2_dinode); x < sbd.bsize; x += skip) {
 			skip = indirect_dirent(indirect->ii,
-					       buf + x,
+					       dinebuf + x,
 					       indirect->ii[0].dirents);
 			if (skip <= 0)
 				break;
 		}
 	}
 	else if (isdir &&
-			 (di->di_flags & GFS2_DIF_EXHASH) &&
-			 di->di_height == 0) {
+			 (dine->di_flags & GFS2_DIF_EXHASH) &&
+			 dine->di_height == 0) {
 		/* Leaf Pointers: */
 		
-		last = be64_to_cpu(*(uint64_t *)(buf + sizeof(struct gfs2_dinode)));
+		last = be64_to_cpu(*(uint64_t *)(dinebuf + sizeof(struct gfs2_dinode)));
     
 		for (x = sizeof(struct gfs2_dinode), y = 0;
-			 y < (1 << di->di_depth);
+			 y < (1 << dine->di_depth);
 			 x += sizeof(uint64_t), y++) {
-			p = be64_to_cpu(*(uint64_t *)(buf + x));
+			p = be64_to_cpu(*(uint64_t *)(dinebuf + x));
 
-			if (p != last || ((y + 1) * sizeof(uint64_t) == di->di_size)) {
+			if (p != last || ((y + 1) * sizeof(uint64_t) == dine->di_size)) {
 				struct gfs2_buffer_head *tmp_bh;
 				int skip = 0, direntcount = 0;
 				struct gfs2_leaf leaf;
@@ -392,7 +392,7 @@ int do_indirect_extended(char *buf, struct iinfo *iinf, int hgt)
 **
 *******************************************************************************
 ******************************************************************************/
-void do_leaf_extended(char *buf, struct iinfo *indir)
+void do_leaf_extended(char *dlebuf, struct iinfo *indir)
 {
 	int x, i;
 	struct gfs2_dirent de;
@@ -402,14 +402,14 @@ void do_leaf_extended(char *buf, struct iinfo *indir)
 	/* Directory Entries: */
 	for (i = sizeof(struct gfs2_leaf); i < sbd.bsize;
 	     i += de.de_rec_len) {
-		gfs2_dirent_in(&de, buf + i);
+		gfs2_dirent_in(&de, dlebuf + i);
 		if (de.de_inum.no_addr) {
 			indir->ii[0].block = de.de_inum.no_addr;
 			indir->ii[0].dirent[x].block = de.de_inum.no_addr;
 			memcpy(&indir->ii[0].dirent[x].dirent,
 			       &de, sizeof(struct gfs2_dirent));
 			memcpy(&indir->ii[0].dirent[x].filename,
-			       buf + i + sizeof(struct gfs2_dirent),
+			       dlebuf + i + sizeof(struct gfs2_dirent),
 			       de.de_name_len);
 			indir->ii[0].dirent[x].filename[de.de_name_len] = '\0';
 			indir->ii[0].is_dir = TRUE;
@@ -438,7 +438,7 @@ void do_leaf_extended(char *buf, struct iinfo *indir)
 *******************************************************************************
 ******************************************************************************/
 
-void do_eattr_extended(char *buf)
+static void do_eattr_extended(char *deebuf)
 {
 	struct gfs2_ea_header ea;
 	unsigned int x;
@@ -450,12 +450,12 @@ void do_eattr_extended(char *buf)
 	for (x = sizeof(struct gfs2_meta_header); x < sbd.bsize; x += ea.ea_rec_len)
 	{
 		eol(0);
-		gfs2_ea_header_in(&ea, buf + x);
-		gfs2_ea_header_print(&ea, buf + x + sizeof(struct gfs2_ea_header));
+		gfs2_ea_header_in(&ea, deebuf + x);
+		gfs2_ea_header_print(&ea, deebuf + x + sizeof(struct gfs2_ea_header));
 	}
 }
 
-void gfs2_inum_print2(const char *title,struct gfs2_inum *no)
+static void gfs2_inum_print2(const char *title,struct gfs2_inum *no)
 {
 	if (termlines) {
 		check_highlight(TRUE);
@@ -475,40 +475,41 @@ void gfs2_inum_print2(const char *title,struct gfs2_inum *no)
  * gfs2_sb_print2 - Print out a superblock
  * @sb: the cpu-order buffer
  */
-void gfs2_sb_print2(struct gfs2_sb *sb)
+static void gfs2_sb_print2(struct gfs2_sb *sbp2)
 {
-	gfs2_meta_header_print(&sb->sb_header);
+	gfs2_meta_header_print(&sbp2->sb_header);
+
+	pv(sbp2, sb_fs_format, "%u", "0x%x");
+	pv(sbp2, sb_multihost_format, "%u", "0x%x");
 
-	pv(sb, sb_fs_format, "%u", "0x%x");
-	pv(sb, sb_multihost_format, "%u", "0x%x");
 	if (gfs1)
 		pv(sbd1, sb_flags, "%u", "0x%x");
-	pv(sb, sb_bsize, "%u", "0x%x");
-	pv(sb, sb_bsize_shift, "%u", "0x%x");
+	pv(sbp2, sb_bsize, "%u", "0x%x");
+	pv(sbp2, sb_bsize_shift, "%u", "0x%x");
 	if (gfs1) {
 		pv(sbd1, sb_seg_size, "%u", "0x%x");
 		gfs2_inum_print2("jindex ino", &sbd1->sb_jindex_di);
 		gfs2_inum_print2("rindex ino", &sbd1->sb_rindex_di);
 	}
 	else
-		gfs2_inum_print2("master dir", &sb->sb_master_dir);
-	gfs2_inum_print2("root dir  ", &sb->sb_root_dir);
+		gfs2_inum_print2("master dir", &sbp2->sb_master_dir);
+	gfs2_inum_print2("root dir  ", &sbp2->sb_root_dir);
 
-	pv(sb, sb_lockproto, "%s", NULL);
-	pv(sb, sb_locktable, "%s", NULL);
+	pv(sbp2, sb_lockproto, "%s", NULL);
+	pv(sbp2, sb_locktable, "%s", NULL);
 	if (gfs1) {
 		gfs2_inum_print2("quota ino ", &gfs1_quota_di);
 		gfs2_inum_print2("license   ", &gfs1_license_di);
 	}
 #ifdef GFS2_HAS_UUID
-	print_it("  sb_uuid", "%s", NULL, str_uuid(sb->sb_uuid));
+	print_it("  sb_uuid", "%s", NULL, str_uuid(sbp2->sb_uuid));
 #endif
 }
 
 /**
  * gfs1_rgrp_in - read in a gfs1 rgrp
  */
-void gfs1_rgrp_in(struct gfs1_rgrp *rgrp, char *rbuf)
+static void gfs1_rgrp_in(struct gfs1_rgrp *rgrp, char *rbuf)
 {
         struct gfs1_rgrp *str = (struct gfs1_rgrp *)rbuf;
 
@@ -526,7 +527,7 @@ void gfs1_rgrp_in(struct gfs1_rgrp *rgrp, char *rbuf)
 /**
  * gfs_rgrp_print - Print out a resource group header
  */
-void gfs1_rgrp_print(struct gfs1_rgrp *rg)
+static void gfs1_rgrp_print(struct gfs1_rgrp *rg)
 {
         gfs2_meta_header_print(&rg->rg_header);
         pv(rg, rg_flags, "%u", "0x%x");
diff --git a/gfs2/edit/gfs2hex.h b/gfs2/edit/gfs2hex.h
index 68b98ea..a35fce5 100644
--- a/gfs2/edit/gfs2hex.h
+++ b/gfs2/edit/gfs2hex.h
@@ -20,7 +20,7 @@ int display_gfs2(void);
 int edit_gfs2(void);
 void do_dinode_extended(struct gfs2_dinode *di, char *buf);
 void print_gfs2(const char *fmt, ...);
-int do_indirect_extended(char *buf, struct iinfo *iinf, int hgt);
+int do_indirect_extended(char *diebuf, struct iinfo *iinf, int hgt);
 void do_leaf_extended(char *dlebuf, struct iinfo *indir);
 void eol(int col);
 
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 49577f9..99b42bf 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -48,6 +48,8 @@ const char *allocdesc[2][5] = {
 	{"Free ", "Data ", "Unlnk", "Meta ", "Resrv"},
 	{"Free ", "Data ", "FreeM", "Meta ", "Resrv"},};
 
+const char *prog_name;
+
 int display(int identify_only);
 extern void savemeta(const char *out_fn, int slow);
 extern void restoremeta(const char *in_fn, const char *out_device,
@@ -90,58 +92,58 @@ extern void restoremeta(const char *in_fn, const char *out_device,
 		}						\
 	} while(0)
 
-int gfs2_dinode_printval(struct gfs2_dinode *di, const char *strfield)
-{
-	checkprint(strfield, di, di_mode);
-	checkprint(strfield, di, di_uid);
-	checkprint(strfield, di, di_gid);
-	checkprint(strfield, di, di_nlink);
-	checkprint(strfield, di, di_size);
-	checkprint(strfield, di, di_blocks);
-	checkprint(strfield, di, di_atime);
-	checkprint(strfield, di, di_mtime);
-	checkprint(strfield, di, di_ctime);
-	checkprint(strfield, di, di_major);
-	checkprint(strfield, di, di_minor);
-	checkprint(strfield, di, di_goal_meta);
-	checkprint(strfield, di, di_goal_data);
-	checkprint(strfield, di, di_flags);
-	checkprint(strfield, di, di_payload_format);
-	checkprint(strfield, di, di_height);
-	checkprint(strfield, di, di_depth);
-	checkprint(strfield, di, di_entries);
-	checkprint(strfield, di, di_eattr);
+static int gfs2_dinode_printval(struct gfs2_dinode *dip, const char *strfield)
+{
+	checkprint(strfield, dip, di_mode);
+	checkprint(strfield, dip, di_uid);
+	checkprint(strfield, dip, di_gid);
+	checkprint(strfield, dip, di_nlink);
+	checkprint(strfield, dip, di_size);
+	checkprint(strfield, dip, di_blocks);
+	checkprint(strfield, dip, di_atime);
+	checkprint(strfield, dip, di_mtime);
+	checkprint(strfield, dip, di_ctime);
+	checkprint(strfield, dip, di_major);
+	checkprint(strfield, dip, di_minor);
+	checkprint(strfield, dip, di_goal_meta);
+	checkprint(strfield, dip, di_goal_data);
+	checkprint(strfield, dip, di_flags);
+	checkprint(strfield, dip, di_payload_format);
+	checkprint(strfield, dip, di_height);
+	checkprint(strfield, dip, di_depth);
+	checkprint(strfield, dip, di_entries);
+	checkprint(strfield, dip, di_eattr);
 
 	return -1;
 }
 
-int gfs2_dinode_assignval(struct gfs2_dinode *di, const char *strfield,
+static int gfs2_dinode_assignval(struct gfs2_dinode *dia, const char *strfield,
 			  uint64_t value)
 {
-	checkassign(strfield, di, di_mode, value);
-	checkassign(strfield, di, di_uid, value);
-	checkassign(strfield, di, di_gid, value);
-	checkassign(strfield, di, di_nlink, value);
-	checkassign(strfield, di, di_size, value);
-	checkassign(strfield, di, di_blocks, value);
-	checkassign(strfield, di, di_atime, value);
-	checkassign(strfield, di, di_mtime, value);
-	checkassign(strfield, di, di_ctime, value);
-	checkassign(strfield, di, di_major, value);
-	checkassign(strfield, di, di_minor, value);
-	checkassign(strfield, di, di_goal_meta, value);
-	checkassign(strfield, di, di_goal_data, value);
-	checkassign(strfield, di, di_flags, value);
-	checkassign(strfield, di, di_payload_format, value);
-	checkassign(strfield, di, di_height, value);
-	checkassign(strfield, di, di_depth, value);
-	checkassign(strfield, di, di_entries, value);
-	checkassign(strfield, di, di_eattr, value);
+	checkassign(strfield, dia, di_mode, value);
+	checkassign(strfield, dia, di_uid, value);
+	checkassign(strfield, dia, di_gid, value);
+	checkassign(strfield, dia, di_nlink, value);
+	checkassign(strfield, dia, di_size, value);
+	checkassign(strfield, dia, di_blocks, value);
+	checkassign(strfield, dia, di_atime, value);
+	checkassign(strfield, dia, di_mtime, value);
+	checkassign(strfield, dia, di_ctime, value);
+	checkassign(strfield, dia, di_major, value);
+	checkassign(strfield, dia, di_minor, value);
+	checkassign(strfield, dia, di_goal_meta, value);
+	checkassign(strfield, dia, di_goal_data, value);
+	checkassign(strfield, dia, di_flags, value);
+	checkassign(strfield, dia, di_payload_format, value);
+	checkassign(strfield, dia, di_height, value);
+	checkassign(strfield, dia, di_depth, value);
+	checkassign(strfield, dia, di_entries, value);
+	checkassign(strfield, dia, di_eattr, value);
 
 	return -1;
 }
 
-int gfs2_rgrp_printval(struct gfs2_rgrp *rg, const char *strfield)
+static int gfs2_rgrp_printval(struct gfs2_rgrp *rg, const char *strfield)
 {
 	checkprint(strfield, rg, rg_flags);
 	checkprint(strfield, rg, rg_free);
@@ -150,7 +152,7 @@ int gfs2_rgrp_printval(struct gfs2_rgrp *rg, const char *strfield)
 	return -1;
 }
 
-int gfs2_rgrp_assignval(struct gfs2_rgrp *rg, const char *strfield,
+static int gfs2_rgrp_assignval(struct gfs2_rgrp *rg, const char *strfield,
 			uint64_t value)
 {
 	checkassign(strfield, rg, rg_flags, value);
@@ -163,7 +165,7 @@ int gfs2_rgrp_assignval(struct gfs2_rgrp *rg, const char *strfield,
 /* ------------------------------------------------------------------------ */
 /* UpdateSize - screen size changed, so update it                           */
 /* ------------------------------------------------------------------------ */
-void UpdateSize(int sig)
+static void UpdateSize(int sig)
 {
 	static char term_buffer[2048];
 	int rc;
@@ -174,10 +176,10 @@ void UpdateSize(int sig)
 		return;
 	rc=tgetent(term_buffer,termtype);
 	if (rc>=0) {
-		termlines = tgetnum("li");
+		termlines = tgetnum((char *)"li");
 		if (termlines < 10)
 			termlines = 30;
-		termcols = tgetnum("co");
+		termcols = tgetnum((char *)"co");
 		if (termcols < 80)
 			termcols = 80;
 	}
@@ -191,7 +193,7 @@ void UpdateSize(int sig)
 /* ------------------------------------------------------------------------- */
 /* erase - clear the screen */
 /* ------------------------------------------------------------------------- */
-void Erase(void)
+static void Erase(void)
 {
 	int i;
 	char spaces[256];
@@ -210,7 +212,7 @@ void Erase(void)
 /* ------------------------------------------------------------------------- */
 /* display_title_lines */
 /* ------------------------------------------------------------------------- */
-void display_title_lines(void)
+static void display_title_lines(void)
 {
 	Erase();
 	COLORS_TITLE;
@@ -226,7 +228,7 @@ void display_title_lines(void)
 /* returns: 1 if user exited by hitting enter                                */
 /*          0 if user exited by hitting escape                               */
 /* ------------------------------------------------------------------------- */
-int bobgets(char string[],int x,int y,int sz,int *ch)
+static int bobgets(char string[],int x,int y,int sz,int *ch)
 {
 	int done,runningy,rc;
 
@@ -367,7 +369,7 @@ int bobgets(char string[],int x,int y,int sz,int *ch)
 /******************************************************************************
 ** instr - instructions
 ******************************************************************************/
-void gfs2instr(const char *s1, const char *s2)
+static void gfs2instr(const char *s1, const char *s2)
 {
 	COLORS_HIGHLIGHT;
 	move(line,0);
@@ -389,7 +391,7 @@ void gfs2instr(const char *s1, const char *s2)
 *******************************************************************************
 ******************************************************************************/
 
-void print_usage(void)
+static void print_usage(void)
 {
 	int ch;
 
@@ -442,7 +444,7 @@ void print_usage(void)
 /* returns: metatype if block is a GFS2 structure block type                */
 /*          0 if block is not a GFS2 structure                              */
 /* ------------------------------------------------------------------------ */
-int get_block_type(const char *lpBuffer)
+static int get_block_type(const char *lpBuffer)
 {
 	int ret_type = 0;
 
@@ -653,7 +655,7 @@ int display_block_type(const char *lpBuffer, int from_restore)
 /* ------------------------------------------------------------------------ */
 /* hexdump - hex dump the filesystem block to the screen                    */
 /* ------------------------------------------------------------------------ */
-int hexdump(uint64_t startaddr, const char *lpBuffer, int len)
+static int hexdump(uint64_t startaddr, const char *lpBuffer, int len)
 {
 	const unsigned char *pointer,*ptr2;
 	int i;
@@ -794,7 +796,7 @@ static int risize(void)
 /* ------------------------------------------------------------------------ */
 /* rgcount - return how many rgrps there are.                               */
 /* ------------------------------------------------------------------------ */
-void rgcount(void)
+static void rgcount(void)
 {
 	printf("%lld RGs in this file system.\n",
 	       (unsigned long long)sbd.md.riinode->i_di.di_size / risize());
@@ -806,36 +808,36 @@ void rgcount(void)
 /* ------------------------------------------------------------------------ */
 /* find_rgrp_block - locate the block for a given rgrp number               */
 /* ------------------------------------------------------------------------ */
-uint64_t find_rgrp_block(struct gfs2_inode *di, int rg)
+static uint64_t find_rgrp_block(struct gfs2_inode *dif, int rg)
 {
 	int amt;
-	struct gfs2_rindex buf, ri;
-	uint64_t offset, gfs1_adj = 0;
+	struct gfs2_rindex fbuf, ri;
+	uint64_t foffset, gfs1_adj = 0;
 
-	offset = rg * risize();
+	foffset = rg * risize();
 	if (gfs1) {
 		uint64_t sd_jbsize =
 			(sbd.bsize - sizeof(struct gfs2_meta_header));
 
-		gfs1_adj = (offset / sd_jbsize) *
+		gfs1_adj = (foffset / sd_jbsize) *
 			sizeof(struct gfs2_meta_header);
 		gfs1_adj += sizeof(struct gfs2_meta_header);
 	}
-	amt = gfs2_readi(di, (void *)&buf, offset + gfs1_adj, risize());
+	amt = gfs2_readi(dif, (void *)&fbuf, foffset + gfs1_adj, risize());
 	if (!amt) /* end of file */
 		return 0;
-	gfs2_rindex_in(&ri, (void *)&buf);
+	gfs2_rindex_in(&ri, (void *)&fbuf);
 	return ri.ri_addr;
 }
 
 /* ------------------------------------------------------------------------ */
 /* gfs_rgrp_in - Read in a resource group header                            */
 /* ------------------------------------------------------------------------ */
-void gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf)
+static void gfs_rgrp_in(struct gfs_rgrp *rgrp, char *gbuf)
 {
-	struct gfs_rgrp *str = (struct gfs_rgrp *)buf;
+	struct gfs_rgrp *str = (struct gfs_rgrp *)gbuf;
 
-	gfs2_meta_header_in(&rgrp->rg_header, buf);
+	gfs2_meta_header_in(&rgrp->rg_header, gbuf);
 	rgrp->rg_flags = be32_to_cpu(str->rg_flags);
 	rgrp->rg_free = be32_to_cpu(str->rg_free);
 	rgrp->rg_useddi = be32_to_cpu(str->rg_useddi);
@@ -848,11 +850,11 @@ void gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf)
 /* ------------------------------------------------------------------------ */
 /* gfs_rgrp_out */
 /* ------------------------------------------------------------------------ */
-void gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf)
+static void gfs_rgrp_out(struct gfs_rgrp *rgrp, char *gbuf)
 {
-	struct gfs_rgrp *str = (struct gfs_rgrp *)buf;
+	struct gfs_rgrp *str = (struct gfs_rgrp *)gbuf;
 
-	gfs2_meta_header_out(&rgrp->rg_header, buf);
+	gfs2_meta_header_out(&rgrp->rg_header, gbuf);
 	str->rg_flags = cpu_to_be32(rgrp->rg_flags);
 	str->rg_free = cpu_to_be32(rgrp->rg_free);
 	str->rg_useddi = cpu_to_be32(rgrp->rg_useddi);
@@ -865,7 +867,7 @@ void gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf)
 /* ------------------------------------------------------------------------ */
 /* gfs_rgrp_print - print a gfs1 resource group                             */
 /* ------------------------------------------------------------------------ */
-void gfs_rgrp_print(struct gfs_rgrp *rg)
+static void gfs_rgrp_print(struct gfs_rgrp *rg)
 {
 	gfs2_meta_header_print(&rg->rg_header);
 	pv(rg, rg_flags, "%u", "0x%x");
@@ -880,17 +882,17 @@ void gfs_rgrp_print(struct gfs_rgrp *rg)
 /* ------------------------------------------------------------------------ */
 /* get_rg_addr                                                              */
 /* ------------------------------------------------------------------------ */
-uint64_t get_rg_addr(int rgnum)
+static uint64_t get_rg_addr(int rgnum)
 {
 	struct gfs2_buffer_head *bh;
-	uint64_t rgblk = 0, block;
+	uint64_t rgblk = 0, gblock;
 	struct gfs2_inode *riinode;
 
 	if (gfs1)
-		block = sbd1->sb_rindex_di.no_addr;
+		gblock = sbd1->sb_rindex_di.no_addr;
 	else
-		block = masterblock("rindex");
-	bh = bread(&sbd.buf_list, block);
+		gblock = masterblock("rindex");
+	bh = bread(&sbd.buf_list, gblock);
 	riinode = inode_get(&sbd, bh);
 	if (rgnum < riinode->i_di.di_size / risize())
 		rgblk = find_rgrp_block(riinode, rgnum);
@@ -908,7 +910,7 @@ uint64_t get_rg_addr(int rgnum)
 /* modify: TRUE if the value is to be modified, FALSE if it's to be printed */
 /* full: TRUE if the full RG should be printed.                             */
 /* ------------------------------------------------------------------------ */
-void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full)
+static void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full)
 {
 	union {
 		struct gfs2_rgrp rg2;
@@ -956,32 +958,32 @@ void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full)
 /* ------------------------------------------------------------------------ */
 /* parse_rindex - print the rgindex file.                                   */
 /* ------------------------------------------------------------------------ */
-int parse_rindex(struct gfs2_inode *di, int print_rindex)
+static int parse_rindex(struct gfs2_inode *dip, int print_rindex)
 {
 	int error, start_line;
 	struct gfs2_rindex ri;
-	char buf[sizeof(struct gfs_rindex)];
+	char rbuf[sizeof(struct gfs_rindex)];
 	char highlighted_addr[32];
 
 	start_line = line;
 	error = 0;
-	print_gfs2("RG index entries found: %d.", di->i_di.di_size / risize());
+	print_gfs2("RG index entries found: %d.", dip->i_di.di_size / risize());
 	eol(0);
 	lines_per_row[dmode] = 6;
 	memset(highlighted_addr, 0, sizeof(highlighted_addr));
 
 	for (print_entry_ndx=0; ; print_entry_ndx++) {
-		uint64_t offset;
+		uint64_t roff;
 
-		offset = print_entry_ndx * risize();
+		roff = print_entry_ndx * risize();
 
 		if (gfs1)
-			error = gfs1_readi(di, (void *)&buf, offset, risize());
+			error = gfs1_readi(dip, (void *)&rbuf, roff, risize());
 		else
-			error = gfs2_readi(di, (void *)&buf, offset, risize());
+			error = gfs2_readi(dip, (void *)&rbuf, roff, risize());
 		if (!error) /* end of file */
 			break;
-		gfs2_rindex_in(&ri, buf);
+		gfs2_rindex_in(&ri, rbuf);
 		if (!termlines ||
 			(print_entry_ndx >= start_row[dmode] &&
 			 ((print_entry_ndx - start_row[dmode])+1) * lines_per_row[dmode] <=
@@ -1025,9 +1027,9 @@ int parse_rindex(struct gfs2_inode *di, int print_rindex)
 /* ------------------------------------------------------------------------ */
 /* gfs_jindex_in - read in a gfs1 jindex structure.                         */
 /* ------------------------------------------------------------------------ */
-void gfs_jindex_in(struct gfs_jindex *jindex, char *buf)
+void gfs_jindex_in(struct gfs_jindex *jindex, char *jbuf)
 {
-        struct gfs_jindex *str = (struct gfs_jindex *) buf;
+        struct gfs_jindex *str = (struct gfs_jindex *) jbuf;
 
         jindex->ji_addr = be64_to_cpu(str->ji_addr);
         jindex->ji_nsegment = be32_to_cpu(str->ji_nsegment);
@@ -1038,7 +1040,7 @@ void gfs_jindex_in(struct gfs_jindex *jindex, char *buf)
 /* ------------------------------------------------------------------------ */
 /* gfs_jindex_print - print an jindex entry.                                */
 /* ------------------------------------------------------------------------ */
-void gfs_jindex_print(struct gfs_jindex *ji)
+static void gfs_jindex_print(struct gfs_jindex *ji)
 {
         pv((unsigned long long)ji, ji_addr, "%llu", "0x%llx");
         pv(ji, ji_nsegment, "%u", "0x%x");
@@ -1048,23 +1050,23 @@ void gfs_jindex_print(struct gfs_jindex *ji)
 /* ------------------------------------------------------------------------ */
 /* print_jindex - print the jindex file.                                    */
 /* ------------------------------------------------------------------------ */
-int print_jindex(struct gfs2_inode *di)
+static int print_jindex(struct gfs2_inode *dij)
 {
 	int error, start_line;
 	struct gfs_jindex ji;
-	char buf[sizeof(struct gfs_jindex)];
+	char jbuf[sizeof(struct gfs_jindex)];
 
 	start_line = line;
 	error = 0;
 	print_gfs2("Journal index entries found: %d.",
-		   di->i_di.di_size / sizeof(struct gfs_jindex));
+		   dij->i_di.di_size / sizeof(struct gfs_jindex));
 	eol(0);
 	lines_per_row[dmode] = 4;
 	for (print_entry_ndx=0; ; print_entry_ndx++) {
-		error = gfs2_readi(di, (void *)&buf,
+		error = gfs2_readi(dij, (void *)&jbuf,
 				   print_entry_ndx*sizeof(struct gfs_jindex),
 				   sizeof(struct gfs_jindex));
-		gfs_jindex_in(&ji, buf);
+		gfs_jindex_in(&ji, jbuf);
 		if (!error) /* end of file */
 			break;
 		if (!termlines ||
@@ -1091,23 +1093,23 @@ int print_jindex(struct gfs2_inode *di)
 /* ------------------------------------------------------------------------ */
 /* print_inum - print the inum file.                                        */
 /* ------------------------------------------------------------------------ */
-int print_inum(struct gfs2_inode *di)
+static int print_inum(struct gfs2_inode *dii)
 {
-	uint64_t buf, inodenum;
+	uint64_t inum, inodenum;
 	int rc;
 	
-	rc = gfs2_readi(di, (void *)&buf, 0, sizeof(buf));
+	rc = gfs2_readi(dii, (void *)&inum, 0, sizeof(inum));
 	if (!rc) {
 		print_gfs2("The inum file is empty.");
 		eol(0);
 		return 0;
 	}
-	if (rc != sizeof(buf)) {
+	if (rc != sizeof(inum)) {
 		print_gfs2("Error reading inum file.");
 		eol(0);
 		return -1;
 	}
-	inodenum = be64_to_cpu(buf);
+	inodenum = be64_to_cpu(inum);
 	print_gfs2("Next inode num = %lld (0x%llx)", inodenum, inodenum);
 	eol(0);
 	return 0;
@@ -1116,23 +1118,23 @@ int print_inum(struct gfs2_inode *di)
 /* ------------------------------------------------------------------------ */
 /* print_statfs - print the statfs file.                                    */
 /* ------------------------------------------------------------------------ */
-int print_statfs(struct gfs2_inode *di)
+static int print_statfs(struct gfs2_inode *dis)
 {
-	struct gfs2_statfs_change buf, sfc;
+	struct gfs2_statfs_change sfb, sfc;
 	int rc;
 	
-	rc = gfs2_readi(di, (void *)&buf, 0, sizeof(buf));
+	rc = gfs2_readi(dis, (void *)&sfb, 0, sizeof(sfb));
 	if (!rc) {
 		print_gfs2("The statfs file is empty.");
 		eol(0);
 		return 0;
 	}
-	if (rc != sizeof(buf)) {
+	if (rc != sizeof(sfb)) {
 		print_gfs2("Error reading statfs file.");
 		eol(0);
 		return -1;
 	}
-	gfs2_statfs_change_in(&sfc, (char *)&buf);
+	gfs2_statfs_change_in(&sfc, (char *)&sfb);
 	print_gfs2("statfs file contents:");
 	eol(0);
 	gfs2_statfs_change_print(&sfc);
@@ -1142,25 +1144,25 @@ int print_statfs(struct gfs2_inode *di)
 /* ------------------------------------------------------------------------ */
 /* print_quota - print the quota file.                                      */
 /* ------------------------------------------------------------------------ */
-int print_quota(struct gfs2_inode *di)
+static int print_quota(struct gfs2_inode *diq)
 {
-	struct gfs2_quota buf, q;
+	struct gfs2_quota qbuf, q;
 	int i, error;
 	
 	print_gfs2("quota file contents:");
 	eol(0);
-	print_gfs2("quota entries found: %d.", di->i_di.di_size / sizeof(q));
+	print_gfs2("quota entries found: %d.", diq->i_di.di_size / sizeof(q));
 	eol(0);
 	for (i=0; ; i++) {
-		error = gfs2_readi(di, (void *)&buf, i * sizeof(q), sizeof(buf));
+		error = gfs2_readi(diq, (void *)&qbuf, i * sizeof(q), sizeof(qbuf));
 		if (!error)
 			break;
-		if (error != sizeof(buf)) {
+		if (error != sizeof(qbuf)) {
 			print_gfs2("Error reading quota file.");
 			eol(0);
 			return -1;
 		}
-		gfs2_quota_in(&q, (char *)&buf);
+		gfs2_quota_in(&q, (char *)&qbuf);
 		print_gfs2("Entry #%d", i + 1);
 		eol(0);
 		gfs2_quota_print(&q);
@@ -1171,7 +1173,7 @@ int print_quota(struct gfs2_inode *di)
 /* ------------------------------------------------------------------------ */
 /* has_indirect_blocks                                                      */
 /* ------------------------------------------------------------------------ */
-int has_indirect_blocks(void)
+static int has_indirect_blocks(void)
 {
 	if (indirect_blocks || gfs2_struct_type == GFS2_METATYPE_SB ||
 	    gfs2_struct_type == GFS2_METATYPE_LF ||
@@ -1184,7 +1186,7 @@ int has_indirect_blocks(void)
 /* ------------------------------------------------------------------------ */
 /* print_inode_type                                                         */
 /* ------------------------------------------------------------------------ */
-void print_inode_type(__be16 de_type)
+static void print_inode_type(__be16 de_type)
 {
 	if (gfs1) {
 		switch(de_type) {
@@ -1252,7 +1254,7 @@ void print_inode_type(__be16 de_type)
 /* ------------------------------------------------------------------------ */
 /* display_leaf - display directory leaf                                    */
 /* ------------------------------------------------------------------------ */
-int display_leaf(struct iinfo *ind)
+static int display_leaf(struct iinfo *ind)
 {
 	int start_line, total_dirents = start_row[dmode];
 	int d;
@@ -1308,7 +1310,7 @@ int display_leaf(struct iinfo *ind)
 /* ------------------------------------------------------------------------ */
 /* metapath_to_lblock - convert from metapath, height to logical block      */
 /* ------------------------------------------------------------------------ */
-uint64_t metapath_to_lblock(struct metapath *mp, int hgt)
+static uint64_t metapath_to_lblock(struct metapath *mp, int hgt)
 {
 	int h;
 	uint64_t lblock = 0;
@@ -1329,7 +1331,7 @@ uint64_t metapath_to_lblock(struct metapath *mp, int hgt)
 /* ------------------------------------------------------------------------ */
 /* dinode_valid - check if we have a dinode in recent history               */
 /* ------------------------------------------------------------------------ */
-int dinode_valid(void)
+static int dinode_valid(void)
 {
 	int i;
 
@@ -1347,7 +1349,7 @@ int dinode_valid(void)
 /* ------------------------------------------------------------------------ */
 /* get_height                                                               */
 /* ------------------------------------------------------------------------ */
-int get_height(void)
+static int get_height(void)
 {
 	int cur_height = 0, i;
 
@@ -1366,7 +1368,7 @@ int get_height(void)
 /* ------------------------------------------------------------------------ */
 /* display_indirect                                                         */
 /* ------------------------------------------------------------------------ */
-int display_indirect(struct iinfo *ind, int indblocks, int level, uint64_t startoff)
+static int display_indirect(struct iinfo *ind, int indblocks, int level, uint64_t startoff)
 {
 	int start_line, total_dirents;
 	int cur_height = -1, pndx;
@@ -1541,7 +1543,7 @@ int block_is_rindex(void)
 /*                   special case meant to parse the rindex and follow the  */
 /*                   blocks to the real rgs.                                */
 /* ------------------------------------------------------------------------ */
-int block_is_rglist(void)
+static int block_is_rglist(void)
 {
 	if (block == RGLIST_DUMMY_BLOCK)
 		return TRUE;
@@ -1630,7 +1632,7 @@ int block_is_in_per_node(void)
 /* ------------------------------------------------------------------------ */
 /* block_has_extended_info                                                  */
 /* ------------------------------------------------------------------------ */
-int block_has_extended_info(void)
+static int block_has_extended_info(void)
 {
 	if (has_indirect_blocks() ||
 	    block_is_rindex() ||
@@ -1646,7 +1648,7 @@ int block_has_extended_info(void)
 /* ------------------------------------------------------------------------ */
 /* display_extended                                                         */
 /* ------------------------------------------------------------------------ */
-int display_extended(void)
+static int display_extended(void)
 {
 	struct gfs2_inode *tmp_inode;
 	struct gfs2_buffer_head *tmp_bh;
@@ -1703,7 +1705,7 @@ int display_extended(void)
 /* ------------------------------------------------------------------------ */
 /* read_superblock - read the superblock                                    */
 /* ------------------------------------------------------------------------ */
-void read_superblock(int fd)
+static void read_superblock(int fd)
 {
 	int count;
 
@@ -1776,7 +1778,7 @@ void read_superblock(int fd)
 /* ------------------------------------------------------------------------ */
 /* read_master_dir - read the master directory                              */
 /* ------------------------------------------------------------------------ */
-void read_master_dir(void)
+static void read_master_dir(void)
 {
 	ioctl(sbd.device_fd, BLKFLSBUF, 0);
 	lseek(sbd.device_fd, sbd.sd_sb.sb_master_dir.no_addr * sbd.bsize,
@@ -1903,7 +1905,7 @@ int display(int identify_only)
 /* ------------------------------------------------------------------------ */
 /* push_block - push a block onto the block stack                           */
 /* ------------------------------------------------------------------------ */
-void push_block(uint64_t blk)
+static void push_block(uint64_t blk)
 {
 	int i, bhst;
 
@@ -1930,7 +1932,7 @@ void push_block(uint64_t blk)
 /* ------------------------------------------------------------------------ */
 /* pop_block - pop a block off the block stack                              */
 /* ------------------------------------------------------------------------ */
-uint64_t pop_block(void)
+static uint64_t pop_block(void)
 {
 	int i, bhst;
 
@@ -1954,7 +1956,7 @@ uint64_t pop_block(void)
 /* find_journal_block - figure out where a journal starts, given the name   */
 /* Returns: journal block number, changes j_size to the journal size        */
 /* ------------------------------------------------------------------------ */
-uint64_t find_journal_block(const char *journal, uint64_t *j_size)
+static uint64_t find_journal_block(const char *journal, uint64_t *j_size)
 {
 	int journal_num;
 	uint64_t jindex_block, jblock = 0;
@@ -2010,7 +2012,7 @@ uint64_t find_journal_block(const char *journal, uint64_t *j_size)
 /* This is used to find blocks that aren't represented in the bitmaps, such */
 /* as the RGs and bitmaps or the superblock.                                */
 /* ------------------------------------------------------------------------ */
-uint64_t find_metablockoftype_slow(uint64_t startblk, int metatype, int print)
+static uint64_t find_metablockoftype_slow(uint64_t startblk, int metatype, int print)
 {
 	uint64_t blk, last_fs_block;
 	int found = 0;
@@ -2051,7 +2053,7 @@ uint64_t find_metablockoftype_slow(uint64_t startblk, int metatype, int print)
 /* all, if we're searching for a dinode, we want a real allocated inode,    */
 /* not just some block that used to be an inode in a previous incarnation.  */
 /* ------------------------------------------------------------------------ */
-uint64_t find_metablockoftype_rg(uint64_t startblk, int metatype, int print)
+static uint64_t find_metablockoftype_rg(uint64_t startblk, int metatype, int print)
 {
 	uint64_t blk;
 	int first = 1, found = 0;
@@ -2112,7 +2114,7 @@ uint64_t find_metablockoftype_rg(uint64_t startblk, int metatype, int print)
 /* ------------------------------------------------------------------------ */
 /* Find next metadata block AFTER a given point in the fs                   */
 /* ------------------------------------------------------------------------ */
-uint64_t find_metablockoftype(const char *strtype, int print)
+static uint64_t find_metablockoftype(const char *strtype, int print)
 {
 	int mtype = 0;
 	uint64_t startblk, blk = 0;
@@ -2211,7 +2213,7 @@ uint64_t check_keywords(const char *kword)
 /* ------------------------------------------------------------------------ */
 /* goto_block - go to a desired block entered by the user                   */
 /* ------------------------------------------------------------------------ */
-uint64_t goto_block(void)
+static uint64_t goto_block(void)
 {
 	char string[256];
 	int ch;
@@ -2248,7 +2250,7 @@ uint64_t goto_block(void)
 /* ------------------------------------------------------------------------ */
 /* init_colors                                                              */
 /* ------------------------------------------------------------------------ */
-void init_colors()
+static void init_colors(void)
 {
 
 	if (color_scheme) {
@@ -2274,7 +2276,7 @@ void init_colors()
 /* ------------------------------------------------------------------------ */
 /* hex_edit - Allow the user to edit the page by entering hex digits        */
 /* ------------------------------------------------------------------------ */
-void hex_edit(int *exitch)
+static void hex_edit(int *exitch)
 {
 	int left_off;
 	int ch;
@@ -2330,7 +2332,7 @@ void hex_edit(int *exitch)
 /* ------------------------------------------------------------------------ */
 /* page up                                                                  */
 /* ------------------------------------------------------------------------ */
-void pageup(void)
+static void pageup(void)
 {
 	if (dmode == EXTENDED_MODE) {
 		if (edit_row[dmode] - (dsplines / lines_per_row[dmode]) > 0)
@@ -2362,7 +2364,7 @@ void pageup(void)
 /* ------------------------------------------------------------------------ */
 /* page down                                                                */
 /* ------------------------------------------------------------------------ */
-void pagedn(void)
+static void pagedn(void)
 {
 	if (dmode == EXTENDED_MODE) {
 		if ((edit_row[dmode] + dsplines) / lines_per_row[dmode] + 1 <=
@@ -2391,7 +2393,7 @@ void pagedn(void)
 /* ------------------------------------------------------------------------ */
 /* jump - jump to the address the cursor is on                              */
 /* ------------------------------------------------------------------------ */
-void jump(void)
+static void jump(void)
 {
 	if (dmode == HEX_MODE) {
 		unsigned int col2;
@@ -2421,30 +2423,30 @@ void jump(void)
 /* ------------------------------------------------------------------------ */
 /* print block type                                                         */
 /* ------------------------------------------------------------------------ */
-void print_block_type(uint64_t block, int type, const char *additional)
+static void print_block_type(uint64_t tblock, int type, const char *additional)
 {
 	if (type <= GFS2_METATYPE_QC)
 		printf("%d (Block %lld is type %d: %s%s)\n", type,
-		       (unsigned long long)block, type, block_type_str[type],
+		       (unsigned long long)tblock, type, block_type_str[type],
 		       additional);
 	else
 		printf("%d (Block %lld is type %d: unknown%s)\n", type,
-		       (unsigned long long)block, type, additional);
+		       (unsigned long long)tblock, type, additional);
 }
 
 /* ------------------------------------------------------------------------ */
 /* find_print block type                                                    */
 /* ------------------------------------------------------------------------ */
-void find_print_block_type(void)
+static void find_print_block_type(void)
 {
-	uint64_t block;
+	uint64_t tblock;
 	struct gfs2_buffer_head *bh;
 	int type;
 
-	block = blockstack[blockhist % BLOCK_STACK_SIZE].block;
-	bh = bread(&sbd.buf_list, block);
+	tblock = blockstack[blockhist % BLOCK_STACK_SIZE].block;
+	bh = bread(&sbd.buf_list, tblock);
 	type = get_block_type(bh->b_data);
-	print_block_type(block, type, "");
+	print_block_type(tblock, type, "");
 	brelse(bh, NOT_UPDATED);
 	gfs2_rgrp_free(&sbd.rglist, not_updated);
 	exit(0);
@@ -2453,17 +2455,17 @@ void find_print_block_type(void)
 /* ------------------------------------------------------------------------ */
 /* Find and print the resource group associated with a given block          */
 /* ------------------------------------------------------------------------ */
-void find_print_block_rg(int bitmap)
+static void find_print_block_rg(int bitmap)
 {
-	uint64_t block, rgblock;
+	uint64_t rblock, rgblock;
 	int i;
 	struct rgrp_list *rgd;
 
-	block = blockstack[blockhist % BLOCK_STACK_SIZE].block;
-	if (block == sbd.sb_addr)
+	rblock = blockstack[blockhist % BLOCK_STACK_SIZE].block;
+	if (rblock == sbd.sb_addr)
 		printf("0 (the superblock is not in the bitmap)\n");
 	else {
-		rgd = gfs2_blk2rgrpd(&sbd, block);
+		rgd = gfs2_blk2rgrpd(&sbd, rblock);
 		if (rgd) {
 			rgblock = rgd->ri.ri_addr;
 			if (bitmap) {
@@ -2471,7 +2473,7 @@ void find_print_block_rg(int bitmap)
 
 				for (i = 0; i < rgd->ri.ri_length; i++) {
 					bits = &(rgd->bits[i]);
-					if (block - rgd->ri.ri_data0 <
+					if (rblock - rgd->ri.ri_data0 <
 					    ((bits->bi_start + bits->bi_len) *
 					     GFS2_NBBY)) {
 						break;
@@ -2496,9 +2498,9 @@ void find_print_block_rg(int bitmap)
 /* ------------------------------------------------------------------------ */
 /* find/change/print block allocation (what the bitmap says about block)    */
 /* ------------------------------------------------------------------------ */
-void find_change_block_alloc(int *newval)
+static void find_change_block_alloc(int *newval)
 {
-	uint64_t block;
+	uint64_t ablock;
 	int type;
 	struct rgrp_list *rgd;
 
@@ -2513,19 +2515,19 @@ void find_change_block_alloc(int *newval)
 		gfs2_rgrp_free(&sbd.rglist, not_updated);
 		exit(-1);
 	}
-	block = blockstack[blockhist % BLOCK_STACK_SIZE].block;
-	if (block == sbd.sb_addr)
+	ablock = blockstack[blockhist % BLOCK_STACK_SIZE].block;
+	if (ablock == sbd.sb_addr)
 		printf("3 (the superblock is not in the bitmap)\n");
 	else {
 		if (newval) {
-			if (gfs2_set_bitmap(&sbd, block, *newval))
+			if (gfs2_set_bitmap(&sbd, ablock, *newval))
 				printf("-1 (block invalid or part of an rgrp).\n");
 			else
 				printf("%d\n", *newval);
 		} else {
-			rgd = gfs2_blk2rgrpd(&sbd, block);
+			rgd = gfs2_blk2rgrpd(&sbd, ablock);
 			if (rgd) {
-				type = gfs2_get_bitmap(&sbd, block, rgd);
+				type = gfs2_get_bitmap(&sbd, ablock, rgd);
 				printf("%d (%s)\n", type, allocdesc[gfs1][type]);
 				gfs2_rgrp_relse(rgd, not_updated);
 			} else {
@@ -2544,20 +2546,20 @@ void find_change_block_alloc(int *newval)
 /* ------------------------------------------------------------------------ */
 /* process request to print a certain field from a previously pushed block  */
 /* ------------------------------------------------------------------------ */
-void process_field(const char *field, uint64_t *newval, int print_field)
+static void process_field(const char *field, uint64_t *newval, int print_field)
 {
-	uint64_t block;
+	uint64_t fblock;
 	struct gfs2_buffer_head *bh;
 	int type;
 	struct gfs2_rgrp rg;
 
-	block = blockstack[blockhist % BLOCK_STACK_SIZE].block;
-	bh = bread(&sbd.buf_list, block);
+	fblock = blockstack[blockhist % BLOCK_STACK_SIZE].block;
+	bh = bread(&sbd.buf_list, fblock);
 	type = get_block_type(bh->b_data);
 	switch (type) {
 	case GFS2_METATYPE_SB:
 		if (print_field)
-			print_block_type(block, type,
+			print_block_type(fblock, type,
 					 " which is not implemented");
 		break;
 	case GFS2_METATYPE_RG:
@@ -2574,7 +2576,7 @@ void process_field(const char *field, uint64_t *newval, int print_field)
 		break;
 	case GFS2_METATYPE_RB:
 		if (print_field)
-			print_block_type(block, type,
+			print_block_type(fblock, type,
 					 " which is not implemented");
 		break;
 	case GFS2_METATYPE_DI:
@@ -2600,7 +2602,7 @@ void process_field(const char *field, uint64_t *newval, int print_field)
 	case GFS2_METATYPE_QC:
 	default:
 		if (print_field)
-			print_block_type(block, type,
+			print_block_type(fblock, type,
 					 " which is not implemented");
 		break;
 	}
@@ -2611,7 +2613,7 @@ void process_field(const char *field, uint64_t *newval, int print_field)
 /* ------------------------------------------------------------------------ */
 /* interactive_mode - accept keystrokes from user and display structures    */
 /* ------------------------------------------------------------------------ */
-void interactive_mode(void)
+static void interactive_mode(void)
 {
 	int ch, Quit;
 
@@ -2876,11 +2878,11 @@ void interactive_mode(void)
 /* ------------------------------------------------------------------------ */
 /* gfs_log_header_in - read in a gfs1-style log header                      */
 /* ------------------------------------------------------------------------ */
-void gfs_log_header_in(struct gfs_log_header *head, char *buf)
+void gfs_log_header_in(struct gfs_log_header *head, char *inbuf)
 {
-	struct gfs_log_header *str = (struct gfs_log_header *) buf;
+	struct gfs_log_header *str = (struct gfs_log_header *) inbuf;
 
-	gfs2_meta_header_in(&head->lh_header, buf);
+	gfs2_meta_header_in(&head->lh_header, inbuf);
 
 	head->lh_flags = be32_to_cpu(str->lh_flags);
 	head->lh_pad = be32_to_cpu(str->lh_pad);
@@ -2913,7 +2915,7 @@ void gfs_log_header_print(struct gfs_log_header *lh)
 /* print_ld_blocks - print all blocks given in a log descriptor             */
 /* returns: the number of block numbers it printed                          */
 /* ------------------------------------------------------------------------ */
-int print_ld_blocks(const uint64_t *b, const char *end, int start_line)
+static int print_ld_blocks(const uint64_t *b, const char *end, int start_line)
 {
 	int bcount = 0, i = 0;
 	static char str[256];
@@ -2945,7 +2947,7 @@ int print_ld_blocks(const uint64_t *b, const char *end, int start_line)
 /* fsck_readi - same as libgfs2's gfs2_readi, but sets absolute block #     */
 /*              of the first bit of data read.                              */
 /* ------------------------------------------------------------------------ */
-int fsck_readi(struct gfs2_inode *ip, void *buf, uint64_t offset,
+static int fsck_readi(struct gfs2_inode *ip, void *rbuf, uint64_t roffset,
 	       unsigned int size, uint64_t *abs_block)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
@@ -2959,18 +2961,18 @@ int fsck_readi(struct gfs2_inode *ip, void *buf, uint64_t offset,
 	int copied = 0;
 
 	*abs_block = 0;
-	if (offset >= ip->i_di.di_size)
+	if (roffset >= ip->i_di.di_size)
 		return 0;
-	if ((offset + size) > ip->i_di.di_size)
-		size = ip->i_di.di_size - offset;
+	if ((roffset + size) > ip->i_di.di_size)
+		size = ip->i_di.di_size - roffset;
 	if (!size)
 		return 0;
 	if (isdir) {
-		o = offset % sdp->sd_jbsize;
-		lblock = offset / sdp->sd_jbsize;
+		o = roffset % sdp->sd_jbsize;
+		lblock = roffset / sdp->sd_jbsize;
 	} else {
-		lblock = offset >> sdp->sd_sb.sb_bsize_shift;
-		o = offset & (sdp->bsize - 1);
+		lblock = roffset >> sdp->sd_sb.sb_bsize_shift;
+		o = roffset & (sdp->bsize - 1);
 	}
 
 	if (!ip->i_di.di_height) /* inode_is_stuffed */
@@ -2994,10 +2996,10 @@ int fsck_readi(struct gfs2_inode *ip, void *buf, uint64_t offset,
 		} else
 			bh = NULL;
 		if (bh) {
-			memcpy(buf, bh->b_data + o, amount);
+			memcpy(rbuf, bh->b_data + o, amount);
 			brelse(bh, not_updated);
 		} else {
-			memset(buf, 0, amount);
+			memset(rbuf, 0, amount);
 		}
 		copied += amount;
 		lblock++;
@@ -3006,7 +3008,7 @@ int fsck_readi(struct gfs2_inode *ip, void *buf, uint64_t offset,
 	return copied;
 }
 
-void check_journal_wrap(uint64_t seq, uint64_t *highest_seq)
+static void check_journal_wrap(uint64_t seq, uint64_t *highest_seq)
 {
 	if (seq < *highest_seq) {
 		print_gfs2("------------------------------------------------"
@@ -3024,7 +3026,7 @@ void check_journal_wrap(uint64_t seq, uint64_t *highest_seq)
 /* ------------------------------------------------------------------------ */
 /* dump_journal - dump a journal file's contents.                           */
 /* ------------------------------------------------------------------------ */
-void dump_journal(const char *journal)
+static void dump_journal(const char *journal)
 {
 	struct gfs2_buffer_head *j_bh = NULL;
 	uint64_t jblock, j_size, jb, abs_block;
@@ -3149,7 +3151,7 @@ void dump_journal(const char *journal)
 /* ------------------------------------------------------------------------ */
 /* usage - print command line usage                                         */
 /* ------------------------------------------------------------------------ */
-void usage(void)
+static void usage(void)
 {
 	fprintf(stderr,"\nFormat is: gfs2_edit [-c 1] [-V] [-x] [-h] [identify] [-p structures|blocks][blocktype][blockalloc [val]][blockbits][blockrg][find sb|rg|rb|di|in|lf|jd|lh|ld|ea|ed|lb|13|qc][field <f>[val]] /dev/device\n\n");
 	fprintf(stderr,"If only the device is specified, it enters into hexedit mode.\n");
@@ -3224,7 +3226,7 @@ void usage(void)
 /* ------------------------------------------------------------------------ */
 /* parameterpass1 - pre-processing for command-line parameters              */
 /* ------------------------------------------------------------------------ */
-void parameterpass1(int argc, char *argv[], int i)
+static void parameterpass1(int argc, char *argv[], int i)
 {
 	if (!strcasecmp(argv[i], "-V")) {
 		printf("%s version %s (built %s %s)\n",
@@ -3281,7 +3283,7 @@ void parameterpass1(int argc, char *argv[], int i)
 /*        normals parameters, device name, etc.  The second pass is for     */
 /*        figuring out what structures to print out.                        */
 /* ------------------------------------------------------------------------ */
-void process_parameters(int argc, char *argv[], int pass)
+static void process_parameters(int argc, char *argv[], int pass)
 {
 	int i;
 	uint64_t keyword_blk;
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 68116f5..c508345 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -66,7 +66,6 @@ enum dsp_mode { HEX_MODE = 0, GFS2_MODE = 1, EXTENDED_MODE = 2, INIT_MODE = 3 };
 #define GFS_LOG_DESC_Q          (402)    /* quota */
 #define GFS_LOG_DESC_LAST       (500)    /* final in a logged transaction */
 
-EXTERN char *prog_name;
 EXTERN uint64_t block INIT(0);
 EXTERN int blockhist INIT(0);
 EXTERN int edit_mode INIT(0);
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 6c36b69..1983ba3 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -64,14 +64,14 @@ uint64_t masterblock(const char *fn);
  * returns: 0 if successful
  *          -1 if this isn't gfs metadata.
  */
-int get_gfs_struct_info(char *buf, int *block_type, int *struct_len)
+static int get_gfs_struct_info(char *gbuf, int *block_type, int *gstruct_len)
 {
 	struct gfs2_meta_header mh, mhbuf;
 
 	*block_type = 0;
-	*struct_len = sbd.bsize;
+	*gstruct_len = sbd.bsize;
 
-	memcpy(&mhbuf, buf, sizeof(mhbuf));
+	memcpy(&mhbuf, gbuf, sizeof(mhbuf));
 	gfs2_meta_header_in(&mh, (void *)&mhbuf);
 	if (mh.mh_magic != GFS2_MAGIC)
 		return -1;
@@ -80,46 +80,46 @@ int get_gfs_struct_info(char *buf, int *block_type, int *struct_len)
 
 	switch (mh.mh_type) {
 	case GFS2_METATYPE_SB:   /* 1 (superblock) */
-		*struct_len = sizeof(struct gfs_sb);
+		*gstruct_len = sizeof(struct gfs_sb);
 		break;
 	case GFS2_METATYPE_RG:   /* 2 (rsrc grp hdr) */
-		*struct_len = sbd.bsize; /*sizeof(struct gfs_rgrp);*/
+		*gstruct_len = sbd.bsize; /*sizeof(struct gfs_rgrp);*/
 		break;
 	case GFS2_METATYPE_RB:   /* 3 (rsrc grp bitblk) */
-		*struct_len = sbd.bsize;
+		*gstruct_len = sbd.bsize;
 		break;
 	case GFS2_METATYPE_DI:   /* 4 (disk inode) */
-		*struct_len = sbd.bsize; /*sizeof(struct gfs_dinode);*/
+		*gstruct_len = sbd.bsize; /*sizeof(struct gfs_dinode);*/
 		break;
 	case GFS2_METATYPE_IN:   /* 5 (indir inode blklst) */
-		*struct_len = sbd.bsize; /*sizeof(struct gfs_indirect);*/
+		*gstruct_len = sbd.bsize; /*sizeof(struct gfs_indirect);*/
 		break;
 	case GFS2_METATYPE_LF:   /* 6 (leaf dinode blklst) */
-		*struct_len = sbd.bsize; /*sizeof(struct gfs_leaf);*/
+		*gstruct_len = sbd.bsize; /*sizeof(struct gfs_leaf);*/
 		break;
 	case GFS2_METATYPE_JD:   /* 7 (journal data) */
-		*struct_len = sbd.bsize;
+		*gstruct_len = sbd.bsize;
 		break;
 	case GFS2_METATYPE_LH:   /* 8 (log header) */
 		if (gfs1)
-			*struct_len = 512; /* gfs copies the log header
-					      twice and compares the copy,
-					      so we need to save all 512
-					      bytes of it. */
+			*gstruct_len = 512; /* gfs copies the log header
+					       twice and compares the copy,
+					       so we need to save all 512
+					       bytes of it. */
 		else
-			*struct_len = sizeof(struct gfs2_log_header);
+			*gstruct_len = sizeof(struct gfs2_log_header);
 		break;
 	case GFS2_METATYPE_LD:   /* 9 (log descriptor) */
-		*struct_len = sbd.bsize;
+		*gstruct_len = sbd.bsize;
 		break;
 	case GFS2_METATYPE_EA:   /* 10 (extended attr hdr) */
-		*struct_len = sbd.bsize;
+		*gstruct_len = sbd.bsize;
 		break;
 	case GFS2_METATYPE_ED:   /* 11 (extended attr data) */
-		*struct_len = sbd.bsize;
+		*gstruct_len = sbd.bsize;
 		break;
 	default:
-		*struct_len = sbd.bsize;
+		*gstruct_len = sbd.bsize;
 		break;
 	}
 	return 0;
@@ -131,12 +131,12 @@ int get_gfs_struct_info(char *buf, int *block_type, int *struct_len)
 /* checking every block kills performance.  We only report    */
 /* every second because we don't need 100 extra messages in   */
 /* logs made from verbose mode.                               */
-void warm_fuzzy_stuff(uint64_t block, int force, int save)
+static void warm_fuzzy_stuff(uint64_t wfsblock, int force, int save)
 {
         static struct timeval tv;
         static uint32_t seconds = 0;
         
-	last_reported_block = block;
+	last_reported_block = wfsblock;
 	gettimeofday(&tv, NULL);
 	if (!seconds)
 		seconds = tv.tv_sec;
@@ -147,9 +147,9 @@ void warm_fuzzy_stuff(uint64_t block, int force, int save)
 		if (last_fs_block) {
 			printf("\r");
 			if (save) {
-				percent = (block * 100) / last_fs_block;
+				percent = (wfsblock * 100) / last_fs_block;
 				printf("%" PRIu64 " metadata blocks (%"
-				       PRIu64 "%%) processed, ", block,
+				       PRIu64 "%%) processed, ", wfsblock,
 				       percent);
 			}
 			if (total_out < 1024 * 1024)
@@ -169,7 +169,7 @@ void warm_fuzzy_stuff(uint64_t block, int force, int save)
 	}
 }
 
-int block_is_a_journal(void)
+static int block_is_a_journal(void)
 {
 	int j;
 
@@ -179,7 +179,7 @@ int block_is_a_journal(void)
 	return FALSE;
 }
 
-int block_is_systemfile(void)
+static int block_is_systemfile(void)
 {
 	return block_is_jindex() || block_is_inum_file() ||
 		block_is_statfs_file() || block_is_quota_file() ||
@@ -187,7 +187,7 @@ int block_is_systemfile(void)
 		block_is_per_node() || block_is_in_per_node();
 }
 
-int save_block(int fd, int out_fd, uint64_t blk)
+static int save_block(int fd, int out_fd, uint64_t blk)
 {
 	int blktype, blklen, outsz;
 	uint16_t trailing0;
@@ -232,7 +232,7 @@ int save_block(int fd, int out_fd, uint64_t blk)
 /*
  * save_ea_block - save off an extended attribute block
  */
-void save_ea_block(int out_fd, struct gfs2_buffer_head *metabh)
+static void save_ea_block(int out_fd, struct gfs2_buffer_head *metabh)
 {
 	int i, e, ea_len = sbd.bsize;
 	struct gfs2_ea_header ea;
@@ -261,7 +261,7 @@ void save_ea_block(int out_fd, struct gfs2_buffer_head *metabh)
 /*
  * save_indirect_blocks - save all indirect blocks for the given buffer
  */
-void save_indirect_blocks(int out_fd, osi_list_t *cur_list,
+static void save_indirect_blocks(int out_fd, osi_list_t *cur_list,
 			  struct gfs2_buffer_head *mybh, int height, int hgt)
 {
 	uint64_t old_block = 0, indir_block;
@@ -311,7 +311,7 @@ void save_indirect_blocks(int out_fd, osi_list_t *cur_list,
  * For file system journals, the "data" is a mixture of metadata and
  * journaled data.  We want all the metadata and none of the user data.
  */
-void save_inode_data(int out_fd)
+static void save_inode_data(int out_fd)
 {
 	uint32_t height;
 	struct gfs2_inode *inode;
@@ -399,7 +399,7 @@ void save_inode_data(int out_fd)
 	inode_put(inode, not_updated);
 }
 
-void get_journal_inode_blocks(void)
+static void get_journal_inode_blocks(void)
 {
 	int journal;
 	struct gfs2_buffer_head *bh;
@@ -449,14 +449,14 @@ void get_journal_inode_blocks(void)
 	}
 }
 
-int next_rg_freemeta(struct rgrp_list *rgd, uint64_t *block, int first)
+static int next_rg_freemeta(struct rgrp_list *rgd, uint64_t *nrfblock, int first)
 {
 	struct gfs2_bitmap *bits = NULL;
 	uint32_t length = rgd->ri.ri_length;
-	uint32_t blk = (first)? 0: (uint32_t)((*block+1)-rgd->ri.ri_data0);
+	uint32_t blk = (first)? 0: (uint32_t)((*nrfblock+1)-rgd->ri.ri_data0);
 	int i;
 
-	if(!first && (*block < rgd->ri.ri_data0)) {
+	if(!first && (*nrfblock < rgd->ri.ri_data0)) {
 		log_err("next_rg_freemeta:  Start block is outside rgrp "
 			"bounds.\n");
 		exit(1);
@@ -473,7 +473,8 @@ int next_rg_freemeta(struct rgrp_list *rgd, uint64_t *block, int first)
 				  bits->bi_offset, bits->bi_len, blk,
 				  GFS2_BLKST_UNLINKED);
 		if(blk != BFITNOENT){
-			*block = blk + (bits->bi_start * GFS2_NBBY) + rgd->ri.ri_data0;
+			*nrfblock = blk + (bits->bi_start * GFS2_NBBY) +
+				rgd->ri.ri_data0;
 			break;
 		}
 		blk=0;
@@ -694,7 +695,7 @@ static const char *anthropomorphize(unsigned long long inhuman_value)
 	return out_val;
 }
 
-int restore_data(int fd, int in_fd, int printblocksonly)
+static int restore_data(int fd, int in_fd, int printblocksonly)
 {
 	size_t rs;
 	uint64_t buf64, writes = 0, highest_valid_block = 0;
@@ -832,7 +833,7 @@ int restore_data(int fd, int in_fd, int printblocksonly)
 	return 0;
 }
 
-void complain(const char *complaint)
+static void complain(const char *complaint)
 {
 	fprintf(stderr, "%s\n", complaint);
 	die("Format is: \ngfs2_edit restoremeta <file to restore> "
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index e6e0396..a225eb1 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -73,7 +73,7 @@ int gfs2_revoke_check(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
 {
 	osi_list_t *tmp;
 	struct gfs2_revoke_replay *rr;
-	int wrap, a, b, revoke;
+	int wrap, a, b;
 	int found = 0;
 
 	osi_list_foreach(tmp, &sd_revoke_list) {
@@ -90,8 +90,7 @@ int gfs2_revoke_check(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
 	wrap = (rr->rr_where < sd_replay_tail);
 	a = (sd_replay_tail < where);
 	b = (where < rr->rr_where);
-	revoke = (wrap) ? (a || b) : (a && b);
-	return revoke;
+	return (wrap) ? (a || b) : (a && b);
 }
 
 void gfs2_revoke_clean(struct gfs2_sbd *sdp)
@@ -261,7 +260,7 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
  * Returns: errno
  */
 
-int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
+static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
 		       unsigned int end, int pass)
 {
 	struct gfs2_buffer_head *bh;
@@ -336,7 +335,7 @@ int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
  * fix_journal_seq_no - Fix log header sequencing problems
  * @ip: the journal incore inode
  */
-int fix_journal_seq_no(struct gfs2_inode *ip)
+static int fix_journal_seq_no(struct gfs2_inode *ip)
 {
 	int error = 0, wrapped = 0;
 	uint32_t jd_blocks = ip->i_di.di_size / ip->i_sbd->sd_sb.sb_bsize;
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 48e71c3..a12deed 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -46,7 +46,7 @@ static int was_mounted_ro = 0;
  * Change the lock protocol so nobody can mount the fs
  *
  */
-int block_mounters(struct gfs2_sbd *sbp, int block_em)
+static int block_mounters(struct gfs2_sbd *sbp, int block_em)
 {
 	if(block_em) {
 		/* verify it starts with lock_ */
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index b2fba6c..718aa8f 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -39,7 +39,7 @@ int errors_found = 0, errors_corrected = 0;
 const char *pass = "";
 uint64_t last_data_block;
 uint64_t first_data_block;
-char *prog_name = "gfs2_fsck"; /* needed by libgfs2 */
+const char *prog_name = "gfs2_fsck"; /* needed by libgfs2 */
 int preen = 0, force_check = 0;
 
 /* This function is for libgfs2's sake.                                      */
@@ -53,19 +53,19 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...)
 	va_end(args);
 }
 
-void usage(char *name)
+static void usage(char *name)
 {
 	printf("Usage: %s [-afhnpqvVy] <device> \n", basename(name));
 }
 
-void version(void)
+static void version(void)
 {
 	printf("GFS2 fsck %s (built %s %s)\n",
 	       GFS_RELEASE_NAME, __DATE__, __TIME__);
 	printf("%s\n", REDHAT_COPYRIGHT);
 }
 
-int read_cmdline(int argc, char **argv, struct gfs2_options *opts)
+static int read_cmdline(int argc, char **argv, struct gfs2_options *gopts)
 {
 	int c;
 
@@ -74,7 +74,7 @@ int read_cmdline(int argc, char **argv, struct gfs2_options *opts)
 
 		case 'a':
 			preen = 1;
-			opts->yes = 1;
+			gopts->yes = 1;
 			break;
 		case 'f':
 			force_check = 1;
@@ -84,11 +84,11 @@ int read_cmdline(int argc, char **argv, struct gfs2_options *opts)
 			exit(FSCK_OK);
 			break;
 		case 'n':
-			opts->no = 1;
+			gopts->no = 1;
 			break;
 		case 'p':
 			preen = 1;
-			opts->yes = 1;
+			gopts->yes = 1;
 			break;
 		case 'q':
 			decrease_verbosity();
@@ -101,7 +101,7 @@ int read_cmdline(int argc, char **argv, struct gfs2_options *opts)
 			exit(FSCK_OK);
 			break;
 		case 'y':
-			opts->yes = 1;
+			gopts->yes = 1;
 			break;
 		case ':':
 		case '?':
@@ -115,9 +115,9 @@ int read_cmdline(int argc, char **argv, struct gfs2_options *opts)
 		}
 	}
 	if(argc > optind) {
-		opts->device = (argv[optind]);
-		if(!opts->device) {
-			fprintf(stderr, "Please use '-h' for usage.\n");
+		gopts->device = (argv[optind]);
+		if(!gopts->device) {
+			fprintf(stderr, _("Please use '-h' for usage.\n"));
 			return FSCK_USAGE;
 		}
 	} else {
@@ -127,7 +127,7 @@ int read_cmdline(int argc, char **argv, struct gfs2_options *opts)
 	return 0;
 }
 
-void interrupt(int sig)
+static void interrupt(int sig)
 {
 	char response;
 	char progress[PATH_MAX];
@@ -154,7 +154,7 @@ void interrupt(int sig)
 
 /* Check system inode and verify it's marked "in use" in the bitmap:       */
 /* Should work for all system inodes: root, master, jindex, per_node, etc. */
-int check_system_inode(struct gfs2_inode *sysinode, const char *filename,
+static int check_system_inode(struct gfs2_inode *sysinode, const char *filename,
 		       void builder(struct gfs2_sbd *sbp),
 		       enum gfs2_mark_block mark)
 {
@@ -224,7 +224,7 @@ int check_system_inode(struct gfs2_inode *sysinode, const char *filename,
 	return 0;
 }
 
-int check_system_inodes(struct gfs2_sbd *sdp)
+static int check_system_inodes(struct gfs2_sbd *sdp)
 {
 	/*******************************************************************
 	 *******  Check the system inode integrity             *************
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index a0ac86b..70c3be6 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -116,7 +116,7 @@ void fsck_inode_put(struct gfs2_inode *ip, enum update_flags update)
  * This function tries to repair a corrupt directory entry.  All we
  * know at this point is that the length field is wrong.
  */
-int dirent_repair(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
+static int dirent_repair(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
 		  struct gfs2_dirent *de, struct gfs2_dirent *dent,
 		  int type, int first)
 {
@@ -186,7 +186,7 @@ static void dirblk_truncate(struct gfs2_inode *ip, struct gfs2_dirent *fixb,
  * returns: 0 - good block or it was repaired to be good
  *         -1 - error occurred
  */
-int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
+static int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
 		  int type, enum update_flags *update,
 		  uint16_t *count, struct metawalk_fxns *pass)
 {
@@ -333,9 +333,9 @@ int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
 /* so that they replace the bad ones.  We have to hack up the old    */
 /* leaf a bit, but it's better than deleting the whole directory,    */
 /* which is what used to happen before.                              */
-void warn_and_patch(struct gfs2_inode *ip, uint64_t *leaf_no, 
-		    uint64_t *bad_leaf, uint64_t old_leaf,
-		    uint64_t first_ok_leaf, int index, const char *msg)
+static void warn_and_patch(struct gfs2_inode *ip, uint64_t *leaf_no, 
+			   uint64_t *bad_leaf, uint64_t old_leaf,
+			   uint64_t first_ok_leaf, int pindex, const char *msg)
 {
 	if (*bad_leaf != *leaf_no) {
 		log_err( _("Directory Inode %llu (0x%llx) points to leaf %llu"
@@ -350,12 +350,12 @@ void warn_and_patch(struct gfs2_inode *ip, uint64_t *leaf_no,
 	    query(&opts, _("Attempt to patch around it? (y/n) "))) {
 		errors_corrected++;
 		if (gfs2_check_range(ip->i_sbd, old_leaf) == 0)
-			gfs2_put_leaf_nr(ip, index, old_leaf);
+			gfs2_put_leaf_nr(ip, pindex, old_leaf);
 		else
-			gfs2_put_leaf_nr(ip, index, first_ok_leaf);
-		log_err( _("Directory Inode %" PRIu64 "(0x%" PRIx64
-			   ") repaired.\n"), ip->i_di.di_num.no_addr,
-			ip->i_di.di_num.no_addr);
+			gfs2_put_leaf_nr(ip, pindex, first_ok_leaf);
+		log_err( _("Directory Inode %llu (0x%llx) repaired.\n"),
+			 (unsigned long long)ip->i_di.di_num.no_addr,
+			 (unsigned long long)ip->i_di.di_num.no_addr);
 	}
 	else
 		log_err( _("Bad leaf left in place.\n"));
@@ -364,15 +364,15 @@ void warn_and_patch(struct gfs2_inode *ip, uint64_t *leaf_no,
 }
 
 /* Checks exhash directory entries */
-int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
-		    struct metawalk_fxns *pass)
+static int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
+			   struct metawalk_fxns *pass)
 {
 	int error;
 	struct gfs2_leaf leaf, oldleaf;
 	uint64_t leaf_no, old_leaf, bad_leaf = -1;
 	uint64_t first_leaf_ptr = -1, first_ok_leaf = -1;
 	struct gfs2_buffer_head *lbh;
-	int index;
+	int lindex;
 	struct gfs2_sbd *sbp = ip->i_sbd;
 	uint16_t count;
 	int ref_count = 0, exp_count = 0;
@@ -381,8 +381,8 @@ int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
 	   leaf. That way, bad blocks at the beginning will be overwritten
 	   with the first valid leaf. */
 	first_ok_leaf = -1;
-	for(index = 0; index < (1 << ip->i_di.di_depth); index++) {
-		gfs2_get_leaf_nr(ip, index, &first_ok_leaf);
+	for(lindex = 0; lindex < (1 << ip->i_di.di_depth); lindex++) {
+		gfs2_get_leaf_nr(ip, lindex, &first_ok_leaf);
 		if (first_leaf_ptr == -1)
 			first_leaf_ptr = first_ok_leaf;
 		if(gfs2_check_range(ip->i_sbd, first_ok_leaf) == 0) {
@@ -397,16 +397,16 @@ int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
 	}
 	old_leaf = -1;
 	memset(&oldleaf, 0, sizeof(oldleaf));
-	for(index = 0; index < (1 << ip->i_di.di_depth); index++) {
+	for(lindex = 0; lindex < (1 << ip->i_di.di_depth); lindex++) {
 		if (fsck_abort)
 			break;
-		gfs2_get_leaf_nr(ip, index, &leaf_no);
+		gfs2_get_leaf_nr(ip, lindex, &leaf_no);
 
 		/* GFS has multiple indirect pointers to the same leaf
 		 * until those extra pointers are needed, so skip the
 		 * dups */
 		if (leaf_no == bad_leaf) {
-			gfs2_put_leaf_nr(ip, index, old_leaf); /* fill w/old
+			gfs2_put_leaf_nr(ip, lindex, old_leaf); /* fill w/old
 								  leaf info */
 			ref_count++;
 			continue;
@@ -462,8 +462,8 @@ int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
 					(unsigned long long)
 					ip->i_di.di_num.no_addr);
 				warn_and_patch(ip, &leaf_no, &bad_leaf,
-					       old_leaf, first_ok_leaf,
-					       index, _("that is out of range"));
+					       old_leaf, first_ok_leaf, lindex,
+					       _("that is out of range"));
 				memcpy(&leaf, &oldleaf, sizeof(oldleaf));
 				break;
 			}
@@ -474,7 +474,7 @@ int check_leaf_blks(struct gfs2_inode *ip, enum update_flags *update,
 			/* Make sure it's really a valid leaf block. */
 			if (gfs2_check_meta(lbh, GFS2_METATYPE_LF)) {
 				warn_and_patch(ip, &leaf_no, &bad_leaf,
-					       old_leaf, first_ok_leaf, index,
+					       old_leaf, first_ok_leaf, lindex,
 					       _("that is not really a leaf"));
 				memcpy(&leaf, &oldleaf, sizeof(oldleaf));
 				brelse(lbh, not_updated);
@@ -667,9 +667,7 @@ static int check_eattr_entries(struct gfs2_inode *ip,
 		}
 		offset += be32_to_cpu(ea_hdr->ea_rec_len);
 		if(ea_hdr->ea_flags & GFS2_EAFLAG_LAST ||
-		   offset >= ip->i_sbd->sd_sb.sb_bsize ||
-		   ea_hdr->ea_rec_len == 0) {
-			
+		   offset >= ip->i_sbd->sd_sb.sb_bsize || ea_hdr->ea_rec_len == 0){
 			break;
 		}
 		ea_hdr_prev = ea_hdr;
@@ -1062,7 +1060,7 @@ end:
 }
 
 /* Checks stuffed inode directories */
-int check_linear_dir(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
+static int check_linear_dir(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
 		     enum update_flags *update, struct metawalk_fxns *pass)
 {
 	int error = 0;
@@ -1267,19 +1265,19 @@ int delete_blocks(struct gfs2_inode *ip, uint64_t block,
 int delete_metadata(struct gfs2_inode *ip, uint64_t block,
 		    struct gfs2_buffer_head **bh, void *private)
 {
-	return delete_blocks(ip, block, bh, "metadata", private);
+	return delete_blocks(ip, block, bh, _("metadata"), private);
 }
 
 int delete_data(struct gfs2_inode *ip, uint64_t block, void *private)
 {
-	return delete_blocks(ip, block, NULL, "data", private);
+	return delete_blocks(ip, block, NULL, _("data"), private);
 }
 
 int delete_eattr_indir(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
 		       struct gfs2_buffer_head **bh,
 		       enum update_flags *want_updated, void *private)
 {
-	return delete_blocks(ip, block, NULL, "indirect extended attribute",
+	return delete_blocks(ip, block, NULL, _("indirect extended attribute"),
 			     private);
 }
 
@@ -1287,5 +1285,6 @@ int delete_eattr_leaf(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
 		      struct gfs2_buffer_head **bh,
 		      enum update_flags *want_updated, void *private)
 {
-	return delete_blocks(ip, block, NULL, "extended attribute", private);
+	return delete_blocks(ip, block, NULL, _("extended attribute"),
+			     private);
 }
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index edcb7ec..a23da46 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -599,7 +599,7 @@ static int check_eattr_entries(struct gfs2_inode *ip,
 	return 0;
 }
 
-int clear_metalist(struct gfs2_inode *ip, uint64_t block,
+static int clear_metalist(struct gfs2_inode *ip, uint64_t block,
 		   struct gfs2_buffer_head **bh, void *private)
 {
 	struct gfs2_block_query q = {0};
@@ -617,7 +617,7 @@ int clear_metalist(struct gfs2_inode *ip, uint64_t block,
 	return 0;
 }
 
-int clear_data(struct gfs2_inode *ip, uint64_t block, void *private)
+static int clear_data(struct gfs2_inode *ip, uint64_t block, void *private)
 {
 	struct gfs2_block_query q = {0};
 
@@ -633,7 +633,7 @@ int clear_data(struct gfs2_inode *ip, uint64_t block, void *private)
 
 }
 
-int clear_leaf(struct gfs2_inode *ip, uint64_t block,
+static int clear_leaf(struct gfs2_inode *ip, uint64_t block,
 	       struct gfs2_buffer_head *bh, void *private)
 {
 	struct gfs2_block_query q = {0};
@@ -687,7 +687,7 @@ int add_to_dir_list(struct gfs2_sbd *sbp, uint64_t block)
 	return 0;
 }
 
-int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
+static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
 			  uint64_t block)
 {
 	struct gfs2_block_query q = {0};
@@ -927,7 +927,7 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
 	return 0;
 }
 
-int scan_meta(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
+static int scan_meta(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
 			  uint64_t block)
 {
 	if (gfs2_check_meta(bh, 0)) {
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index ff59968..5e75ae3 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -336,7 +336,7 @@ static int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
 }
 
 /* Finds all references to duplicate blocks in the metadata */
-int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode, struct dup_blocks *b)
+static int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode, struct dup_blocks *b)
 {
 	struct gfs2_inode *ip;
 	struct fxn_info myfi = {b->block_no, 0, 1};
@@ -391,7 +391,7 @@ int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode, struct dup_blocks *b)
 	return 0;
 }
 
-int handle_dup_blk(struct gfs2_sbd *sbp, struct dup_blocks *b)
+static int handle_dup_blk(struct gfs2_sbd *sbp, struct dup_blocks *b)
 {
 	osi_list_t *tmp;
 	struct inode_with_dups *id;
@@ -526,8 +526,8 @@ int pass1b(struct gfs2_sbd *sbp)
 	struct gfs2_block_query q;
 	osi_list_t *tmp = NULL, *x;
 	struct metawalk_fxns find_dirents = {0};
-	find_dirents.check_dentry = &find_dentry;
 	int rc = FSCK_OK;
+	find_dirents.check_dentry = &find_dentry;
 
 	log_info( _("Looking for duplicate blocks...\n"));
 
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index a7dbb41..395ca2c 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -31,7 +31,7 @@
 
 /* Set children's parent inode in dir_info structure - ext2 does not set
  * dotdot inode here, but instead in pass3 - should we? */
-int set_parent_dir(struct gfs2_sbd *sbp, uint64_t childblock,
+static int set_parent_dir(struct gfs2_sbd *sbp, uint64_t childblock,
 				   uint64_t parentblock)
 {
 	struct dir_info *di;
@@ -58,7 +58,7 @@ int set_parent_dir(struct gfs2_sbd *sbp, uint64_t childblock,
 }
 
 /* Set's the child's '..' directory inode number in dir_info structure */
-int set_dotdot_dir(struct gfs2_sbd *sbp, uint64_t childblock,
+static int set_dotdot_dir(struct gfs2_sbd *sbp, uint64_t childblock,
 				   uint64_t parentblock)
 {
 	struct dir_info *di;
@@ -105,13 +105,12 @@ static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
 	return 0;
 }
 
-const char *de_type_string(uint8_t de_type)
+static const char *de_type_string(uint8_t de_type)
 {
-	const char *de_types[15] =
-		{"unknown", "fifo", "chrdev", "invalid",
-		 "directory", "invalid", "blkdev", "invalid",
-		 "file", "invalid", "symlink", "invalid",
-		 "socket", "invalid", "wht"};
+	const char *de_types[15] = {"unknown", "fifo", "chrdev", "invalid",
+								"directory", "invalid", "blkdev", "invalid",
+								"file", "invalid", "symlink", "invalid",
+								"socket", "invalid", "wht"};
 	if (de_type < 15)
 		return de_types[de_type];
 	return de_types[3]; /* invalid */
@@ -166,7 +165,7 @@ struct metawalk_fxns pass2_fxns_delete = {
 
 /* FIXME: should maybe refactor this a bit - but need to deal with
  * FIXMEs internally first */
-int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
+static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
 		 struct gfs2_dirent *prev_de,
 		 struct gfs2_buffer_head *bh, char *filename,
 		 enum update_flags *update, uint16_t *count, void *priv)
@@ -313,7 +312,6 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
 			dirent2_del(ip, bh, prev_de, dent);
 			*update = updated;
 			log_warn( _("Directory entry '%s' cleared\n"), tmp_name);
-
 			/* If it was previously marked invalid (i.e. known
 			   to be bad, not just a free block, etc.) then
 			   delete any metadata it holds.  If not, return. */
diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c
index 46bd3aa..48f6135 100644
--- a/gfs2/fsck/pass3.c
+++ b/gfs2/fsck/pass3.c
@@ -27,7 +27,7 @@
 #include "metawalk.h"
 
 static int attach_dotdot_to(struct gfs2_sbd *sbp, uint64_t newdotdot,
-							uint64_t olddotdot, uint64_t block)
+			    uint64_t olddotdot, uint64_t block)
 {
 	char *filename;
 	int filename_len;
@@ -69,7 +69,7 @@ static int attach_dotdot_to(struct gfs2_sbd *sbp, uint64_t newdotdot,
 	return 0;
 }
 
-struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp,
+static struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp,
 										struct dir_info *di)
 {
 	struct dir_info *pdi;
diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c
index e217236..fd0ac0e 100644
--- a/gfs2/fsck/pass4.c
+++ b/gfs2/fsck/pass4.c
@@ -33,7 +33,7 @@ struct metawalk_fxns pass4_fxns_delete = {
 
 /* Updates the link count of an inode to what the fsck has seen for
  * link count */
-int fix_inode_count(struct gfs2_sbd *sbp, struct inode_info *ii,
+static int fix_inode_count(struct gfs2_sbd *sbp, struct inode_info *ii,
 					struct gfs2_inode *ip)
 {
 	log_info( _("Fixing inode count for %llu (0x%llx) \n"),
@@ -50,7 +50,7 @@ int fix_inode_count(struct gfs2_sbd *sbp, struct inode_info *ii,
 	return 0;
 }
 
-int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
+static int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
 	osi_list_t *tmp;
 	struct inode_info *ii;
 	struct gfs2_inode *ip;
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index aa9d3bd..a533536 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -23,7 +23,7 @@
 #include "fs_bits.h"
 #include "util.h"
 
-int convert_mark(struct gfs2_block_query *q, uint32_t *count)
+static int convert_mark(struct gfs2_block_query *q, uint32_t *count)
 {
 	if (q->eattr_block) {
 		count[2]++;
@@ -66,7 +66,7 @@ int convert_mark(struct gfs2_block_query *q, uint32_t *count)
 	return -1;
 }
 
-int check_block_status(struct gfs2_sbd *sbp, char *buffer, unsigned int buflen,
+static int check_block_status(struct gfs2_sbd *sbp, char *buffer, unsigned int buflen,
 					   uint64_t *rg_block, uint64_t rg_data, uint32_t *count)
 {
 	unsigned char *byte, *end;
@@ -165,7 +165,7 @@ int check_block_status(struct gfs2_sbd *sbp, char *buffer, unsigned int buflen,
 	return 0;
 }
 
-enum update_flags update_rgrp(struct gfs2_sbd *sbp, struct rgrp_list *rgp,
+static enum update_flags update_rgrp(struct gfs2_sbd *sbp, struct rgrp_list *rgp,
 							  uint32_t *count)
 {
 	uint32_t i;
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 35e7811..9d28b1a 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -49,7 +49,7 @@ struct special_blocks false_rgrps;
  * for a real RG block.  These are "fake" RGs that need to be ignored for
  * the purposes of finding where things are.
  */
-void find_journaled_rgs(struct gfs2_sbd *sdp)
+static void find_journaled_rgs(struct gfs2_sbd *sdp)
 {
 	int j, new = 0;
 	unsigned int jblocks;
@@ -79,7 +79,7 @@ void find_journaled_rgs(struct gfs2_sbd *sdp)
 	}
 }
 
-int is_false_rg(uint64_t block)
+static int is_false_rg(uint64_t block)
 {
 	if (blockfind(&false_rgrps, block))
 		return 1;
@@ -111,7 +111,7 @@ int is_false_rg(uint64_t block)
  * same RG size determined by the original mkfs, so recovery is easier.
  *
  */
-int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list,
+static int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list,
 			 int *num_rgs)
 {
 	struct gfs2_buffer_head *bh;
@@ -352,7 +352,7 @@ int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list,
  * Sets:    sdp->rglist to a linked list of fsck_rgrp structs representing
  *          what we think the rindex should really look like.
  */
-int gfs2_rindex_calculate(struct gfs2_sbd *sdp, osi_list_t *ret_list,
+static int gfs2_rindex_calculate(struct gfs2_sbd *sdp, osi_list_t *ret_list,
 			   int *num_rgs)
 {
 	osi_list_init(ret_list);
@@ -386,7 +386,7 @@ int gfs2_rindex_calculate(struct gfs2_sbd *sdp, osi_list_t *ret_list,
  * rewrite_rg_block - rewrite ("fix") a buffer with rg or bitmap data
  * returns: 0 if the rg was repaired, otherwise 1
  */
-int rewrite_rg_block(struct gfs2_sbd *sdp, struct rgrp_list *rg,
+static int rewrite_rg_block(struct gfs2_sbd *sdp, struct rgrp_list *rg,
 		     uint64_t errblock)
 {
 	int x = errblock - rg->ri.ri_addr;
diff --git a/gfs2/libgfs2/block_list.c b/gfs2/libgfs2/block_list.c
index 9fc3ac5..b0d7000 100644
--- a/gfs2/libgfs2/block_list.c
+++ b/gfs2/libgfs2/block_list.c
@@ -63,7 +63,7 @@ void gfs2_special_free(struct special_blocks *blist)
 	}
 }
 
-void gfs2_dup_free(struct dup_blocks *blist)
+static void gfs2_dup_free(struct dup_blocks *blist)
 {
 	struct dup_blocks *f;
 
@@ -90,7 +90,7 @@ struct special_blocks *blockfind(struct special_blocks *blist, uint64_t num)
 	return NULL;
 }
 
-struct dup_blocks *dupfind(struct dup_blocks *blist, uint64_t num)
+static struct dup_blocks *dupfind(struct dup_blocks *blist, uint64_t num)
 {
 	osi_list_t *head = &blist->list;
 	osi_list_t *tmp;
@@ -119,7 +119,7 @@ void gfs2_special_set(struct special_blocks *blocklist, uint64_t block)
 	return;
 }
 
-void gfs2_dup_set(struct dup_blocks *blocklist, uint64_t block)
+static void gfs2_dup_set(struct dup_blocks *blocklist, uint64_t block)
 {
 	struct dup_blocks *b;
 
@@ -135,7 +135,7 @@ void gfs2_dup_set(struct dup_blocks *blocklist, uint64_t block)
 	return;
 }
 
-void gfs2_special_clear(struct special_blocks *blocklist, uint64_t block)
+static void gfs2_special_clear(struct special_blocks *blocklist, uint64_t block)
 {
 	struct special_blocks *b;
 
@@ -146,7 +146,7 @@ void gfs2_special_clear(struct special_blocks *blocklist, uint64_t block)
 	}
 }
 
-void gfs2_dup_clear(struct dup_blocks *blocklist, uint64_t block)
+static void gfs2_dup_clear(struct dup_blocks *blocklist, uint64_t block)
 {
 	struct dup_blocks *b;
 
diff --git a/gfs2/libgfs2/buf.c b/gfs2/libgfs2/buf.c
index 3f9e748..6c7e181 100644
--- a/gfs2/libgfs2/buf.c
+++ b/gfs2/libgfs2/buf.c
@@ -161,11 +161,11 @@ struct gfs2_buffer_head *bhold(struct gfs2_buffer_head *bh)
 	return bh;
 }
 
-void brelse(struct gfs2_buffer_head *bh, enum update_flags updated)
+void brelse(struct gfs2_buffer_head *bh, enum update_flags is_updated)
 {
     /* We can't just say b_changed = updated because we don't want to     */
 	/* set it FALSE if it's TRUE until we write the changed data to disk. */
-	if (updated)
+	if (is_updated)
 		bh->b_changed = TRUE;
 	if (!bh->b_count) {
 		stack;
diff --git a/gfs2/libgfs2/fs_geometry.c b/gfs2/libgfs2/fs_geometry.c
index 4501a84..0ad7df4 100644
--- a/gfs2/libgfs2/fs_geometry.c
+++ b/gfs2/libgfs2/fs_geometry.c
@@ -33,8 +33,7 @@
  * Returns: the number of RGs
  */
 
-uint64_t
-how_many_rgrps(struct gfs2_sbd *sdp, struct device *dev, int rgsize_specified)
+static uint64_t how_many_rgrps(struct gfs2_sbd *sdp, struct device *dev, int rgsize_specified)
 {
 	uint64_t nrgrp;
 
@@ -63,8 +62,7 @@ how_many_rgrps(struct gfs2_sbd *sdp, struct device *dev, int rgsize_specified)
  * Returns: a list of rgrp_list_t structures
  */
 
-void
-compute_rgrp_layout(struct gfs2_sbd *sdp, int rgsize_specified)
+void compute_rgrp_layout(struct gfs2_sbd *sdp, int rgsize_specified)
 {
 	struct device *dev;
 	struct rgrp_list *rl, *rlast = NULL, *rlast2 = NULL;
@@ -187,7 +185,7 @@ rgblocks2bitblocks(unsigned int bsize, uint32_t *rgblocks, uint32_t *bitblocks)
  * If fd > 0, write the data to the given file handle.
  * Otherwise, use gfs2 buffering in buf.c.
  */
-void build_rgrps(struct gfs2_sbd *sdp, int write)
+void build_rgrps(struct gfs2_sbd *sdp, int do_write)
 {
 	osi_list_t *tmp, *head;
 	struct rgrp_list *rl;
@@ -224,7 +222,7 @@ void build_rgrps(struct gfs2_sbd *sdp, int write)
 		rg->rg_flags = rl->rgf_flags;
 		rg->rg_free = rgblocks;
 
-		if (write) {
+		if (do_write) {
 			for (x = 0; x < bitblocks; x++) {
 				bh = bget(&sdp->nvbuf_list, rl->start + x);
 				if (x)
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 675dcd6..7dacd43 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -26,7 +26,7 @@
 #include "libgfs2.h"
 
 /* Detect directory is a stuffed inode */
-int inode_is_stuffed(struct gfs2_inode *ip)
+static int inode_is_stuffed(struct gfs2_inode *ip)
 {
 	return !ip->i_di.di_height;
 }
@@ -42,15 +42,15 @@ struct gfs2_inode *inode_get(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh)
 	return ip;
 }
 
-void inode_put(struct gfs2_inode *ip, enum update_flags updated)
+void inode_put(struct gfs2_inode *ip, enum update_flags is_updated)
 {
-	if (updated)
+	if (is_updated)
 		gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
-	brelse(ip->i_bh, updated);
+	brelse(ip->i_bh, is_updated);
 	free(ip);
 }
 
-uint64_t blk_alloc_i(struct gfs2_sbd *sdp, unsigned int type)
+static uint64_t blk_alloc_i(struct gfs2_sbd *sdp, unsigned int type)
 {
 	osi_list_t *tmp, *head;
 	struct rgrp_list *rl = NULL;
@@ -627,9 +627,8 @@ int gfs2_dirent_next(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
 	return 0;
 }
 
-static int
-dirent_alloc(struct gfs2_inode *dip, struct gfs2_buffer_head *bh, int name_len,
-			 struct gfs2_dirent **dent_out)
+static int dirent_alloc(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
+			int name_len, struct gfs2_dirent **dent_out)
 {
 	struct gfs2_dirent *dent, *new;
 	unsigned int rec_len = GFS2_DIRENT_SIZE(name_len);
@@ -691,7 +690,7 @@ dirent_alloc(struct gfs2_inode *dip, struct gfs2_buffer_head *bh, int name_len,
 }
 
 void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
-				struct gfs2_dirent *prev, struct gfs2_dirent *cur)
+		 struct gfs2_dirent *prev, struct gfs2_dirent *cur)
 {
 	uint16_t cur_rec_len, prev_rec_len;
 
@@ -709,14 +708,14 @@ void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
 	prev->de_rec_len = cpu_to_be16(prev_rec_len);
 }
 
-void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t index,
+void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t lindex,
 					  uint64_t *leaf_out)
 {
 	uint64_t leaf_no;
 	int count;
 
 	count = gfs2_readi(dip, (char *)&leaf_no,
-		      index * sizeof(uint64_t),
+		      lindex * sizeof(uint64_t),
 		      sizeof(uint64_t));
 	if (count != sizeof(uint64_t))
 		die("gfs2_get_leaf_nr:  Bad internal read.\n");
@@ -736,8 +735,7 @@ void gfs2_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out)
 		die("gfs2_put_leaf_nr:  Bad internal write.\n");
 }
 
-static void
-dir_split_leaf(struct gfs2_inode *dip, uint32_t index, uint64_t leaf_no)
+static void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex, uint64_t leaf_no)
 {
 	struct gfs2_buffer_head *nbh, *obh;
 	struct gfs2_leaf *nleaf, *oleaf;
@@ -767,7 +765,7 @@ dir_split_leaf(struct gfs2_inode *dip, uint32_t index, uint64_t leaf_no)
 	len = 1 << (dip->i_di.di_depth - be16_to_cpu(oleaf->lf_depth));
 	half_len = len >> 1;
 
-	start = (index & ~(len - 1));
+	start = (lindex & ~(len - 1));
 
 	zalloc(lp, half_len * sizeof(uint64_t));
 
@@ -839,8 +837,7 @@ dir_split_leaf(struct gfs2_inode *dip, uint32_t index, uint64_t leaf_no)
 	brelse(nbh, updated);
 }
 
-static void
-dir_double_exhash(struct gfs2_inode *dip)
+static void dir_double_exhash(struct gfs2_inode *dip)
 {
 	struct gfs2_sbd *sdp = dip->i_sbd;
 	uint64_t *buf;
@@ -910,12 +907,12 @@ int gfs2_get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
  * Returns: 0 on success, error code otherwise
  */
 
-static int get_first_leaf(struct gfs2_inode *dip, uint32_t index,
-						  struct gfs2_buffer_head **bh_out)
+static int get_first_leaf(struct gfs2_inode *dip, uint32_t lindex,
+			  struct gfs2_buffer_head **bh_out)
 {
 	uint64_t leaf_no;
 
-	gfs2_get_leaf_nr(dip, index, &leaf_no);
+	gfs2_get_leaf_nr(dip, lindex, &leaf_no);
 	*bh_out = bread(&dip->i_sbd->buf_list, leaf_no);
 	return 0;
 }
@@ -930,7 +927,7 @@ static int get_first_leaf(struct gfs2_inode *dip, uint32_t index,
  */
 
 static int get_next_leaf(struct gfs2_inode *dip,struct gfs2_buffer_head *bh_in,
-						 struct gfs2_buffer_head **bh_out)
+			 struct gfs2_buffer_head **bh_out)
 {
 	struct gfs2_leaf *leaf;
 
@@ -942,14 +939,13 @@ static int get_next_leaf(struct gfs2_inode *dip,struct gfs2_buffer_head *bh_in,
 	return 0;
 }
 
-static void
-dir_e_add(struct gfs2_inode *dip, char *filename, int len,
-		  struct gfs2_inum *inum, unsigned int type)
+static void dir_e_add(struct gfs2_inode *dip, const char *filename, int len,
+		      struct gfs2_inum *inum, unsigned int type)
 {
 	struct gfs2_buffer_head *bh, *nbh;
 	struct gfs2_leaf *leaf, *nleaf;
 	struct gfs2_dirent *dent;
-	uint32_t index;
+	uint32_t lindex;
 	uint32_t hash;
 	uint64_t leaf_no, bn;
 
@@ -957,11 +953,11 @@ dir_e_add(struct gfs2_inode *dip, char *filename, int len,
 	hash = gfs2_disk_hash(filename, len);
 	/* Have to kludge because (hash >> 32) gives hash for some reason. */
 	if (dip->i_di.di_depth)
-		index = hash >> (32 - dip->i_di.di_depth);
+		lindex = hash >> (32 - dip->i_di.di_depth);
 	else
-		index = 0;
+		lindex = 0;
 
-	gfs2_get_leaf_nr(dip, index, &leaf_no);
+	gfs2_get_leaf_nr(dip, lindex, &leaf_no);
 
 	for (;;) {
 		bh = bread(&dip->i_sbd->buf_list, leaf_no);
@@ -971,7 +967,7 @@ dir_e_add(struct gfs2_inode *dip, char *filename, int len,
 
 			if (be16_to_cpu(leaf->lf_depth) < dip->i_di.di_depth) {
 				brelse(bh, not_updated);
-				dir_split_leaf(dip, index, leaf_no);
+				dir_split_leaf(dip, lindex, leaf_no);
 				goto restart;
 
 			} else if (dip->i_di.di_depth < GFS2_DIR_MAX_DEPTH) {
@@ -1025,8 +1021,7 @@ dir_e_add(struct gfs2_inode *dip, char *filename, int len,
 	}
 }
 
-static void
-dir_make_exhash(struct gfs2_inode *dip)
+static void dir_make_exhash(struct gfs2_inode *dip)
 {
 	struct gfs2_sbd *sdp = dip->i_sbd;
 	struct gfs2_dirent *dent;
@@ -1213,7 +1208,8 @@ struct gfs2_inode *createi(struct gfs2_inode *dip, char *filename,
  *
  * Returns: 1 if the files are the same, otherwise 0.
  */
-int gfs2_filecmp(const char *file1, const char *file2, int len_of_file2)
+
+static int gfs2_filecmp(const char *file1, const char *file2, int len_of_file2)
 {
 	if (strlen(file1) != len_of_file2)
 		return 0;
@@ -1231,11 +1227,10 @@ int gfs2_filecmp(const char *file1, const char *file2, int len_of_file2)
  *
  * Returns:
  */
-static int leaf_search(struct gfs2_inode *dip,
-					   struct gfs2_buffer_head *bh, 
-					   const char *filename, int len,
-                       struct gfs2_dirent **dent_out,
-					   struct gfs2_dirent **dent_prev)
+static int leaf_search(struct gfs2_inode *dip, struct gfs2_buffer_head *bh, 
+		       const char *filename, int len,
+		       struct gfs2_dirent **dent_out,
+		       struct gfs2_dirent **dent_prev)
 {
 	uint32_t hash;
 	struct gfs2_dirent *dent, *prev = NULL;
@@ -1289,14 +1284,14 @@ static int leaf_search(struct gfs2_inode *dip,
  *
  * Returns: 0 on sucess, error code otherwise
  */
-static int linked_leaf_search(struct gfs2_inode *dip,
-							  const char *filename, int len,
-                              struct gfs2_dirent **dent_out,
-							  struct gfs2_dirent **dent_prev,
-							  struct gfs2_buffer_head **bh_out)
+
+static int linked_leaf_search(struct gfs2_inode *dip, const char *filename,
+			      int len, struct gfs2_dirent **dent_out,
+			      struct gfs2_dirent **dent_prev,
+			      struct gfs2_buffer_head **bh_out)
 {
 	struct gfs2_buffer_head *bh = NULL, *bh_next;
-	uint32_t hsize, index;
+	uint32_t hsize, lindex;
 	uint32_t hash;
 	int error = 0;
 
@@ -1307,9 +1302,9 @@ static int linked_leaf_search(struct gfs2_inode *dip,
 	/*  Figure out the address of the leaf node.  */
 
 	hash = gfs2_disk_hash(filename, len);
-	index = hash >> (32 - dip->i_di.di_depth);
+	lindex = hash >> (32 - dip->i_di.di_depth);
 
-	error = get_first_leaf(dip, index, &bh_next);
+	error = get_first_leaf(dip, lindex, &bh_next);
 	if (error)
 		return error;
 
@@ -1335,7 +1330,7 @@ static int linked_leaf_search(struct gfs2_inode *dip,
 		}
 		
 		error = get_next_leaf(dip, bh, &bh_next);
-	}while (!error);
+	} while (!error);
 	
 	brelse(bh, not_updated);
 	
@@ -1351,7 +1346,7 @@ static int linked_leaf_search(struct gfs2_inode *dip,
  * Returns:
  */
 static int dir_e_search(struct gfs2_inode *dip, const char *filename,
-						int len, unsigned int *type, struct gfs2_inum *inum)
+			int len, unsigned int *type, struct gfs2_inum *inum)
 {
 	struct gfs2_buffer_head *bh = NULL;
 	struct gfs2_dirent *dent;
@@ -1380,7 +1375,7 @@ static int dir_e_search(struct gfs2_inode *dip, const char *filename,
  * Returns:
  */
 static int dir_l_search(struct gfs2_inode *dip, const char *filename,
-						int len, unsigned int *type, struct gfs2_inum *inum)
+			int len, unsigned int *type, struct gfs2_inum *inum)
 {
 	struct gfs2_buffer_head *dibh;
 	struct gfs2_dirent *dent;
@@ -1413,8 +1408,8 @@ static int dir_l_search(struct gfs2_inode *dip, const char *filename,
  *
  * Returns: 0 if found, -1 on failure, -ENOENT if not found.
  */
-int dir_search(struct gfs2_inode *dip, const char *filename, int len,
-			   unsigned int *type, struct gfs2_inum *inum)
+static int dir_search(struct gfs2_inode *dip, const char *filename, int len,
+		      unsigned int *type, struct gfs2_inum *inum)
 {
 	int error;
 
@@ -1431,17 +1426,17 @@ int dir_search(struct gfs2_inode *dip, const char *filename, int len,
 
 static int dir_e_del(struct gfs2_inode *dip, const char *filename, int len)
 {
-	int index;
+	int lindex;
 	int error;
 	int found = 0;
 	uint64_t leaf_no;
 	struct gfs2_buffer_head *bh = NULL;
 	struct gfs2_dirent *cur, *prev;
 
-	index = (1 << (dip->i_di.di_depth))-1;
+	lindex = (1 << (dip->i_di.di_depth))-1;
 
-	for(; (index >= 0) && !found; index--){
-		gfs2_get_leaf_nr(dip, index, &leaf_no);
+	for(; (lindex >= 0) && !found; lindex--){
+		gfs2_get_leaf_nr(dip, lindex, &leaf_no);
 
 		while(leaf_no && !found){
 			bh = bread(&dip->i_sbd->buf_list, leaf_no);
@@ -1469,7 +1464,7 @@ static int dir_e_del(struct gfs2_inode *dip, const char *filename, int len)
 }
 
 static int dir_l_del(struct gfs2_inode *dip, struct gfs2_buffer_head *dibh,
-					 const char *filename, int len){
+		     const char *filename, int len){
 	int error=0;
 	int got_buf = 0;
 	struct gfs2_dirent *cur, *prev;
@@ -1513,7 +1508,7 @@ static int dir_l_del(struct gfs2_inode *dip, struct gfs2_buffer_head *dibh,
  * Returns: 0 on success (or if it doesn't already exist), -1 on failure
  */
 int gfs2_dirent_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
-					const char *filename, int len){
+		    const char *filename, int len){
 	int error;
 
 	if(!S_ISDIR(dip->i_di.di_mode))
@@ -1536,7 +1531,7 @@ int gfs2_dirent_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
  * Returns: 0 on success, -EXXXX on failure
  */
 int gfs2_lookupi(struct gfs2_inode *dip, const char *filename, int len,
-				 struct gfs2_inode **ipp)
+		 struct gfs2_inode **ipp)
 {
 	struct gfs2_sbd *sdp = dip->i_sbd;
 	int error = 0;
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index bef6aef..f9e5a6e 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -156,7 +156,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
 	free(mp);
 }
 
-int gfs1_readi(struct gfs2_inode *ip, void *buf,
+int gfs1_readi(struct gfs2_inode *ip, void *bufin,
 	       uint64_t offset, unsigned int size)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
@@ -167,6 +167,7 @@ int gfs1_readi(struct gfs2_inode *ip, void *buf,
 	int not_new = 0;
 	int journaled = fs_is_jdata(ip);
 	int copied = 0;
+	char *buf = bufin;
 
 	if (offset >= ip->i_di.di_size)
 		return 0;
@@ -300,9 +301,6 @@ int gfs1_ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount, int quiet)
 	if (gfs1_rindex_read(sdp, fd, &count1))
 	    goto fail;
 	for (tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next) {
-		enum update_flags f;
-
-		f = not_updated;
 		rgd = osi_list_entry(tmp, struct rgrp_list, list);
 		errblock = gfs2_rgrp_read(sdp, rgd);
 		if (errblock)
@@ -328,7 +326,7 @@ int gfs1_ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount, int quiet)
 /* ------------------------------------------------------------------------ */
 /* gfs_dinode_in */
 /* ------------------------------------------------------------------------ */
-void gfs_dinode_in(struct gfs_dinode *di, char *buf)
+static void gfs_dinode_in(struct gfs_dinode *di, char *buf)
 {
 	struct gfs_dinode *str = (struct gfs_dinode *)buf;
 
diff --git a/gfs2/libgfs2/gfs2_log.c b/gfs2/libgfs2/gfs2_log.c
index 8103a62..f9f61b2 100644
--- a/gfs2/libgfs2/gfs2_log.c
+++ b/gfs2/libgfs2/gfs2_log.c
@@ -39,7 +39,7 @@ void decrease_verbosity(void)
 	_state.print_level--;
 }
 
-void print_msg(int priority, char *file, int line, const char *format,
+void print_msg(int priority, const char *file, int line, const char *format,
 			   va_list args) {
 
 	switch (priority) {
@@ -65,8 +65,8 @@ void print_msg(int priority, char *file, int line, const char *format,
 }
 
 
-void print_fsck_log(int iif, int priority, char *file, int line,
-					const char *format, ...)
+void print_fsck_log(int iif, int priority, const char *file, int line,
+		    const char *format, ...)
 {
 
 	va_list args;
@@ -83,7 +83,7 @@ void print_fsck_log(int iif, int priority, char *file, int line,
 	va_end(args);
 }
 
-char gfs2_getch(void)
+static char gfs2_getch(void)
 {
 	struct termios termattr, savetermattr;
 	char ch;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 167aef0..ffd673c 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -267,7 +267,7 @@ struct metapath {
 	unsigned int mp_list[GFS2_MAX_META_HEIGHT];
 };
 
-extern char *prog_name;
+extern const char *prog_name;
 
 #define GFS2_DEFAULT_BSIZE          (4096)
 #define GFS2_DEFAULT_JSIZE          (128)
@@ -381,7 +381,6 @@ struct gfs2_block_list *gfs2_block_list_create(struct gfs2_sbd *sdp,
 					       uint64_t *addl_mem_needed);
 struct special_blocks *blockfind(struct special_blocks *blist, uint64_t num);
 void gfs2_special_set(struct special_blocks *blocklist, uint64_t block);
-void gfs2_special_clear(struct special_blocks *blocklist, uint64_t block);
 void gfs2_special_free(struct special_blocks *blist);
 int gfs2_block_mark(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
 		    uint64_t block, enum gfs2_mark_block mark);
@@ -439,8 +438,6 @@ int gfs2_set_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, int state);
 /* fs_geometry.c */
 void rgblocks2bitblocks(unsigned int bsize, uint32_t *rgblocks,
 			uint32_t *bitblocks);
-uint64_t how_many_rgrps(struct gfs2_sbd *sdp, struct device *dev,
-			int rgsize_specified);
 void compute_rgrp_layout(struct gfs2_sbd *sdp, int rgsize_specified);
 void build_rgrps(struct gfs2_sbd *sdp, int write);
 
@@ -647,9 +644,8 @@ do { print_log(1, MSG_CRITICAL, format); } while(0)
 
 void increase_verbosity(void);
 void decrease_verbosity(void);
-void print_fsck_log(int iif, int priority, char *file, int line,
+void print_fsck_log(int iif, int priority, const char *file, int line,
 					const char *format, ...);
-char gfs2_getch(void);
 
 char generic_interrupt(const char *caller, const char *where,
 		       const char *progress, const char *question,
@@ -676,8 +672,7 @@ char *mp2fsname2(char *devname);
 char *name2value(char *str, char *name);
 uint32_t name2u32(char *str, char *name);
 uint64_t name2u64(char *str, char *name);
-char *__get_sysfs(char *fsname, char *filename);
-char *get_sysfs(char *fsname, char *filename);
+char *get_sysfs(const char *fsname, const char *filename);
 unsigned int get_sysfs_uint(char *fsname, char *filename);
 void set_sysfs(char *fsname, char *filename, char *val);
 char *do_basename(char *device);
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index 2c475a0..5a4e42b 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -60,8 +60,7 @@ uint32_t compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
 	return x;
 }
 
-void
-compute_constants(struct gfs2_sbd *sdp)
+void compute_constants(struct gfs2_sbd *sdp)
 {
 	uint32_t hash_blocks, ind_blocks, leaf_blocks;
 	uint32_t tmp_blocks;
@@ -239,8 +238,7 @@ mount_gfs2_meta(struct gfs2_sbd *sdp)
 	lock_for_admin(sdp);
 }
 
-void
-cleanup_metafs(struct gfs2_sbd *sdp)
+void cleanup_metafs(struct gfs2_sbd *sdp)
 {
 	int ret;
 
@@ -257,7 +255,7 @@ cleanup_metafs(struct gfs2_sbd *sdp)
 		rmdir(sdp->metafs_path);
 }
 
-char *__get_sysfs(char *fsname, char *filename)
+static char *__get_sysfs(const char *fsname, const char *filename)
 {
 	char path[PATH_MAX];
 	int fd, rv;
@@ -277,8 +275,7 @@ char *__get_sysfs(char *fsname, char *filename)
 	return sysfs_buf;
 }
 
-char *
-get_sysfs(char *fsname, char *filename)
+char *get_sysfs(const char *fsname, const char *filename)
 {
 	char *p = strchr(__get_sysfs(fsname, filename), '\n');
 	if (p)
@@ -581,8 +578,7 @@ int is_fsname(char *name)
  * Returns: the fsname
  */
 
-char *
-mp2fsname(char *mp)
+char *mp2fsname(char *mp)
 {
 	char device_id[PATH_MAX], *fsname = NULL;
 	struct stat statbuf;
@@ -627,7 +623,6 @@ mp2fsname2(char *mp)
 	struct stat statbuf;
 	DIR *d;
 	struct dirent *de;
-	struct gfs2_sbd sb;
 	FILE *fp = fopen("/proc/mounts", "r");
 	char buffer[PATH_MAX], device_name[PATH_MAX];
 	int fsdump, fspass, ret, found = 0;
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index 800efcb..7bebb3f 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -149,15 +149,15 @@ uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_list *rgd)
 	return 0;
 }
 
-void gfs2_rgrp_relse(struct rgrp_list *rgd, enum update_flags updated)
+void gfs2_rgrp_relse(struct rgrp_list *rgd, enum update_flags is_updated)
 {
 	int x, length = rgd->ri.ri_length;
 
 	for (x = 0; x < length; x++)
-		brelse(rgd->bh[x], updated);
+		brelse(rgd->bh[x], is_updated);
 }
 
-void gfs2_rgrp_free(osi_list_t *rglist, enum update_flags updated)
+void gfs2_rgrp_free(osi_list_t *rglist, enum update_flags is_updated)
 {
 	struct rgrp_list *rgd;
 
@@ -165,7 +165,7 @@ void gfs2_rgrp_free(osi_list_t *rglist, enum update_flags updated)
 		rgd = osi_list_entry(rglist->next, struct rgrp_list, list);
 		if (rgd->bh && rgd->bh[0] && /* if a buffer exists and       */
 			rgd->bh[0]->b_count) /* the 1st buffer is allocated */
-			gfs2_rgrp_relse(rgd, updated); /* free them all. */
+			gfs2_rgrp_relse(rgd, is_updated); /* free them all. */
 		if(rgd->bits)
 			free(rgd->bits);
 		if(rgd->bh) {
diff --git a/gfs2/libgfs2/size.c b/gfs2/libgfs2/size.c
index 12b40c5..4aa7d34 100644
--- a/gfs2/libgfs2/size.c
+++ b/gfs2/libgfs2/size.c
@@ -36,8 +36,7 @@
  * Returns: -1 on error (with errno set), 0 on success (with @bytes set)
  */
 
-static int
-do_device_size(int fd, uint64_t *bytes)
+static int do_device_size(int fd, uint64_t *bytes)
 {
 	off_t off;
 #if 0
@@ -71,8 +70,7 @@ do_device_size(int fd, uint64_t *bytes)
  * Returns: -1 on error (with errno set), 0 on success (with @bytes set)
  */
 
-int
-device_size(int fd, uint64_t *bytes)
+int device_size(int fd, uint64_t *bytes)
 {
 	struct stat st;
 	int error;
diff --git a/gfs2/mkfs/main.c b/gfs2/mkfs/main.c
index 359b1c3..5a1ebba 100644
--- a/gfs2/mkfs/main.c
+++ b/gfs2/mkfs/main.c
@@ -31,7 +31,7 @@
 #include "libgfs2.h"
 #include "gfs2_mkfs.h"
 
-char *prog_name;
+const char *prog_name;
 
 /**
  * main - do everything
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index 6e52a56..879f399 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -70,7 +70,7 @@ static void usage(void)
 		"  -v               Verbose, increase verbosity\n"));
 }
 
-void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
+static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
 {
 	int opt;
 
@@ -121,7 +121,7 @@ void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
 /**
  * figure_out_rgsize
  */
-void figure_out_rgsize(struct gfs2_sbd *sdp, unsigned int *rgsize)
+static void figure_out_rgsize(struct gfs2_sbd *sdp, unsigned int *orgsize)
 {
 	osi_list_t *head = &sdp->rglist;
 	struct rgrp_list *r1, *r2;
@@ -130,7 +130,7 @@ void figure_out_rgsize(struct gfs2_sbd *sdp, unsigned int *rgsize)
 	r1 = osi_list_entry(head->next->next, struct rgrp_list, list);
 	r2 = osi_list_entry(head->next->next->next, struct rgrp_list, list);
 
-	*rgsize = r2->ri.ri_addr - r1->ri.ri_addr;
+	*orgsize = r2->ri.ri_addr - r1->ri.ri_addr;
 }
 
 /**
@@ -142,7 +142,7 @@ void figure_out_rgsize(struct gfs2_sbd *sdp, unsigned int *rgsize)
  * Returns: The calculated size
  */
 
-uint64_t filesystem_size(struct gfs2_sbd *sdp)
+static uint64_t filesystem_size(struct gfs2_sbd *sdp)
 {
 	osi_list_t *tmp;
 	struct rgrp_list *rgl;
@@ -164,7 +164,7 @@ uint64_t filesystem_size(struct gfs2_sbd *sdp)
 /**
  * initialize_new_portion - Write the new rg information to disk buffers.
  */
-void initialize_new_portion(struct gfs2_sbd *sdp, int *old_rg_count)
+static void initialize_new_portion(struct gfs2_sbd *sdp, int *old_rg_count)
 {
 	uint64_t rgrp = 0;
 	osi_list_t *head = &sdp->rglist;
@@ -193,7 +193,7 @@ void initialize_new_portion(struct gfs2_sbd *sdp, int *old_rg_count)
 /**
  * fix_rindex - Add the new entries to the end of the rindex file.
  */
-void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count)
+static void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count)
 {
 	int count, rg;
 	struct rgrp_list *rl;
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
index 4b5eb74..ce47ebd 100644
--- a/gfs2/mkfs/main_jadd.c
+++ b/gfs2/mkfs/main_jadd.c
@@ -36,8 +36,8 @@
 
 #define BUF_SIZE 4096
 
-void
-make_jdata(int fd, char *value)
+static void
+make_jdata(int fd, const char *value)
 {
         int err;
         uint32_t val;
@@ -54,8 +54,8 @@ make_jdata(int fd, char *value)
                 die( _("error doing set flags (%d): %s\n"), err, strerror(errno));
 }
 
-int 
-rename2system(struct gfs2_sbd *sdp, char *new_dir, char *new_name)
+static int
+rename2system(struct gfs2_sbd *sdp, const char *new_dir, const char *new_name)
 {
 	char oldpath[PATH_MAX], newpath[PATH_MAX];
 	int error = 0;
@@ -77,8 +77,7 @@ rename2system(struct gfs2_sbd *sdp, char *new_dir, char *new_name)
  *
  */
 
-static void 
-print_usage(void)
+static void print_usage(void)
 {
 	printf( _("Usage:\n\n"
 		"%s [options] /path/to/filesystem\n\n"
@@ -100,8 +99,7 @@ print_usage(void)
  *
  */
 
-static void
-decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
+static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
 {
 	int cont = TRUE;
 	int optchar;
@@ -205,7 +203,7 @@ print_results(struct gfs2_sbd *sdp)
 
 }
 
-int 
+static int
 create_new_inode(struct gfs2_sbd *sdp)
 {
 	char name[PATH_MAX];
@@ -232,7 +230,7 @@ create_new_inode(struct gfs2_sbd *sdp)
 	return fd;
 }
 
-void 
+static void
 add_ir(struct gfs2_sbd *sdp)
 {
 	int fd;
@@ -257,7 +255,7 @@ add_ir(struct gfs2_sbd *sdp)
 		new_name, error, strerror(errno));
 }
 
-void 
+static void 
 add_sc(struct gfs2_sbd *sdp)
 {
 	int fd;
@@ -283,7 +281,7 @@ add_sc(struct gfs2_sbd *sdp)
 		    new_name, error, strerror(errno));
 }
 
-void 
+static void 
 add_qc(struct gfs2_sbd *sdp)
 {
 	int fd;
@@ -376,7 +374,7 @@ gather_info(struct gfs2_sbd *sdp)
 }
 #endif 
 
-void 
+static void 
 find_current_journals(struct gfs2_sbd *sdp)
 {
 	char jindex[PATH_MAX];
@@ -407,7 +405,7 @@ close:
 	sdp->orig_journals = existing_journals;
 }
 
-void 
+static void 
 add_j(struct gfs2_sbd *sdp)
 {
 	int fd;
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 3456f6d..9eb4761 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -35,7 +35,7 @@
 #include "gfs2_mkfs.h"
 #include "libvolume_id.h"
 
-char *prog_name;
+const char *prog_name;
 
 /**
  * This function is for libgfs2's sake.
@@ -300,7 +300,7 @@ static void are_you_sure(struct gfs2_sbd *sdp)
  *
  */
 
-void check_mount(char *device)
+static void check_mount(char *device)
 {
 	struct stat st_buf;
 	int fd;
diff --git a/gfs2/mount/mount.gfs2.c b/gfs2/mount/mount.gfs2.c
index 4097915..d8a60c3 100644
--- a/gfs2/mount/mount.gfs2.c
+++ b/gfs2/mount/mount.gfs2.c
@@ -8,7 +8,7 @@
 
 #include "util.h"
 
-char *prog_name;
+const char *prog_name;
 char *fsname;
 int verbose, fake_mount = 0, no_mtab = 0;
 static sigset_t old_sigset;
diff --git a/gfs2/mount/umount.gfs2.c b/gfs2/mount/umount.gfs2.c
index acf91f0..c42b80e 100644
--- a/gfs2/mount/umount.gfs2.c
+++ b/gfs2/mount/umount.gfs2.c
@@ -8,7 +8,7 @@
 
 #include "util.h"
 
-char *prog_name;
+const char *prog_name;
 char *fsname;
 char *expert;
 int verbose;
diff --git a/gfs2/mount/util.c b/gfs2/mount/util.c
index 4c5bb06..2970d33 100644
--- a/gfs2/mount/util.c
+++ b/gfs2/mount/util.c
@@ -20,7 +20,7 @@ static int adding_another_mountpoint;
 /* opt_map stuff from util-linux */
 
 struct opt_map {
-	char *opt;      /* option name */
+	const char *opt;      /* option name */
 	int skip;       /* skip in mtab option string (gfs: not used) */
 	int inv;	/* true if flag value should be inverted */
 	int mask;       /* flag mask value */
@@ -237,7 +237,7 @@ void read_proc_mounts(struct mount_options *mo)
 	log_debug("read_proc_mounts: opts = \"%s\"", mo->opts);
 }
 
-void gfs2_inum_in(struct gfs2_inum *no, char *buf)
+static void gfs2_inum_in(struct gfs2_inum *no, char *buf)
 {
 	struct gfs2_inum *str = (struct gfs2_inum *)buf;
 
@@ -245,7 +245,7 @@ void gfs2_inum_in(struct gfs2_inum *no, char *buf)
 	no->no_addr = be64_to_cpu(str->no_addr);
 }
 
-void gfs2_meta_header_in(struct gfs2_meta_header *mh, char *buf)
+static void gfs2_meta_header_in(struct gfs2_meta_header *mh, char *buf)
 {
 	struct gfs2_meta_header *str = (struct gfs2_meta_header *)buf;
 
@@ -254,7 +254,7 @@ void gfs2_meta_header_in(struct gfs2_meta_header *mh, char *buf)
 	mh->mh_format = be32_to_cpu(str->mh_format);
 }
 
-void gfs2_sb_in(struct gfs2_sb *sb, char *buf)
+static void gfs2_sb_in(struct gfs2_sb *sb, char *buf)
 {
 	struct gfs2_sb *str = (struct gfs2_sb *)buf;
 
diff --git a/gfs2/quota/check.c b/gfs2/quota/check.c
index 59c287f..0a1c1e3 100644
--- a/gfs2/quota/check.c
+++ b/gfs2/quota/check.c
@@ -320,7 +320,7 @@ print_list(char *str, osi_list_t *list)
  */
 
 static int
-do_compare(char *type, osi_list_t *fs_list, osi_list_t *qf_list)
+do_compare(const char *type, osi_list_t *fs_list, osi_list_t *qf_list)
 {
 	osi_list_t *tmp1, *tmp2;
 	values_t *v1, *v2;
diff --git a/gfs2/quota/gfs2_quota.h b/gfs2/quota/gfs2_quota.h
index a929dfa..064c813 100644
--- a/gfs2/quota/gfs2_quota.h
+++ b/gfs2/quota/gfs2_quota.h
@@ -79,7 +79,7 @@ extern char *prog_name;
 
 void do_get_super(int fd, struct gfs2_sb *sb);
 void do_sync(struct gfs2_sbd *sdp, commandline_t *comline);
-void cleanup();
+void cleanup(void);
 void read_superblock(struct gfs2_sb *sb, struct gfs2_sbd *sdp);
 inline void read_quota_internal(int fd, unsigned int id, int id_type, 
 				struct gfs2_quota *q);
diff --git a/gfs2/quota/main.c b/gfs2/quota/main.c
index 36b6f2d..0136d18 100644
--- a/gfs2/quota/main.c
+++ b/gfs2/quota/main.c
@@ -43,7 +43,7 @@
 #define OPTION_STRING ("bdf:g:hkl:mnsu:V")
 #define FS_IOC_FIEMAP                   _IOWR('f', 11, struct fiemap)
 
-char *prog_name;
+const char *prog_name;
 
 /**
  * This function is for libgfs2's sake.
diff --git a/gfs2/tool/gfs2_tool.h b/gfs2/tool/gfs2_tool.h
index e67da9c..2dd0f88 100644
--- a/gfs2/tool/gfs2_tool.h
+++ b/gfs2/tool/gfs2_tool.h
@@ -19,7 +19,6 @@
 #define OUTPUT_K      1
 #define OUTPUT_HUMAN  2
 
-extern char *prog_name;
 extern char *action;
 extern int override;
 extern int expert;
diff --git a/gfs2/tool/main.c b/gfs2/tool/main.c
index a2529c2..7c37734 100644
--- a/gfs2/tool/main.c
+++ b/gfs2/tool/main.c
@@ -33,7 +33,7 @@
 #include "gfs2_tool.h"
 #include "libgfs2.h"
 
-char *prog_name;
+const char *prog_name;
 char *action = NULL;
 int override = FALSE;
 int expert = FALSE;
diff --git a/gfs2/tool/sb.c b/gfs2/tool/sb.c
index cf76d6e..44f4443 100644
--- a/gfs2/tool/sb.c
+++ b/gfs2/tool/sb.c
@@ -49,7 +49,7 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...)
  * str_to_hexchar - convert a string consisting of two isxdigits back to hex.
  * Returns: the hex character
  */
-int str_to_hexchar(const char *estring)
+static int str_to_hexchar(const char *estring)
 {
 	int ch = 0;