diff -Naurd cluster-3.0.0.rc2/cman/cman_tool/join.c cluster-3.0.0.rc3/cman/cman_tool/join.c
--- cluster-3.0.0.rc2/cman/cman_tool/join.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/cman_tool/join.c	2009-06-11 11:02:55.000000000 +0200
@@ -172,12 +172,12 @@
 	if (comline->noconfig_opt) {
 		envp[envptr++] = strdup("CMAN_NOCONFIG=true");
 		snprintf(scratch, sizeof(scratch), "COROSYNC_DEFAULT_CONFIG_IFACE=cmanpreconfig%s",
-			 comline->noopenais_opt?"":":openaisserviceenable");
+			 comline->noopenais_opt?"":":openaisserviceenablestable");
 		envp[envptr++] = strdup(scratch);
 	}
 	else {
 		snprintf(scratch, sizeof(scratch), "COROSYNC_DEFAULT_CONFIG_IFACE=%s:cmanpreconfig%s", comline->config_lcrso,
-			 comline->noopenais_opt?"":":openaisserviceenable");
+			 comline->noopenais_opt?"":":openaisserviceenablestable");
 		envp[envptr++] = strdup(scratch);
 	}
 
diff -Naurd cluster-3.0.0.rc2/cman/cman_tool/main.c cluster-3.0.0.rc3/cman/cman_tool/main.c
--- cluster-3.0.0.rc2/cman/cman_tool/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/cman_tool/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -53,8 +53,8 @@
 		printf("  -w               Wait until node has joined a cluster\n");
 		printf("  -q               Wait until the cluster is quorate\n");
 		printf("  -t               Maximum time (in seconds) to wait\n");
-		printf("  -k <file>        Private key file for AIS communications\n");
-		printf("  -P               Don't set aisexec to realtime priority\n");
+		printf("  -k <file>        Private key file for Corosync communications\n");
+		printf("  -P               Don't set corosync to realtime priority\n");
 		printf("  -X               Use internal cman defaults for configuration\n");
 		printf("  -A               Don't load openais services\n");
 		printf("\n");
diff -Naurd cluster-3.0.0.rc2/cman/daemon/ais.c cluster-3.0.0.rc3/cman/daemon/ais.c
--- cluster-3.0.0.rc2/cman/daemon/ais.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/daemon/ais.c	2009-06-11 11:02:55.000000000 +0200
@@ -31,7 +31,6 @@
 #include "cnxman-socket.h"
 #include "cnxman-private.h"
 #include "commands.h"
-#include "logging.h"
 
 #include "ais.h"
 #include "cman.h"
@@ -57,7 +56,6 @@
 static hdb_handle_t cluster_parent_handle;
 
 static int startup_pipe;
-static unsigned int debug_mask;
 static int first_trans = 1;
 struct corosync_api_v1 *corosync;
 
@@ -90,7 +88,7 @@
 			    const unsigned int *left_list, size_t left_list_entries,
 			    const unsigned int *joined_list, size_t joined_list_entries,
 			    const struct memb_ring_id *ring_id);
-static void cman_deliver_fn(unsigned int nodeid, const struct iovec *iovec, unsigned int iov_len,
+static void cman_deliver_fn(unsigned int nodeid, const void *msg, unsigned int msg_len,
 			    int endian_conversion_required);
 static void cman_quorum_init(struct corosync_api_v1 *api, quorum_set_quorate_fn_t report);
 
@@ -185,13 +183,10 @@
 		objdb_get_int(api, object_handle, "quorum_dev_poll", &quorumdev_poll, DEFAULT_QUORUMDEV_POLL);
 		objdb_get_int(api, object_handle, "shutdown_timeout", &shutdown_timeout, DEFAULT_SHUTDOWN_TIMEOUT);
 		objdb_get_int(api, object_handle, "ccsd_poll", &ccsd_poll_interval, DEFAULT_CCSD_POLL);
-		objdb_get_int(api, object_handle, "debug_mask", &debug_mask, 0);
 
-		/* All other debugging options should already have been set in preconfig */
-		set_debuglog(debug_mask);
 	}
 	corosync->object_find_destroy(find_handle);
-	P_DAEMON(CMAN_NAME " starting");
+	log_printf(LOGSYS_LEVEL_DEBUG, CMAN_NAME " starting");
 
 	/* Open local sockets and initialise I/O queues */
 	if (read_cman_config(api, &config_version)) {
@@ -231,7 +226,7 @@
 	struct cl_protheader header;
 	int totem_flags = TOTEM_AGREED;
 
-	P_AIS("comms send message %p len = %d\n", buf,len);
+	log_printf(LOGSYS_LEVEL_DEBUG, "ais: comms send message %p len = %d\n", buf,len);
 	header.tgtport = toport;
 	header.srcport = fromport;
 	header.flags   = flags;
@@ -249,28 +244,31 @@
 	return corosync->tpg_joined_mcast(group_handle, iov, 2, totem_flags);
 }
 
-// This assumes the iovec has only one element ... is it true ??
-static void cman_deliver_fn(unsigned int nodeid, const struct iovec *iovec, unsigned int iov_len,
+static void cman_deliver_fn(unsigned int nodeid, const void *msg, unsigned int msg_len,
 			    int endian_conversion_required)
 {
-	struct cl_protheader *header = iovec->iov_base;
-	char *buf = iovec->iov_base;
+	const struct cl_protheader *original_header = msg;
+	struct cl_protheader header;
+	const char *buf = msg;
 
-	P_AIS("deliver_fn source nodeid = %d, len=%d, endian_conv=%d\n",
-	      nodeid, (int)iovec->iov_len, endian_conversion_required);
+	log_printf(LOGSYS_LEVEL_DEBUG, "ais: deliver_fn source nodeid = %d, len=%d, endian_conv=%d\n",
+	      nodeid, msg_len, endian_conversion_required);
 
 	if (endian_conversion_required) {
-		header->srcid = swab32(header->srcid);
-		header->tgtid = swab32(header->tgtid);
-		header->flags = swab32(header->flags);
+		header.srcid = swab32(original_header->srcid);
+		header.tgtid = swab32(original_header->tgtid);
+		header.flags = swab32(original_header->flags);
+	} 
+	else {
+	        memcpy(&header, original_header, sizeof(header));
 	}
 
 	/* Only pass on messages for us or everyone */
-	if (header->tgtid == our_nodeid() ||
-	    header->tgtid == 0) {
-		send_to_userport(header->srcport, header->tgtport,
-				 header->srcid, header->tgtid,
-				 buf + sizeof(struct cl_protheader), iovec->iov_len - sizeof(struct cl_protheader),
+	if (header.tgtid == our_nodeid() ||
+	    header.tgtid == 0) {
+		send_to_userport(header.srcport, header.tgtport,
+				 header.srcid, header.tgtid,
+				 buf + sizeof(struct cl_protheader), msg_len - sizeof(struct cl_protheader),
 				 endian_conversion_required);
 	}
 }
@@ -287,7 +285,7 @@
 	static size_t saved_left_list_size;
 	static unsigned int *saved_left_list = NULL;
 
-	P_AIS("confchg_fn called type = %d, seq=%lld\n", configuration_type, ring_id->seq);
+	log_printf(LOGSYS_LEVEL_DEBUG, "ais: confchg_fn called type = %d, seq=%lld\n", configuration_type, ring_id->seq);
 
 	memcpy(&cman_ring_id, ring_id, sizeof(*ring_id));
 	incarnation = ring_id->seq;
@@ -324,7 +322,7 @@
 	}
 
 	if (configuration_type == TOTEM_CONFIGURATION_REGULAR) {
-		P_AIS("last memb_count = %d, current = %"PRIuFAST32"\n", last_memb_count, member_list_entries);
+		log_printf(LOGSYS_LEVEL_DEBUG, "ais: last memb_count = %d, current = %"PRIuFAST32"\n", last_memb_count, member_list_entries);
 		send_transition_msg(last_memb_count, first_trans);
 		last_memb_count = member_list_entries;
 		if (member_list_entries > 1)
@@ -336,6 +334,11 @@
 	}
 }
 
+void corosync_shutdown(void)
+{
+	corosync->request_shutdown();
+}
+
 /* Write an error message down the CMAN startup pipe so
    that cman_tool can display it */
 int write_cman_pipe(const char *message)
diff -Naurd cluster-3.0.0.rc2/cman/daemon/ais.h cluster-3.0.0.rc3/cman/daemon/ais.h
--- cluster-3.0.0.rc2/cman/daemon/ais.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/daemon/ais.h	2009-06-11 11:02:55.000000000 +0200
@@ -11,3 +11,4 @@
 extern int num_ais_nodes;
 extern quorum_set_quorate_fn_t corosync_set_quorum;
 extern struct memb_ring_id cman_ring_id;
+extern void corosync_shutdown(void);
diff -Naurd cluster-3.0.0.rc2/cman/daemon/barrier.c cluster-3.0.0.rc3/cman/daemon/barrier.c
--- cluster-3.0.0.rc2/cman/daemon/barrier.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/daemon/barrier.c	2009-06-11 11:02:55.000000000 +0200
@@ -28,7 +28,6 @@
 #include "cnxman-private.h"
 #include "daemon.h"
 #include "commands.h"
-#include "logging.h"
 #include "barrier.h"
 #include "cman.h"
 #include "ais.h"
@@ -104,7 +103,7 @@
 		bmsg.subcmd = BARRIER_COMPLETE;
 		strcpy(bmsg.name, barrier->name);
 
-		P_BARRIER("Sending COMPLETE for %s\n", barrier->name);
+		log_printf(LOGSYS_LEVEL_DEBUG, "barrier: Sending COMPLETE for %s\n", barrier->name);
 		comms_send_message((char *) &bmsg, sizeof (bmsg),
 				   0, 0,
 				   0,
@@ -116,7 +115,7 @@
 /* Return 1 if we deleted the barrier */
 static int barrier_complete_phase2(struct cl_barrier *barrier, int status)
 {
-	P_BARRIER("complete_phase2 for %s\n", barrier->name);
+	log_printf(LOGSYS_LEVEL_DEBUG, "barrier: complete_phase2 for %s\n", barrier->name);
 
 	barrier->endreason = status;
 
@@ -141,7 +140,7 @@
 {
 	struct cl_barrier *barrier = arg;
 
-	P_BARRIER("Barrier timer_fn called for %s\n", barrier->name);
+	log_printf(LOGSYS_LEVEL_DEBUG, "barrier: Barrier timer_fn called for %s\n", barrier->name);
 
 	/* Ignore any futher messages, they are too late. */
 	barrier->phase = 0;
@@ -186,7 +185,7 @@
 	if (!barrier)
 		return;
 
-	P_BARRIER("Got %d for %s, from node %s\n", msg->subcmd, msg->name,
+	log_printf(LOGSYS_LEVEL_DEBUG, "barrier: Got %d for %s, from node %s\n", msg->subcmd, msg->name,
 		  node ? node->name : "unknown");
 
 	switch (msg->subcmd) {
@@ -228,7 +227,7 @@
 	if (flags & BARRIER_ATTR_MULTISTEP)
 		return -EINVAL;
 
-	P_BARRIER("barrier_register %s, nodes = %d, flags =%x\n", name, nodes, flags);
+	log_printf(LOGSYS_LEVEL_DEBUG, "barrier: barrier_register %s, nodes = %d, flags =%x\n", name, nodes, flags);
 
 	/* See if it already exists */
 	if ((barrier = find_barrier(name))) {
@@ -282,7 +281,7 @@
 						   barrier_timer_fn, &barrier->timer);
 		}
 
-		P_BARRIER("Sending WAIT for %s\n", barrier->name);
+		log_printf(LOGSYS_LEVEL_DEBUG, "barrier: Sending WAIT for %s\n", barrier->name);
 		status = comms_send_message((char *)&bmsg, sizeof(bmsg), 0,0, 0, MSG_TOTEM_SAFE);
 		if (status < 0) {
 			return status;
diff -Naurd cluster-3.0.0.rc2/cman/daemon/cmanconfig.c cluster-3.0.0.rc3/cman/daemon/cmanconfig.c
--- cluster-3.0.0.rc2/cman/daemon/cmanconfig.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/daemon/cmanconfig.c	2009-06-11 11:02:55.000000000 +0200
@@ -18,7 +18,6 @@
 #include "list.h"
 #include "cnxman-socket.h"
 #include "cnxman-private.h"
-#include "logging.h"
 #include "commands.h"
 #include "cman.h"
 #define OBJDB_API struct corosync_api_v1
@@ -100,7 +99,7 @@
 		    goto out_err;
 	    }
 
-	    P_MEMB("Got node %s from ccs (id=%d, votes=%d)\n", nodename, this_nodeid, votes);
+	    log_printf(LOGSYS_LEVEL_DEBUG, "memb: Got node %s from ccs (id=%d, votes=%d)\n", nodename, this_nodeid, votes);
 	    add_ccs_node(nodename, this_nodeid, votes, expected);
 	    nodes_handle = nodeslist_next(corosync, find_handle);
     } while (nodes_handle);
diff -Naurd cluster-3.0.0.rc2/cman/daemon/cman-preconfig.c cluster-3.0.0.rc3/cman/daemon/cman-preconfig.c
--- cluster-3.0.0.rc2/cman/daemon/cman-preconfig.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/daemon/cman-preconfig.c	2009-06-11 11:02:55.000000000 +0200
@@ -24,11 +24,10 @@
 #define OBJDB_API struct objdb_iface_ver0
 #include "cnxman-socket.h"
 #include "nodelist.h"
-#include "logging.h"
 
 #define MAX_PATH_LEN PATH_MAX
 
-static unsigned int debug_mask;
+static unsigned int debug;
 static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, const char **error_string);
 static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const char **error_string);
 
@@ -203,30 +202,22 @@
 	char *str;
 
 	objdb->object_find_create(object_handle, "logger_subsys", strlen("logger_subsys"), &find_handle);
-	while (!objdb->object_find_next(object_handle, &subsys_handle)) {
-
-		if (objdb_get_string(objdb, subsys_handle, "subsys", &str)) {
-			continue;
+	while (!objdb->object_find_next(find_handle, &subsys_handle)) {
+		if (!objdb_get_string(objdb, subsys_handle, "subsys", &str)) {
+			if (strncmp(str, CMAN_NAME, 4) == 0) {
+				objdb->object_find_destroy(find_handle);
+				return subsys_handle;
+			}
 		}
-		if (strcmp(str, CMAN_NAME) == 0)
-			return subsys_handle;
 	}
 	objdb->object_find_destroy(find_handle);
 
-	/* We can't find it ... create one */
-	if (objdb->object_create(object_handle, &subsys_handle,
-				    "logger_subsys", strlen("logger_subsys")) == 0) {
-
-		objdb->object_key_create(subsys_handle, "subsys", strlen("subsys"),
-					    CMAN_NAME, strlen(CMAN_NAME)+1);
-	}
-
-	return subsys_handle;
+	return -1;
 
 }
 
 
-static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr, int port)
+static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr, int port, int broadcast)
 {
 	hdb_handle_t totem_object_handle;
 	hdb_handle_t find_handle;
@@ -275,8 +266,12 @@
 		objdb->object_key_create(interface_object_handle, "bindnetaddr", strlen("bindnetaddr"),
 					 tmp, strlen(tmp)+1);
 
-		objdb->object_key_create(interface_object_handle, "mcastaddr", strlen("mcastaddr"),
-					 mcast, strlen(mcast)+1);
+		if (broadcast)
+			objdb->object_key_create(interface_object_handle, "broadcast", strlen("broadcast"),
+						 "yes", strlen("yes")+1);
+		else
+			objdb->object_key_create(interface_object_handle, "mcastaddr", strlen("mcastaddr"),
+						 mcast, strlen(mcast)+1);
 
 		sprintf(tmp, "%d", port);
 		objdb->object_key_create(interface_object_handle, "mcastport", strlen("mcastport"),
@@ -503,7 +498,9 @@
 		votes = 1;
 	}
 	if (getenv("CMAN_DEBUG")) {
-		debug_mask = atoi(getenv("CMAN_DEBUG"));
+		debug = atoi(getenv("CMAN_DEBUG"));
+		if (debug > 0)
+			debug = 1;
 	}
 
 	return 0;
@@ -517,6 +514,8 @@
 	hdb_handle_t find_handle;
 	hdb_handle_t node_object_handle;
 	hdb_handle_t alt_object;
+	int broadcast = 0;
+	char *str;
 	int error;
 
 	if (!getenv("CMAN_NOCONFIG")) {
@@ -609,7 +608,18 @@
 		objdb_get_int(objdb, object_handle, "port", &portnum, DEFAULT_PORT);
 	}
 
-	if (add_ifaddr(objdb, mcast_name, nodename, portnum))
+	/* Check for broadcast */
+	if (!objdb_get_string(objdb, object_handle, "broadcast", &str)) {
+		if (strcmp(str, "yes") == 0) {
+			mcast_name = strdup("255.255.255.255");
+			if (!mcast_name)
+				return -1;
+			broadcast = 1;
+		}
+		free(str);
+	}
+
+	if (add_ifaddr(objdb, mcast_name, nodename, portnum, broadcast))
 		return -1;
 
 	/* Get all alternative node names */
@@ -630,7 +640,7 @@
 			mcast = mcast_name;
 		}
 
-		if (add_ifaddr(objdb, mcast, node, portnum))
+		if (add_ifaddr(objdb, mcast, node, portnum, broadcast))
 			return -1;
 
 		num_nodenames++;
@@ -644,9 +654,9 @@
 /* These are basically cman overrides to the totem config bits */
 static void add_cman_overrides(struct objdb_iface_ver0 *objdb)
 {
-	hdb_handle_t logger_object_handle;
 	char *logstr;
 	char *logfacility;
+	char *loglevel;
 	hdb_handle_t object_handle;
 	hdb_handle_t find_handle;
 	char tmp[256];
@@ -745,16 +755,17 @@
 	objdb->object_find_destroy(find_handle);
 
 	logfacility = facility_name_get(SYSLOGFACILITY);
+	loglevel = priority_name_get(SYSLOGLEVEL);
 
-	logger_object_handle = find_cman_logger(objdb, object_handle);
-
-	if (objdb_get_string(objdb, object_handle, "syslog_facility", &logstr)) {
-		objdb->object_key_create(object_handle, "syslog_facility", strlen("syslog_facility"),
-					    logfacility, strlen(logfacility)+1);
+	/* enable timestamps on logging */
+	if (objdb_get_string(objdb, object_handle, "timestamp", &logstr)) {
+		objdb->object_key_create(object_handle, "timestamp", strlen("timestamp"),
+					    "on", strlen("on")+1);
 	}
 
-	if (objdb_get_string(objdb, object_handle, "to_file", &logstr)) {
-		objdb->object_key_create(object_handle, "to_file", strlen("to_file"),
+	/* configure logfile */
+	if (objdb_get_string(objdb, object_handle, "to_logfile", &logstr)) {
+		objdb->object_key_create(object_handle, "to_logfile", strlen("to_logfile"),
 					    "yes", strlen("yes")+1);
 	}
 
@@ -763,27 +774,53 @@
 					    LOGDIR "/corosync.log", strlen(LOGDIR "/corosync.log")+1);
 	}
 
-	if (objdb_get_string(objdb, object_handle, "timestamp", &logstr)) {
-		objdb->object_key_create(object_handle, "timestamp", strlen("timestamp"),
-					    "on", strlen("on")+1);
+	if (objdb_get_string(objdb, object_handle, "logfile_priority", &logstr)) {
+		objdb->object_key_create(object_handle, "logfile_priority", strlen("logfile_priority"),
+					    loglevel, strlen(loglevel)+1);
 	}
 
-	if (debug_mask) {
-		objdb->object_key_create(object_handle, "to_stderr", strlen("to_stderr"),
+	/* syslog */
+	if (objdb_get_string(objdb, object_handle, "to_syslog", &logstr)) {
+		objdb->object_key_create(object_handle, "to_syslog", strlen("to_syslog"),
 					    "yes", strlen("yes")+1);
-		objdb->object_key_create(logger_object_handle, "debug", strlen("debug"),
-					    "on", strlen("on")+1);
-		objdb->object_key_create(logger_object_handle, "syslog_level", strlen("syslog_level"),
-					    "debug", strlen("debug")+1);
+	}
 
+	if (objdb_get_string(objdb, object_handle, "syslog_facility", &logstr)) {
+		objdb->object_key_create(object_handle, "syslog_facility", strlen("syslog_facility"),
+					    logfacility, strlen(logfacility)+1);
 	}
-	else {
-		char *loglevel;
-		loglevel = priority_name_get(SYSLOGLEVEL);
-		objdb->object_key_create(logger_object_handle, "syslog_level", strlen("syslog_level"),
+
+	if (objdb_get_string(objdb, object_handle, "syslog_priority", &logstr)) {
+		objdb->object_key_create(object_handle, "syslog_priority", strlen("syslog_priority"),
 					    loglevel, strlen(loglevel)+1);
 	}
 
+	if (!debug) {
+		hdb_handle_t logger_object_handle;
+
+		if (!objdb_get_string(objdb, object_handle, "debug", &logstr)) {
+			if (!strncmp(logstr, "on", 2)) {
+				debug=1;
+			}
+		}
+
+		logger_object_handle = find_cman_logger(objdb, object_handle);
+		if (logger_object_handle > -1) {
+			if (!objdb_get_string(objdb, logger_object_handle, "debug", &logstr)) {
+				if (!strncmp(logstr, "on", 2)) {
+					debug=1;
+				}
+				if (!strncmp(logstr, "off", 3)) {
+					debug=0;
+				}
+			}
+		}
+	}
+
+	if (debug) {
+		objdb->object_key_create(object_handle, "to_stderr", strlen("to_stderr"),
+					    "yes", strlen("yes")+1);
+	}
 
 	/* Make sure we allow connections from user/group "ais" */
 	objdb->object_find_create(OBJECT_PARENT_HANDLE, "aisexec", strlen("aisexec"), &find_handle);
@@ -812,11 +849,6 @@
 			objdb->object_key_create(object_handle, "two_node", strlen("two_node"),
 						 str, strlen(str) + 1);
 		}
-		if (debug_mask) {
-			sprintf(str, "%d", debug_mask);
-			objdb->object_key_create(object_handle, "debug_mask", strlen("debug_mask"),
-						 str, strlen(str) + 1);
-		}
 	}
 	objdb->object_find_destroy(find_handle);
 
diff -Naurd cluster-3.0.0.rc2/cman/daemon/commands.c cluster-3.0.0.rc3/cman/daemon/commands.c
--- cluster-3.0.0.rc2/cman/daemon/commands.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/daemon/commands.c	2009-06-11 11:02:55.000000000 +0200
@@ -33,7 +33,6 @@
 #include "cnxman-private.h"
 #include "daemon.h"
 #include "barrier.h"
-#include "logging.h"
 #define OBJDB_API struct corosync_api_v1
 #include "cmanconfig.h"
 #include "nodelist.h"
@@ -287,7 +286,7 @@
 
 		newname = strdup(name);
 		if (newname) {
-			P_MEMB("replacing old node name %s with %s\n", newnode->name, name);
+			log_printf(LOGSYS_LEVEL_DEBUG, "memb: replacing old node name %s with %s\n", newnode->name, name);
 			free(newnode->name);
 			newnode->name = newname;
 		}
@@ -298,7 +297,7 @@
 
 	newnode->flags |= NODE_FLAGS_REREAD;
 
-	P_MEMB("add_new_node: %s, (id=%d, votes=%d) newalloc=%d\n",
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: add_new_node: %s, (id=%d, votes=%d) newalloc=%d\n",
 	       name, nodeid, votes, newalloc);
 
 	return newnode;
@@ -542,7 +541,7 @@
 		outbuf = *retbuf + offset;
 		einfo = (struct cl_extra_info *)outbuf;
 
-		P_MEMB("get_extrainfo: allocated new buffer\n");
+		log_printf(LOGSYS_LEVEL_DEBUG, "memb: get_extrainfo: allocated new buffer\n");
 	}
 
 	einfo->node_state = us->state;
@@ -580,6 +579,9 @@
 			struct sockaddr_in6 *saddr6;
 
 			objdb_get_string(corosync, object_handle, "mcastaddr", &mcast);
+			/* If this fails, it must be using broadcast*/
+			if (!mcast)
+				mcast = "255.255.255.255";
 			memset(ptr, 0, sizeof(struct sockaddr_storage));
 
 			saddr4 = (struct sockaddr_in *)ptr;
@@ -634,7 +636,7 @@
 		if ((retsize / sizeof(struct cl_cluster_node)) < total_nodes) {
 			*retbuf = malloc(sizeof(struct cl_cluster_node) * total_nodes + offset);
 			outbuf = *retbuf + offset;
-			P_MEMB("get_all_members: allocated new buffer (retsize=%d)\n", retsize);
+			log_printf(LOGSYS_LEVEL_DEBUG, "memb: get_all_members: allocated new buffer (retsize=%d)\n", retsize);
 		}
 	}
 	user_node = (struct cl_cluster_node *)outbuf;
@@ -656,7 +658,7 @@
 	}
 
 	*retlen = sizeof(struct cl_cluster_node) * num_nodes;
-	P_MEMB("get_all_members: retlen = %d\n", *retlen);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: get_all_members: retlen = %d\n", *retlen);
 	return num_nodes;
 }
 
@@ -698,7 +700,7 @@
 			node = find_node_by_name(u_node->name);
 
 		if (!node) {
-			P_MEMB("cmd_get_node failed: id=%d, name='%s'\n", u_node->node_id, u_node->name);
+			log_printf(LOGSYS_LEVEL_DEBUG, "memb: cmd_get_node failed: id=%d, name='%s'\n", u_node->node_id, u_node->name);
 			return -ENOENT;
 		}
 	}
@@ -780,7 +782,7 @@
 {
 	struct cl_killmsg msg;
 
-	P_MEMB("Sending KILL to node %d\n", nodeid);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: Sending KILL to node %d\n", nodeid);
 
 	msg.cmd = CLUSTER_MSG_KILLNODE;
 	msg.reason = reason;
@@ -796,7 +798,7 @@
 {
 	struct cl_leavemsg msg;
 
-	P_MEMB("Sending LEAVE, reason %d\n", reason);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: Sending LEAVE, reason %d\n", reason);
 
 	msg.cmd = CLUSTER_MSG_LEAVE;
 	msg.reason = reason;
@@ -868,14 +870,14 @@
 	   a cluster that has been running for a while
 	*/
        	if (!get_port_bit(rem_node, 0)) {
-		P_MEMB("islistening, no data for node %d, sending PORTENQ\n", nodeid);
+		log_printf(LOGSYS_LEVEL_DEBUG, "memb: islistening, no data for node %d, sending PORTENQ\n", nodeid);
 		send_port_enquire(rem_node->node_id);
 
 		/* Admit our ignorance */
 		return -EBUSY;
 	}
 	else {
-		P_MEMB("islistening, for node %d, low bytes are %x %x\n", nodeid, rem_node->port_bits[0], rem_node->port_bits[1]);
+		log_printf(LOGSYS_LEVEL_DEBUG, "memb: islistening, for node %d, low bytes are %x %x\n", nodeid, rem_node->port_bits[0], rem_node->port_bits[1]);
 		return get_port_bit(rem_node, rq.port);
 	}
 }
@@ -897,7 +899,7 @@
 	if (!arg.nodeid)
 		arg.nodeid = us->node_id;
 
-	P_MEMB("Setting votes for node %d to %d\n", arg.nodeid, arg.newvotes);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: Setting votes for node %d to %d\n", arg.nodeid, arg.newvotes);
 
 	node = find_node_by_nodeid(arg.nodeid);
 	if (!node)
@@ -928,7 +930,7 @@
 
 	memcpy(&port, cmdbuf, sizeof(int));
 
-	P_MEMB("requested bind to port %d, (us=%p)\n", port, con);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: requested bind to port %d, (us=%p)\n", port, con);
 
 	if (port == 0 || port > 255)
 		return -EINVAL;
@@ -1004,14 +1006,14 @@
 			shutdown_con = NULL;
 		}
 
-		P_MEMB("shutdown decision is: %d (yes=%d, no=%d) flags=%x\n", reply, shutdown_yes, shutdown_no, shutdown_flags);
+		log_printf(LOGSYS_LEVEL_DEBUG, "memb: shutdown decision is: %d (yes=%d, no=%d) flags=%x\n", reply, shutdown_yes, shutdown_no, shutdown_flags);
 	}
 }
 
 /* Not all nodes responded to the shutdown */
 static void shutdown_timer_fn(void *arg)
 {
-	P_MEMB("Shutdown timer fired. flags = %x\n", shutdown_flags);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: Shutdown timer fired. flags = %x\n", shutdown_flags);
 
 	/* Mark undecideds as "NO" */
 	shutdown_no = shutdown_expected;
@@ -1027,7 +1029,7 @@
 	if (!shutdown_con)
 		return -EWOULDBLOCK;
 
-	P_MEMB("Shutdown reply is %d\n", response);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: Shutdown reply is %d\n", response);
 
 	/* We only need to keep a track of a client's response in
 	   case it pulls the connection before the shutdown process
@@ -1200,7 +1202,7 @@
 	if (!quorum_device || quorum_device->state == NODESTATE_DEAD)
 		return;
 
-	P_MEMB("quorum_device_timer_fn\n");
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: quorum_device_timer_fn\n");
 	gettimeofday(&now, NULL);
 	if (quorum_device->last_hello.tv_sec + quorumdev_poll/1000 < now.tv_sec) {
 		quorum_device->state = NODESTATE_DEAD;
@@ -1270,7 +1272,7 @@
 	strcpy(fence_msg->agent, f->fence_agent);
 	comms_send_message(msg, sizeof(msg), 0,0, 0, 0);
 
-	P_MEMB("node %d fenced by %s\n", f->nodeid, f->fence_agent);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: node %d fenced by %s\n", f->nodeid, f->fence_agent);
 	return 0;
 }
 
@@ -1350,7 +1352,7 @@
 	char *outbuf = *retbuf;
 	int value;
 
-	P_MEMB("command to process is %x\n", cmd);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: command to process is %x\n", cmd);
 
 	switch (cmd) {
 
@@ -1376,7 +1378,11 @@
 
 	case CMAN_CMD_SET_DEBUGLOG:
 		memcpy(&value, cmdbuf, sizeof(int));
-		set_debuglog(value);
+		/* sanitize input value */
+		if (value > 0)
+			value = 1;
+
+		logsys_config_debug_set(CMAN_NAME, value);
 		err = 0;
 		break;
 	case CMAN_CMD_START_CONFCHG:
@@ -1504,20 +1510,28 @@
 		err = do_cmd_get_node_addrs(cmdbuf, retbuf, retsize, retlen, offset);
 		break;
 	}
-	P_MEMB("command return code is %d\n", err);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: command return code is %d\n", err);
 	return err;
 }
 
 
 int send_to_userport(unsigned char fromport, unsigned char toport,
 		     int nodeid, int tgtid,
-		     char *recv_buf, int len,
+		     const char *recv_buf, int len,
 		     int endian_conv)
 {
 	int ret = -1;
 
 	if (toport == 0) {
-		process_internal_message(recv_buf, nodeid, endian_conv);
+
+	  /* We need to make a private copy here so that the internal command
+	   * processors can do byteswapping.
+	   */
+	        char *newmsg = alloca(len);
+		if (!newmsg)
+		    return -1;
+		memcpy(newmsg, recv_buf, len);
+		process_internal_message(newmsg, nodeid, endian_conv);
 		ret = 0;
 	}
 	else {
@@ -1525,7 +1539,7 @@
 		if (port_array[toport]) {
 			struct connection *c = port_array[toport];
 
-			P_MEMB("send_to_userport. cmd=%d,  endian_conv=%d\n", recv_buf[0],endian_conv);
+			log_printf(LOGSYS_LEVEL_DEBUG, "memb: send_to_userport. cmd=%d,  endian_conv=%d\n", recv_buf[0],endian_conv);
 
 			send_data_reply(c, nodeid, fromport, recv_buf, len);
 			ret = 0;
@@ -1596,7 +1610,7 @@
 void unbind_con(struct connection *con)
 {
 	if (con->port) {
-		P_MEMB("Unbinding con for port %d\n", con->port);
+		log_printf(LOGSYS_LEVEL_DEBUG, "memb: Unbinding con for port %d\n", con->port);
 		port_array[con->port] = NULL;
 		send_port_close_msg(con->port);
 		clear_port_bit(us, con->port);
@@ -1697,7 +1711,7 @@
 
 	we_are_a_cluster_member = 1;
 
-	P_MEMB("sending TRANSITION message. cluster_name = %s\n", cluster_name);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: sending TRANSITION message. cluster_name = %s\n", cluster_name);
 	msg->cmd = CLUSTER_MSG_TRANSITION;
 	msg->first_trans = first_trans;
 	msg->votes = us->votes;
@@ -1834,7 +1848,7 @@
 	struct cl_fencemsg *msg = data;
 	struct cluster_node *node;
 
-	P_DAEMON("got FENCE message, node %d fenced by %s\n", msg->nodeid, msg->agent);
+	log_printf(LOGSYS_LEVEL_DEBUG, "daemon: got FENCE message, node %d fenced by %s\n", msg->nodeid, msg->agent);
 
 	node = find_node_by_nodeid(msg->nodeid);
 	if (!node)
@@ -1861,7 +1875,7 @@
 	nodestate_t old_state;
 
 	if (valid_transition_msg(nodeid, msg) != 0) {
-		P_MEMB("Transition message from %d does not match current config - should quit ?\n", nodeid);
+		log_printf(LOGSYS_LEVEL_DEBUG, "memb: Transition message from %d does not match current config - should quit ?\n", nodeid);
 		// Now what ??
 		return;
 	}
@@ -1885,7 +1899,7 @@
 	old_expected = node->expected_votes;
 	old_state = node->state;
 
-	P_MEMB("Got TRANSITION message. msg->flags=%x, node->flags=%x, first_trans=%d\n",
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: Got TRANSITION message. msg->flags=%x, node->flags=%x, first_trans=%d\n",
 	       msg->flags, node->flags, msg->first_trans);
 
 	/* Newer nodes 6.1.0 onwards, set the DIRTY flag if they have state. If the new node has been down
@@ -1895,13 +1909,11 @@
 		/* Don't duplicate messages */
 		if (node->state != NODESTATE_AISONLY) {
 			if (cluster_is_quorate) {
-				P_MEMB("Killing node %s because it has rejoined the cluster with existing state", node->name);
 				log_printf(LOG_CRIT, "Killing node %s because it has rejoined the cluster with existing state", node->name);
 				node->state = NODESTATE_AISONLY;
 				send_kill(nodeid, CLUSTER_KILL_REJOIN);
 			}
 			else {
-				P_MEMB("Node %s not joined to cman because it has existing state", node->name);
 				log_printf(LOG_CRIT, "Node %s not joined to cman because it has existing state", node->name);
 				node->state = NODESTATE_AISONLY;
 			}
@@ -1916,13 +1928,11 @@
 		/* Don't duplicate messages */
 		if (node->state != NODESTATE_AISONLY) {
 			if (cluster_is_quorate) {
-				P_MEMB("Killing node %s because it has rejoined the cluster without cman_tool join", node->name);
 				log_printf(LOG_CRIT, "Killing node %s because it has rejoined the cluster without cman_tool join", node->name);
 				node->state = NODESTATE_AISONLY;
 				send_kill(nodeid, CLUSTER_KILL_REJOIN);
 			}
 			else {
-				P_MEMB("Node %s not joined to cman because it has rejoined an inquorate cluster", node->name);
 				log_printf(LOG_CRIT, "Node %s not joined to cman because it has rejoined an inquorate cluster", node->name);
 				node->state = NODESTATE_AISONLY;
 			}
@@ -1984,7 +1994,7 @@
 	struct cluster_node *node = find_node_by_nodeid(nodeid);
 	unsigned char portresult[PORT_BITS_SIZE+1];
 
-	P_MEMB("Message on port 0 is %d\n", msg->cmd);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: Message on port 0 is %d\n", msg->cmd);
 
 	/* Byteswap messages if needed */
 	if (need_byteswap)
@@ -2008,7 +2018,7 @@
 	case CLUSTER_MSG_PORTENQ:
 		portresult[0] = CLUSTER_MSG_PORTSTATUS;
 		memcpy(portresult+1, us->port_bits, PORT_BITS_SIZE);
-		P_MEMB("Sending PORTRESULT, low bytes = %x %x\n", us->port_bits[0], us->port_bits[1]);
+		log_printf(LOGSYS_LEVEL_DEBUG, "memb: Sending PORTRESULT, low bytes = %x %x\n", us->port_bits[0], us->port_bits[1]);
 
 		/* Broadcast reply as other new nodes may be interested */
 		comms_send_message(portresult, PORT_BITS_SIZE+1, 0,0, 0, 0);
@@ -2016,20 +2026,20 @@
 
 	case CLUSTER_MSG_PORTSTATUS:
 		if (nodeid != us->node_id) {
-			P_MEMB("got PORTRESULT from %d, low bytes = %x %x\n", nodeid, data[1], data[2]);
+			log_printf(LOGSYS_LEVEL_DEBUG, "memb: got PORTRESULT from %d, low bytes = %x %x\n", nodeid, data[1], data[2]);
 			if (node)
 				memcpy(node->port_bits, data+1, PORT_BITS_SIZE);
 		}
 		break;
 
 	case CLUSTER_MSG_TRANSITION:
-		P_MEMB("got TRANSITION from node %d\n", nodeid);
+		log_printf(LOGSYS_LEVEL_DEBUG, "memb: got TRANSITION from node %d\n", nodeid);
 		do_process_transition(nodeid, data);
 		break;
 
 	case CLUSTER_MSG_KILLNODE:
 		killmsg = (struct cl_killmsg *)data;
-		P_MEMB("got KILL for node %d\n", killmsg->nodeid);
+		log_printf(LOGSYS_LEVEL_DEBUG, "memb: got KILL for node %d\n", killmsg->nodeid);
 		if (killmsg->nodeid == wanted_nodeid) {
 			/* Must use syslog directly here or the message will never arrive */
 			syslog(LOG_CRIT, "cman killed by node %d because %s\n", nodeid,
@@ -2041,7 +2051,7 @@
 
 	case CLUSTER_MSG_LEAVE:
 		leavemsg = (struct cl_leavemsg *)data;
-		P_MEMB("got LEAVE from node %d, reason = %d\n", nodeid, leavemsg->reason);
+		log_printf(LOGSYS_LEVEL_DEBUG, "memb: got LEAVE from node %d, reason = %d\n", nodeid, leavemsg->reason);
 
 		/* We got our own leave message back. now quit */
 		if (node && node->node_id == us->node_id) {
@@ -2049,7 +2059,7 @@
 			if (shutdown_con)
 				send_status_return(shutdown_con, CMAN_CMD_TRY_SHUTDOWN, 0);
 			cman_finish();
-			exit(0);
+			corosync_shutdown();
 		}
 
 		/* Someone else, make a note of the reason for leaving */
@@ -2134,12 +2144,12 @@
 {
 	struct cluster_node *node;
 
-	P_MEMB("add_ais_node ID=%d, incarnation = %" PRIu64 "\n",nodeid, incar);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: add_ais_node ID=%d, incarnation = %" PRIu64 "\n",nodeid, incar);
 
 	node = find_node_by_nodeid(nodeid);
 	if (!node && total_members == 1) {
 		node = us;
-		P_MEMB("Adding AIS node for 'us'\n");
+		log_printf(LOGSYS_LEVEL_DEBUG, "memb: Adding AIS node for 'us'\n");
 	}
 
  	/* This really should exist!! */
@@ -2165,7 +2175,7 @@
 {
 	struct cluster_node *node;
 	time_t t;
-	P_MEMB("del_ais_node %d\n", nodeid);
+	log_printf(LOGSYS_LEVEL_DEBUG, "memb: del_ais_node %d\n", nodeid);
 
 	node = find_node_by_nodeid(nodeid);
 	if (!node)
@@ -2201,7 +2211,7 @@
 		memset(&node->port_bits, 0, sizeof(node->port_bits));
 		cluster_members--;
 
-		P_MEMB("del_ais_node %s, leave_reason=%x\n", node->name, node->leave_reason);
+		log_printf(LOGSYS_LEVEL_DEBUG, "memb: del_ais_node %s, leave_reason=%x\n", node->name, node->leave_reason);
 		if ((node->leave_reason & 0xF) == CLUSTER_LEAVEFLAG_REMOVED)
 			recalculate_quorum(1, 1);
 		else
diff -Naurd cluster-3.0.0.rc2/cman/daemon/commands.h cluster-3.0.0.rc3/cman/daemon/commands.h
--- cluster-3.0.0.rc2/cman/daemon/commands.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/daemon/commands.h	2009-06-11 11:02:55.000000000 +0200
@@ -5,7 +5,7 @@
 
 extern int send_to_userport(unsigned char fromport, unsigned char toport,
 			    int nodeid, int tgtnodeid,
-			    char *recv_buf, int len,
+			    const char *recv_buf, int len,
 			    int endian_conv);
 extern void clean_dead_listeners(void);
 extern void unbind_con(struct connection *con);
diff -Naurd cluster-3.0.0.rc2/cman/daemon/daemon.c cluster-3.0.0.rc3/cman/daemon/daemon.c
--- cluster-3.0.0.rc2/cman/daemon/daemon.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/daemon/daemon.c	2009-06-11 11:02:55.000000000 +0200
@@ -30,7 +30,6 @@
 #include "cnxman-socket.h"
 #include "cnxman-private.h"
 #include "daemon.h"
-#include "logging.h"
 #include "commands.h"
 #include "barrier.h"
 #include "ais.h"
@@ -64,7 +63,7 @@
 {
 	int ret;
 
-	P_DAEMON("sending reply %x to fd %d\n", msg->command, con->fd);
+	log_printf(LOGSYS_LEVEL_DEBUG, "daemon: sending reply %x to fd %d\n", msg->command, con->fd);
 
 	/* If there are already queued messages then don't send this one
 	   out of order */
@@ -82,7 +81,7 @@
 
 		/* Have we exceeded the allowed number of queued messages ? */
 		if (con->num_write_msgs > max_outstanding_messages) {
-			P_DAEMON("Disconnecting. client has more that %d replies outstanding (%d)\n", max_outstanding_messages, con->num_write_msgs);
+			log_printf(LOGSYS_LEVEL_DEBUG, "daemon: Disconnecting. client has more that %d replies outstanding (%d)\n", max_outstanding_messages, con->num_write_msgs);
 			remove_client(cs_poll_handle, con);
 			return -1;
 		}
@@ -101,7 +100,7 @@
 			qm->offset = 0;
 		list_add(&con->write_msgs, &qm->list);
 		con->num_write_msgs++;
-		P_DAEMON("queued last message, count is %d\n", con->num_write_msgs);
+		log_printf(LOGSYS_LEVEL_DEBUG, "daemon: queued last message, count is %d\n", con->num_write_msgs);
 		poll_dispatch_modify(cs_poll_handle, con->fd, POLLIN | POLLOUT, process_client);
 	}
 	return 0;
@@ -129,7 +128,7 @@
 		msgs++;
 	}
 
-	P_DAEMON("Freed %d queued messages\n", msgs);
+	log_printf(LOGSYS_LEVEL_DEBUG, "daemon: Freed %d queued messages\n", msgs);
 	free(con);
 	num_connections--;
 }
@@ -161,7 +160,7 @@
 	}
 	if (list_empty(&con->write_msgs)) {
 		/* Remove POLLOUT callback */
-		P_DAEMON("Removing POLLOUT from fd %d\n", con->fd);
+		log_printf(LOGSYS_LEVEL_DEBUG, "daemon: Removing POLLOUT from fd %d\n", con->fd);
 		poll_dispatch_modify(cs_poll_handle, con->fd, POLLIN, process_client);
 	}
 }
@@ -183,7 +182,7 @@
 
 		len = read(fd, buf, sizeof(struct sock_header));
 
-		P_DAEMON("read %d bytes from fd %d\n", len, fd);
+		log_printf(LOGSYS_LEVEL_DEBUG, "daemon: read %d bytes from fd %d\n", len, fd);
 
 		if (len == 0) {
 			remove_client(handle, con);
@@ -200,17 +199,17 @@
 		}
 
 		if (msg->magic != CMAN_MAGIC) {
-			P_DAEMON("bad magic in client command %x\n", msg->magic);
+			log_printf(LOGSYS_LEVEL_DEBUG, "daemon: bad magic in client command %x\n", msg->magic);
 			send_status_return(con, msg->command, -EINVAL);
 			return 0;
 		}
 		if (msg->version != CMAN_VERSION) {
-			P_DAEMON("bad version in client command. msg = 0x%x, us = 0x%x\n", msg->version, CMAN_VERSION);
+			log_printf(LOGSYS_LEVEL_DEBUG, "daemon: bad version in client command. msg = 0x%x, us = 0x%x\n", msg->version, CMAN_VERSION);
 			send_status_return(con, msg->command, -EINVAL);
 			return 0;
 		}
 		if ((msg->length-len) > MAX_CLUSTER_MESSAGE) {
-			P_DAEMON("message on socket is too big\n");
+			log_printf(LOGSYS_LEVEL_DEBUG, "daemon: message on socket is too big\n");
 			send_status_return(con, msg->command, -EINVAL);
 			return 0;
 		}
@@ -234,11 +233,11 @@
 			totallen += len;
 		}
 
-		P_DAEMON("client command is %x\n", msg->command);
+		log_printf(LOGSYS_LEVEL_DEBUG, "daemon: client command is %x\n", msg->command);
 
 		/* Privileged functions can only be done on ADMIN sockets */
 		if (msg->command & CMAN_CMDFLAG_PRIV && con->type != CON_ADMIN) {
-			P_DAEMON("command disallowed from non-admin client\n");
+			log_printf(LOGSYS_LEVEL_DEBUG, "daemon: command disallowed from non-admin client\n");
 			send_status_return(con, msg->command, -EPERM);
 			return 0;
 		}
@@ -249,7 +248,7 @@
 		*/
 		if ((msg->command == CMAN_CMD_DATA || msg->command == CMAN_CMD_BIND ||
 		     msg->command == CMAN_CMD_NOTIFY) && con->type == CON_ADMIN) {
-			P_DAEMON("can't send data down an admin socket, sorry\n");
+			log_printf(LOGSYS_LEVEL_DEBUG, "daemon: can't send data down an admin socket, sorry\n");
 			send_status_return(con, msg->command, -EINVAL);
 			return 0;
 		}
@@ -260,7 +259,7 @@
 			uint8_t port;
 			struct sock_data_header *dmsg = (struct sock_data_header *)msg;
 
-			P_DAEMON("sending %lu bytes of data to node %d, port %d\n",
+			log_printf(LOGSYS_LEVEL_DEBUG, "daemon: sending %lu bytes of data to node %d, port %d\n",
 				 (unsigned long)(msg->length - sizeof(struct sock_data_header)), dmsg->nodeid, dmsg->port);
 
 			databuf += sizeof(struct sock_data_header);
@@ -291,7 +290,7 @@
 			int ret;
 			int retlen = 0;
 
-			P_DAEMON("About to process command\n");
+			log_printf(LOGSYS_LEVEL_DEBUG, "daemon: About to process command\n");
 
 			cmdbuf += sizeof(struct sock_header);
 
@@ -311,7 +310,7 @@
 			reply->header.length = retlen + sizeof(struct sock_reply_header);
 			reply->status = ret;
 
-			P_DAEMON("Returning command data. length = %d\n", retlen);
+			log_printf(LOGSYS_LEVEL_DEBUG, "daemon: Returning command data. length = %d\n", retlen);
 			send_reply_message(con, (struct sock_header *)reply);
 
 			if (retbuf != small_retbuf)
@@ -415,7 +414,7 @@
 {
 	struct sock_reply_header msg;
 
-	P_DAEMON("send status return: %d\n", status);
+	log_printf(LOGSYS_LEVEL_DEBUG, "daemon: send status return: %d\n", status);
 	msg.header.magic = CMAN_MAGIC;
 	msg.header.command = cmd | CMAN_CMDFLAG_REPLY;
 	msg.header.length = sizeof(msg);
@@ -425,7 +424,7 @@
 	return send_reply_message(con, (struct sock_header *)&msg);
 }
 
-int send_data_reply(struct connection *con, int nodeid, int port, char *data, int len)
+int send_data_reply(struct connection *con, int nodeid, int port, const char *data, int len)
 {
 	char buf[len + sizeof(struct sock_data_header)];
 	struct sock_data_header *msg = (struct sock_data_header *)buf;
diff -Naurd cluster-3.0.0.rc2/cman/daemon/daemon.h cluster-3.0.0.rc3/cman/daemon/daemon.h
--- cluster-3.0.0.rc2/cman/daemon/daemon.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/daemon/daemon.h	2009-06-11 11:02:55.000000000 +0200
@@ -1,5 +1,5 @@
 extern int send_status_return(struct connection *con, uint32_t cmd, int status);
-extern int send_data_reply(struct connection *con, int nodeid, int port, char *data, int len);
+extern int send_data_reply(struct connection *con, int nodeid, int port, const char *data, int len);
 extern void set_cman_timeout(int secs);
 extern void notify_listeners(struct connection *con, int reason, int arg);
 extern int num_listeners(void);
diff -Naurd cluster-3.0.0.rc2/cman/daemon/logging.c cluster-3.0.0.rc3/cman/daemon/logging.c
--- cluster-3.0.0.rc2/cman/daemon/logging.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/daemon/logging.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,29 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include <signal.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <corosync/engine/logsys.h>
-#include "list.h"
-#include "cman.h"
-#include "cnxman-socket.h"
-#include "cnxman-private.h"
-#include "logging.h"
-
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME);
-
-int subsys_mask = 0;
-
-void set_debuglog(int subsystems)
-{
-	if (subsystems)
-		logsys_config_mode_set(CMAN_NAME, LOGSYS_LEVEL_DEBUG);
-	else
-		logsys_config_mode_set(CMAN_NAME, LOGSYS_LEVEL_INFO);
-	subsys_mask = subsystems;
-}
diff -Naurd cluster-3.0.0.rc2/cman/daemon/logging.h cluster-3.0.0.rc3/cman/daemon/logging.h
--- cluster-3.0.0.rc2/cman/daemon/logging.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/daemon/logging.h	1970-01-01 01:00:00.000000000 +0100
@@ -1,17 +0,0 @@
-//#include <corosync/service/logsys.h>
-
-extern void set_debuglog(int subsystems);
-
-/* Debug macros */
-#define CMAN_DEBUG_NONE    1
-#define CMAN_DEBUG_BARRIER 2
-#define CMAN_DEBUG_MEMB    4
-#define CMAN_DEBUG_DAEMON  8
-#define CMAN_DEBUG_AIS    16
-
-extern int subsys_mask;
-
-#define P_BARRIER(fmt, args...) if (subsys_mask & CMAN_DEBUG_BARRIER) log_printf(LOGSYS_LEVEL_DEBUG, "barrier: " fmt, ## args)
-#define P_MEMB(fmt, args...)    if (subsys_mask & CMAN_DEBUG_MEMB) log_printf(LOGSYS_LEVEL_DEBUG, "memb: " fmt, ## args)
-#define P_DAEMON(fmt, args...)  if (subsys_mask & CMAN_DEBUG_DAEMON) log_printf(LOGSYS_LEVEL_DEBUG , "daemon: " fmt, ## args)
-#define P_AIS(fmt, args...)     if (subsys_mask & CMAN_DEBUG_AIS) log_printf(LOGSYS_LEVEL_DEBUG, "ais " fmt, ## args)
diff -Naurd cluster-3.0.0.rc2/cman/daemon/Makefile cluster-3.0.0.rc3/cman/daemon/Makefile
--- cluster-3.0.0.rc2/cman/daemon/Makefile	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/daemon/Makefile	2009-06-11 11:02:55.000000000 +0200
@@ -18,7 +18,6 @@
 LDFLAGS += -L${libdir}
 
 OBJS1=	daemon.o \
-	logging.o \
 	ais.o \
 	commands.o \
 	barrier.o \
diff -Naurd cluster-3.0.0.rc2/cman/init.d/cman.in cluster-3.0.0.rc3/cman/init.d/cman.in
--- cluster-3.0.0.rc2/cman/init.d/cman.in	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/init.d/cman.in	2009-06-11 11:02:55.000000000 +0200
@@ -122,7 +122,16 @@
 #     The default script is "network-bridge".
 [ -z "$NETWORK_BRIDGE_SCRIPT" ] && NETWORK_BRIDGE_SCRIPT="network-bridge"
 
-[ -n "$CLUSTERNAME" ] && cman_join_opts="-c $CLUSTERNAME"
+# CMAN_JOIN_OPTS -- allows extra options to be passed to cman_tool when join
+#     operation is performed.
+#     NOTES:
+#	$CLUSTERNAME   automatically appends "-c $CLUSTERNAME"
+#	$NODENAME      automatically appends "-n $NODENAME"
+#	$CONFIG_LOADER automatically appends "-C $CONFIG_LOADER"
+
+[ -n "$CMAN_JOIN_OPTS" ] && cman_join_opts="$CMAN_JOIN_OPTS"
+
+[ -n "$CLUSTERNAME" ] && cman_join_opts+="-c $CLUSTERNAME"
 
 [ -n "$NODENAME" ] && cman_join_opts+=" -n $NODENAME"
 
@@ -139,6 +148,10 @@
 # openaisparser   - use internal openais config file parser.
 [ -n "$CONFIG_LOADER" ] && cman_join_opts+=" -C $CONFIG_LOADER"
 
+# CMAN_LEAVE_OPTS -- allows extra options to be passed to cman_tool when leave
+#     operation is performed.
+[ -n "$CMAN_LEAVE_OPTS" ] && cman_leave_opts="$CMAN_LEAVE_OPTS"
+
 # INITLOGLEVEL -- select how verbose the init script should be
 # possible values:
 # quiet           - only one line notification for start/stop operations
@@ -477,7 +490,7 @@
 stop_cman()
 {
 	if cman_running; then
-		errmsg=$( cman_tool -t $CMAN_SHUTDOWN_TIMEOUT \
+		errmsg=$( cman_tool $cman_leave_opts -t $CMAN_SHUTDOWN_TIMEOUT \
 			-w leave $cmanremove 2>&1 ) || return 1
 	fi
 }
diff -Naurd cluster-3.0.0.rc2/cman/man/cman.5 cluster-3.0.0.rc3/cman/man/cman.5
--- cluster-3.0.0.rc2/cman/man/cman.5	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/man/cman.5	2009-06-11 11:02:55.000000000 +0200
@@ -159,9 +159,9 @@
 
 \fIOther corosync parameters\fR
 .in +7
-When corosync is started by cman (cman_tool runs aisexec), the corosync.conf
+When corosync is started by cman (cman_tool runs corosync), the corosync.conf
 file is not used.  Many of the configuration parameters listed in
-corosync.conf can be set in cluster.conf (CCS) instead.  Cman will read
+corosync.conf can be set in cluster.conf instead.  Cman will read
 corosync parameters from the following sections in cluster.conf and load
 them into corosync:
 
@@ -218,5 +218,5 @@
 
 .SH "SEE ALSO"
 
-cluster.conf(5), corosync.conf(5), ccs(7), cman_tool(8)
+cluster.conf(5), corosync.conf(5), cman_tool(8)
 
diff -Naurd cluster-3.0.0.rc2/cman/man/cman_tool.8 cluster-3.0.0.rc3/cman/man/cman_tool.8
--- cluster-3.0.0.rc2/cman/man/cman_tool.8	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/man/cman_tool.8	2009-06-11 11:02:55.000000000 +0200
@@ -264,9 +264,7 @@
 On each node using this configuration you will need to have the same authorization key
 installed. To create this key run
 .br
-mkdir /etc/ais
-.br
-ais-keygen
+corosync-keygen
 .br
 mv /etc/ais/authkey /etc/cluster/cman_authkey
 .br
@@ -274,7 +272,7 @@
 .br
 .TP
 .I -C
-Overrides the default configuration module. Usually cman uses ccsd to load its
+Overrides the default configuration module. Usually cman uses xmlconfig (cluster.conf) to load its
 configuration. If you have your configuration database held elsewhere (eg LDAP) and 
 have a configuration plugin for it, then you should specify the name of the module
 (see the documentation for the module for the name of it - it's not necessarily the 
@@ -284,12 +282,12 @@
 add two modules (eg) 'ldapconfig' and 'ldappreproc' to the chain start cman with
 -C ldapconfig:ldappreproc
 .br
-The default value for this is 'ccsconfig'. Note that if the -X is on the command-line
+The default value for this is 'xmlconfig'. Note that if the -X is on the command-line
 then -C will be ignored.
 .TP
 .I -A
 Don't load openais services. Normally cman_tool join will load the configuration
-module 'openaisserviceenable' which will load the services installed by openais.
+module 'openaisserviceenablestable' which will load the services installed by openais.
 If you don't want to use these services or have not installed openais then
 this switch will disable them.
 .SH "NODES" OPTIONS
@@ -398,7 +396,7 @@
 This section details how the configuration systems work in cman. You might need to know this if you are using the -C option
 to cman_tool, or writing your own configuration subsystem.
 .br
-By default cman uses two configuration plugins to corosync. The first, 'ccsconfig', reads the configuration information
+By default cman uses two configuration plugins to corosync. The first, 'xmlconfig', reads the configuration information
 stored in cluster.conf and stores it in an internal database, in the same schema as it finds in cluster.conf. 
 The second plugin, 'cmanpreconfig', takes the information in that the database, adds several cman defaults, determines 
 the corosync node name and nodeID
@@ -406,7 +404,7 @@
 cmanpreconfig also reads several environment variables that might be set by cman_tool which can override information in the 
 configuration.
 .br
-In the absence of ccsconfig, ie when 'cman_tool join' is run with -X switch (this removes ccsconfig from the module list), 
+In the absence of xmlconfig, ie when 'cman_tool join' is run with -X switch (this removes xmlconfig from the module list), 
 cmanpreconfig also generates several defaults so that the cluster can be got running without any configuration information - see above
 for the details.
 .br
diff -Naurd cluster-3.0.0.rc2/cman/qdisk/disk.c cluster-3.0.0.rc3/cman/qdisk/disk.c
--- cluster-3.0.0.rc2/cman/qdisk/disk.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/qdisk/disk.c	2009-06-11 11:02:55.000000000 +0200
@@ -27,6 +27,7 @@
 #include <linux/fs.h>
 #include <liblogthread.h>
 #include <zlib.h>
+#include "iostate.h"
 
 static int diskRawRead(target_info_t *disk, char *buf, int len);
 
@@ -229,7 +230,9 @@
 	disk->d_pagesz = sysconf(_SC_PAGESIZE);
 
 	/* Check to verify that the partition is large enough.*/
+	io_state(STATE_LSEEK);
 	ret = lseek(disk->d_fd, END_OF_DISK(disk->d_blksz), SEEK_SET);
+	io_state(STATE_NONE);
 	if (ret < 0) {
 		logt_print(LOG_DEBUG, "open_partition: seek");
 		close(disk->d_fd);
@@ -332,7 +335,9 @@
 	shared_header_t *hdrp;
 	char *data;
 
+	io_state(STATE_LSEEK);
 	ret = lseek(disk->d_fd, readOffset, SEEK_SET);
+	io_state(STATE_NONE);
 	if (ret != readOffset) {
 		logt_print(LOG_DEBUG,
 		       "diskRawReadShadow: can't seek to offset %d.\n",
@@ -354,11 +359,9 @@
 	data = (char *)buf + sizeof(*hdrp);
 
 	if (header_verify(hdrp, data, len)) {
-#ifdef DEBUG
 		logt_print(LOG_DEBUG, "diskRawReadShadow: bad CRC32, "
 		       "offset = %d len = %d\n",
 		       (int) readOffset, len);
-#endif
 		errno = EPROTO;
 		return -1;
 	}
@@ -391,7 +394,10 @@
 	if (bounceNeeded == 0) {
 		/* Already aligned and even multiple of 512, no bounceio
 		 * required. */
-		return (read(disk->d_fd, buf, len));
+		io_state(STATE_READ);
+		readret = read(disk->d_fd, buf, len);
+		io_state(STATE_NONE);
+		return readret;
 	}
 
 	if (len > disk->d_blksz) {
@@ -420,7 +426,9 @@
 		return -1;
 	}
 
+	io_state(STATE_READ);
 	readret = read(disk->d_fd, alignedBuf, readlen);
+	io_state(STATE_NONE);
 	if (readret > 0) {
 		if (readret > len) {
 			memcpy(alignedBuf, buf, len);
@@ -463,7 +471,10 @@
 	if (bounceNeeded == 0) {
 		/* Already aligned and even multiple of 512, no bounceio
 		 * required. */
-		return (write(disk->d_fd, buf, len));
+		io_state(STATE_WRITE);
+		ret = write(disk->d_fd, buf, len);
+		io_state(STATE_NONE);
+		return ret;
 	}
 
 	if (len > disk->d_blksz) {
@@ -500,7 +511,9 @@
 	}
 
 	memcpy(buf, alignedBuf, len);
+	io_state(STATE_WRITE);
 	ret = write(disk->d_fd, alignedBuf, writelen);
+	io_state(STATE_NONE);
 	if (ret > len) {
 		ret = len;
 	}
@@ -528,7 +541,9 @@
 		return (-1);
 	}
 
+	io_state(STATE_LSEEK);
 	retval_seek = lseek(disk->d_fd, writeOffset, SEEK_SET);
+	io_state(STATE_NONE);
 	if (retval_seek != writeOffset) {
 		logt_print(LOG_ERR,
 		       "diskRawWriteShadow: can't seek to offset %d\n",
diff -Naurd cluster-3.0.0.rc2/cman/qdisk/iostate.c cluster-3.0.0.rc3/cman/qdisk/iostate.c
--- cluster-3.0.0.rc2/cman/qdisk/iostate.c	1970-01-01 01:00:00.000000000 +0100
+++ cluster-3.0.0.rc3/cman/qdisk/iostate.c	2009-06-11 11:02:55.000000000 +0200
@@ -0,0 +1,142 @@
+#include <pthread.h>
+#include <iostate.h>
+#include <unistd.h>
+#include <time.h>
+#include <sys/time.h>
+#include <liblogthread.h>
+#include "iostate.h"
+
+static iostate_t main_state = 0;
+static int main_incarnation = 0;
+static int qdisk_timeout = 0, sleeptime = 0;
+static int thread_active = 0;
+static pthread_t io_nanny_tid = 0;
+static pthread_mutex_t state_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t state_cond = PTHREAD_COND_INITIALIZER;
+
+struct state_table {
+	iostate_t state;
+	const char *value;
+};
+
+static struct state_table io_state_table[] = {
+{	STATE_NONE,	"none"	},
+{	STATE_WRITE,	"write"	},
+{	STATE_READ,	"read"	},
+{	STATE_LSEEK,	"seek"	},
+{	-1,		NULL	} };
+
+static const char *
+state_to_string(iostate_t state)
+{
+	static const char *ret = "unknown";
+	int i;
+
+	for (i=0; io_state_table[i].value; i++) {
+		if (io_state_table[i].state == state) {
+			ret = io_state_table[i].value;
+			break;
+		}
+	}
+
+	return ret;
+}
+
+
+void
+io_state(iostate_t state)
+{
+	pthread_mutex_lock(&state_mutex);
+	main_state = state;
+	main_incarnation++; /* it does not matter if this wraps. */
+	pthread_mutex_unlock(&state_mutex);
+
+	/* Optimization: Don't signal on STATE_NONE */
+	if (state != STATE_NONE)
+		pthread_cond_broadcast(&state_cond);
+}
+
+
+static void *
+io_nanny_thread(void *arg)
+{
+	struct timespec wait_time;
+	iostate_t last_main_state = 0, current_main_state = 0;
+	int last_main_incarnation = 0, current_main_incarnation = 0;
+	int logged_incarnation = 0;
+
+	/* Start with wherever we're at now */
+	pthread_mutex_lock(&state_mutex);
+	current_main_state = last_main_state = main_state;
+	current_main_incarnation = last_main_incarnation = main_incarnation;
+	pthread_mutex_unlock(&state_mutex);
+
+	while (thread_active) {
+		pthread_mutex_lock(&state_mutex);
+    		clock_gettime(CLOCK_REALTIME, &wait_time);
+		wait_time.tv_sec += sleeptime;
+		pthread_cond_timedwait(&state_cond, &state_mutex, &wait_time);
+		current_main_state = main_state;
+		current_main_incarnation = main_incarnation;
+		pthread_mutex_unlock(&state_mutex);
+
+		if (!thread_active)
+			break;
+
+		if (!current_main_state)
+			continue;
+
+		/* if the state or incarnation changed, the main qdiskd
+		 * thread is healthy */
+		if (current_main_state != last_main_state ||
+		    current_main_incarnation != last_main_incarnation) {
+			last_main_state = current_main_state;
+			last_main_incarnation = current_main_incarnation;
+			continue;
+		}
+
+		/* Don't log things twice */
+		if (logged_incarnation == current_main_incarnation)
+			continue;
+		logged_incarnation = current_main_incarnation;
+
+		logt_print(LOG_WARNING, "qdiskd: %s "
+			   "(system call) has hung for %d seconds\n",
+			   state_to_string(current_main_state), sleeptime);
+		logt_print(LOG_WARNING,
+			   "In %d more seconds, we will be evicted\n",
+			   (qdisk_timeout-sleeptime));
+	}
+
+	return NULL;
+}
+
+
+int
+io_nanny_start(int timeout)
+{
+	int ret;
+
+	pthread_mutex_lock(&state_mutex);
+
+	sleeptime = timeout / 2;
+	qdisk_timeout = timeout;
+	thread_active = 1;
+
+	ret = pthread_create(&io_nanny_tid, NULL, io_nanny_thread, NULL);
+	pthread_mutex_unlock(&state_mutex);
+
+	return ret;
+}
+
+
+int
+io_nanny_stop(void)
+{
+	thread_active = 0;
+	pthread_cond_broadcast(&state_cond);
+	pthread_join(io_nanny_tid, NULL);
+	io_nanny_tid = 0;
+
+	return 0;
+}
diff -Naurd cluster-3.0.0.rc2/cman/qdisk/iostate.h cluster-3.0.0.rc3/cman/qdisk/iostate.h
--- cluster-3.0.0.rc2/cman/qdisk/iostate.h	1970-01-01 01:00:00.000000000 +0100
+++ cluster-3.0.0.rc3/cman/qdisk/iostate.h	2009-06-11 11:02:55.000000000 +0200
@@ -0,0 +1,17 @@
+#ifndef _IOSTATE_H
+#define _IOSTATE_H
+
+typedef enum {
+	STATE_NONE	= 0,
+	STATE_READ	= 1,
+	STATE_WRITE	= 2,
+	STATE_LSEEK	= 3,
+	STATE_UNKNOWN	= 4
+} iostate_t;
+
+void io_state(iostate_t state);
+
+int io_nanny_start(int timeout);
+int io_nanny_stop(void);
+
+#endif
diff -Naurd cluster-3.0.0.rc2/cman/qdisk/main.c cluster-3.0.0.rc3/cman/qdisk/main.c
--- cluster-3.0.0.rc2/cman/qdisk/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/qdisk/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -28,6 +28,8 @@
 
 #define LOG_DAEMON_NAME  "qdiskd"
 #define LOG_MODE_DEFAULT LOG_MODE_OUTPUT_SYSLOG|LOG_MODE_OUTPUT_FILE
+#include "iostate.h"
+
 
 /* from main.c */
 void set_priority(int queue, int prio);
@@ -1793,9 +1795,14 @@
 		goto out;
 	}
 	*/
+
+	io_nanny_start(ctx.qc_tko * ctx.qc_interval);
+
 	if (quorum_loop(&ctx, ni, MAX_NODES_DISK) == 0)
 		cman_unregister_quorum_device(ctx.qc_cman_admin);
 
+	io_nanny_stop();
+
 	quorum_logout(&ctx);
 out:
 	/* free cman handle to avoid leak in cman */
diff -Naurd cluster-3.0.0.rc2/cman/qdisk/Makefile cluster-3.0.0.rc3/cman/qdisk/Makefile
--- cluster-3.0.0.rc2/cman/qdisk/Makefile	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/qdisk/Makefile	2009-06-11 11:02:55.000000000 +0200
@@ -12,14 +12,13 @@
 include $(OBJDIR)/make/uninstall.mk
 
 CFLAGS += -D_GNU_SOURCE
-CFLAGS += -Werror -Wstrict-prototypes -Wshadow
 CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${logtincdir}
 CFLAGS += -I${zlibincdir} 
 CFLAGS += -I$(S)
 CFLAGS += -I${incdir}
 
 LDFLAGS += -L${logtlibdir} -llogthread -lpthread
-LDFLAGS += -L${zliblibdir} -lz
+LDFLAGS += -L${zliblibdir} -lz -lrt
 LDFLAGS += -L${libdir}
 
 EXTRA_LDFLAGS += -L${cmanlibdir} -L${ccslibdir} -lcman -lccs
@@ -34,7 +33,8 @@
 SHAREDOBJS= disk.o \
 	    disk_util.o \
 	    proc.o \
-	    scandisk.o
+	    scandisk.o \
+	    iostate.o
 
 ${TARGET1}: ${SHAREDOBJS} ${OBJS1}
 	$(CC) -o $@ $^ $(EXTRA_LDFLAGS) $(LDFLAGS)
diff -Naurd cluster-3.0.0.rc2/cman/qdisk/scandisk.c cluster-3.0.0.rc3/cman/qdisk/scandisk.c
--- cluster-3.0.0.rc2/cman/qdisk/scandisk.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/qdisk/scandisk.c	2009-06-11 11:02:55.000000000 +0200
@@ -574,15 +574,15 @@
 		goto found;
 
 	snprintf(newpath, sizeof(newpath), "%s/../device/media", path);
-	if (lstat(newpath, &sb))
+	if (!lstat(newpath, &sb))
 		goto found;
 
 	snprintf(newpath, sizeof(newpath), "%s/device/devtype", path);
-	if (lstat(newpath, &sb))
+	if (!lstat(newpath, &sb))
 		return 1;
 
 	snprintf(newpath, sizeof(newpath), "%s/../device/devtype", path);
-	if (lstat(newpath, &sb))
+	if (!lstat(newpath, &sb))
 		return 1;
 
 	return -1;
diff -Naurd cluster-3.0.0.rc2/cman/qdisk/scandisk.h cluster-3.0.0.rc3/cman/qdisk/scandisk.h
--- cluster-3.0.0.rc2/cman/qdisk/scandisk.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/cman/qdisk/scandisk.h	2009-06-11 11:02:55.000000000 +0200
@@ -13,10 +13,8 @@
 #define SYSBLOCKPATH	SYSFSPATH "/block"
 #endif
 
-#ifdef DEBUG
-#define	DEVCACHETIMEOUT	5	/* expressed in seconds */
-#else
-#define	DEVCACHETIMEOUT	30
+#ifndef	DEVCACHETIMEOUT
+#define	DEVCACHETIMEOUT	30	/* expressed in seconds */
 #endif
 
 /* each entry can be (generally):
diff -Naurd cluster-3.0.0.rc2/config/libs/libccsconfdb/ccs.h cluster-3.0.0.rc3/config/libs/libccsconfdb/ccs.h
--- cluster-3.0.0.rc2/config/libs/libccsconfdb/ccs.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/config/libs/libccsconfdb/ccs.h	2009-06-11 11:02:55.000000000 +0200
@@ -1,7 +1,3 @@
-#ifdef __CCS_COMPAT_DOT_H__
-#error DO NOT INCLUDE libccscompat.h and ccs.h at the same time. it is BAD!
-#endif
-
 #ifndef __CCS_DOT_H__
 #define __CCS_DOT_H__
 
diff -Naurd cluster-3.0.0.rc2/config/plugins/xml/Makefile cluster-3.0.0.rc3/config/plugins/xml/Makefile
--- cluster-3.0.0.rc2/config/plugins/xml/Makefile	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/config/plugins/xml/Makefile	2009-06-11 11:02:55.000000000 +0200
@@ -12,7 +12,6 @@
 
 CFLAGS += -fPIC -D_GNU_SOURCE
 CFLAGS += `xml2-config --cflags`
-CFLAGS += -I${cmanincdir}/../daemon
 CFLAGS += -I${incdir}
 
 LDFLAGS += `xml2-config --libs`
diff -Naurd cluster-3.0.0.rc2/config/tools/ccs_tool/Makefile cluster-3.0.0.rc3/config/tools/ccs_tool/Makefile
--- cluster-3.0.0.rc2/config/tools/ccs_tool/Makefile	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/config/tools/ccs_tool/Makefile	2009-06-11 11:02:55.000000000 +0200
@@ -6,7 +6,7 @@
 
 include ../../../make/defines.mk
 
-all: ${TARGET1} ${TARGET2}
+all: depends ${TARGET1} ${TARGET2}
 
 include $(OBJDIR)/make/cobj.mk
 include $(OBJDIR)/make/clean.mk
@@ -32,7 +32,7 @@
 	ln -sf ${TARGET1} ${TARGET2}
 
 depends:
-	$(MAKE) -C $(OBJDIR)/cman/lib all
+	$(MAKE) -C $(OBJDIR)/config/libs/libccsconfdb all
 
 clean: generalclean
 
diff -Naurd cluster-3.0.0.rc2/configure cluster-3.0.0.rc3/configure
--- cluster-3.0.0.rc2/configure	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/configure	2009-06-11 11:02:55.000000000 +0200
@@ -47,8 +47,6 @@
 	fencelibdir => \$fencelibdir,
 	logtincdir => \$logtincdir,
 	logtlibdir => \$logtlibdir,
-	volidincdir => \$volidincdir,
-	volidlibdir => \$volidlibdir,
 	ncursesincdir => \$ncursesincdir,
 	ncurseslibdir => \$ncurseslibdir,
 	slangincdir => \$slangincdir,
@@ -138,8 +136,6 @@
 		    'fencelibdir=s',
 		    'logtincdir=s',
 		    'logtlibdir=s',
-		    'volidincdir=s',
-		    'volidlibdir=s',
 		    'ncursesincdir=s',
 		    'ncurseslibdir=s',
 		    'slangincdir=s',
@@ -230,10 +226,10 @@
   print "--module_dir=\tthe base directory for kernel modules.  (Default:  /lib/modules/`uname -r`/kernel\n";
   print "\nbuild flags:\n";
   print "--cc=\t\tcompiler to use.  (Default: gcc)\n";
-  print "--debug\t\tEnable debugging build. Changes default CFLAGS to -Wall -O0 -DDEBUG -g.\n";
-  print "--cflags=\toverride default CFLAGS settings.  (Default: -Wall -O2 -g)\n";
+  print "--debug\t\tEnable debugging build. Changes default optimization CFLAGS to -O0 -DDEBUG -ggdb3\n";
+  print "--cflags=\toverride default CFLAGS settings.\n";
   print "--extracflags=\tadd extra compiler options to default CFLAGS setting.  (Default: none)\n";
-  print "--enable_paranoia_cflags=\tadd paranoia compiler options to default CFLAGS setting.  (Default: tons)\n";
+  print "--enable_paranoia_cflags=\tadd paranoia compiler options to default CFLAGS setting.  (Default: -Werror)\n";
   print "--ldflags=\toverride default LDFLAGS settings.  (Default: none)\n";
   print "--extraldflags=\tadd extra linking options to default LDFLAGS settings.  (Default: none)\n";
   print "--objdir=\tspecify directory where to store object files.  (Defaults: current build dir)\n";
@@ -252,8 +248,6 @@
   print "--fencelibdir=\tthe base directory for fence libraries.  (Default: ./fence/libfence)\n";
   print "--logtincdir=\tthe base directory for logthread include files.  (Default: ./common/liblogthread)\n";
   print "--logtlibdir=\tthe base directory for logthread libraries.  (Default: ./common/liblogthread)\n";
-  print "--volidincdir=\tthe base directory for volume_id include files.  (Default: {incdir})\n";
-  print "--volidlibdir=\tthe base directory for volume_id libraries.  (Default: {libdir})\n";
   print "--ncursesincdir=\tthe base directory for ncurses include files.  (Default: {incdir})\n";
   print "--ncurseslibdir=\tthe base directory for ncurses libraries.  (Default: {libdir})\n";
   print "--slangincdir=\tthe base directory for S-Lang include files.  (Default: {incdir})\n";
@@ -370,24 +364,25 @@
   $cc="gcc";
 }
 if (!$cflags) {
-  $cflags="-Wall -Wformat=2 -MMD";
+  $cflags="";
+  $cflags="${cflags} -Wall -Wformat=2 -Wshadow -Wmissing-prototypes";
+  $cflags="${cflags} -Wstrict-prototypes -Wdeclaration-after-statement";
+  $cflags="${cflags} -Wpointer-arith -Wwrite-strings -Wcast-align";
+  $cflags="${cflags} -Wbad-function-cast -Wmissing-format-attribute";
+  $cflags="${cflags} -Wformat-security -Wformat-nonliteral -Wno-long-long";
+  $cflags="${cflags} -Wno-strict-aliasing -Wmissing-declarations";
   if (!$debug) {
     $cflags="${cflags} -O2";
   } else {
     $cflags="${cflags} -O0 -DDEBUG";
   }
-  $cflags="${cflags} -g";
+  $cflags="${cflags} -ggdb3 -MMD";
 }
 if ($extracflags) {
   $cflags="${cflags} ${extracflags}";
 }
 if ($enable_paranoia_cflags) {
-  $cflags="${cflags} -Wshadow -Wmissing-prototypes -Wmissing-declarations";
-  $cflags="${cflags} -Wstrict-prototypes -Wdeclaration-after-statement";
-  $cflags="${cflags} -Wpointer-arith -Wwrite-strings -Wcast-align";
-  $cflags="${cflags} -Wbad-function-cast -Wmissing-format-attribute";
-  $cflags="${cflags} -Wformat-security -Wformat-nonliteral -Wno-long-long";
-  $cflags="${cflags} -Wno-strict-aliasing";
+  $cflags="-Werror ${cflags}";
 }
 if (!$ldflags) {
   $ldflags="";
@@ -492,12 +487,6 @@
 if (!$logtlibdir) {
   $logtlibdir="${objdir}/common/liblogthread";
 }
-if (!$volidincdir) {
-  $volidincdir="${incdir}";
-}
-if (!$volidlibdir) {
-  $volidlibdir="${libdir}";
-}
 if (!$readlineincdir) {
   $readlineincdir="${incdir}";
 }
@@ -751,8 +740,6 @@
   $_ =~ s/\@FENCELIBDIR\@/$fencelibdir/;
   $_ =~ s/\@LOGTINCDIR\@/$logtincdir/;
   $_ =~ s/\@LOGTLIBDIR\@/$logtlibdir/;
-  $_ =~ s/\@VOLIDINCDIR\@/$volidincdir/;
-  $_ =~ s/\@VOLIDLIBDIR\@/$volidlibdir/;
   $_ =~ s/\@READLINEINCDIR\@/$readlineincdir/;
   $_ =~ s/\@READLINELIBDIR\@/$readlinelibdir/;
   $_ =~ s/\@NCURSESINCDIR\@/$ncursesincdir/;
diff -Naurd cluster-3.0.0.rc2/dlm/libdlm/libdlm.c cluster-3.0.0.rc3/dlm/libdlm/libdlm.c
--- cluster-3.0.0.rc2/dlm/libdlm/libdlm.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/dlm/libdlm/libdlm.c	2009-06-11 11:02:55.000000000 +0200
@@ -244,7 +244,7 @@
 }
 
 /* Cleanup default lockspace */
-int dlm_pthread_cleanup()
+int dlm_pthread_cleanup(void)
 {
     struct dlm_ls_info *lsinfo = default_ls;
 
@@ -1183,7 +1183,7 @@
 }
 
 /* Multi-threaded callers normally use this */
-int dlm_pthread_init()
+int dlm_pthread_init(void)
 {
     if (open_default_lockspace())
 	return -1;
diff -Naurd cluster-3.0.0.rc2/dlm/libdlm/libdlm.h cluster-3.0.0.rc3/dlm/libdlm/libdlm.h
--- cluster-3.0.0.rc2/dlm/libdlm/libdlm.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/dlm/libdlm/libdlm.h	2009-06-11 11:02:55.000000000 +0200
@@ -220,9 +220,9 @@
  */
 
 #ifdef _REENTRANT
-extern int dlm_pthread_init();
+extern int dlm_pthread_init(void);
 extern int dlm_ls_pthread_init(dlm_lshandle_t lockspace);
-extern int dlm_pthread_cleanup();
+extern int dlm_pthread_cleanup(void);
 #endif
 
 
diff -Naurd cluster-3.0.0.rc2/dlm/libdlm/libdlm_lt.pc.in cluster-3.0.0.rc3/dlm/libdlm/libdlm_lt.pc.in
--- cluster-3.0.0.rc2/dlm/libdlm/libdlm_lt.pc.in	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/dlm/libdlm/libdlm_lt.pc.in	2009-06-11 11:02:55.000000000 +0200
@@ -3,7 +3,7 @@
 libdir=@LIBDIR@
 includedir=@INCDIR@
 
-Name: libdlm
+Name: libdlm_lt
 Version: @VERSION@
 Description: Cluster Distributed Lock Manager non-threaded library
 Requires:
diff -Naurd cluster-3.0.0.rc2/dlm/libdlmcontrol/main.c cluster-3.0.0.rc3/dlm/libdlmcontrol/main.c
--- cluster-3.0.0.rc2/dlm/libdlmcontrol/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/dlm/libdlmcontrol/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -16,7 +16,7 @@
 	int rv, off = 0;
 
 	while (off < count) {
-		rv = read(fd, buf + off, count - off);
+		rv = read(fd, (char *)buf + off, count - off);
 		if (rv == 0)
 			return -1;
 		if (rv == -1 && errno == EINTR)
@@ -33,7 +33,7 @@
 	int rv, off = 0;
 
  retry:
-	rv = write(fd, buf + off, count);
+	rv = write(fd, (char *)buf + off, count);
 	if (rv == -1 && errno == EINTR)
 		goto retry;
 	if (rv < 0) {
@@ -48,7 +48,7 @@
 	return 0;
 }
 
-static int do_connect(char *sock_path)
+static int do_connect(const char *sock_path)
 {
 	struct sockaddr_un sun;
 	socklen_t addrlen;
@@ -86,7 +86,7 @@
 		strncpy(h->name, name, DLM_LOCKSPACE_LEN);
 }
 
-int do_dump(int cmd, char *name, char *buf)
+static int do_dump(int cmd, char *name, char *buf)
 {
 	struct dlmc_header h, *rh;
 	char *reply;
diff -Naurd cluster-3.0.0.rc2/dlm/tool/main.c cluster-3.0.0.rc3/dlm/tool/main.c
--- cluster-3.0.0.rc2/dlm/tool/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/dlm/tool/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -109,7 +109,7 @@
 	unsigned int expect_replies;
 };
 
-char *mode_str(int mode)
+static const char *mode_str(int mode)
 {
 	switch (mode) {
 	case -1:
@@ -130,7 +130,7 @@
 	return "??";
 }
 
-char *msg_str(int type)
+static const char *msg_str(int type)
 {
 	switch (type) {
 	case DLM_MSG_REQUEST:
@@ -359,7 +359,7 @@
 	int rv, off = 0;
 
  retry:
-	rv = write(fd, buf + off, count);
+	rv = write(fd, (char *)buf + off, count);
 	if (rv == -1 && errno == EINTR)
 		goto retry;
 	if (rv < 0)
@@ -393,7 +393,7 @@
 	return join_flags;
 }
 
-void do_join(char *name)
+static void do_join(char *name)
 {
 	dlm_lshandle_t *dh;
 	uint32_t flags = 0;
@@ -423,7 +423,7 @@
 	printf("done\n");
 }
 
-void do_leave(char *name)
+static void do_leave(char *name)
 {
 	dlm_lshandle_t *dh;
 
@@ -441,7 +441,7 @@
 	printf("done\n");
 }
 
-char *pr_master(int nodeid)
+static char *pr_master(int nodeid)
 {
 	static char buf[64];
 
@@ -457,7 +457,7 @@
 	return buf;
 }
 
-char *pr_extra(uint32_t flags, int root_list, int recover_list,
+static char *pr_extra(uint32_t flags, int root_list, int recover_list,
 	       int recover_locks_count, char *first_lkid)
 {
 	static char buf[128];
@@ -476,7 +476,7 @@
 	return buf;
 }
 
-void print_rsb(char *line, struct rinfo *ri)
+static void print_rsb(char *line, struct rinfo *ri)
 {
 	char type[4], namefmt[4], *p;
 	char addr[64];
@@ -532,7 +532,7 @@
 	fprintf(stderr, "print_rsb error rv %d line \"%s\"\n", rv, line);
 }
 
-void print_lvb(char *line)
+static void print_lvb(char *line)
 {
 	char lvb[1024];
 	char type[4];
@@ -568,7 +568,7 @@
 	int nodeid, ownpid, status, grmode, rqmode, highbast, rsb_lookup, wait_type;
 };
 
-char *pr_grmode(struct lkb *lkb)
+static const char *pr_grmode(struct lkb *lkb)
 {
 	if (lkb->status == DLM_LKSTS_GRANTED || lkb->status == DLM_LKSTS_CONVERT)
 		return mode_str(lkb->grmode);
@@ -578,7 +578,7 @@
 		return "XX";
 }
 
-char *pr_rqmode(struct lkb *lkb)
+static const char *pr_rqmode(struct lkb *lkb)
 {
 	static char buf[5];
 
@@ -596,7 +596,7 @@
 	}
 }
 
-char *pr_remote(struct lkb *lkb, struct rinfo *ri)
+static const char *pr_remote(struct lkb *lkb, struct rinfo *ri)
 {
 	static char buf[64];
 
@@ -613,7 +613,7 @@
 	}
 }
 
-char *pr_wait(struct lkb *lkb)
+static const char *pr_wait(struct lkb *lkb)
 {
 	static char buf[16];
 
@@ -627,7 +627,7 @@
 	}
 }
 
-char *pr_verbose(struct lkb *lkb)
+static char *pr_verbose(struct lkb *lkb)
 {
 	static char buf[128];
 
@@ -641,13 +641,13 @@
 	return buf;
 }
 
-void print_lkb(char *line, struct rinfo *ri)
+static void print_lkb(char *line, struct rinfo *ri)
 {
 	struct lkb lkb;
 	char type[4];
 	int rv;
 
-	rv = sscanf(line, "%s %x %d %x %u %llu %x %x %d %d %d %d %d %d %u %llu %llu",
+	rv = sscanf(line, "%s %x %d %x %u %"PRIu64" %x %x %d %d %d %d %d %d %u %"PRIu64" %"PRIu64,
 		    type,
 		    &lkb.id,
 		    &lkb.nodeid,
@@ -779,7 +779,7 @@
 
 #define LOCK_LINE_MAX 1024
 
-void do_waiters(char *name, struct summary *sum)
+static void do_waiters(char *name, struct summary *sum)
 {
 	FILE *file;
 	char path[PATH_MAX];
@@ -835,7 +835,7 @@
 	fclose(file);
 }
 
-void do_lockdebug(char *name)
+static void do_lockdebug(char *name)
 {
 	struct summary summary;
 	struct rinfo info;
@@ -899,7 +899,7 @@
 	}
 }
 
-void parse_r_name(char *line, char *name)
+static void parse_r_name(char *line, char *name)
 {
 	char *p;
 	int i = 0;
@@ -917,7 +917,7 @@
 	}
 }
 
-void do_lockdump(char *name)
+static void do_lockdump(char *name)
 {
 	FILE *file;
 	char path[PATH_MAX];
@@ -947,10 +947,8 @@
 	}
 
 	/* skip the header on the first line */
-	if(!fgets(line, LOCK_LINE_MAX, file)) {
-		fprintf(stderr, "can't read %s: %s\n", path, strerror(errno));
+	if (!fgets(line, LOCK_LINE_MAX, file))
 		return;
-	}
 
 	while (fgets(line, LOCK_LINE_MAX, file)) {
 		rv = sscanf(line, "%x %d %x %u %llu %x %x %hhd %hhd %hhd %u %d %d",
@@ -1039,7 +1037,7 @@
 	return str;
 }
 
-static char *nf_check_str(uint32_t flags)
+static const char *nf_check_str(uint32_t flags)
 {
 	if (flags & DLMC_NF_CHECK_FENCING)
 		return "fence";
@@ -1053,7 +1051,7 @@
 	return "none";
 }
 
-static char *condition_str(int cond)
+static const char *condition_str(int cond)
 {
 	switch (cond) {
 	case 0:
@@ -1079,9 +1077,9 @@
 	return a->nodeid - b->nodeid;
 }
 
-static void show_nodeids(int count, struct dlmc_node *nodes)
+static void show_nodeids(int count, struct dlmc_node *nodes_in)
 {
-	struct dlmc_node *n = nodes;
+	struct dlmc_node *n = nodes_in;
 	int i;
 
 	for (i = 0; i < count; i++) {
@@ -1153,9 +1151,9 @@
 	return 0;
 }
 
-static void show_all_nodes(int count, struct dlmc_node *nodes)
+static void show_all_nodes(int count, struct dlmc_node *nodes_in)
 {
-	struct dlmc_node *n = nodes;
+	struct dlmc_node *n = nodes_in;
 	int i;
 
 	for (i = 0; i < count; i++) {
diff -Naurd cluster-3.0.0.rc2/fence/agents/alom/fence_alom.py cluster-3.0.0.rc3/fence/agents/alom/fence_alom.py
--- cluster-3.0.0.rc2/fence/agents/alom/fence_alom.py	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/agents/alom/fence_alom.py	2009-06-11 11:02:55.000000000 +0200
@@ -64,8 +64,13 @@
 	fence_action(conn, options, set_power_status, get_power_status,None)
 
 	# Logout from system
-	conn.sendline("logout")
-	conn.close()
+	try:
+		conn.sendline("logout")
+		conn.close()
+	except exceptions.OSError:
+		pass
+	except pexpect.ExceptionPexpect:
+		pass	                                         
 
 if __name__ == "__main__":
 	main()
diff -Naurd cluster-3.0.0.rc2/fence/agents/apc/fence_apc.py cluster-3.0.0.rc3/fence/agents/apc/fence_apc.py
--- cluster-3.0.0.rc2/fence/agents/apc/fence_apc.py	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/agents/apc/fence_apc.py	2009-06-11 11:02:55.000000000 +0200
@@ -223,6 +223,8 @@
 		conn.close()
 	except exceptions.OSError:
 		pass
+	except pexpect.ExceptionPexpect:
+		pass
 
 if __name__ == "__main__":
 	main()
diff -Naurd cluster-3.0.0.rc2/fence/agents/bladecenter/fence_bladecenter.py cluster-3.0.0.rc3/fence/agents/bladecenter/fence_bladecenter.py
--- cluster-3.0.0.rc2/fence/agents/bladecenter/fence_bladecenter.py	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/agents/bladecenter/fence_bladecenter.py	2009-06-11 11:02:55.000000000 +0200
@@ -112,8 +112,13 @@
 	##
 	## Logout from system
 	######
-	conn.send("exit\r\n")
-	conn.close()
+	try:
+		conn.send("exit\r\n")
+		conn.close()
+	except exceptions.OSError:
+		pass
+	except pexpect.ExceptionPexpect:
+		pass
 
 if __name__ == "__main__":
 	main()
diff -Naurd cluster-3.0.0.rc2/fence/agents/drac/fence_drac5.py cluster-3.0.0.rc3/fence/agents/drac/fence_drac5.py
--- cluster-3.0.0.rc2/fence/agents/drac/fence_drac5.py	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/agents/drac/fence_drac5.py	2009-06-11 11:02:55.000000000 +0200
@@ -117,8 +117,13 @@
 	##
 	## Logout from system
 	######
-	conn.sendline("exit")
-	conn.close()
+	try:
+		conn.sendline("exit")
+		conn.close()
+	except exceptions.OSError:
+		pass
+	except pexpect.ExceptionPexpect:
+		pass
 
 if __name__ == "__main__":
 	main()
diff -Naurd cluster-3.0.0.rc2/fence/agents/ldom/fence_ldom.py cluster-3.0.0.rc3/fence/agents/ldom/fence_ldom.py
--- cluster-3.0.0.rc2/fence/agents/ldom/fence_ldom.py	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/agents/ldom/fence_ldom.py	2009-06-11 11:02:55.000000000 +0200
@@ -107,8 +107,13 @@
 	##
 	## Logout from system
 	######
-	conn.sendline("logout")
-	conn.close()
+	try:
+		conn.sendline("logout")
+		conn.close()
+	except exceptions.OSError:
+		pass
+	except pexpect.ExceptionPexpect:
+		pass	
 
 if __name__ == "__main__":
 	main()
diff -Naurd cluster-3.0.0.rc2/fence/agents/lib/fencing.py.py cluster-3.0.0.rc3/fence/agents/lib/fencing.py.py
--- cluster-3.0.0.rc2/fence/agents/lib/fencing.py.py	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/agents/lib/fencing.py.py	2009-06-11 11:02:55.000000000 +0200
@@ -442,6 +442,8 @@
 				name = "port"
 			elif name == "hostname":
 				name = "ipaddr"
+			elif name == "modulename":
+				name = "module_name"
 
 			##
 			######
diff -Naurd cluster-3.0.0.rc2/fence/agents/lpar/fence_lpar.py cluster-3.0.0.rc3/fence/agents/lpar/fence_lpar.py
--- cluster-3.0.0.rc2/fence/agents/lpar/fence_lpar.py	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/agents/lpar/fence_lpar.py	2009-06-11 11:02:55.000000000 +0200
@@ -143,7 +143,7 @@
 	## Fence agent specific defaults
 	#####
 	if 0 == options.has_key("-c"):
-		options["-c"] = [ ":~>", "]\$" ]
+		options["-c"] = [ ":~>", "]\$", "\$ " ]
 
 	if 0 == options.has_key("-x"):
 		fail_usage("Failed: You have to use ssh connection (-x) to fence device")
@@ -166,8 +166,13 @@
 	##
 	## Logout from system
 	######
-	conn.send("quit\r\n")
-	conn.close()
+	try:
+		conn.send("quit\r\n")
+		conn.close()
+	except exceptions.OSError:
+		pass
+	except pexpect.ExceptionPexpect:
+		pass	                                         
 
 if __name__ == "__main__":
 	main()
diff -Naurd cluster-3.0.0.rc2/fence/agents/rsa/fence_rsa.py cluster-3.0.0.rc3/fence/agents/rsa/fence_rsa.py
--- cluster-3.0.0.rc2/fence/agents/rsa/fence_rsa.py	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/agents/rsa/fence_rsa.py	2009-06-11 11:02:55.000000000 +0200
@@ -65,8 +65,13 @@
 	##
 	## Logout from system
 	######
-	conn.sendline("exit")
-	conn.close()
+	try:
+		conn.sendline("exit")
+		conn.close()
+	except exceptions.OSError:
+		pass
+	except pexpect.ExceptionPexpect:
+		pass	
 
 if __name__ == "__main__":
 	main()
diff -Naurd cluster-3.0.0.rc2/fence/agents/scsi/fence_scsi_test.pl cluster-3.0.0.rc3/fence/agents/scsi/fence_scsi_test.pl
--- cluster-3.0.0.rc2/fence/agents/scsi/fence_scsi_test.pl	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/agents/scsi/fence_scsi_test.pl	2009-06-11 11:02:55.000000000 +0200
@@ -175,8 +175,23 @@
     print "  -h     Help. Prints out this usage information.\n\n";
 }
 
+sub test_tools_path
+{
+    my $tool_name = "sg_persist";
+    
+    for my $path ( split /:/, $ENV{PATH} ) {
+        if ( -f "$path/$tool_name" && -x _ ) {
+          return;
+        }
+    }
+    
+    die "No $tool_name command available, please install the sg3_utils package.\n"
+}
+
 ### MAIN #######################################################################
 
+test_tools_path;
+
 if (getopts("cdhst:v") == 0)
 {
     print_usage;
diff -Naurd cluster-3.0.0.rc2/fence/agents/virsh/fence_virsh.py cluster-3.0.0.rc3/fence/agents/virsh/fence_virsh.py
--- cluster-3.0.0.rc2/fence/agents/virsh/fence_virsh.py	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/agents/virsh/fence_virsh.py	2009-06-11 11:02:55.000000000 +0200
@@ -82,8 +82,13 @@
 	fence_action(conn, options, set_power_status, get_power_status, get_outlets_status)
 
 	## Logout from system
-	conn.sendline("quit")
-	conn.close()
+	try:
+		conn.sendline("quit")
+		conn.close()
+	except exceptions.OSError:
+		pass
+	except pexpect.ExceptionPexpect:
+		pass
 
 if __name__ == "__main__":
 	main()
diff -Naurd cluster-3.0.0.rc2/fence/agents/wti/fence_wti.py cluster-3.0.0.rc3/fence/agents/wti/fence_wti.py
--- cluster-3.0.0.rc2/fence/agents/wti/fence_wti.py	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/agents/wti/fence_wti.py	2009-06-11 11:02:55.000000000 +0200
@@ -119,8 +119,13 @@
 	##
 	## Logout from system
 	######
-	conn.send("/X"+"\r\n")
-	conn.close()
+	try:
+		conn.send("/X"+"\r\n")
+		conn.close()
+	except exceptions.OSError:
+		pass
+	except pexpect.ExceptionPexpect:
+		pass
 
 if __name__ == "__main__":
 	main()
diff -Naurd cluster-3.0.0.rc2/fence/agents/xvm/Makefile cluster-3.0.0.rc3/fence/agents/xvm/Makefile
--- cluster-3.0.0.rc2/fence/agents/xvm/Makefile	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/agents/xvm/Makefile	2009-06-11 11:02:55.000000000 +0200
@@ -30,7 +30,6 @@
 		debug.o
 
 CFLAGS += -D_GNU_SOURCE
-CFLAGS += -Werror -Wstrict-prototypes -Wshadow
 CFLAGS += -I${ccsincdir} -I${cmanincdir}
 CFLAGS += -I${corosyncincdir} -I${openaisincdir}
 CFLAGS += -I${logtincdir}
diff -Naurd cluster-3.0.0.rc2/fence/fenced/config.c cluster-3.0.0.rc3/fence/fenced/config.c
--- cluster-3.0.0.rc2/fence/fenced/config.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/fenced/config.c	2009-06-11 11:02:55.000000000 +0200
@@ -24,9 +24,9 @@
 int cfgd_post_join_delay = DEFAULT_POST_JOIN_DELAY;
 int cfgd_post_fail_delay = DEFAULT_POST_FAIL_DELAY;
 int cfgd_override_time   = DEFAULT_OVERRIDE_TIME;
-char *cfgd_override_path = DEFAULT_OVERRIDE_PATH;
+const char *cfgd_override_path = DEFAULT_OVERRIDE_PATH;
 
-void read_ccs_name(char *path, char *name)
+void read_ccs_name(const char *path, char *name)
 {
 	char *str;
 	int error;
@@ -40,7 +40,7 @@
 	free(str);
 }
 
-void read_ccs_yesno(char *path, int *yes, int *no)
+void read_ccs_yesno(const char *path, int *yes, int *no)
 {
 	char *str;
 	int error;
@@ -61,7 +61,7 @@
 	free(str);
 }
 
-void read_ccs_int(char *path, int *config_val)
+void read_ccs_int(const char *path, int *config_val)
 {
 	char *str;
 	int val;
diff -Naurd cluster-3.0.0.rc2/fence/fenced/config.h cluster-3.0.0.rc3/fence/fenced/config.h
--- cluster-3.0.0.rc2/fence/fenced/config.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/fenced/config.h	2009-06-11 11:02:55.000000000 +0200
@@ -26,7 +26,7 @@
 extern int cfgd_post_join_delay;
 extern int cfgd_post_fail_delay;
 extern int cfgd_override_time;
-extern char *cfgd_override_path;
+extern const char *cfgd_override_path;
 
 #endif
 
diff -Naurd cluster-3.0.0.rc2/fence/fenced/cpg.c cluster-3.0.0.rc3/fence/fenced/cpg.c
--- cluster-3.0.0.rc2/fence/fenced/cpg.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/fenced/cpg.c	2009-06-11 11:02:55.000000000 +0200
@@ -107,7 +107,7 @@
         }
 }
 
-static char *msg_name(int type)
+static const char *msg_name(int type)
 {
 	switch (type) {
 	case FD_MSG_PROTOCOL:
@@ -1289,7 +1289,7 @@
 	}
 
 	if (len < sizeof(*hd)) {
-		log_error("deliver_cb short message %d", len);
+		log_error("deliver_cb short message %zd", len);
 		return;
 	}
 
@@ -1759,7 +1759,7 @@
 	struct fd_header *hd;
 
 	if (len < sizeof(*hd)) {
-		log_error("deliver_cb short message %d", len);
+		log_error("deliver_cb short message %zd", len);
 		return;
 	}
 
diff -Naurd cluster-3.0.0.rc2/fence/fenced/fd.h cluster-3.0.0.rc3/fence/fenced/fd.h
--- cluster-3.0.0.rc2/fence/fenced/fd.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/fenced/fd.h	2009-06-11 11:02:55.000000000 +0200
@@ -191,9 +191,9 @@
 int setup_ccs(void);
 void close_ccs(void);
 void reread_ccs(void);
-void read_ccs_name(char *path, char *name);
-void read_ccs_yesno(char *path, int *yes, int *no);
-void read_ccs_int(char *path, int *config_val);
+void read_ccs_name(const char *path, char *name);
+void read_ccs_yesno(const char *path, int *yes, int *no);
+void read_ccs_int(const char *path, int *config_val);
 int read_ccs(struct fd *fd);
 
 /* cpg.c */
@@ -266,7 +266,7 @@
 /* logging.c */
 
 void init_logging(void);
-void setup_logging();
+void setup_logging(void);
 void close_logging(void);
 
 #endif				/*  __FD_DOT_H__  */
diff -Naurd cluster-3.0.0.rc2/fence/fenced/main.c cluster-3.0.0.rc3/fence/fenced/main.c
--- cluster-3.0.0.rc2/fence/fenced/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/fenced/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -13,6 +13,7 @@
 static pthread_t query_thread;
 static pthread_mutex_t query_mutex;
 static struct list_head controlled_entries;
+static char default_name[8];
 
 struct client {
 	int fd;
@@ -25,7 +26,7 @@
 	int rv, off = 0;
 
 	while (off < count) {
-		rv = read(fd, buf + off, count - off);
+		rv = read(fd, (char *)buf + off, count - off);
 		if (rv == 0)
 			return -1;
 		if (rv == -1 && errno == EINTR)
@@ -42,7 +43,7 @@
 	int rv, off = 0;
 
  retry:
-	rv = write(fd, buf + off, count);
+	rv = write(fd, (char *)buf + off, count);
 	if (rv == -1 && errno == EINTR)
 		goto retry;
 	if (rv < 0) {
@@ -335,7 +336,7 @@
 	struct fenced_node node;
 	int nodeid, rv;
 
-	fd = find_fd("default");
+	fd = find_fd(default_name);
 	if (!fd) {
 		rv = -ENOENT;
 		goto out;
@@ -360,7 +361,7 @@
 	struct fenced_domain domain;
 	int rv;
 
-	fd = find_fd("default");
+	fd = find_fd(default_name);
 	if (!fd) {
 		rv = -ENOENT;
 		goto out;
@@ -384,7 +385,7 @@
 	struct fenced_node *nodes = NULL;
 	int rv, result;
 
-	fd = find_fd("default");
+	fd = find_fd(default_name);
 	if (!fd) {
 		result = -ENOENT;
 		node_count = 0;
@@ -426,6 +427,7 @@
 	char *extra = NULL;
 	int rv, extra_len;
 
+
 	rv = do_read(client[ci].fd, &h, sizeof(h));
 	if (rv < 0) {
 		log_debug("connection %d read error %d", ci, rv);
@@ -460,13 +462,13 @@
 
 	switch (h.command) {
 	case FENCED_CMD_JOIN:
-		do_join("default");
+		do_join(default_name);
 		break;
 	case FENCED_CMD_LEAVE:
-		do_leave("default");
+		do_leave(default_name);
 		break;
 	case FENCED_CMD_EXTERNAL:
-		do_external("default", extra, extra_len);
+		do_external(default_name, extra, extra_len);
 		break;
 	case FENCED_CMD_DUMP_DEBUG:
 	case FENCED_CMD_NODE_INFO:
@@ -499,7 +501,7 @@
 	log_debug("client connection %d fd %d", i, fd);
 }
 
-static int setup_listener(char *sock_path)
+static int setup_listener(const char *sock_path)
 {
 	struct sockaddr_un addr;
 	socklen_t addrlen;
@@ -621,7 +623,7 @@
 	char path[PATH_MAX+1];
 };
 
-static void register_controlled_dir(char *path)
+static void register_controlled_dir(const char *path)
 {
 	struct controlled_entry *ce;
 
@@ -1025,6 +1027,8 @@
 	INIT_LIST_HEAD(&domains);
 	INIT_LIST_HEAD(&controlled_entries);
 
+	strcpy(default_name, "default");
+
 	read_arguments(argc, argv);
 
 	if (!daemon_debug_opt) {
@@ -1036,7 +1040,7 @@
 	}
 	lockfile();
 	init_logging();
-	log_level(LOG_INFO, "fenced %s", RELEASE_VERSION);
+	log_level(LOG_INFO, "fenced %s started", RELEASE_VERSION);
 	signal(SIGTERM, sigterm_handler);
 	set_oom_adj(-16);
 
diff -Naurd cluster-3.0.0.rc2/fence/fenced/member_cman.c cluster-3.0.0.rc3/fence/fenced/member_cman.c
--- cluster-3.0.0.rc2/fence/fenced/member_cman.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/fenced/member_cman.c	2009-06-11 11:02:55.000000000 +0200
@@ -1,5 +1,6 @@
 #include "fd.h"
 #include "config.h"
+#include <arpa/inet.h>
 #include <libcman.h>
 
 #define BUFLEN		MAX_NODENAME_LEN+1
@@ -33,6 +34,7 @@
 static int name_equal(char *name1, char *name2)
 {
 	char name3[BUFLEN], name4[BUFLEN];
+	char addr1[INET6_ADDRSTRLEN];
 	int i, len1, len2;
 
 	len1 = strlen(name1);
@@ -41,6 +43,16 @@
 	if (len1 == len2 && !strncmp(name1, name2, len1))
 		return 1;
 
+	/*
+	 * If the names are IP addresses then don't compare
+	 * what is in front of the dots.
+	 */
+	if (inet_pton(AF_INET, name1, addr1) == 0)
+		return 0;
+
+	if (inet_pton(AF_INET6, name1, addr1) == 0)
+		return 0;
+
 	memset(name3, 0, BUFLEN);
 	memset(name4, 0, BUFLEN);
 
@@ -97,7 +109,7 @@
 	if (cn)
 		return cn->cn_name;
 
-	return "unknown";
+	return NULL;
 }
 
 int name_to_nodeid(char *name)
diff -Naurd cluster-3.0.0.rc2/fence/fenced/recover.c cluster-3.0.0.rc3/fence/fenced/recover.c
--- cluster-3.0.0.rc2/fence/fenced/recover.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/fenced/recover.c	2009-06-11 11:02:55.000000000 +0200
@@ -80,7 +80,7 @@
 	return num_victims;
 }
 
-static inline void close_override(int *fd, char *path)
+static inline void close_override(int *fd, const char *path)
 {
 	unlink(path);
 	if (fd) {
@@ -90,7 +90,7 @@
 	}
 }
 
-static int open_override(char *path)
+static int open_override(const char *path)
 {
 	int ret;
 	mode_t om;
@@ -176,7 +176,7 @@
 	struct timeval first, last, start, now;
 	int victim_count, last_count = 0, delay = 0;
 	struct node *node;
-	char *delay_type;
+	const char *delay_type;
 
 	if (list_empty(&fd->victims))
 		return;
@@ -244,10 +244,11 @@
 
 	master_name = nodeid_to_name(fd->master);
 
-	log_level(LOG_INFO, "fencing deferred to %s", master_name);
+	log_level(LOG_INFO, "fencing deferred to %s",
+		  master_name ? master_name : "unknown");
 }
 
-static char *fe_str(int r)
+static const char *fe_str(int r)
 {
 	switch (r) {
 	case FE_AGENT_SUCCESS:
diff -Naurd cluster-3.0.0.rc2/fence/fence_node/fence_node.c cluster-3.0.0.rc3/fence/fence_node/fence_node.c
--- cluster-3.0.0.rc2/fence/fence_node/fence_node.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/fence_node/fence_node.c	2009-06-11 11:02:55.000000000 +0200
@@ -18,7 +18,7 @@
 #define FL_SIZE 32
 static struct fence_log flog[FL_SIZE];
 static int flog_count;
-static char *action = "fence";
+static const char *action = "fence";
 
 #define OPTION_STRING "UvhV"
 
@@ -81,7 +81,7 @@
 	return 0;
 }
 
-static char *fe_str(int r)
+static const char *fe_str(int r)
 {
 	switch (r) {
 	case FE_AGENT_SUCCESS:
diff -Naurd cluster-3.0.0.rc2/fence/fence_tool/fence_tool.c cluster-3.0.0.rc3/fence/fence_tool/fence_tool.c
--- cluster-3.0.0.rc2/fence/fence_tool/fence_tool.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/fence_tool/fence_tool.c	2009-06-11 11:02:55.000000000 +0200
@@ -61,7 +61,7 @@
 	int rv, off = 0;
 
  retry:
-	rv = write(fd, buf + off, count);
+	rv = write(fd, (char *)buf + off, count);
 	if (rv == -1 && errno == EINTR)
 		goto retry;
 	if (rv < 0)
@@ -128,7 +128,7 @@
 	return count;
 }
 
-static int check_controlled_dir(char *path)
+static int check_controlled_dir(const char *path)
 {
 	DIR *d;
 	struct dirent *de;
@@ -485,7 +485,7 @@
 #define CGST_WAIT_MESSAGES	2
 #define CGST_WAIT_FENCING	3
 
-static char *wait_str(int state)
+static const char *wait_str(int state)
 {
 	switch (state) {
 	case 0:
@@ -506,7 +506,7 @@
 #define VIC_DONE_OVERRIDE       3
 #define VIC_DONE_EXTERNAL       4
 
-static char *how_str(int how)
+static const char *how_str(int how)
 {
 	switch (how) {
 	case 0:
diff -Naurd cluster-3.0.0.rc2/fence/libfenced/main.c cluster-3.0.0.rc3/fence/libfenced/main.c
--- cluster-3.0.0.rc2/fence/libfenced/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/fence/libfenced/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -15,7 +15,7 @@
 	int rv, off = 0;
 
 	while (off < count) {
-		rv = read(fd, buf + off, count - off);
+		rv = read(fd, (char *)buf + off, count - off);
 		if (rv == 0)
 			return -1;
 		if (rv == -1 && errno == EINTR)
@@ -32,7 +32,7 @@
 	int rv, off = 0;
 
  retry:
-	rv = write(fd, buf + off, count);
+	rv = write(fd, (char *)buf + off, count);
 	if (rv == -1 && errno == EINTR)
 		goto retry;
 	if (rv < 0) {
@@ -47,7 +47,7 @@
 	return 0;
 }
 
-static int do_connect(char *sock_path)
+static int do_connect(const char *sock_path)
 {
 	struct sockaddr_un sun;
 	socklen_t addrlen;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_debug/basic.c cluster-3.0.0.rc3/gfs/gfs_debug/basic.c
--- cluster-3.0.0.rc2/gfs/gfs_debug/basic.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_debug/basic.c	2009-06-11 11:02:55.000000000 +0200
@@ -171,7 +171,7 @@
 	unsigned int bn = 0;
 	unsigned int bit;
 	unsigned char value;
-	char *type;
+	const char *type;
 
 	printf("\n");
 
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_debug/readfile.c cluster-3.0.0.rc3/gfs/gfs_debug/readfile.c
--- cluster-3.0.0.rc2/gfs/gfs_debug/readfile.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_debug/readfile.c	2009-06-11 11:02:55.000000000 +0200
@@ -189,7 +189,7 @@
 
 static void
 do_readdir(struct gfs_dinode *di, char *data,
-	   uint32_t index, uint32_t len, uint64_t leaf_no,
+	   uint32_t lindex, uint32_t len, uint64_t leaf_no,
 	   void *opaque)
 {
 	struct gfs_leaf leaf;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_debug/util.c cluster-3.0.0.rc3/gfs/gfs_debug/util.c
--- cluster-3.0.0.rc2/gfs/gfs_debug/util.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_debug/util.c	2009-06-11 11:02:55.000000000 +0200
@@ -89,7 +89,7 @@
 	struct gfs_leaf leaf;
 	uint32_t hsize, len;
 	uint32_t ht_offset, lp_offset, ht_offset_cur = -1;
-	uint32_t index = 0;
+	uint32_t lindex = 0;
 	uint64_t lp[sd_hash_ptrs];
 	uint64_t leaf_no;
 	int error;
@@ -98,9 +98,9 @@
 	if (hsize * sizeof(uint64_t) != di->di_size)
 		die("bad hash table size\n");
 
-	while (index < hsize) {
-		lp_offset = index % sd_hash_ptrs;
-		ht_offset = index - lp_offset;
+	while (lindex < hsize) {
+		lp_offset = lindex % sd_hash_ptrs;
+		ht_offset = lindex - lp_offset;
 
 		if (ht_offset_cur != ht_offset) {
 			error = gfs_readi(di, (char *)lp, ht_offset * sizeof(uint64_t), sd_hash_bsize);
@@ -117,13 +117,13 @@
 		gfs_leaf_in(&leaf, data);
 		len = 1 << (di->di_depth - leaf.lf_depth);
 
-		lc(di, data, index, len, leaf_no, opaque);
+		lc(di, data, lindex, len, leaf_no, opaque);
 
 		free(data);
-		index += len;
+		lindex += len;
 	}
 
-	if (index != hsize)
+	if (lindex != hsize)
 		die("screwed up directory\n");
 }
 
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/eattr.c cluster-3.0.0.rc3/gfs/gfs_fsck/eattr.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/eattr.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/eattr.c	2009-06-11 11:02:55.000000000 +0200
@@ -1,7 +1,7 @@
 #include <stdint.h>
 
 #include "fsck_incore.h"
-
+#include "eattr.h"
 
 static int clear_blk_nodup(struct fsck_sb *sbp, uint64_t block)
 {
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/file.c cluster-3.0.0.rc3/gfs/gfs_fsck/file.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/file.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/file.c	2009-06-11 11:02:55.000000000 +0200
@@ -14,7 +14,7 @@
  *
  * Returns: The amount of data actually copied or the error
  */
-int readi(struct fsck_inode *ip, void *buf, uint64 offset, unsigned int size)
+int readi(struct fsck_inode *ip, void *bufin, uint64 offset, unsigned int size)
 {
 	struct fsck_sb *sdp = ip->i_sbd;
 	osi_buf_t *bh;
@@ -25,6 +25,7 @@
 	int journaled = fs_is_jdata(ip);
 	int copied = 0;
 	int error = 0;
+	char *buf = bufin;
 
 	if (offset >= ip->i_di.di_size){
 		log_debug("readi:  Offset (%"PRIu64") is >= "
@@ -110,7 +111,7 @@
  *
  * Returns: The number of bytes correctly written or error code
  */
-int writei(struct fsck_inode *ip, void *buf, uint64_t offset, unsigned int size)
+int writei(struct fsck_inode *ip, void *bufin, uint64_t offset, unsigned int size)
 {
 	struct fsck_sb *sdp = ip->i_sbd;
 	osi_buf_t *dibh, *bh;
@@ -122,6 +123,7 @@
 	const uint64_t start = offset;
 	int copied = 0;
 	int error = 0;
+	char *buf = bufin;
 
 	/*  Bomb out on writing nothing.
 	    Posix says we can't change the time here.  */
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/fs_bits.c cluster-3.0.0.rc3/gfs/gfs_fsck/fs_bits.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/fs_bits.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/fs_bits.c	2009-06-11 11:02:55.000000000 +0200
@@ -32,7 +32,7 @@
 	*byte |= new_state << bit;
 }
 
-uint32_t fs_bitfit_core(struct fsck_sb *sbp, uint64_t goal, uint64_t start, uint64_t len,
+static uint32_t fs_bitfit_core(struct fsck_sb *sbp, uint64_t goal, uint64_t start, uint64_t len,
 		   unsigned char old_state)
 {
 	uint64_t block;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/fs_dir.c cluster-3.0.0.rc3/gfs/gfs_fsck/fs_dir.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/fs_dir.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/fs_dir.c	2009-06-11 11:02:55.000000000 +0200
@@ -64,7 +64,7 @@
  *
  * Returns: 0 on success, error code otherwise
  */
-int dirent_next(osi_buf_t *bh, struct gfs_dirent **dent)
+static int dirent_next(osi_buf_t *bh, struct gfs_dirent **dent)
 {
 	struct gfs_dirent *tmp, *cur;
 	char *bh_end;
@@ -208,18 +208,18 @@
 /**
  * get_first_leaf - Get first leaf
  * @dip: The GFS inode
- * @index:
+ * @lindex:
  * @bh_out:
  *
  * Returns: 0 on success, error code otherwise
  */
 
-static int get_first_leaf(struct fsck_inode *dip, uint32 index, osi_buf_t **bh_out)
+static int get_first_leaf(struct fsck_inode *dip, uint32 lindex, osi_buf_t **bh_out)
 {
 	uint64 leaf_no;
 	int error;
 
-	error = get_leaf_nr(dip, index, &leaf_no);
+	error = get_leaf_nr(dip, lindex, &leaf_no);
 	if (!error)
 		error = get_leaf(dip, leaf_no, bh_out);
 
@@ -356,7 +356,7 @@
 			      struct gfs_dirent **dent_prev, osi_buf_t **bh_out)
 {
 	osi_buf_t *bh = NULL, *bh_next;
-	uint32 hsize, index;
+	uint32 hsize, lindex;
 	uint32 hash;
 	int error = 0;
 
@@ -370,9 +370,9 @@
 
 	if(id->type == ID_FILENAME){
 		hash = dir_hash(id->filename);
-		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;
 		}
@@ -403,8 +403,8 @@
 
 		relse_buf(dip->i_sbd, bh);
 	} else if(id->type == ID_INUM){
-		for(index=0; index < (1 << dip->i_di.di_depth); index++){
-			error = get_first_leaf(dip, index, &bh_next);
+		for(lindex=0; lindex < (1 << dip->i_di.di_depth); lindex++){
+			error = get_first_leaf(dip, lindex, &bh_next);
 			if (error){
 				return error;
 			}
@@ -732,12 +732,12 @@
 /**
  * dir_split_leaf - Split a leaf block into two
  * @dip: The GFS inode
- * @index:
+ * @lindex:
  * @leaf_no:
  *
  * Returns: 0 on success, error code on failure
  */
-static int dir_split_leaf(struct fsck_inode *dip, uint32 index, uint64 leaf_no)
+static int dir_split_leaf(struct fsck_inode *dip, uint32 lindex, uint64 leaf_no)
 {
 	struct fsck_sb *sdp = dip->i_sbd;
 	osi_buf_t *nbh, *obh, *dibh;
@@ -795,7 +795,7 @@
 	}
 	half_len = len >> 1;
 
-	start = (index & ~(len - 1));
+	start = (lindex & ~(len - 1));
 
 	log_debug("Splitting leaf: len = %u, half_len = %u\n", len, half_len);
 
@@ -1071,7 +1071,7 @@
 
 
 static int dir_e_del(struct fsck_inode *dip, osi_filename_t *filename){
-	int index;
+	int lindex;
 	int error;
 	int found = 0;
 	uint64 leaf_no;
@@ -1083,10 +1083,10 @@
 	id.filename = filename;
 	id.inum = NULL;
 
-	index = (1 << (dip->i_di.di_depth))-1;
+	lindex = (1 << (dip->i_di.di_depth))-1;
 
-	for(; (index >= 0) && !found; index--){
-		error = get_leaf_nr(dip, index, &leaf_no);
+	for(; (lindex >= 0) && !found; lindex--){
+		error = get_leaf_nr(dip, lindex, &leaf_no);
 		if (error){
 			log_err("dir_e_del:  Unable to get leaf number.\n");
 			return error;
@@ -1230,7 +1230,7 @@
 	osi_buf_t *bh, *nbh, *dibh;
 	struct gfs_leaf *leaf, *nleaf;
 	struct gfs_dirent *dent;
-	uint32 hsize, index;
+	uint32 hsize, lindex;
 	uint32 hash;
 	uint64 leaf_no, bn;
 	int error;
@@ -1248,10 +1248,10 @@
 	/*  Figure out the address of the leaf node.  */
 
 	hash = dir_hash(filename);
-	index = hash >> (32 - dip->i_di.di_depth);
+	lindex = hash >> (32 - dip->i_di.di_depth);
 
 
-	error = get_leaf_nr(dip, index, &leaf_no);
+	error = get_leaf_nr(dip, lindex, &leaf_no);
 	if (error){
 		log_err("dir_e_add:  Unable to get leaf number.\n");
 		return error;
@@ -1275,7 +1275,7 @@
 				/*  Can we split the leaf?  */
 				relse_buf(sdp, bh);
 
-				error = dir_split_leaf(dip, index, leaf_no);
+				error = dir_split_leaf(dip, lindex, leaf_no);
 				if (error){
 					log_err("dir_e_add:  Unable to split leaf.\n");
 					return error;
@@ -1598,20 +1598,20 @@
 
 
 /**
- * get_leaf_nr - Get a leaf number associated with the index
+ * get_leaf_nr - Get a leaf number associated with the lindex
  * @dip: The GFS inode
- * @index:
+ * @lindex:
  * @leaf_out:
  *
  * Returns: 0 on success, error code otherwise
  */
 
-int get_leaf_nr(struct fsck_inode *dip, uint32 index, uint64 *leaf_out)
+int get_leaf_nr(struct fsck_inode *dip, uint32 lindex, uint64 *leaf_out)
 {
 	uint64 leaf_no;
 	int error = -1;
 	error = readi(dip, (char *)&leaf_no,
-		      index * sizeof(uint64), sizeof(uint64));
+		      lindex * sizeof(uint64), sizeof(uint64));
 	if (error != sizeof(uint64)){
 		log_debug("get_leaf_nr:  Bad internal read.  (rtn = %d)\n",
 			  error);
@@ -1625,15 +1625,15 @@
 
 
 /**
- * put_leaf_nr - Put a leaf number associated with the index
+ * put_leaf_nr - Put a leaf number associated with the lindex
  * @dip: The GFS inode
- * @index:
+ * @lindex:
  * @leaf_out:
  *
  * Returns: 0 on success, error code otherwise
  */
 
-int put_leaf_nr(struct fsck_inode *dip, uint32 index, uint64 leaf_out)
+int put_leaf_nr(struct fsck_inode *dip, uint32 lindex, uint64 leaf_out)
 {
 	uint64 leaf_no;
 	int error = -1;
@@ -1641,7 +1641,7 @@
 	leaf_no = cpu_to_gfs64(leaf_out);
 
 	error = writei(dip, (char *)&leaf_no,
-		       index * sizeof(uint64), sizeof(uint64));
+		       lindex * sizeof(uint64), sizeof(uint64));
 	if (error != sizeof(uint64)){
 		log_debug("put_leaf_nr:  Bad internal write.  (rtn = %d)\n",
 			  error);
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/fs_inode.c cluster-3.0.0.rc3/gfs/gfs_fsck/fs_inode.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/fs_inode.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/fs_inode.c	2009-06-11 11:02:55.000000000 +0200
@@ -307,7 +307,7 @@
 	return error;
 }
 
-int fs_createi(struct fsck_inode *dip, osi_filename_t *name,
+static int fs_createi(struct fsck_inode *dip, osi_filename_t *name,
 	       unsigned int type, unsigned int mode, osi_cred_t *cred,
 	       int *new, struct fsck_inode **ipp)
 {
@@ -492,7 +492,7 @@
  *
  * Returns: 0 on success, -1 on failure.
  */
-int fs_mkdir(struct fsck_inode *dip, char *new_dir, int mode, struct fsck_inode **nip){
+int fs_mkdir(struct fsck_inode *dip, const char *new_dir, int mode, struct fsck_inode **nip){
 	int error;
 	osi_cred_t creds;
 	osi_buf_t *dibh;
@@ -501,7 +501,7 @@
 	struct fsck_inode *ip= NULL;
 	struct fsck_sb *sdp = dip->i_sbd;
 	osi_filename_t name;
-	int new;
+	int new = 0;
 
 	name.name = (unsigned char *)new_dir;
 	name.len = strlen(new_dir);
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/fs_inode.h cluster-3.0.0.rc3/gfs/gfs_fsck/fs_inode.h
--- cluster-3.0.0.rc2/gfs/gfs_fsck/fs_inode.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/fs_inode.h	2009-06-11 11:02:55.000000000 +0200
@@ -5,7 +5,7 @@
 
 int fs_copyin_dinode(struct fsck_inode *ip, osi_buf_t *bh);
 int fs_copyout_dinode(struct fsck_inode *ip);
-int fs_mkdir(struct fsck_inode *dip, char *new_dir, int mode, struct fsck_inode **nip);
+int fs_mkdir(struct fsck_inode *dip, const char *new_dir, int mode, struct fsck_inode **nip);
 int fs_remove(struct fsck_inode *ip);
 
 static __inline__ int fs_is_stuffed(struct fsck_inode *ip)
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/initialize.c cluster-3.0.0.rc3/gfs/gfs_fsck/initialize.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/initialize.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/initialize.c	2009-06-11 11:02:55.000000000 +0200
@@ -18,7 +18,7 @@
  *
  * Go through journals and replay them - then clear them
  */
-int init_journals(struct fsck_sb *sbp)
+static int init_journals(struct fsck_sb *sbp)
 {
 
 	if(!sbp->opts->no) {
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/log.c cluster-3.0.0.rc3/gfs/gfs_fsck/log.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/log.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/log.c	2009-06-11 11:02:55.000000000 +0200
@@ -26,7 +26,7 @@
 	_state.print_level--;
 }
 
-void print_msg(int priority, char *file, int line, const char *format, va_list args) {
+static void print_msg(int priority, const char *file, int line, const char *format, va_list args) {
 
 	switch (priority) {
 
@@ -51,7 +51,7 @@
 }
 
 
-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;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/log.h cluster-3.0.0.rc3/gfs/gfs_fsck/log.h
--- cluster-3.0.0.rc2/gfs/gfs_fsck/log.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/log.h	2009-06-11 11:02:55.000000000 +0200
@@ -80,7 +80,7 @@
 
 void increase_verbosity(void);
 void decrease_verbosity(void);
-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, ...);
 int query(struct fsck_sb *sbp, const char *format, ...);
 
 
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/main.c cluster-3.0.0.rc3/gfs/gfs_fsck/main.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -14,7 +14,8 @@
 int skip_this_pass = FALSE, fsck_abort = FALSE, fsck_query = FALSE;
 const char *pass = "";
 
-void print_map(struct block_list *il, int count)
+#if 0
+static void print_map(struct block_list *il, int count)
 {
 	int i, j;
 	struct block_query k;
@@ -36,20 +37,21 @@
 	}
 	log_info("\n");
 }
+#endif
 
-void usage(char *name)
+static void usage(char *name)
 {
 	printf("Usage: %s [-hnqvVy] <device> \n", basename(name));
 }
 
-void version(void)
+static void version(void)
 {
 	printf("GFS fsck %s (built %s %s)\n",
 	       RELEASE_VERSION, __DATE__, __TIME__);
 	printf("%s\n", REDHAT_COPYRIGHT);
 }
 
-int read_cmdline(int argc, char **argv, struct options *opts)
+static int read_cmdline(int argc, char **argv, struct options *opts)
 {
 	int c;
 
@@ -102,7 +104,7 @@
 	return 0;
 }
 
-void interrupt(int sig)
+static void interrupt(int sig)
 {
 	fd_set rfds;
 	struct timeval tv;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/metawalk.c cluster-3.0.0.rc3/gfs/gfs_fsck/metawalk.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/metawalk.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/metawalk.c	2009-06-11 11:02:55.000000000 +0200
@@ -8,7 +8,7 @@
 
 #include "metawalk.h"
 
-int check_entries(struct fsck_inode *ip, osi_buf_t *bh, int index,
+static int check_entries(struct fsck_inode *ip, osi_buf_t *bh, int lindex,
 		  int type, int *update, uint16_t *count,
 		  struct metawalk_fxns *pass)
 {
@@ -114,8 +114,8 @@
 /* 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 fsck_inode *ip, uint64_t *leaf_no, 
-		    uint64_t *bad_leaf, uint64_t old_leaf, int index,
+static void warn_and_patch(struct fsck_inode *ip, uint64_t *leaf_no, 
+		    uint64_t *bad_leaf, uint64_t old_leaf, int lindex,
 		    const char *msg)
 {
 	if (*bad_leaf != *leaf_no) {
@@ -125,7 +125,7 @@
 	}
 	if (*leaf_no == *bad_leaf ||
 	    query(ip->i_sbd, "Attempt to patch around it? (y/n) ")) {
-		put_leaf_nr(ip, index, old_leaf);
+		put_leaf_nr(ip, lindex, old_leaf);
 	}
 	else
 		log_err("Bad leaf left in place.\n");
@@ -134,28 +134,28 @@
 }
 
 /* Checks exthash directory entries */
-int check_leaf(struct fsck_inode *ip, int *update, struct metawalk_fxns *pass)
+static int check_leaf(struct fsck_inode *ip, int *update, struct metawalk_fxns *pass)
 {
 	int error;
 	struct gfs_leaf leaf, oldleaf;
 	uint64_t leaf_no, old_leaf, bad_leaf = -1;
 	osi_buf_t *lbh;
-	int index;
+	int lindex;
 	struct fsck_sb *sbp = ip->i_sbd;
 	uint16_t count;
 	int ref_count = 0, exp_count = 0;
 
 	old_leaf = 0;
 	memset(&oldleaf, 0, sizeof(oldleaf));
-	for(index = 0; index < (1 << ip->i_di.di_depth); index++) {
-		if(get_leaf_nr(ip, index, &leaf_no)) {
+	for(lindex = 0; lindex < (1 << ip->i_di.di_depth); lindex++) {
+		if(get_leaf_nr(ip, lindex, &leaf_no)) {
 			log_err("Unable to get leaf block number in dir %"
 				PRIu64"\n"
 				"\tDepth = %u\n"
-				"\tindex = %u\n",
+				"\tlindex = %u\n",
 				ip->i_num.no_addr,
 				ip->i_di.di_depth,
-				index);
+				lindex);
 			return -1;
 		}
 
@@ -163,7 +163,7 @@
 		 * until those extra pointers are needed, so skip the
 		 * dups */
 		if (leaf_no == bad_leaf) {
-			put_leaf_nr(ip, index, old_leaf); /* fill w/old leaf */
+			put_leaf_nr(ip, lindex, old_leaf); /* fill w/old leaf */
 			ref_count++;
 			continue;
 		}
@@ -208,7 +208,7 @@
 					"range for directory #%"PRIu64".\n",
 					leaf_no, ip->i_di.di_num.no_addr);
 				warn_and_patch(ip, &leaf_no, &bad_leaf,
-					       old_leaf, index,
+					       old_leaf, lindex,
 					       "that is out of range");
 				memcpy(&leaf, &oldleaf, sizeof(oldleaf));
 				break;
@@ -220,7 +220,7 @@
 					"directory #%"PRIu64".\n",
 					leaf_no, ip->i_di.di_num.no_addr);
 				warn_and_patch(ip, &leaf_no, &bad_leaf,
-					       old_leaf, index,
+					       old_leaf, lindex,
 					       "that cannot be read");
 				memcpy(&leaf, &oldleaf, sizeof(oldleaf));
 				relse_buf(sbp, lbh);
@@ -229,7 +229,7 @@
 			/* Make sure it's really a valid leaf block. */
 			if (check_meta(lbh, GFS_METATYPE_LF)) {
 				warn_and_patch(ip, &leaf_no, &bad_leaf,
-					       old_leaf, index,
+					       old_leaf, lindex,
 					       "that is not really a leaf");
 				memcpy(&leaf, &oldleaf, sizeof(oldleaf));
 				relse_buf(sbp, lbh);
@@ -246,7 +246,7 @@
 				  ip->i_di.di_depth, leaf.lf_depth);
 			if(pass->check_dentry && 
 			   ip->i_di.di_type == GFS_FILE_DIR) {
-				error = check_entries(ip, lbh, index,
+				error = check_entries(ip, lbh, lindex,
 						      DIR_EXHASH, update,
 						      &count,
 						      pass);
@@ -696,7 +696,7 @@
 
 
 /* Checks stuffed inode directories */
-int check_linear_dir(struct fsck_inode *ip, osi_buf_t *bh, int *update,
+static int check_linear_dir(struct fsck_inode *ip, osi_buf_t *bh, int *update,
 		     struct metawalk_fxns *pass)
 {
 	int error = 0;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/ondisk.c cluster-3.0.0.rc3/gfs/gfs_fsck/ondisk.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/ondisk.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/ondisk.c	2009-06-11 11:02:55.000000000 +0200
@@ -41,7 +41,7 @@
  */
 
 static void
-print_array(char *title, char *buf, int count, int console)
+print_array(const char *title, char *buf, int count, int console)
 {
 	int x;
 
@@ -349,20 +349,20 @@
  */
 
 void
-gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
+gfs_rindex_in(struct gfs_rindex *grindex, char *buf)
 {
 	struct gfs_rindex *str = (struct gfs_rindex *) buf;
 
-	CPIN_64(rindex, str, ri_addr);
-	CPIN_32(rindex, str, ri_length);
-	CPIN_32(rindex, str, ri_pad);
+	CPIN_64(grindex, str, ri_addr);
+	CPIN_32(grindex, str, ri_length);
+	CPIN_32(grindex, str, ri_pad);
 
-	CPIN_64(rindex, str, ri_data1);
-	CPIN_32(rindex, str, ri_data);
+	CPIN_64(grindex, str, ri_data1);
+	CPIN_32(grindex, str, ri_data);
 
-	CPIN_32(rindex, str, ri_bitbytes);
+	CPIN_32(grindex, str, ri_bitbytes);
 
-	CPIN_08(rindex, str, ri_reserved, 64);
+	CPIN_08(grindex, str, ri_reserved, 64);
 
 }
 
@@ -374,20 +374,20 @@
  */
 
 void
-gfs_rindex_out(struct gfs_rindex *rindex, char *buf)
+gfs_rindex_out(struct gfs_rindex *grindex, char *buf)
 {
 	struct gfs_rindex *str = (struct gfs_rindex *) buf;
 
-	CPOUT_64(rindex, str, ri_addr);
-	CPOUT_32(rindex, str, ri_length);
-	CPOUT_32(rindex, str, ri_pad);
+	CPOUT_64(grindex, str, ri_addr);
+	CPOUT_32(grindex, str, ri_length);
+	CPOUT_32(grindex, str, ri_pad);
 
-	CPOUT_64(rindex, str, ri_data1);
-	CPOUT_32(rindex, str, ri_data);
+	CPOUT_64(grindex, str, ri_data1);
+	CPOUT_32(grindex, str, ri_data);
 
-	CPOUT_32(rindex, str, ri_bitbytes);
+	CPOUT_32(grindex, str, ri_bitbytes);
 
-	CPOUT_08(rindex, str, ri_reserved, 64);
+	CPOUT_08(grindex, str, ri_reserved, 64);
 
 }
 
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/pass1b.c cluster-3.0.0.rc3/gfs/gfs_fsck/pass1b.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/pass1b.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/pass1b.c	2009-06-11 11:02:55.000000000 +0200
@@ -317,7 +317,7 @@
 }
 
 /* Finds all references to duplicate blocks in the metadata */
-int find_block_ref(struct fsck_sb *sbp, uint64_t inode, struct blocks *b)
+static int find_block_ref(struct fsck_sb *sbp, uint64_t inode, struct blocks *b)
 {
 	struct fsck_inode *ip;
 	struct fxn_info myfi = {b->block_no, 0, 1};
@@ -371,7 +371,7 @@
 }
 
 /* Finds all blocks marked in the duplicate block bitmap */
-int find_dup_blocks(struct fsck_sb *sbp)
+static int find_dup_blocks(struct fsck_sb *sbp)
 {
 	uint64_t block_no = 0;
 	struct blocks *b;
@@ -396,7 +396,7 @@
 
 
 
-int handle_dup_blk(struct fsck_sb *sbp, struct blocks *b)
+static int handle_dup_blk(struct fsck_sb *sbp, struct blocks *b)
 {
 	osi_list_t *tmp;
 	struct inode_with_dups *id;
@@ -462,9 +462,10 @@
 	struct block_query q;
 	osi_list_t *tmp;
 	struct metawalk_fxns find_dirents = {0};
-	find_dirents.check_dentry = &find_dentry;
 	int rc = 0;
 
+	find_dirents.check_dentry = &find_dentry;
+
 	osi_list_init(&sbp->dup_list);
 	/* Shove all blocks marked as duplicated into a list */
 	log_info("Looking for duplicate blocks...\n");
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/pass1.c cluster-3.0.0.rc3/gfs/gfs_fsck/pass1.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/pass1.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/pass1.c	2009-06-11 11:02:55.000000000 +0200
@@ -528,7 +528,7 @@
 	return 0;
 }
 
-int clear_metalist(struct fsck_inode *ip, uint64_t block,
+static int clear_metalist(struct fsck_inode *ip, uint64_t block,
 		   osi_buf_t **bh, void *private)
 {
 	struct fsck_sb *sdp = ip->i_sbd;
@@ -547,7 +547,7 @@
 	return 0;
 }
 
-int clear_data(struct fsck_inode *ip, uint64_t block, void *private)
+static int clear_data(struct fsck_inode *ip, uint64_t block, void *private)
 {
 	struct fsck_sb *sdp = ip->i_sbd;
 	struct block_query q = {0};
@@ -564,7 +564,7 @@
 
 }
 
-int clear_leaf(struct fsck_inode *ip, uint64_t block,
+static int clear_leaf(struct fsck_inode *ip, uint64_t block,
 	       osi_buf_t *bh, void *private)
 {
 
@@ -621,7 +621,7 @@
 }
 
 
-int handle_di(struct fsck_sb *sdp, osi_buf_t *bh, uint64_t block, int mfree)
+static int handle_di(struct fsck_sb *sdp, osi_buf_t *bh, uint64_t block, int mfree)
 {
 	struct block_query q = {0};
 	struct fsck_inode *ip;
@@ -878,7 +878,7 @@
 }
 
 
-int scan_meta(struct fsck_sb *sdp, osi_buf_t *bh, uint64_t block, int mfree)
+static int scan_meta(struct fsck_sb *sdp, osi_buf_t *bh, uint64_t block, int mfree)
 {
 
 	if (check_meta(bh, 0)) {
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/pass1c.c cluster-3.0.0.rc3/gfs/gfs_fsck/pass1c.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/pass1c.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/pass1c.c	2009-06-11 11:02:55.000000000 +0200
@@ -15,11 +15,16 @@
 	if(!prev){
 		curr->ea_type = GFS_EATYPE_UNUSED;
 	} else {
+		uint32_t curr_rec_len;
+		uint32_t prev_rec_len;
+
+		curr_rec_len = gfs32_to_cpu(curr->ea_rec_len);
+		prev_rec_len = gfs32_to_cpu(prev->ea_rec_len);
+
 		prev->ea_rec_len =
-			cpu_to_gfs32(gfs32_to_cpu(curr->ea_rec_len) +
-				     gfs32_to_cpu(prev->ea_rec_len));
+			cpu_to_gfs32(curr_rec_len + prev_rec_len);
 		if (curr->ea_flags & GFS_EAFLAG_LAST)
-			prev->ea_flags |= GFS_EAFLAG_LAST;	
+			prev->ea_flags |= GFS_EAFLAG_LAST;
 	}
 	if(write_buf(sdp, leaf_bh, 0)){
 		stack;
@@ -29,7 +34,7 @@
 	return 0;
 }
 
-int check_eattr_indir(struct fsck_inode *ip, uint64_t block,
+static int check_eattr_indir(struct fsck_inode *ip, uint64_t block,
 		      uint64_t parent, osi_buf_t **bh,
 		      void *private)
 {
@@ -65,7 +70,8 @@
 	*bh = indir_bh;
 	return 0;
 }
-int check_eattr_leaf(struct fsck_inode *ip, uint64_t block,
+
+static int check_eattr_leaf(struct fsck_inode *ip, uint64_t block,
 		     uint64_t parent, osi_buf_t **bh, void *private)
 {
 	int *update = (int *) private;
@@ -198,7 +204,7 @@
 	return 0;
 }
 
-int check_eattr_extentry(struct fsck_inode *ip, uint64_t *ea_ptr,
+static int check_eattr_extentry(struct fsck_inode *ip, uint64_t *ea_ptr,
 			 osi_buf_t *leaf_bh,
 			 struct gfs_ea_header *ea_hdr,
 			 struct gfs_ea_header *ea_hdr_prev,
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/pass2.c cluster-3.0.0.rc3/gfs/gfs_fsck/pass2.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/pass2.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/pass2.c	2009-06-11 11:02:55.000000000 +0200
@@ -25,7 +25,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 fsck_sb *sbp, uint64_t childblock,
+static int set_parent_dir(struct fsck_sb *sbp, uint64_t childblock,
 		   uint64_t parentblock)
 {
 	struct dir_info *di;
@@ -51,7 +51,7 @@
 }
 
 /* Set's the child's '..' directory inode number in dir_info structure */
-int set_dotdot_dir(struct fsck_sb *sbp, uint64_t childblock,
+static int set_dotdot_dir(struct fsck_sb *sbp, uint64_t childblock,
 		   uint64_t parentblock)
 {
 	struct dir_info *di;
@@ -142,7 +142,7 @@
 
 /* FIXME: should maybe refactor this a bit - but need to deal with
  * FIXMEs internally first */
-int check_dentry(struct fsck_inode *ip, struct gfs_dirent *dent,
+static int check_dentry(struct fsck_inode *ip, struct gfs_dirent *dent,
 		 struct gfs_dirent *prev_de,
 		 osi_buf_t *bh, char *filename, int *update,
 		 uint16_t *count, void *priv)
@@ -501,7 +501,7 @@
 
 
 
-int build_rooti(struct fsck_sb *sbp)
+static int build_rooti(struct fsck_sb *sbp)
 {
 	struct fsck_inode *ip;
 	osi_buf_t *bh;
@@ -553,7 +553,7 @@
 }
 
 /* Check root inode and verify it's in the bitmap */
-int check_root_dir(struct fsck_sb *sbp)
+static int check_root_dir(struct fsck_sb *sbp)
 {
 	uint64_t rootblock;
 	struct dir_status ds = {0};
@@ -730,11 +730,12 @@
 	osi_buf_t b, *bh = &b;
 	osi_filename_t filename;
 	char tmp_name[256];
+	int error = 0;
+
 	if(check_root_dir(sbp)) {
 		stack;
 		return -1;
 	}
-	int error = 0;
 
 	log_info("Checking directory inodes.\n");
 	/* Grab each directory inode, and run checks on it */
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/pass3.c cluster-3.0.0.rc3/gfs/gfs_fsck/pass3.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/pass3.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/pass3.c	2009-06-11 11:02:55.000000000 +0200
@@ -56,7 +56,7 @@
 	return 0;
 }
 
-struct dir_info *mark_and_return_parent(struct fsck_sb *sbp,
+static struct dir_info *mark_and_return_parent(struct fsck_sb *sbp,
 					struct dir_info *di)
 {
 	struct dir_info *pdi;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/pass4.c cluster-3.0.0.rc3/gfs/gfs_fsck/pass4.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/pass4.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/pass4.c	2009-06-11 11:02:55.000000000 +0200
@@ -9,7 +9,7 @@
 
 /* Updates the link count of an inode to what the fsck has seen for
  * link count */
-int fix_inode_count(struct fsck_sb *sbp, struct inode_info *ii,
+static int fix_inode_count(struct fsck_sb *sbp, struct inode_info *ii,
 		    struct fsck_inode *ip)
 {
 	log_info("Fixing inode count for %"PRIu64"\n",
@@ -26,7 +26,7 @@
 	return 0;
 }
 
-int scan_inode_list(struct fsck_sb *sbp, osi_list_t *list) {
+static int scan_inode_list(struct fsck_sb *sbp, osi_list_t *list) {
 	osi_list_t *tmp;
 	struct inode_info *ii;
 	struct fsck_inode *ip;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/pass5.c cluster-3.0.0.rc3/gfs/gfs_fsck/pass5.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/pass5.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/pass5.c	2009-06-11 11:02:55.000000000 +0200
@@ -119,7 +119,7 @@
 }
 #endif /* DEBUG */
 
-int convert_mark(enum mark_block mark, uint32_t *count)
+static int convert_mark(enum mark_block mark, uint32_t *count)
 {
 	switch(mark) {
 
@@ -163,7 +163,7 @@
 }
 
 
-int check_block_status(struct fsck_sb *sbp, char *buffer, unsigned int buflen,
+static int check_block_status(struct fsck_sb *sbp, char *buffer, unsigned int buflen,
 		       uint64_t *rg_block, uint64_t rg_data, uint32_t *count)
 {
 	unsigned char *byte, *end;
@@ -240,7 +240,7 @@
 #define FREE_META_COUNT  16
 #define CONVERT_FREEMETA_TO_FREE (FREE_COUNT | FREE_META_COUNT)
 
-int update_rgrp(struct fsck_rgrp *rgp, uint32_t *count, int rgcount)
+static int update_rgrp(struct fsck_rgrp *rgp, uint32_t *count, int rgcount)
 {
 	uint32_t i;
 	fs_bitmap_t *bits;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/super.c cluster-3.0.0.rc3/gfs/gfs_fsck/super.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/super.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/super.c	2009-06-11 11:02:55.000000000 +0200
@@ -220,7 +220,7 @@
 }
 
 /* Print out debugging information in same format as gfs_edit. */
-int hexdump(uint64 startaddr, const unsigned char *lpBuffer, int len)
+static int hexdump(uint64 startaddr, const unsigned char *lpBuffer, int len)
 {
 	const unsigned char *pointer, *ptr2;
 	int i;
@@ -264,7 +264,7 @@
  * Returns: the number of bitmap blocks
  */
 
-uint32 rgrplength2bitblocks(struct fsck_sb *sdp, uint32 length)
+static uint32 rgrplength2bitblocks(struct fsck_sb *sdp, uint32 length)
 {
 	uint32 bitbytes;
 	uint32 old_blocks = 0, blocks;
@@ -342,7 +342,7 @@
  * will have the same number of RGs as the second original subdevice.
  * Other RGs found after that will be considered "extra."
  */
-int gfs_rgindex_rebuild(struct fsck_sb *sdp, osi_list_t *ret_list,
+static int gfs_rgindex_rebuild(struct fsck_sb *sdp, osi_list_t *ret_list,
 			unsigned int *num_rgs)
 {
 	osi_buf_t *bh; /* buffer handle */
@@ -959,7 +959,7 @@
  * Sets:    ret_list to a linked list of fsck_rgrp structs representing
  *          what we think the rgindex should really look like.
  */
-int gfs_rgindex_calculate(struct fsck_sb *sdp, osi_list_t *ret_list,
+static int gfs_rgindex_calculate(struct fsck_sb *sdp, osi_list_t *ret_list,
 			  unsigned int *num_rgs)
 {
 	osi_buf_t *bh; /* buffer handle */
@@ -1105,7 +1105,7 @@
 /*
  * ri_cleanup - free up the memory we previously allocated.
  */
-void ri_cleanup(osi_list_t *rglist)
+static void ri_cleanup(osi_list_t *rglist)
 {
 	struct fsck_rgrp *rgd;
 
@@ -1144,7 +1144,7 @@
 	osi_list_t expected_rglist; /* List of expected resource groups */
 	osi_list_t *tmp;
 	struct gfs_rindex buf;
-	unsigned int rg, calc_rg_count;
+	unsigned int rg, calc_rg_count = 0;
 	int error, count1 = 0, count2 = 0;
 	int fix_grow_problems = 0, grow_problems = 0;
 	enum rgindex_trust_level { /* how far can we trust our RG index? */
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_fsck/util.c cluster-3.0.0.rc3/gfs/gfs_fsck/util.c
--- cluster-3.0.0.rc2/gfs/gfs_fsck/util.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_fsck/util.c	2009-06-11 11:02:55.000000000 +0200
@@ -90,13 +90,13 @@
  */
 int check_meta(osi_buf_t *bh, int type){
   uint32 check_magic = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_magic;
-  uint32 check_type = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
+  uint32 check_metatype = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
  
   check_magic = gfs32_to_cpu(check_magic);
-  check_type = gfs32_to_cpu(check_type);
-  if((check_magic != GFS_MAGIC) || (type && (check_type != type))){
+  check_metatype = gfs32_to_cpu(check_metatype);
+  if((check_magic != GFS_MAGIC) || (type && (check_metatype != type))){
 	  log_debug("For %"PRIu64" Expected %X:%X - got %X:%X\n", BH_BLKNO(bh), GFS_MAGIC, type,
-		    check_magic, check_type);
+		    check_magic, check_metatype);
     return -1;
   }
   return 0;
@@ -111,11 +111,11 @@
  */
 int check_type(osi_buf_t *bh, int type){
   uint32 check_magic = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_magic;
-  uint32 check_type = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
+  uint32 check_metatype = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
  
   check_magic = gfs32_to_cpu(check_magic);
-  check_type = gfs32_to_cpu(check_type);
-  if((check_magic != GFS_MAGIC) || (check_type != type)){
+  check_metatype = gfs32_to_cpu(check_metatype);
+  if((check_magic != GFS_MAGIC) || (check_metatype != type)){
     return -1;
   }
   return 0;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_grow/main.c cluster-3.0.0.rc3/gfs/gfs_grow/main.c
--- cluster-3.0.0.rc2/gfs/gfs_grow/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_grow/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -68,7 +68,7 @@
  */
 
 static uint64_t
-device_geometry(char *device)
+device_geometry(char *device_g)
 {
 	int fd;
 	uint64_t bytes;
@@ -77,10 +77,10 @@
 	if (override_device_size)
 		bytes = override_device_size;
 	else {
-		fd = open(device, O_RDONLY);
+		fd = open(device_g, O_RDONLY);
 		if (fd < 0) {
 			fprintf(stderr, "gfs_grow: can't open %s: %s\n",
-				device, strerror(errno));
+				device_g, strerror(errno));
 			exit(EXIT_FAILURE);
 		}
 
@@ -88,7 +88,7 @@
 		if (error) {
 			fprintf(stderr,
 				"gfs_grow: can't determine size of %s: %s\n",
-				device, strerror(errno));
+				device_g, strerror(errno));
 			exit(EXIT_FAILURE);
 		}
 
@@ -110,10 +110,13 @@
  */
 
 static int
-jread(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
+jread(int fd, const char *file, void *buf, uint64_t size, uint64_t *offset)
 {
 	struct gfs_ioctl gi;
-	char *argv[] = { "do_hfile_read", file };
+	char *argv[] = {
+		(char *)"do_hfile_read",
+		(char *)file
+	};
 	int error;
 
 	gi.gi_argc = 2;
@@ -141,10 +144,13 @@
  */
 
 static int
-jwrite(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
+jwrite(int fd, const char *file, void *buf, uint64_t size, uint64_t *offset)
 {
 	struct gfs_ioctl gi;
-	char *argv[] = { "do_hfile_write", file };
+	char *argv[] = {
+		(char *)"do_hfile_write",
+		(char *)file
+	};
 	int error;
 
 	gi.gi_argc = 2;
@@ -373,10 +379,13 @@
  */
 
 static uint64_t
-get_length(int fd, char *file)
+get_length(int fd, const char *file)
 {
 	struct gfs_ioctl gi;
-	char *argv[] = { "get_hfile_stat", file };
+	char *argv[] = {
+		(char *)"get_hfile_stat",
+		(char *)file
+	};
 	struct gfs_dinode di;
 	int error;
 
@@ -540,7 +549,7 @@
 {
 	int fd;
 	struct gfs_ioctl gi;
-	char *argv[] = { "get_super" };
+	char *argv[] = { (char *)"get_super" };
 	int error;
 
 	fd = open(fspath, O_RDONLY);
@@ -653,7 +662,7 @@
  *
  */
 
-uint64_t
+static uint64_t
 rgrp_length(uint64_t size)
 {
 	uint64_t bitbytes = RGRP_BITMAP_BLKS(&fs_sb) + 1;
@@ -681,7 +690,7 @@
  * Returns: The end of the new resource group
  */
 
-uint64_t
+static uint64_t
 make_rgrp(uint64_t offset, uint64_t size)
 {
 	struct rglist_entry *rgl = malloc(sizeof(struct rglist_entry));
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_jadd/main.c cluster-3.0.0.rc3/gfs/gfs_jadd/main.c
--- cluster-3.0.0.rc2/gfs/gfs_jadd/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_jadd/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -76,7 +76,7 @@
  */
 
 static uint64_t
-device_geometry(char *device)
+device_geometry(char *device_g)
 {
 	int fd;
 	uint64_t bytes;
@@ -85,10 +85,10 @@
 	if (override_device_size)
 		bytes = override_device_size;
 	else {
-		fd = open(device, O_RDONLY);
+		fd = open(device_g, O_RDONLY);
 		if (fd < 0) {
 			fprintf(stderr, "gfs_jadd: can't open %s: %s\n",
-				device, strerror(errno));
+				device_g, strerror(errno));
 			exit(EXIT_FAILURE);
 		}
 
@@ -96,7 +96,7 @@
 		if (error) {
 			fprintf(stderr,
 				"gfs_grow: can't determine size of %s: %s\n",
-				device, strerror(errno));
+				device_g, strerror(errno));
 			exit(EXIT_FAILURE);
 		}
 
@@ -117,11 +117,14 @@
  * Returns: Error code, or amount of data read
  */
 
-int
-jread(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
+static int
+jread(int fd, const char *file, void *buf, uint64_t size, uint64_t *offset)
 {
 	struct gfs_ioctl gi;
-	char *argv[] = { "do_hfile_read", file };
+	char *argv[] = {
+		(char *)"do_hfile_read",
+		(char *)file
+	};
 	int error;
 
 	gi.gi_argc = 2;
@@ -148,11 +151,14 @@
  * Returns: Error code, or the amount of data written
  */
 
-int
-jwrite(int fd, char *file, void *buf, uint64_t size, uint64_t *offset)
+static int
+jwrite(int fd, const char *file, void *buf, uint64_t size, uint64_t *offset)
 {
 	struct gfs_ioctl gi;
-	char *argv[] = { "do_hfile_write", file };
+	char *argv[] = {
+		(char *)"do_hfile_write",
+		(char *)file
+	};
 	int error;
 
 	gi.gi_argc = 2;
@@ -389,10 +395,13 @@
  */
 
 static uint64_t
-get_length(int fd, char *file)
+get_length(int fd, const char *file)
 {
 	struct gfs_ioctl gi;
-	char *argv[] = { "get_hfile_stat", file };
+	char *argv[] = {
+		(char *)"get_hfile_stat",
+		(char *)file
+	};
 	struct gfs_dinode di;
 	int error;
 
@@ -500,7 +509,9 @@
 {
 	int fd;
 	struct gfs_ioctl gi;
-	char *argv[] = { "get_super" };
+	char *argv[] = {
+		(char *)"get_super"
+	};
 	int error;
 
 	fd = open(fspath, O_RDONLY);
@@ -620,7 +631,7 @@
  *
  */
 
-uint64_t
+static uint64_t
 make_journal(uint64_t offset, uint64_t size)
 {
 	struct jilist_entry *jil = malloc(sizeof(struct jilist_entry));
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_mkfs/main.c cluster-3.0.0.rc3/gfs/gfs_mkfs/main.c
--- cluster-3.0.0.rc2/gfs/gfs_mkfs/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_mkfs/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -34,7 +34,7 @@
  *
  */
 
-static void print_usage()
+static void print_usage(void)
 {
   printf("Usage:\n");
   printf("\n");
@@ -204,7 +204,7 @@
  *
  */
 
-void are_you_sure(commandline_t *comline)
+static void are_you_sure(commandline_t *comline)
 {
 	char input[32];
 	struct volume_id *vid = NULL;
@@ -250,7 +250,7 @@
  *
  */
 
-void check_mount(char *device)
+static void check_mount(char *device)
 {
 	struct stat st_buf;
 	int fd;
@@ -281,7 +281,7 @@
  *
  */
 
-void print_results(commandline_t *comline)
+static void print_results(commandline_t *comline)
 {
   if (comline->quiet)
     return;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_mkfs/Makefile cluster-3.0.0.rc3/gfs/gfs_mkfs/Makefile
--- cluster-3.0.0.rc2/gfs/gfs_mkfs/Makefile	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_mkfs/Makefile	2009-06-11 11:02:55.000000000 +0200
@@ -18,11 +18,10 @@
 	structures.o
 
 CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${gfskincdir} -I${volidincdir}
+CFLAGS += -I${gfskincdir}
 CFLAGS += -I$(S)/../include -I$(S)/../libgfs
 CFLAGS += -I${incdir}
 
-LDFLAGS += -L${volidlibdir} -lvolume_id
 LDFLAGS += -L../libgfs -lgfs
 LDFLAGS += -L${libdir}
 
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_mkfs/structures.c cluster-3.0.0.rc3/gfs/gfs_mkfs/structures.c
--- cluster-3.0.0.rc2/gfs/gfs_mkfs/structures.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_mkfs/structures.c	2009-06-11 11:02:55.000000000 +0200
@@ -365,7 +365,7 @@
 
 static char *fill_rindex(commandline_t *comline, osi_list_t *rlist)
 {
-	struct gfs_rindex *ri, rindex;
+	struct gfs_rindex *ri, grindex;
 	rgrp_list_t *rl;
 	osi_list_t *tmp;
 	char *buf;
@@ -402,10 +402,10 @@
 		printf("\nResource Index data:\n");
 
 		for (r = 0; r < comline->rgrps; r++) {
-			gfs_rindex_in(&rindex, buf + r * sizeof(struct gfs_rindex));
+			gfs_rindex_in(&grindex, buf + r * sizeof(struct gfs_rindex));
 
 			printf("\n  Resource index %d\n", r);
-			gfs_rindex_print(&rindex);
+			gfs_rindex_print(&grindex);
 		}
 	}
 	return buf;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_quota/check.c cluster-3.0.0.rc3/gfs/gfs_quota/check.c
--- cluster-3.0.0.rc2/gfs/gfs_quota/check.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_quota/check.c	2009-06-11 11:02:55.000000000 +0200
@@ -195,7 +195,10 @@
 	hidden_blocks = compute_hidden_blocks(comline, fd);
 
 	do {
-		char *argv[] = { "do_hfile_read", "quota" };
+		char *argv[] = {
+			(char *)"do_hfile_read",
+			(char *)"quota"
+		};
 
 		gi.gi_argc = 2;
 		gi.gi_argv = argv;
@@ -238,7 +241,7 @@
  */
 
 static void
-print_list(char *str, osi_list_t *list)
+print_list(const char *str, osi_list_t *list)
 {
 #if 0
 	osi_list_t *tmp;
@@ -261,7 +264,7 @@
  */
 
 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;
@@ -444,7 +447,10 @@
 		value = cpu_to_gfs64(value);
 
 		{
-			char *argv[] = { "do_hfile_write", "quota"};
+			char *argv[] = {
+				(char *)"do_hfile_write",
+				(char *)"quota"
+			};
 
 			gi.gi_argc = 2;
 			gi.gi_argv = argv;
@@ -463,7 +469,10 @@
 			v->v_id);
 
 		{
-			char *argv[] = { "do_quota_refresh", buf };
+			char *argv[] = {
+				(char *)"do_quota_refresh",
+				(char *)buf
+			};
 
 			gi.gi_argc = 2;
 			gi.gi_argv = argv;
@@ -507,7 +516,10 @@
 
 	for (;;) {
 		{
-			char *argv[] = { "do_hfile_read", "quota" };
+			char *argv[] = {
+				(char *)"do_hfile_read",
+				(char *)"quota"
+			};
 
 			gi.gi_argc = 2;
 			gi.gi_argv = argv;
@@ -526,7 +538,10 @@
 		value = cpu_to_gfs64(value);
 
 		{
-			char *argv[] = { "do_hfile_write", "quota" };
+			char *argv[] = {
+				(char *)"do_hfile_write",
+				(char *)"quota"
+			};
 
 			gi.gi_argc = 2;
 			gi.gi_argv = argv;
@@ -545,7 +560,10 @@
 			0);
 
 		{
-			char *argv[] = { "do_quota_refresh", buf };
+			char *argv[] = {
+				(char *)"do_quota_refresh",
+				(char *)buf
+			};
 
 			gi.gi_argc = 2;
 			gi.gi_argv = argv;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_quota/gfs_quota.h cluster-3.0.0.rc3/gfs/gfs_quota/gfs_quota.h
--- cluster-3.0.0.rc2/gfs/gfs_quota/gfs_quota.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_quota/gfs_quota.h	2009-06-11 11:02:55.000000000 +0200
@@ -77,6 +77,10 @@
 void do_get_super(int fd, struct gfs_sb *sb);
 void do_sync(commandline_t *comline);
 uint64_t compute_hidden_blocks(commandline_t *comline, int fd);
+void print_quota(commandline_t *comline,
+            int user, uint32_t id,
+            struct gfs_quota *q,
+            struct gfs_sb *sb);
 
 /*  check.c  */
 
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_quota/layout.c cluster-3.0.0.rc3/gfs/gfs_quota/layout.c
--- cluster-3.0.0.rc2/gfs/gfs_quota/layout.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_quota/layout.c	2009-06-11 11:02:55.000000000 +0200
@@ -22,12 +22,6 @@
 
 #define LAYOUT_DATA_QUANTUM (4194304)
 
-extern void
-print_quota(commandline_t *comline,
-            int user, uint32_t id,
-            struct gfs_quota *q,
-            struct gfs_sb *sb);
-
 struct extent {
         osi_list_t list;
 
@@ -143,7 +137,7 @@
         osi_list_t *tmp;
         buffer_t *b;
         struct gfs_meta_header mh;
-        char *type;
+        const char *type;
 
         for (tmp = w->blist.next; tmp != &w->blist; tmp = tmp->next) {
                 b = osi_list_entry(tmp, buffer_t, list);
@@ -391,7 +385,7 @@
  *
  */
 
-void
+static void
 compute_layout(char *path)
 {
         world_t w;
@@ -413,7 +407,9 @@
         check_for_gfs(fd, path);
 
         {
-                char *argv[] = { "get_super" };
+                char *argv[] = {
+			(char *)"get_super"
+		};
 
                 gi.gi_argc = 1;
                 gi.gi_argv = argv;
@@ -436,7 +432,9 @@
         w.hash_ptrs = w.hash_bsize / sizeof(uint64_t);
 
         for (;;) {
-                char *argv[] = { "get_file_meta_quota" };
+                char *argv[] = {
+			(char *)"get_file_meta_quota"
+		};
 
                 w.buf_data = malloc(w.buf_size);
                 if (!w.buf_data)
@@ -479,7 +477,7 @@
  * @argv:
  *
  */
-void 
+static void 
 print_quota_range(commandline_t *comline, int type, uint64_t start, 
                   unsigned int len)
 {
@@ -529,7 +527,10 @@
                 hidden_blocks = compute_hidden_blocks(comline, fd);
 
         do {
-                char *argv[] = { "do_hfile_read", "quota" };
+                char *argv[] = {
+			(char *)"do_hfile_read",
+			(char *)"quota"
+		};
 
                 gi.gi_argc = 2;
                 gi.gi_argv = argv;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_quota/main.c cluster-3.0.0.rc3/gfs/gfs_quota/main.c
--- cluster-3.0.0.rc2/gfs/gfs_quota/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_quota/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -36,7 +36,7 @@
  */
 
 static void
-print_usage()
+print_usage(void)
 {
 	printf("Usage:\n");
 	printf("\n");
@@ -96,7 +96,9 @@
 do_get_super(int fd, struct gfs_sb *sb)
 {
 	struct gfs_ioctl gi;
-	char *argv[] = { "get_super" };
+	char *argv[] = {
+		(char *)"get_super"
+	};
 	int error;
 
 	gi.gi_argc = 1;
@@ -260,7 +262,10 @@
 	int error;
 
 	{
-		char *argv[] = { "get_hfile_stat", "jindex" };
+		char *argv[] = {
+			(char *)"get_hfile_stat",
+			(char *)"jindex"
+		};
 
 		gi.gi_argc = 2;
 		gi.gi_argv = argv;	
@@ -275,7 +280,10 @@
 	}
 
 	{
-		char *argv[] = { "get_hfile_stat", "rindex" };
+		char *argv[] = {
+			(char *)"get_hfile_stat",
+			(char *)"rindex"
+		};
 
 		gi.gi_argc = 2;
 		gi.gi_argv = argv;	
@@ -290,7 +298,10 @@
 	}
 
 	{
-		char *argv[] = { "get_hfile_stat", "quota" };
+		char *argv[] = {
+			(char *)"get_hfile_stat",
+			(char *)"quota"
+		};
 
 		gi.gi_argc = 2;
 		gi.gi_argv = argv;	
@@ -305,7 +316,10 @@
 	}
 
 	{
-		char *argv[] = { "get_hfile_stat", "license" };
+		char *argv[] = {
+			(char *)"get_hfile_stat",
+			(char *)"license"
+		};
 
 		gi.gi_argc = 2;
 		gi.gi_argv = argv;	
@@ -402,7 +416,9 @@
 do_sync_one(char *filesystem)
 {
 	int fd;
-	char *argv[] = { "do_quota_sync" };
+	char *argv[] = {
+		(char *)"do_quota_sync"
+	};
 	struct gfs_ioctl gi;
 	int error;
 
@@ -485,7 +501,10 @@
 		comline->id);
 
 	{
-		char *argv[] = { "do_quota_read", buf };
+		char *argv[] = {
+			(char *)"do_quota_read",
+			(char *)buf
+		};
 
 		gi.gi_argc = 2;
 		gi.gi_argv = argv;
@@ -639,7 +658,10 @@
 	new_value = cpu_to_gfs64(new_value);
 
 	{
-		char *argv[] = { "do_hfile_write", "quota" };
+		char *argv[] = {
+			(char *)"do_hfile_write",
+			(char *)"quota"
+		};
 
 		gi.gi_argc = 2;
 		gi.gi_argv = argv;
@@ -658,7 +680,10 @@
 		comline->id);
 
 	{
-		char *argv[] = { "do_quota_refresh", buf };
+		char *argv[] = {
+			(char *)"do_quota_refresh",
+			(char *)buf
+		};
 
 		gi.gi_argc = 2;
 		gi.gi_argv = argv;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_tool/counters.c cluster-3.0.0.rc3/gfs/gfs_tool/counters.c
--- cluster-3.0.0.rc2/gfs/gfs_tool/counters.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_tool/counters.c	2009-06-11 11:02:55.000000000 +0200
@@ -172,12 +172,14 @@
 
 	for (;;) {
 		struct gfs_ioctl gi;
-		char *argv[] = { "get_counters" };
+		char *local_argv[] = {
+			(char *)"get_counters"
+		};
 		char data[SIZE];
 		int error;
 
 		gi.gi_argc = 1;
-		gi.gi_argv = argv;
+		gi.gi_argv = local_argv;
 		gi.gi_data = data;
 		gi.gi_size = SIZE;
 
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_tool/df.c cluster-3.0.0.rc3/gfs/gfs_tool/df.c
--- cluster-3.0.0.rc2/gfs/gfs_tool/df.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_tool/df.c	2009-06-11 11:02:55.000000000 +0200
@@ -40,28 +40,28 @@
  * printit - parse out and print values according to the output type
  */
 static void printit(char *stat_gfs, const char *label, uint64_t used,
-		    uint64_t free, unsigned int percentage)
+		    uint64_t free_space, unsigned int percentage)
 {
 	uint64_t block_size = name2u64(stat_gfs, "bsize");
 
 	switch (output_type) {
 	case OUTPUT_BLOCKS:
 		printf("  %-15s%-15"PRIu64"%-15"PRIu64"%-15"PRIu64"%u%%\n",
-		       label, used + free, used, free, percentage);
+		       label, used + free_space, used, free_space, percentage);
 		break;
 	case OUTPUT_K:
 		printf("  %-15s%-15"PRIu64"%-15"PRIu64"%-15"PRIu64"%u%%\n",
-		       label, ((used + free) * block_size) / 1024,
-		       (used * block_size) / 1024, (free * block_size) / 1024,
+		       label, ((used + free_space) * block_size) / 1024,
+		       (used * block_size) / 1024, (free_space * block_size) / 1024,
 		       percentage);
 		break;
 	case OUTPUT_HUMAN:
 		/* Need to do three separate printfs here because function
 		   anthropomorphize re-uses the same static space. */
 		printf("  %-15s%-15s", label,
-		       anthropomorphize((used + free) * block_size));
+		       anthropomorphize((used + free_space) * block_size));
 		printf("%-15s", anthropomorphize(used * block_size));
-		printf("%-15s%u%%\n", anthropomorphize(free * block_size),
+		printf("%-15s%u%%\n", anthropomorphize(free_space * block_size),
 		       percentage);
 		break;
 	}
@@ -96,7 +96,9 @@
 
 
 	{
-		char *argv[] = { "get_stat_gfs" };
+		char *argv[] = {
+			(char *)"get_stat_gfs"
+		};
 
 		gi.gi_argc = 1;
 		gi.gi_argv = argv;
@@ -109,7 +111,9 @@
 			    error, strerror(errno));
 	}
 	{
-		char *argv[] = { "get_super" };
+		char *argv[] = {
+			(char *)"get_super"
+		};
 
 		gi.gi_argc = 1;
 		gi.gi_argv = argv;
@@ -122,7 +126,9 @@
 			    error, strerror(errno));
 	}
 	{
-		char *argv[] = { "get_args" };
+		char *argv[] = {
+			(char *)"get_args"
+		};
 
 		gi.gi_argc = 1;
 		gi.gi_argv = argv;
@@ -135,7 +141,9 @@
 			    error, strerror(errno));
 	}
 	{
-		char *argv[] = { "get_lockstruct" };
+		char *argv[] = {
+			(char *)"get_lockstruct"
+		};
 
 		gi.gi_argc = 1;
 		gi.gi_argv = argv;
@@ -148,8 +156,10 @@
 			    error, strerror(errno));
 	}
 	{
-		char *argv[] = { "get_hfile_stat",
-				 "jindex" };
+		char *argv[] = {
+			(char *)"get_hfile_stat",
+			(char *)"jindex"
+		};
 
 		gi.gi_argc = 2;
 		gi.gi_argv = argv;
@@ -162,8 +172,10 @@
 			    error, strerror(errno));
 	}
 	{
-		char *argv[] = { "get_hfile_stat",
-				 "rindex" };
+		char *argv[] = {
+			(char *)"get_hfile_stat",
+			(char *)"rindex"
+		};
 
 		gi.gi_argc = 2;
 		gi.gi_argv = argv;
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_tool/gfs_tool.h cluster-3.0.0.rc3/gfs/gfs_tool/gfs_tool.h
--- cluster-3.0.0.rc2/gfs/gfs_tool/gfs_tool.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_tool/gfs_tool.h	2009-06-11 11:02:55.000000000 +0200
@@ -86,9 +86,9 @@
 char *get_list(void);
 char **str2lines(char *str);
 char *mp2cookie(char *mp, int ioctl_ok);
-char *name2value(char *str, char *name);
-uint32_t name2u32(char *str, char *name);
-uint64_t name2u64(char *str, char *name);
+char *name2value(char *str, const char *name);
+uint32_t name2u32(char *str, const char *name);
+uint64_t name2u64(char *str, const char *name);
 
 
 #endif /* __GFS_TOOL_DOT_H__ */
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_tool/layout.c cluster-3.0.0.rc3/gfs/gfs_tool/layout.c
--- cluster-3.0.0.rc2/gfs/gfs_tool/layout.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_tool/layout.c	2009-06-11 11:02:55.000000000 +0200
@@ -106,7 +106,7 @@
 	osi_list_t *tmp;
 	buffer_t *b;
 	struct gfs_meta_header mh;
-	char *type;
+	const char *type;
 
 	for (tmp = w->blist.next; tmp != &w->blist; tmp = tmp->next) {
 		b = osi_list_entry(tmp, buffer_t, list);
@@ -321,7 +321,7 @@
 	struct gfs_leaf leaf;
 	uint32_t hsize, len;
 	uint32_t ht_offset, lp_offset, ht_offset_cur = -1;
-	uint32_t index = 0;
+	uint32_t lindex = 0;
 	uint64_t lp[w->hash_ptrs];
 	uint64_t leaf_no;
 
@@ -329,9 +329,9 @@
 	if (hsize * sizeof(uint64_t) != w->di.di_size)
 		die("bad hash table size\n");
 
-	while (index < hsize) {
-		lp_offset = index % w->hash_ptrs;
-		ht_offset = index - lp_offset;
+	while (lindex < hsize) {
+		lp_offset = lindex % w->hash_ptrs;
+		ht_offset = lindex - lp_offset;
 
 		if (ht_offset_cur != ht_offset) {
 			journaled_read(w, (char *) lp,
@@ -349,12 +349,12 @@
 
 		len = 1 << (w->di.di_depth - leaf.lf_depth);
 
-		lc(w, index, len, leaf_no, data);
+		lc(w, lindex, len, leaf_no, data);
 
-		index += len;
+		lindex += len;
 	}
 
-	if (index != hsize)
+	if (lindex != hsize)
 		die("screwed up directory\n");
 }
 
@@ -461,7 +461,7 @@
 {
 	do_pf_t pf;
 	unsigned int h;
-	char *type;
+	const char *type;
 
 	switch (w->di.di_type) {
 	case GFS_FILE_REG:
@@ -540,7 +540,7 @@
  */
 
 static void
-do_lc(world_t *w, uint32_t index, uint32_t len, uint64_t leaf_no, void *data)
+do_lc(world_t *w, uint32_t lindex, uint32_t len, uint64_t leaf_no, void *data)
 {
 	buffer_t *b;
 	struct gfs_leaf leaf;
@@ -551,8 +551,8 @@
 		gfs_leaf_in(&leaf, b->data);
 
 		printf("  %.8X             %.8X             %-20" PRIu64
-		       " %u\n", index << (32 - w->di.di_depth),
-		       ((index + len) << (32 - w->di.di_depth)) - 1, blk,
+		       " %u\n", lindex << (32 - w->di.di_depth),
+		       ((lindex + len) << (32 - w->di.di_depth)) - 1, blk,
 		       leaf.lf_entries);
 	}
 
@@ -598,17 +598,16 @@
 			  sizeof(struct gfs_meta_header)))
 
 static void
-print_eattr_data(world_t *w, uint64_t blkno, int *first)
+print_eattr_data(world_t *w, uint64_t eblkno, int *first)
 {
-	buffer_t *b = getbuf(w, blkno);
 	struct gfs_ea_header *ea;
 
-	ea = GFS_EA_BH2FIRST(b);
+	ea = GFS_EA_BH2FIRST(getbuf(w, eblkno));
 	for (;;) {
 		if (!GFS_EA_IS_STUFFED(ea)) {
 			char name[300];
 			uint64_t *p, blkno;
-			uint64_t b;
+			uint64_t d;
 			unsigned int l;
 			unsigned int x;
 			int c;
@@ -623,7 +622,6 @@
 			if (ea->ea_type == GFS_EATYPE_UNUSED)
 				strcpy(name, "unused");
 			else {
-				unsigned int x;
 				switch (ea->ea_type) {
 				case GFS_EATYPE_USR:
 					strcpy(name, "user.");
@@ -641,31 +639,32 @@
 				name[x + ea->ea_name_len] = 0;
 			}
 
-			b = 0;
+			d = 0;
 			l = 0;
+			x = 0;
 			c = FALSE;
 
 			p = GFS_EA2DATAPTRS(ea);
 			for (x = 0; x < ea->ea_num_ptrs; x++) {
 				blkno = gfs64_to_cpu(*p);
-				if (b + l == blkno)
+				if (d + l == blkno)
 					l++;
 				else {
-					if (b) {
+					if (d) {
 						printf("  %-20" PRIu64
-						       " %-10u %s\n", b, l,
+						       " %-10u %s\n", d, l,
 						       name);
 						if (!c) {
 							strcat(name, " (cont)");
 							c = TRUE;
 						}
 					}
-					b = blkno;
+					d = blkno;
 					l = 1;
 				}
 				p++;
 			}
-			printf("  %-20" PRIu64 " %-10u %s\n", b, l, name);
+			printf("  %-20" PRIu64 " %-10u %s\n", d, l, name);
 		}
 		if (GFS_EA_IS_LAST(ea))
 			break;
@@ -775,10 +774,12 @@
 	check_for_gfs(fd, path);
 
 	{
-		char *argv[] = { "get_super" };
+		char *local_argv[] = {
+			(char *)"get_super"
+		};
 
 		gi.gi_argc = 1;
-		gi.gi_argv = argv;
+		gi.gi_argv = local_argv;
 		gi.gi_data = (char *)&w.sb;
 		gi.gi_size = sizeof(struct gfs_sb);
 
@@ -797,14 +798,16 @@
 	w.hash_ptrs = w.hash_bsize / sizeof(uint64_t);
 
 	for (;;) {
-		char *argv[] = { "get_file_meta" };
+		char *local_argv[] = {
+			(char *)"get_file_meta"
+		};
 
 		w.buf_data = malloc(w.buf_size);
 		if (!w.buf_data)
 			die("out of memory\n");
 
 		gi.gi_argc = 1;
-		gi.gi_argv = argv;
+		gi.gi_argv = local_argv;
 		gi.gi_data = w.buf_data;
 		gi.gi_size = w.buf_size;
 
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_tool/misc.c cluster-3.0.0.rc3/gfs/gfs_tool/misc.c
--- cluster-3.0.0.rc2/gfs/gfs_tool/misc.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_tool/misc.c	2009-06-11 11:02:55.000000000 +0200
@@ -27,7 +27,9 @@
 void
 do_file_flush(int argc, char **argv)
 {
-	char *gi_argv[] = { "do_file_flush" };
+	char *gi_argv[] = {
+		(char *)"do_file_flush"
+	};
 	struct gfs_ioctl gi;
 	int fd;
 	int error;
@@ -250,7 +252,7 @@
 set_flag(int argc, char **argv)
 {
 	struct gfs_dinode di;
-	char *set;
+	const char *set;
 	char *flag;
 	struct gfs_ioctl gi;
 	int fd;
@@ -273,9 +275,11 @@
 		check_for_gfs(fd, argv[optind]);
 
 		{
-			char *gi_argv[] = { "set_file_flag",
-					    set,
-					    flag };
+			char *gi_argv[] = {
+				(char *)"set_file_flag",
+				(char *)set,
+				(char *)flag
+			};
 			gi.gi_argc = 3;
 			gi.gi_argv = gi_argv;
 
@@ -299,7 +303,9 @@
 print_stat(int argc, char **argv)
 {
 	int fd;
-	char *gi_argv[] = { "get_file_stat" };
+	char *gi_argv[] = {
+		(char *)"get_file_stat"
+	};
 	struct gfs_ioctl gi;
 	struct gfs_dinode di;
 	int error;
@@ -341,7 +347,9 @@
 print_sb(int argc, char **argv)
 {
 	int fd;
-	char *gi_argv[] = { "get_super" };
+	char *gi_argv[] = {
+		(char *)"get_super"
+	};
 	struct gfs_ioctl gi;
 	struct gfs_sb sb;
 	int error;
@@ -398,12 +406,14 @@
 
 
 	{
-		char *argv[] = { "get_hfile_stat",
-				 "jindex" };
+		char *local_argv[] = {
+			(char *)"get_hfile_stat",
+			(char *)"jindex"
+		};
 		struct gfs_dinode di;
 
 		gi.gi_argc = 2;
-		gi.gi_argv = argv;
+		gi.gi_argv = local_argv;
 		gi.gi_data = (char *)&di;
 		gi.gi_size = sizeof(struct gfs_dinode);
 
@@ -417,13 +427,15 @@
 
 
 	for (offset = 0, x = 0; ; offset += sizeof(struct gfs_jindex), x++) {
-		char *argv[] = { "do_hfile_read",
-				 "jindex" };
+		char *local_argv[] = {
+			(char *)"do_hfile_read",
+			(char *)"jindex"
+		};
 		char buf[sizeof(struct gfs_jindex)];
 		struct gfs_jindex ji;
 		
 		gi.gi_argc = 2;
-		gi.gi_argv = argv;
+		gi.gi_argv = local_argv;
 		gi.gi_data = buf;
 		gi.gi_size = sizeof(struct gfs_jindex);
 		gi.gi_offset = offset;
@@ -473,12 +485,14 @@
 
 
 	{
-		char *argv[] = { "get_hfile_stat",
-				 "rindex" };
+		char *local_argv[] = {
+			(char *)"get_hfile_stat",
+			(char *)"rindex"
+		};
 		struct gfs_dinode di;
 
 		gi.gi_argc = 2;
-		gi.gi_argv = argv;
+		gi.gi_argv = local_argv;
 		gi.gi_data = (char *)&di;
 		gi.gi_size = sizeof(struct gfs_dinode);
 
@@ -492,13 +506,15 @@
 
 
 	for (offset = 0, x = 0; ; offset += sizeof(struct gfs_rindex), x++) {
-		char *argv[] = { "do_hfile_read",
-				 "rindex" };
+		char *local_argv[] = {
+			(char *)"do_hfile_read",
+			(char *)"rindex"
+		};
 		char buf[sizeof(struct gfs_rindex)];
 		struct gfs_rindex ri;
 		
 		gi.gi_argc = 2;
-		gi.gi_argv = argv;
+		gi.gi_argv = local_argv;
 		gi.gi_data = buf;
 		gi.gi_size = sizeof(struct gfs_rindex);
 		gi.gi_offset = offset;
@@ -548,12 +564,14 @@
 
 
 	{
-		char *argv[] = { "get_hfile_stat",
-				 "quota" };
+		char *local_argv[] = {
+			(char *)"get_hfile_stat",
+			(char *)"quota"
+		};
 		struct gfs_dinode di;
 
 		gi.gi_argc = 2;
-		gi.gi_argv = argv;
+		gi.gi_argv = local_argv;
 		gi.gi_data = (char *)&di;
 		gi.gi_size = sizeof(struct gfs_dinode);
 
@@ -567,13 +585,15 @@
 
 
 	for (offset = 0, x = 0; ; offset += sizeof(struct gfs_quota), x++) {
-		char *argv[] = { "do_hfile_read",
-				 "quota" };
+		char *local_argv[] = {
+			(char *)"do_hfile_read",
+			(char *)"quota"
+		};
 		char buf[sizeof(struct gfs_quota)];
 		struct gfs_quota q;
 		
 		gi.gi_argc = 2;
-		gi.gi_argv = argv;
+		gi.gi_argv = local_argv;
 		gi.gi_data = buf;
 		gi.gi_size = sizeof(struct gfs_quota);
 		gi.gi_offset = offset;
@@ -624,7 +644,9 @@
 reclaim_metadata(int argc, char **argv)
 {
 	int fd;
-	char *gi_argv[] = { "do_reclaim" };
+	char *gi_argv[] = {
+		(char *)"do_reclaim"
+	};
 	struct gfs_ioctl gi;
 	char buf[256];
 
@@ -671,7 +693,9 @@
 do_shrink(int argc, char **argv)
 {
 	int fd;
-	char *gi_argv[] = { "do_shrink" };
+	char *gi_argv[] = {
+		(char *)"do_shrink"
+	};
 	struct gfs_ioctl gi;
 
 	if (optind == argc)
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_tool/tune.c cluster-3.0.0.rc3/gfs/gfs_tool/tune.c
--- cluster-3.0.0.rc2/gfs/gfs_tool/tune.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_tool/tune.c	2009-06-11 11:02:55.000000000 +0200
@@ -29,7 +29,9 @@
 get_tune(int argc, char **argv)
 {
 	int fd;
-	char *gi_argv[] = { "get_tune" };
+	char *gi_argv[] = {
+		(char *)"get_tune"
+	};
 	struct gfs_ioctl gi;
 	char str[SIZE], str2[SIZE];
 	char **lines, **l;
@@ -121,10 +123,14 @@
 	}
 
 	{
-		char *argv[] = { "set_tune", param, value };
+		char *local_argv[] = {
+			(char *)"set_tune",
+			(char *)param,
+			(char *)value
+		};
 
 		gi.gi_argc = 3;
-		gi.gi_argv = argv;
+		gi.gi_argv = local_argv;
 
 		if (ioctl(fd, GFS_IOCTL_SUPER, &gi))
 			die("can't change tunable parameter %s: %s\n",
diff -Naurd cluster-3.0.0.rc2/gfs/gfs_tool/util.c cluster-3.0.0.rc3/gfs/gfs_tool/util.c
--- cluster-3.0.0.rc2/gfs/gfs_tool/util.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/gfs_tool/util.c	2009-06-11 11:02:55.000000000 +0200
@@ -170,7 +170,9 @@
 
 	if (ioctl_ok) {
 		struct gfs_ioctl gi;
-		char *argv[] = { "get_cookie" };
+		char *argv[] = {
+			(char *)"get_cookie"
+		};
 		int fd;
 
 		gi.gi_argc = 1;
@@ -206,7 +208,7 @@
  */
 
 char *
-name2value(char *str_in, char *name)
+name2value(char *str_in, const char *name)
 {
 	char str[strlen(str_in) + 1];
 	static char value[256];
@@ -240,7 +242,7 @@
  */
 
 uint32_t
-name2u32(char *str, char *name)
+name2u32(char *str, const char *name)
 {
 	char *value = name2value(str, name);
 	uint32_t x = 0;
@@ -259,7 +261,7 @@
  */
 
 uint64_t
-name2u64(char *str, char *name)
+name2u64(char *str, const char *name)
 {
 	char *value = name2value(str, name);
 	uint64_t x = 0;
diff -Naurd cluster-3.0.0.rc2/gfs/libgfs/file.c cluster-3.0.0.rc3/gfs/libgfs/file.c
--- cluster-3.0.0.rc2/gfs/libgfs/file.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/libgfs/file.c	2009-06-11 11:02:55.000000000 +0200
@@ -11,7 +11,7 @@
  *
  * Returns: The amount of data actually copied or the error
  */
-int readi(int disk_fd, struct gfs_inode *ip, void *buf, uint64 offset,
+int readi(int disk_fd, struct gfs_inode *ip, void *bufin, uint64 offset,
 		  unsigned int size)
 {
 	struct gfs_sbd *sdp = ip->i_sbd;
@@ -23,6 +23,7 @@
 	int journaled = fs_is_jdata(ip);
 	int copied = 0;
 	int error = 0;
+	char *buf = bufin;
 
 	if (offset >= ip->i_di.di_size){
 		log_debug("readi:  Offset (%"PRIu64") is >= "
@@ -109,7 +110,7 @@
  *
  * Returns: The number of bytes correctly written or error code
  */
-int writei(int disk_fd, struct gfs_inode *ip, void *buf, uint64_t offset,
+int writei(int disk_fd, struct gfs_inode *ip, void *bufin, uint64_t offset,
 		   unsigned int size)
 {
 	struct gfs_sbd *sdp = ip->i_sbd;
@@ -122,6 +123,7 @@
 	const uint64_t start = offset;
 	int copied = 0;
 	int error = 0;
+	char *buf = bufin;
 
 	/*  Bomb out on writing nothing.
 	    Posix says we can't change the time here.  */
diff -Naurd cluster-3.0.0.rc2/gfs/libgfs/fs_bits.c cluster-3.0.0.rc3/gfs/libgfs/fs_bits.c
--- cluster-3.0.0.rc2/gfs/libgfs/fs_bits.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/libgfs/fs_bits.c	2009-06-11 11:02:55.000000000 +0200
@@ -28,7 +28,7 @@
 	*byte |= new_state << bit;
 }
 
-uint32_t fs_bitfit_core(struct gfs_sbd *sbp, uint64_t goal, uint64_t start,
+static uint32_t fs_bitfit_core(struct gfs_sbd *sbp, uint64_t goal, uint64_t start,
 						uint64_t len, unsigned char old_state)
 {
 	uint64_t block;
diff -Naurd cluster-3.0.0.rc2/gfs/libgfs/fs_dir.c cluster-3.0.0.rc3/gfs/libgfs/fs_dir.c
--- cluster-3.0.0.rc2/gfs/libgfs/fs_dir.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/libgfs/fs_dir.c	2009-06-11 11:02:55.000000000 +0200
@@ -199,19 +199,19 @@
 /**
  * get_first_leaf - Get first leaf
  * @dip: The GFS inode
- * @index:
+ * @lindex:
  * @bh_out:
  *
  * Returns: 0 on success, error code otherwise
  */
 
-int get_first_leaf(int disk_fd, struct gfs_inode *dip, uint32 index,
+int get_first_leaf(int disk_fd, struct gfs_inode *dip, uint32 lindex,
 				   osi_buf_t **bh_out)
 {
 	uint64 leaf_no;
 	int error;
 
-	error = get_leaf_nr(disk_fd, dip, index, &leaf_no);
+	error = get_leaf_nr(disk_fd, dip, lindex, &leaf_no);
 	if (!error)
 		error = get_leaf(disk_fd, dip, leaf_no, bh_out);
 
@@ -348,7 +348,7 @@
 			      struct gfs_dirent **dent_prev, osi_buf_t **bh_out)
 {
 	osi_buf_t *bh = NULL, *bh_next;
-	uint32 hsize, index;
+	uint32 hsize, lindex;
 	uint32 hash;
 	int error = 0;
 
@@ -362,9 +362,9 @@
 
 	if(id->type == ID_FILENAME){
 		hash = dir_hash(id->filename);
-		index = hash >> (32 - dip->i_di.di_depth);
+		lindex = hash >> (32 - dip->i_di.di_depth);
 
-		error = get_first_leaf(disk_fd, dip, index, &bh_next);
+		error = get_first_leaf(disk_fd, dip, lindex, &bh_next);
 		if (error){
 			return error;
 		}
@@ -395,8 +395,8 @@
 
 		relse_buf(bh);
 	} else if(id->type == ID_INUM){
-		for(index=0; index < (1 << dip->i_di.di_depth); index++){
-			error = get_first_leaf(disk_fd, dip, index, &bh_next);
+		for(lindex=0; lindex < (1 << dip->i_di.di_depth); lindex++){
+			error = get_first_leaf(disk_fd, dip, lindex, &bh_next);
 			if (error){
 				return error;
 			}
@@ -728,12 +728,12 @@
 /**
  * dir_split_leaf - Split a leaf block into two
  * @dip: The GFS inode
- * @index:
+ * @lindex:
  * @leaf_no:
  *
  * Returns: 0 on success, error code on failure
  */
-static int dir_split_leaf(int disk_fd, struct gfs_inode *dip, uint32 index,
+static int dir_split_leaf(int disk_fd, struct gfs_inode *dip, uint32 lindex,
 						  uint64 leaf_no)
 {
 	struct gfs_sbd *sdp = dip->i_sbd;
@@ -792,7 +792,7 @@
 	}
 	half_len = len >> 1;
 
-	start = (index & ~(len - 1));
+	start = (lindex & ~(len - 1));
 
 	log_debug("Splitting leaf: len = %u, half_len = %u\n", len, half_len);
 
@@ -1070,7 +1070,7 @@
 
 
 static int dir_e_del(int disk_fd, struct gfs_inode *dip, osi_filename_t *filename){
-	int index;
+	int lindex;
 	int error;
 	int found = 0;
 	uint64 leaf_no;
@@ -1082,10 +1082,10 @@
 	id.filename = filename;
 	id.inum = NULL;
 
-	index = (1 << (dip->i_di.di_depth))-1;
+	lindex = (1 << (dip->i_di.di_depth))-1;
 
-	for(; (index >= 0) && !found; index--){
-		error = get_leaf_nr(disk_fd, dip, index, &leaf_no);
+	for(; (lindex >= 0) && !found; lindex--){
+		error = get_leaf_nr(disk_fd, dip, lindex, &leaf_no);
 		if (error){
 			log_err("dir_e_del:  Unable to get leaf number.\n");
 			return error;
@@ -1230,7 +1230,7 @@
 	osi_buf_t *bh, *nbh, *dibh;
 	struct gfs_leaf *leaf, *nleaf;
 	struct gfs_dirent *dent;
-	uint32 hsize, index;
+	uint32 hsize, lindex;
 	uint32 hash;
 	uint64 leaf_no, bn;
 	int error;
@@ -1248,10 +1248,10 @@
 	/*  Figure out the address of the leaf node.  */
 
 	hash = dir_hash(filename);
-	index = hash >> (32 - dip->i_di.di_depth);
+	lindex = hash >> (32 - dip->i_di.di_depth);
 
 
-	error = get_leaf_nr(disk_fd, dip, index, &leaf_no);
+	error = get_leaf_nr(disk_fd, dip, lindex, &leaf_no);
 	if (error){
 		log_err("dir_e_add:  Unable to get leaf number.\n");
 		return error;
@@ -1275,7 +1275,7 @@
 				/*  Can we split the leaf?  */
 				relse_buf(bh);
 
-				error = dir_split_leaf(disk_fd, dip, index, leaf_no);
+				error = dir_split_leaf(disk_fd, dip, lindex, leaf_no);
 				if (error){
 					log_err("dir_e_add:  Unable to split leaf.\n");
 					return error;
@@ -1600,21 +1600,21 @@
 
 
 /**
- * get_leaf_nr - Get a leaf number associated with the index
+ * get_leaf_nr - Get a leaf number associated with the lindex
  * @dip: The GFS inode
- * @index:
+ * @lindex:
  * @leaf_out:
  *
  * Returns: 0 on success, error code otherwise
  */
 
-int get_leaf_nr(int disk_fd, struct gfs_inode *dip, uint32 index,
+int get_leaf_nr(int disk_fd, struct gfs_inode *dip, uint32 lindex,
 				uint64 *leaf_out)
 {
 	uint64 leaf_no;
 	int error = -1;
 	error = readi(disk_fd, dip, (char *)&leaf_no,
-				  index * sizeof(uint64), sizeof(uint64));
+				  lindex * sizeof(uint64), sizeof(uint64));
 	if (error != sizeof(uint64)){
 		log_debug("get_leaf_nr:  Bad internal read.  (rtn = %d)\n",
 			  error);
diff -Naurd cluster-3.0.0.rc2/gfs/libgfs/fs_inode.c cluster-3.0.0.rc3/gfs/libgfs/fs_inode.c
--- cluster-3.0.0.rc2/gfs/libgfs/fs_inode.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/libgfs/fs_inode.c	2009-06-11 11:02:55.000000000 +0200
@@ -173,7 +173,7 @@
 	return error;
 }
 
-int fs_createi(int disk_fd, struct gfs_inode *dip, osi_filename_t *name,
+static int fs_createi(int disk_fd, struct gfs_inode *dip, osi_filename_t *name,
 	       unsigned int type, unsigned int mode, osi_cred_t *cred,
 	       int *new, struct gfs_inode **ipp)
 {
@@ -369,7 +369,7 @@
 	struct gfs_inode *ip= NULL;
 	struct gfs_sbd *sdp = dip->i_sbd;
 	osi_filename_t name;
-	int new;
+	int new = 0;
 
 	name.name = (unsigned char *)new_dir;
 	name.len = strlen(new_dir);
diff -Naurd cluster-3.0.0.rc2/gfs/libgfs/libgfs.h cluster-3.0.0.rc3/gfs/libgfs/libgfs.h
--- cluster-3.0.0.rc2/gfs/libgfs/libgfs.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/libgfs/libgfs.h	2009-06-11 11:02:55.000000000 +0200
@@ -202,7 +202,7 @@
 
 void increase_verbosity(void);
 void decrease_verbosity(void);
-void print_log_level(int iif, int priority, char *file, int line, const char *format, ...);
+void print_log_level(int iif, int priority, const char *file, int line, const char *format, ...);
 int query(struct options *opts, const char *format, ...);
 
 /* ------------------------------------------------------------------------- */
@@ -380,13 +380,16 @@
 /* ------------------------------------------------------------------------- */
 /* formerly super.h:                                                         */
 /* ------------------------------------------------------------------------- */
+int hexdump(uint64 startaddr, const unsigned char *lpBuffer, int len);
 int read_sb(int disk_fd, struct gfs_sbd *sdp);
 int ji_update(int disk_fd, struct gfs_sbd *sdp);
 int ri_update(int disk_fd, struct gfs_sbd *sdp);
+void ri_cleanup(osi_list_t *rglist);
 int write_sb(int disk_fd, struct gfs_sbd *sdp);
 int set_block_ranges(int disk_fd, struct gfs_sbd *sdp);
 int read_super_block(int disk_fd, struct gfs_sbd *sdp);
 int compute_constants(struct gfs_sbd *sdp);
+uint32 rgrplength2bitblocks(struct gfs_sbd *sdp, uint32 length);
 
 /* ------------------------------------------------------------------------- */
 /* formerly rgrp.h:                                                          */
diff -Naurd cluster-3.0.0.rc2/gfs/libgfs/log.c cluster-3.0.0.rc3/gfs/libgfs/log.c
--- cluster-3.0.0.rc2/gfs/libgfs/log.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/libgfs/log.c	2009-06-11 11:02:55.000000000 +0200
@@ -26,7 +26,7 @@
 	_state.print_level--;
 }
 
-void print_msg(int priority, char *file, int line, const char *format, va_list args) {
+static void print_msg(int priority, const char *file, int line, const char *format, va_list args) {
 
 	switch (priority) {
 
@@ -48,7 +48,7 @@
 	return;
 }
 
-void print_log_level(int iif, int priority, char *file, int line, const char *format, ...)
+void print_log_level(int iif, int priority, const char *file, int line, const char *format, ...)
 {
 
 	va_list args;
diff -Naurd cluster-3.0.0.rc2/gfs/libgfs/ondisk.c cluster-3.0.0.rc3/gfs/libgfs/ondisk.c
--- cluster-3.0.0.rc2/gfs/libgfs/ondisk.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/libgfs/ondisk.c	2009-06-11 11:02:55.000000000 +0200
@@ -37,7 +37,7 @@
  */
 
 static void
-print_array(char *title, char *buf, int count)
+print_array(const char *title, char *buf, int count)
 {
 	int x;
 
@@ -332,20 +332,20 @@
  */
 
 void
-gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
+gfs_rindex_in(struct gfs_rindex *grindex, char *buf)
 {
 	struct gfs_rindex *str = (struct gfs_rindex *) buf;
 
-	CPIN_64(rindex, str, ri_addr);
-	CPIN_32(rindex, str, ri_length);
-	CPIN_32(rindex, str, ri_pad);
+	CPIN_64(grindex, str, ri_addr);
+	CPIN_32(grindex, str, ri_length);
+	CPIN_32(grindex, str, ri_pad);
 
-	CPIN_64(rindex, str, ri_data1);
-	CPIN_32(rindex, str, ri_data);
+	CPIN_64(grindex, str, ri_data1);
+	CPIN_32(grindex, str, ri_data);
 
-	CPIN_32(rindex, str, ri_bitbytes);
+	CPIN_32(grindex, str, ri_bitbytes);
 
-	CPIN_08(rindex, str, ri_reserved, 64);
+	CPIN_08(grindex, str, ri_reserved, 64);
 
 }
 
@@ -357,20 +357,20 @@
  */
 
 void
-gfs_rindex_out(struct gfs_rindex *rindex, char *buf)
+gfs_rindex_out(struct gfs_rindex *grindex, char *buf)
 {
 	struct gfs_rindex *str = (struct gfs_rindex *) buf;
 
-	CPOUT_64(rindex, str, ri_addr);
-	CPOUT_32(rindex, str, ri_length);
-	CPOUT_32(rindex, str, ri_pad);
+	CPOUT_64(grindex, str, ri_addr);
+	CPOUT_32(grindex, str, ri_length);
+	CPOUT_32(grindex, str, ri_pad);
 
-	CPOUT_64(rindex, str, ri_data1);
-	CPOUT_32(rindex, str, ri_data);
+	CPOUT_64(grindex, str, ri_data1);
+	CPOUT_32(grindex, str, ri_data);
 
-	CPOUT_32(rindex, str, ri_bitbytes);
+	CPOUT_32(grindex, str, ri_bitbytes);
 
-	CPOUT_08(rindex, str, ri_reserved, 64);
+	CPOUT_08(grindex, str, ri_reserved, 64);
 
 }
 
@@ -787,7 +787,7 @@
  */
 
 void
-gfs_dirent_print(struct gfs_dirent *de, char *name)
+gfs_dirent_print(struct gfs_dirent *de, const char *name)
 {
 	char buf[GFS_FNAMESIZE + 1];
 
diff -Naurd cluster-3.0.0.rc2/gfs/libgfs/super.c cluster-3.0.0.rc3/gfs/libgfs/super.c
--- cluster-3.0.0.rc2/gfs/libgfs/super.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/libgfs/super.c	2009-06-11 11:02:55.000000000 +0200
@@ -258,7 +258,6 @@
 	return (len);
 }
 
-
 /**
  * rgrplength2bitblocks - blerg - Stolen by Bob from gfs_mkfs.  Good 
  * candidate for gfslib.
diff -Naurd cluster-3.0.0.rc2/gfs/libgfs/util.c cluster-3.0.0.rc3/gfs/libgfs/util.c
--- cluster-3.0.0.rc2/gfs/libgfs/util.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs/libgfs/util.c	2009-06-11 11:02:55.000000000 +0200
@@ -86,13 +86,13 @@
  */
 int check_meta(osi_buf_t *bh, int type){
   uint32 check_magic = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_magic;
-  uint32 check_type = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
+  uint32 check_metatype = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
  
   check_magic = gfs32_to_cpu(check_magic);
-  check_type = gfs32_to_cpu(check_type);
-  if((check_magic != GFS_MAGIC) || (type && (check_type != type))){
+  check_metatype = gfs32_to_cpu(check_metatype);
+  if((check_magic != GFS_MAGIC) || (type && (check_metatype != type))){
 	  log_debug("For %"PRIu64" Expected %X:%X - got %X:%X\n", BH_BLKNO(bh), GFS_MAGIC, type,
-		    check_magic, check_type);
+		    check_magic, check_metatype);
     return -1;
   }
   return 0;
@@ -107,11 +107,11 @@
  */
 int check_type(osi_buf_t *bh, int type){
   uint32 check_magic = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_magic;
-  uint32 check_type = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
+  uint32 check_metatype = ((struct gfs_meta_header *)BH_DATA((bh)))->mh_type;
  
   check_magic = gfs32_to_cpu(check_magic);
-  check_type = gfs32_to_cpu(check_type);
-  if((check_magic != GFS_MAGIC) || (check_type != type)){
+  check_metatype = gfs32_to_cpu(check_metatype);
+  if((check_magic != GFS_MAGIC) || (check_metatype != type)){
     return -1;
   }
   return 0;
diff -Naurd cluster-3.0.0.rc2/gfs2/convert/gfs2_convert.c cluster-3.0.0.rc3/gfs2/convert/gfs2_convert.c
--- cluster-3.0.0.rc2/gfs2/convert/gfs2_convert.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/convert/gfs2_convert.c	2009-06-11 11:02:55.000000000 +0200
@@ -131,7 +131,6 @@
 struct timeval tv;
 uint64_t dirs_fixed;
 uint64_t dirents_fixed;
-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];
@@ -157,7 +156,7 @@
 /*                   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;
@@ -235,7 +234,7 @@
 /* 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;
@@ -261,7 +260,7 @@
 /* ------------------------------------------------------------------------- */
 /* 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;
@@ -301,7 +300,7 @@
 /*                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)
 {
@@ -415,7 +414,7 @@
 /*                                                                           */
 /* 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;
@@ -593,7 +592,7 @@
 /*                                                                           */
 /* 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;
@@ -682,7 +681,7 @@
 /*                                                                           */
 /* 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;
@@ -773,7 +772,7 @@
 /* ------------------------------------------------------------------------- */
 /* 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;
@@ -795,7 +794,7 @@
 /*                                                                           */
 /* 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;
@@ -885,7 +884,7 @@
 /*                                                                           */
 /* 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;
@@ -931,7 +930,7 @@
 /* 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;
@@ -948,7 +947,7 @@
 	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);
@@ -989,7 +988,7 @@
 /* ------------------------------------------------------------------------- */
 /* 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;
 
@@ -1002,7 +1001,7 @@
 /* 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)];
@@ -1181,7 +1180,7 @@
 /* ------------------------------------------------------------------------- */
 /* 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");
@@ -1196,7 +1195,7 @@
 /* ------------------------------------------------------------------------- */
 /* version  - print version information                                      */
 /* ------------------------------------------------------------------------- */
-void version(void)
+static void version(void)
 {
 	log_notice("gfs2_convert version %s (built %s %s)\n", RELEASE_VERSION,
 			   __DATE__, __TIME__);
@@ -1206,7 +1205,7 @@
 /* ------------------------------------------------------------------------- */
 /* usage - print usage information                                           */
 /* ------------------------------------------------------------------------- */
-void usage(const char *name)
+static void usage(const char *name)
 {
 	give_warning();
 	printf("\nUsage:\n");
@@ -1223,7 +1222,7 @@
 /* ------------------------------------------------------------------------- */
 /* 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)
 
 {
 	char c;
@@ -1279,7 +1278,7 @@
 /* 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;
@@ -1308,7 +1307,7 @@
 /*                                                                           */
 /* 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;
@@ -1391,7 +1390,7 @@
 /* ------------------------------------------------------------------------- */
 /* 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;
@@ -1408,7 +1407,7 @@
 /* ------------------------------------------------------------------------- */
 /* 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;
@@ -1428,7 +1427,7 @@
 /* ------------------------------------------------------------------------- */
 /* 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;
 
@@ -1454,7 +1453,7 @@
 /* ------------------------------------------------------------------------- */
 /* 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;
@@ -1502,10 +1501,10 @@
 	/* 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 -Naurd cluster-3.0.0.rc2/gfs2/edit/gfs2hex.c cluster-3.0.0.rc3/gfs2/edit/gfs2hex.c
--- cluster-3.0.0.rc2/gfs2/edit/gfs2hex.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/edit/gfs2hex.c	2009-06-11 11:02:55.000000000 +0200
@@ -69,6 +69,8 @@
 int insert = 0;
 const char *termtype;
 WINDOW *wind;
+int dsplines = 0;
+
 const char *block_type_str[15] = {
 	"Clump",
 	"Superblock",
@@ -115,7 +117,7 @@
 	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;
@@ -219,7 +221,7 @@
 	}
 }
 
-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;
 
@@ -255,20 +257,20 @@
 **
 *******************************************************************************
 ******************************************************************************/
-void do_dinode_extended(struct gfs2_dinode *di, char *buf)
+void do_dinode_extended(struct gfs2_dinode *dine, char *dinebuf)
 {
 	unsigned int x, y;
 	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].is_dir = FALSE;
@@ -276,7 +278,7 @@
 			}
 		}
 	}
-	else if (isdir && !(di->di_flags & GFS2_DIF_EXHASH)) {
+	else if (isdir && !(dine->di_flags & GFS2_DIF_EXHASH)) {
 		int skip = 0;
 
 		/* Directory Entries: */
@@ -285,25 +287,25 @@
 		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;
@@ -347,7 +349,7 @@
 **
 *******************************************************************************
 ******************************************************************************/
-int do_indirect_extended(char *buf, struct iinfo *iinf)
+int do_indirect_extended(char *diebuf, struct iinfo *iinf)
 {
 	unsigned int x, y;
 	uint64_t p;
@@ -359,7 +361,7 @@
 			  sizeof(struct gfs2_meta_header)), y = 0;
 		 x < sbd.bsize;
 		 x += sizeof(uint64_t), y++) {
-		p = be64_to_cpu(*(uint64_t *)(buf + x));
+		p = be64_to_cpu(*(uint64_t *)(diebuf + x));
 		if (p) {
 			iinf->ii[i_blocks].block = p;
 			iinf->ii[i_blocks].is_dir = FALSE;
@@ -384,24 +386,24 @@
 **
 *******************************************************************************
 ******************************************************************************/
-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;
 
 	x = 0;
-	memset(indir, 0, sizeof(indir));
+	memset(indir, 0, sizeof(*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;
@@ -430,7 +432,7 @@
 *******************************************************************************
 ******************************************************************************/
 
-void do_eattr_extended(char *buf)
+static void do_eattr_extended(char *deebuf)
 {
 	struct gfs2_ea_header ea;
 	unsigned int x;
@@ -442,12 +444,12 @@
 	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);
@@ -467,31 +469,31 @@
  * 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(sb, sb_fs_format, "%u", "0x%x");
-	pv(sb, sb_multihost_format, "%u", "0x%x");
+	pv(sbp2, sb_fs_format, "%u", "0x%x");
+	pv(sbp2, sb_multihost_format, "%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) {
 		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
 }
 
diff -Naurd cluster-3.0.0.rc2/gfs2/edit/gfs2hex.h cluster-3.0.0.rc3/gfs2/edit/gfs2hex.h
--- cluster-3.0.0.rc2/gfs2/edit/gfs2hex.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/edit/gfs2hex.h	2009-06-11 11:02:55.000000000 +0200
@@ -1,10 +1,14 @@
 #ifndef __GFS2HEX_DOT_H__
 #define __GFS2HEX_DOT_H__
 
+#include "hexedit.h"
 
 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 *diebuf, struct iinfo *iinf);
+void do_leaf_extended(char *dlebuf, struct iinfo *indir);
+void eol(int col);
 
 #endif /*  __GFS2HEX_DOT_H__  */
diff -Naurd cluster-3.0.0.rc2/gfs2/edit/hexedit.c cluster-3.0.0.rc3/gfs2/edit/hexedit.c
--- cluster-3.0.0.rc2/gfs2/edit/hexedit.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/edit/hexedit.c	2009-06-11 11:02:55.000000000 +0200
@@ -35,7 +35,6 @@
 #define RGLIST_DUMMY_BLOCK -2
 
 int display(int identify_only);
-extern void eol(int col);
 extern void do_leaf_extended(char *buf, struct iinfo *indir);
 extern int do_indirect_extended(char *buf, struct iinfo *ii);
 extern void savemeta(char *out_fn, int slow);
@@ -79,58 +78,58 @@
 		}						\
 	} while(0)
 
-int gfs2_dinode_printval(struct gfs2_dinode *di, const char *strfield)
+static int gfs2_dinode_printval(struct gfs2_dinode *dip, 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);
+	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);
@@ -139,7 +138,7 @@
 	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);
@@ -152,7 +151,7 @@
 /* ------------------------------------------------------------------------ */
 /* UpdateSize - screen size changed, so update it                           */
 /* ------------------------------------------------------------------------ */
-void UpdateSize(int sig)
+static void UpdateSize(int sig)
 {
 	static char term_buffer[2048];
 	int rc;
@@ -163,10 +162,10 @@
 		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;
 	}
@@ -180,7 +179,7 @@
 /* ------------------------------------------------------------------------- */
 /* erase - clear the screen */
 /* ------------------------------------------------------------------------- */
-void Erase(void)
+static void Erase(void)
 {
 	int i;
 	char spaces[256];
@@ -199,7 +198,7 @@
 /* ------------------------------------------------------------------------- */
 /* display_title_lines */
 /* ------------------------------------------------------------------------- */
-void display_title_lines(void)
+static void display_title_lines(void)
 {
 	Erase();
 	COLORS_TITLE;
@@ -215,7 +214,7 @@
 /* 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;
 
@@ -356,7 +355,7 @@
 /******************************************************************************
 ** instr - instructions
 ******************************************************************************/
-void gfs2instr(const char *s1, const char *s2)
+static void gfs2instr(const char *s1, const char *s2)
 {
 	COLORS_HIGHLIGHT;
 	move(line,0);
@@ -378,7 +377,7 @@
 *******************************************************************************
 ******************************************************************************/
 
-void print_usage(void)
+static void print_usage(void)
 {
 	int ch;
 
@@ -433,7 +432,7 @@
 /* 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;
 
@@ -460,10 +459,10 @@
  *
  * Returns: state on success, -1 on error
  */
-int gfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno,
+static int gfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno,
 					struct rgrp_list *rgd)
 {
-	int           buf, val;
+	int           i, val;
 	uint32_t        rgrp_block;
 	struct gfs2_bitmap	*bits = NULL;
 	unsigned int  bit;
@@ -483,19 +482,19 @@
 
 	rgrp_block = (uint32_t)(blkno - rgd->ri.ri_data0);
 
-	for(buf= 0; buf < rgd->ri.ri_length; buf++){
-		bits = &(rgd->bits[buf]);
+	for(i= 0; i < rgd->ri.ri_length; i++){
+		bits = &(rgd->bits[i]);
 		if(rgrp_block < ((bits->bi_start + bits->bi_len)*GFS2_NBBY)){
 			break;
 		}
 	}
 
-	if(buf >= rgd->ri.ri_length){
+	if(i >= rgd->ri.ri_length){
 		gfs2_rgrp_relse(rgd, not_updated);
 		return -1;
 	}
 
-	byte = (unsigned char *)(rgd->bh[buf]->b_data + bits->bi_offset) +
+	byte = (unsigned char *)(rgd->bh[i]->b_data + bits->bi_offset) +
 		(rgrp_block/GFS2_NBBY - bits->bi_start);
 	bit = (rgrp_block % GFS2_NBBY) * GFS2_BIT_SIZE;
 
@@ -705,7 +704,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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;
@@ -846,7 +845,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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());
@@ -858,37 +857,37 @@
 /* ------------------------------------------------------------------------ */
 /* 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)
 {
-	char buf[sizeof(struct gfs2_rindex)];
+	char fbuf[sizeof(struct gfs2_rindex)];
 	int amt;
 	struct gfs2_rindex ri;
-	uint64_t offset, gfs1_adj = 0;
+	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, buf);
+	gfs2_rindex_in(&ri, 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);
@@ -901,11 +900,11 @@
 /* ------------------------------------------------------------------------ */
 /* 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);
@@ -918,7 +917,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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");
@@ -933,17 +932,17 @@
 /* ------------------------------------------------------------------------ */
 /* 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);
@@ -961,7 +960,7 @@
 /* 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;
@@ -1009,43 +1008,43 @@
 /* ------------------------------------------------------------------------ */
 /* 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));
 	if (gfs1) {
 		/* gfs1 rindex files have the meta_header which is not
 		   accounted for in gfs2's dinode size.  Therefore, adjust. */
-		di->i_di.di_size += ((di->i_di.di_size / sbd.bsize) + 1) *
+		dip->i_di.di_size += ((dip->i_di.di_size / sbd.bsize) + 1) *
 			sizeof(struct gfs2_meta_header);
 	}
 	for (print_entry_ndx=0; ; print_entry_ndx++) {
 		uint64_t gfs1_adj = 0;
-		uint64_t offset = print_entry_ndx * risize();
+		uint64_t roffset = print_entry_ndx * risize();
 
 		if (gfs1) {
 			uint64_t sd_jbsize =
 				(sbd.bsize - sizeof(struct gfs2_meta_header));
 
-			gfs1_adj = (offset / sd_jbsize) *
+			gfs1_adj = (roffset / sd_jbsize) *
 				sizeof(struct gfs2_meta_header);
 			gfs1_adj += sizeof(struct gfs2_meta_header);
 		}
 
-		error = gfs2_readi(di, (void *)&buf, offset + gfs1_adj,
+		error = gfs2_readi(dip, (void *)&rbuf, roffset + gfs1_adj,
 				   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] <=
@@ -1089,9 +1088,9 @@
 /* ------------------------------------------------------------------------ */
 /* 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);
@@ -1102,7 +1101,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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");
@@ -1112,23 +1111,23 @@
 /* ------------------------------------------------------------------------ */
 /* 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 ||
@@ -1155,23 +1154,23 @@
 /* ------------------------------------------------------------------------ */
 /* 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;
@@ -1180,23 +1179,23 @@
 /* ------------------------------------------------------------------------ */
 /* 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);
@@ -1206,25 +1205,25 @@
 /* ------------------------------------------------------------------------ */
 /* 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);
@@ -1235,7 +1234,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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 ||
@@ -1248,7 +1247,7 @@
 /* ------------------------------------------------------------------------ */
 /* print_inode_type                                                         */
 /* ------------------------------------------------------------------------ */
-void print_inode_type(__be16 de_type)
+static void print_inode_type(__be16 de_type)
 {
 	switch(de_type) {
 	case DT_UNKNOWN:
@@ -1284,21 +1283,21 @@
 /* ------------------------------------------------------------------------ */
 /* display_leaf - display directory leaf                                    */
 /* ------------------------------------------------------------------------ */
-int display_leaf(struct iinfo *ind)
+static int display_leaf(struct iinfo *ind)
 {
-	int start_line, total_dirents = 0;
+	int start_line, total_dirents = start_row[dmode];
 	int d;
 
 	eol(0);
 	if (gfs2_struct_type == GFS2_METATYPE_SB)
 		print_gfs2("The superblock has 2 directories");
 	else
-		print_gfs2("This directory contains %d directory entries.",
+		print_gfs2("This directory block contains %d directory entries.",
 			   ind->ii[0].dirents);
 
 	start_line = line;
-	for (d = 0; d < ind->ii[0].dirents; d++) {
-		if (termlines && d >= termlines - start_line - 1
+	for (d = start_row[dmode]; d < ind->ii[0].dirents; d++) {
+		if (termlines && d >= termlines - start_line - 2
 		    + start_row[dmode])
 			break;
 		total_dirents++;
@@ -1342,7 +1341,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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 i, cur_height = -1, pndx;
@@ -1409,6 +1408,7 @@
 		eol(0);
 	}
 	start_line = line;
+	dsplines = termlines - line - 1;
 	for (pndx = start_row[dmode];
 		 (!termlines || pndx < termlines - start_line - 1
 		  + start_row[dmode]) && pndx < indblocks;
@@ -1447,10 +1447,11 @@
 		}
 		if (!S_ISDIR(di.di_mode)) {
 			int hgt;
-			file_offset = startoff;
 			float human_off;
 			char h;
 
+			file_offset = startoff;
+
 			/* Now divide by how deep we are at the moment.      */
 			/* This is how much data is represented by each      */
 			/* indirect pointer for each height we've traversed. */
@@ -1539,7 +1540,7 @@
 /*                   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;
@@ -1628,7 +1629,7 @@
 /* ------------------------------------------------------------------------ */
 /* block_has_extended_info                                                  */
 /* ------------------------------------------------------------------------ */
-int block_has_extended_info(void)
+static int block_has_extended_info(void)
 {
 	if (has_indirect_blocks() ||
 	    block_is_rindex() ||
@@ -1644,7 +1645,7 @@
 /* ------------------------------------------------------------------------ */
 /* display_extended                                                         */
 /* ------------------------------------------------------------------------ */
-int display_extended(void)
+static int display_extended(void)
 {
 	struct gfs2_inode *tmp_inode;
 	struct gfs2_buffer_head *tmp_bh;
@@ -1701,7 +1702,7 @@
 /* ------------------------------------------------------------------------ */
 /* read_superblock - read the superblock                                    */
 /* ------------------------------------------------------------------------ */
-void read_superblock(int fd)
+static void read_superblock(int fd)
 {
 	int count;
 
@@ -1781,7 +1782,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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,
@@ -1902,7 +1903,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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;
 
@@ -1925,7 +1926,7 @@
 /* ------------------------------------------------------------------------ */
 /* pop_block - pop a block off the block stack                              */
 /* ------------------------------------------------------------------------ */
-uint64_t pop_block(void)
+static uint64_t pop_block(void)
 {
 	int i, bhst;
 
@@ -1949,7 +1950,7 @@
 /* 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;
@@ -2005,7 +2006,7 @@
 /* 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;
@@ -2046,7 +2047,7 @@
 /* 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;
@@ -2107,7 +2108,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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;
@@ -2142,7 +2143,7 @@
 /* Check if the word is a keyword such as "sb" or "rindex"                  */
 /* Returns: block number if it is, else 0                                   */
 /* ------------------------------------------------------------------------ */
-uint64_t check_keywords(const char *kword)
+static uint64_t check_keywords(const char *kword)
 {
 	uint64_t blk = 0;
 
@@ -2206,7 +2207,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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;
@@ -2243,7 +2244,7 @@
 /* ------------------------------------------------------------------------ */
 /* init_colors                                                              */
 /* ------------------------------------------------------------------------ */
-void init_colors()
+static void init_colors(void)
 {
 
 	if (color_scheme) {
@@ -2269,7 +2270,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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;
@@ -2325,19 +2326,17 @@
 /* ------------------------------------------------------------------------ */
 /* page up                                                                  */
 /* ------------------------------------------------------------------------ */
-void pageup(void)
+static void pageup(void)
 {
 	if (dmode == EXTENDED_MODE) {
-		int dsplines = termlines - 6;
-		
-		if (edit_row[dmode] - (dsplines / lines_per_row[dmode]) > 0) {
-			start_row[dmode] -= (dsplines / lines_per_row[dmode]);
+		if (edit_row[dmode] - (dsplines / lines_per_row[dmode]) > 0)
 			edit_row[dmode] -= (dsplines / lines_per_row[dmode]);
-		}
-		else {
-			start_row[dmode] = 0;
+		else
 			edit_row[dmode] = 0;
-		}
+		if (start_row[dmode] - (dsplines / lines_per_row[dmode]) > 0)
+			start_row[dmode] -= (dsplines / lines_per_row[dmode]);
+		else
+			start_row[dmode] = 0;
 	}
 	else {
 		start_row[dmode] = edit_row[dmode] = 0;
@@ -2359,18 +2358,19 @@
 /* ------------------------------------------------------------------------ */
 /* page down                                                                */
 /* ------------------------------------------------------------------------ */
-void pagedn(void)
+static void pagedn(void)
 {
 	if (dmode == EXTENDED_MODE) {
-		int dsplines = termlines - 6;
-
-		if ((edit_row[dmode] + dsplines) / lines_per_row[dmode] + 1 <
+		if ((edit_row[dmode] + dsplines) / lines_per_row[dmode] + 1 <=
 		    end_row[dmode]) {
 			start_row[dmode] += dsplines / lines_per_row[dmode];
 			edit_row[dmode] += dsplines / lines_per_row[dmode];
-		}
-		else
+		} else {
 			edit_row[dmode] = end_row[dmode] - 1;
+			while (edit_row[dmode] - start_row[dmode]
+			       + 1 > last_entry_onscreen[dmode])
+				start_row[dmode]++;
+		}
 	}
 	else {
 		start_row[dmode] = edit_row[dmode] = 0;
@@ -2387,7 +2387,7 @@
 /* ------------------------------------------------------------------------ */
 /* jump - jump to the address the cursor is on                              */
 /* ------------------------------------------------------------------------ */
-void jump(void)
+static void jump(void)
 {
 	if (dmode == HEX_MODE) {
 		unsigned int col2;
@@ -2417,30 +2417,30 @@
 /* ------------------------------------------------------------------------ */
 /* 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);
@@ -2449,17 +2449,17 @@
 /* ------------------------------------------------------------------------ */
 /* 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) {
@@ -2467,7 +2467,7 @@
 
 				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;
@@ -2492,9 +2492,9 @@
 /* ------------------------------------------------------------------------ */
 /* 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;
 
@@ -2509,19 +2509,19 @@
 		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[type]);
 				gfs2_rgrp_relse(rgd, not_updated);
 			} else {
@@ -2540,20 +2540,20 @@
 /* ------------------------------------------------------------------------ */
 /* 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;
+	fblock = blockstack[blockhist % BLOCK_STACK_SIZE].block;
 	bh = bread(&sbd.buf_list, block);
 	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:
@@ -2570,7 +2570,7 @@
 		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:
@@ -2596,7 +2596,7 @@
 	case GFS2_METATYPE_QC:
 	default:
 		if (print_field)
-			print_block_type(block, type,
+			print_block_type(fblock, type,
 					 " which is not implemented");
 		break;
 	}
@@ -2607,7 +2607,7 @@
 /* ------------------------------------------------------------------------ */
 /* interactive_mode - accept keystrokes from user and display structures    */
 /* ------------------------------------------------------------------------ */
-void interactive_mode(void)
+static void interactive_mode(void)
 {
 	int ch, Quit;
 
@@ -2725,7 +2725,8 @@
 		case '+':
 			if (dmode == EXTENDED_MODE) {
 				if (edit_row[dmode] + 1 < end_row[dmode]) {
-					if (edit_row[dmode] >= last_entry_onscreen[dmode])
+					if (edit_row[dmode] - start_row[dmode]
+					    + 1 > last_entry_onscreen[dmode])
 						start_row[dmode]++;
 					edit_row[dmode]++;
 				}
@@ -2817,7 +2818,6 @@
 		/* --------------------------------------------------------- */
 		case 0x168:
 			if (dmode == EXTENDED_MODE) {
-				int dsplines = termlines - 6;
 				int ents_per_screen = dsplines /
 					lines_per_row[dmode];
 
@@ -2872,11 +2872,11 @@
 /* ------------------------------------------------------------------------ */
 /* 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);
@@ -2909,7 +2909,7 @@
 /* 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];
@@ -2941,7 +2941,7 @@
 /* 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;
@@ -2955,18 +2955,18 @@
 	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 */
@@ -2990,10 +2990,10 @@
 		} 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++;
@@ -3002,7 +3002,7 @@
 	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("------------------------------------------------"
@@ -3020,7 +3020,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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;
@@ -3145,7 +3145,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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");
@@ -3220,7 +3220,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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",
@@ -3271,7 +3271,7 @@
 /*        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 -Naurd cluster-3.0.0.rc2/gfs2/edit/hexedit.h cluster-3.0.0.rc3/gfs2/edit/hexedit.h
--- cluster-3.0.0.rc2/gfs2/edit/hexedit.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/edit/hexedit.h	2009-06-11 11:02:55.000000000 +0200
@@ -42,7 +42,6 @@
 #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;
 extern int blockhist;
 extern int edit_mode;
@@ -81,6 +80,7 @@
 extern uint64_t temp_blk;
 extern uint64_t starting_blk;
 extern const char *block_type_str[15];
+extern int dsplines;
 
 struct gfs_jindex {
         uint64_t ji_addr;       /* starting block of the journal */
@@ -159,6 +159,9 @@
 extern void gfs_log_header_in(struct gfs_log_header *head, char *buf);
 extern void gfs_log_header_print(struct gfs_log_header *lh);
 extern void gfs_dinode_in(struct gfs_dinode *di, char *buf);
+extern void savemeta(char *out_fn, int saveoption);
+extern void restoremeta(const char *in_fn, const char *out_device, int printblocksonly);
+extern uint64_t masterblock(const char *fn);
 
 struct gfs2_dirents {
 	uint64_t block;
diff -Naurd cluster-3.0.0.rc2/gfs2/edit/savemeta.c cluster-3.0.0.rc3/gfs2/edit/savemeta.c
--- cluster-3.0.0.rc2/gfs2/edit/savemeta.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/edit/savemeta.c	2009-06-11 11:02:55.000000000 +0200
@@ -40,7 +40,6 @@
 int journals_found = 0;
 
 extern void read_superblock(void);
-uint64_t masterblock(const char *fn);
 
 /*
  * get_gfs_struct_info - get block type and structure length
@@ -51,14 +50,14 @@
  * 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;
 
 	*block_type = 0;
-	*struct_len = sbd.bsize;
+	*gstruct_len = sbd.bsize;
 
-	gfs2_meta_header_in(&mh, buf);
+	gfs2_meta_header_in(&mh, gbuf);
 	if (mh.mh_magic != GFS2_MAGIC)
 		return -1;
 
@@ -66,46 +65,52 @@
 
 	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) */
 		/* GFS1 keeps indirect pointers in GFS2_METATYPE_JD blocks
 		   so we need to save the whole block.  For GFS2, we don't
 		   want to, or we might capture user data, which is bad.  */
 		if (gfs1)
-			*struct_len = sbd.bsize;
+			*gstruct_len = sbd.bsize;
 		else
-			*struct_len = sizeof(struct gfs2_meta_header);
+			*gstruct_len = sizeof(struct gfs2_meta_header);
 		break;
 	case GFS2_METATYPE_LH:   /* 8 (log header) */
-		*struct_len = sizeof(struct gfs2_log_header);
+		if (gfs1)
+			*gstruct_len = 512; /* gfs copies the log header
+					       twice and compares the copy,
+					       so we need to save all 512
+					       bytes of it. */
+		else
+			*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;
@@ -117,12 +122,12 @@
 /* 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;
@@ -135,7 +140,7 @@
 			if (save) {
 				percent = (block * 100) / last_fs_block;
 				printf("%" PRIu64 " metadata blocks (%"
-				       PRIu64 "%%) processed, ", block,
+				       PRIu64 "%%) processed, ", wfsblock,
 				       percent);
 			}
 			if (total_out < 1024 * 1024)
@@ -155,7 +160,7 @@
 	}
 }
 
-int block_is_a_journal(void)
+static int block_is_a_journal(void)
 {
 	int j;
 
@@ -165,7 +170,7 @@
 	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() ||
@@ -173,7 +178,7 @@
 		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;
@@ -253,7 +258,7 @@
 /*
  * 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;
@@ -298,7 +303,7 @@
  * 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;
@@ -388,7 +393,7 @@
 	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;
@@ -438,6 +443,40 @@
 	}
 }
 
+int next_rg_freemeta(struct rgrp_list *rgd, uint64_t *block, 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);
+	int i;
+
+	if(!first && (*block < rgd->ri.ri_data0)) {
+		log_err("next_rg_freemeta:  Start block is outside rgrp "
+			"bounds.\n");
+		exit(1);
+	}
+	for(i=0; i < length; i++){
+		bits = &rgd->bits[i];
+		if(blk < bits->bi_len*GFS2_NBBY)
+			break;
+		blk -= bits->bi_len*GFS2_NBBY;
+	}
+	for(; i < length; i++){
+		bits = &rgd->bits[i];
+		blk = gfs2_bitfit((unsigned char *)rgd->bh[i]->b_data +
+				  bits->bi_offset, bits->bi_len, blk,
+				  GFS2_BLKST_UNLINKED);
+		if(blk != BFITNOENT){
+			*block = blk + (bits->bi_start * GFS2_NBBY) + rgd->ri.ri_data0;
+			break;
+		}
+		blk=0;
+	}
+	if(i == length)
+		return -1;
+	return 0;
+}
+
 void savemeta(char *out_fn, int saveoption)
 {
 	int out_fd;
@@ -603,9 +642,9 @@
 			}
 			/* Save off the other metadata: inodes, etc. */
 			if (saveoption != 2) {
-				while (!gfs2_next_rg_meta(rgd, &block, first)) {
-					int blktype;
+				int blktype;
 
+				while (!gfs2_next_rg_meta(rgd, &block, first)) {
 					warm_fuzzy_stuff(block, FALSE, TRUE);
 					blktype = save_block(sbd.device_fd,
 							     out_fd, block);
@@ -613,6 +652,14 @@
 						save_inode_data(out_fd);
 					first = 0;
 				}
+				/* Save off the free/unlinked meta blocks too.
+				   If we don't, we may run into metadata
+				   allocation issues. */
+				while (!next_rg_freemeta(rgd, &block, first)) {
+					blktype = save_block(sbd.device_fd,
+							     out_fd, block);
+					first = 0;
+				}
 			}
 			gfs2_rgrp_relse(rgd, not_updated);
 		}
@@ -636,32 +683,32 @@
 	exit(0);
 }
 
-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;
 	uint16_t buf16;
 	int first = 1, pos;
-	char buf[256];
+	char rdbuf[256];
 	char gfs_superblock_id[8] = {0x01, 0x16, 0x19, 0x70,
 				     0x00, 0x00, 0x00, 0x01};
 
 	if (!printblocksonly)
 		lseek(fd, 0, SEEK_SET);
 	lseek(in_fd, 0, SEEK_SET);
-	rs = read(in_fd, buf, sizeof(buf));
-	if (rs != sizeof(buf)) {
+	rs = read(in_fd, rdbuf, sizeof(rdbuf));
+	if (rs != sizeof(rdbuf)) {
 		fprintf(stderr, "Error: File is too small.\n");
 		return -1;
 	}
-	for (pos = 0; pos < sizeof(buf) - sizeof(uint64_t) - sizeof(uint16_t);
+	for (pos = 0; pos < sizeof(rdbuf) - sizeof(uint64_t) - sizeof(uint16_t);
 	     pos++) {
-		if (!memcmp(&buf[pos + sizeof(uint64_t) + sizeof(uint16_t)],
+		if (!memcmp(&rdbuf[pos + sizeof(uint64_t) + sizeof(uint16_t)],
 			    gfs_superblock_id, sizeof(gfs_superblock_id))) {
 			break;
 		}
 	}
-	if (pos == sizeof(buf) - sizeof(uint64_t) - sizeof(uint16_t))
+	if (pos == sizeof(rdbuf) - sizeof(uint64_t) - sizeof(uint16_t))
 		pos = 0;
 	if (lseek(in_fd, pos, SEEK_SET) != pos) {
 		fprintf(stderr, "bad seek: %s from %s:%d: "
@@ -782,7 +829,7 @@
 	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 -Naurd cluster-3.0.0.rc2/gfs2/fsck/eattr.c cluster-3.0.0.rc3/gfs2/fsck/eattr.c
--- cluster-3.0.0.rc2/gfs2/fsck/eattr.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/eattr.c	2009-06-11 11:02:55.000000000 +0200
@@ -1,8 +1,11 @@
 #include <stdint.h>
 #include <string.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "fsck.h"
+#include "eattr.h"
 
 static int clear_blk_nodup(struct gfs2_sbd *sbp, uint64_t block)
 {
@@ -14,7 +17,7 @@
 	}
 
 	if(q.dup_block) {
-		log_debug("Not clearing block with marked as a duplicate\n");
+		log_debug( _("Not clearing block with marked as a duplicate\n"));
 		return 1;
 	}
 
@@ -74,8 +77,8 @@
 		if(max_ptrs > ea_hdr->ea_num_ptrs) {
 			return 1;
 		} else {
-			log_debug("  Pointers Required: %d\n"
-				  "  Pointers Reported: %d\n",
+			log_debug( _("  Pointers Required: %d\n"
+				  "  Pointers Reported: %d\n"),
 				  max_ptrs,
 				  ea_hdr->ea_num_ptrs);
 		}
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/fs_recovery.c cluster-3.0.0.rc3/gfs2/fsck/fs_recovery.c
--- cluster-3.0.0.rc2/gfs2/fsck/fs_recovery.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/fs_recovery.c	2009-06-11 11:02:55.000000000 +0200
@@ -4,6 +4,8 @@
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "fsck.h"
 #include "fs_recovery.h"
@@ -55,7 +57,7 @@
 {
 	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) {
@@ -72,8 +74,7 @@
 	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)
@@ -246,7 +247,7 @@
  * 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;
@@ -321,7 +322,7 @@
  * 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;
@@ -380,14 +381,14 @@
  * Returns: errno
  */
 
-int gfs2_recover_journal(struct gfs2_inode *ip, int j)
+static int gfs2_recover_journal(struct gfs2_inode *ip, int j)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
 	struct gfs2_log_header head;
 	unsigned int pass;
 	int error;
 
-	log_info("jid=%u: Looking at journal...\n", j);
+	log_info( _("jid=%u: Looking at journal...\n"), j);
 
 	osi_list_init(&sd_revoke_list);
 	error = gfs2_find_jhead(ip, &head);
@@ -412,12 +413,12 @@
 		log_err("jid=%u: The journal was successfully fixed.\n", j);
 	}
 	if (head.lh_flags & GFS2_LOG_HEAD_UNMOUNT) {
-		log_info("jid=%u: Journal is clean.\n", j);
+		log_info( _("jid=%u: Journal is clean.\n"), j);
 		return 0;
 	}
-	if (query(&opts, "\nJournal #%d (\"journal%d\") is dirty.  Okay to replay it? (y/n)",
+	if (query(&opts, _("\nJournal #%d (\"journal%d\") is dirty.  Okay to replay it? (y/n)"),
 		    j+1, j)) {
-		log_info("jid=%u: Replaying journal...\n", j);
+		log_info( _("jid=%u: Replaying journal...\n"), j);
 
 		sd_found_jblocks = sd_replayed_jblocks = 0;
 		sd_found_metablocks = sd_replayed_metablocks = 0;
@@ -429,28 +430,28 @@
 			if (error)
 				goto out;
 		}
-		log_info("jid=%u: Found %u revoke tags\n", j,
+		log_info( _("jid=%u: Found %u revoke tags\n"), j,
 			 sd_found_revokes);
 		gfs2_revoke_clean(sdp);
 		error = clean_journal(ip, &head);
 		if (error)
 			goto out;
-		log_err("jid=%u: Replayed %u of %u journaled data blocks\n",
+		log_err( _("jid=%u: Replayed %u of %u journaled data blocks\n"),
 			j, sd_replayed_jblocks, sd_found_jblocks);
-		log_err("jid=%u: Replayed %u of %u metadata blocks\n",
+		log_err( _("jid=%u: Replayed %u of %u metadata blocks\n"),
 			j, sd_replayed_metablocks, sd_found_metablocks);
 	} else {
-		if (query(&opts, "Do you want to clear the dirty journal instead? (y/n)")) {
+		if (query(&opts, _("Do you want to clear the dirty journal instead? (y/n)"))) {
 			write_journal(sdp, sdp->md.journal[j], j,
 				      sdp->md.journal[j]->i_di.di_size /
 				      sdp->sd_sb.sb_bsize);
 			
 		} else
-			log_err("jid=%u: Dirty journal not replayed or cleared.\n", j);
+			log_err( _("jid=%u: Dirty journal not replayed or cleared.\n"), j);
 	}
 
 out:
-	log_info("jid=%u: %s\n", j, (error) ? "Failed" : "Done");
+	log_info( _("jid=%u: %s\n"), j, (error) ? "Failed" : "Done");
 	return error;
 }
 
@@ -467,7 +468,7 @@
 int replay_journals(struct gfs2_sbd *sdp){
 	int i;
 
-	log_notice("Recovering journals (this may take a while)");
+	log_notice( _("Recovering journals (this may take a while)"));
 
 	/* Get master dinode */
 	sdp->master_dir = gfs2_load_inode(sdp,
@@ -476,7 +477,7 @@
 
 	/* read in the journal index data */
 	if (ji_update(sdp)){
-		log_err("Unable to read in jindex inode.\n");
+		log_err( _("Unable to read in jindex inode.\n"));
 		return -1;
 	}
 
@@ -487,7 +488,7 @@
 		inode_put(sdp->md.journal[i],
 			  (opts.no ? not_updated : updated));
 	}
-	log_notice("\nJournal recovery complete.\n");
+	log_notice( _("\nJournal recovery complete.\n"));
 	inode_put(sdp->master_dir, not_updated);
 	inode_put(sdp->md.jiinode, not_updated);
 	/* Sync the buffers to disk so we get a fresh start. */
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/initialize.c cluster-3.0.0.rc3/gfs2/fsck/initialize.c
--- cluster-3.0.0.rc2/gfs2/fsck/initialize.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/initialize.c	2009-06-11 11:02:55.000000000 +0200
@@ -7,6 +7,8 @@
 #include <fcntl.h>
 #include <string.h>
 #include <unistd.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "fsck.h"
@@ -24,7 +26,7 @@
  *
  * Go through journals and replay them - then clear them
  */
-int init_journals(struct gfs2_sbd *sbp)
+static int init_journals(struct gfs2_sbd *sbp)
 {
 	if(!opts.no) {
 		if(replay_journals(sbp))
@@ -79,12 +81,12 @@
 {
 	uint32_t i;
 
-	log_info("Freeing buffers.\n");
+	log_info( _("Freeing buffers.\n"));
 	while(!osi_list_empty(&sdp->rglist)){
 		struct rgrp_list *rgd;
 
 		rgd = osi_list_entry(sdp->rglist.next, struct rgrp_list, list);
-		log_debug("Deleting rgd for 0x%llx:  rgd=0x%p bits=0x%p\n",
+		log_debug( _("Deleting rgd for 0x%llx:  rgd=0x%p bits=0x%p\n"),
 			  (unsigned long long)rgd->ri.ri_addr, rgd, rgd->bits);
 		osi_list_del(&rgd->list);
 		if(rgd->bits)
@@ -131,7 +133,7 @@
 	uint64_t rmin = 0;
 	int error;
 
-	log_info("Setting block ranges...\n");
+	log_info( _("Setting block ranges...\n"));
 
 	for (tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next)
 	{
@@ -145,8 +147,8 @@
 
 	last_fs_block = rmax;
 	if (last_fs_block > 0xffffffff && sizeof(unsigned long) <= 4) {
-		log_crit("This file system is too big for this computer to handle.\n");
-		log_crit("Last fs block = 0x%llx, but sizeof(unsigned long) is %lu bytes.\n",
+		log_crit( _("This file system is too big for this computer to handle.\n"));
+		log_crit( _("Last fs block = 0x%llx, but sizeof(unsigned long) is %lu bytes.\n"),
 			 (unsigned long long)last_fs_block,
 			 sizeof(unsigned long));
 		goto fail;
@@ -156,16 +158,16 @@
 	first_data_block = rmin;
 
 	if(fsck_lseek(sdp->device_fd, (last_fs_block * sdp->sd_sb.sb_bsize))){
-		log_crit("Can't seek to last block in file system: %"
-				 PRIu64" (0x%" PRIx64 ")\n", last_fs_block, last_fs_block);
+		log_crit( _("Can't seek to last block in file system: %"
+				 PRIu64" (0x%" PRIx64 ")\n"), last_fs_block, last_fs_block);
 		goto fail;
 	}
 
 	memset(buf, 0, sdp->sd_sb.sb_bsize);
 	error = read(sdp->device_fd, buf, sdp->sd_sb.sb_bsize);
 	if (error != sdp->sd_sb.sb_bsize){
-		log_crit("Can't read last block in file system (error %u), "
-				 "last_fs_block: %"PRIu64" (0x%" PRIx64 ")\n", error,
+		log_crit( _("Can't read last block in file system (error %u), "
+				 "last_fs_block: %"PRIu64" (0x%" PRIx64 ")\n"), error,
 				 last_fs_block, last_fs_block);
 		goto fail;
 	}
@@ -194,7 +196,7 @@
 	 ******************  Initialize important inodes  ******************
 	 *******************************************************************/
 
-	log_info("Initializing special inodes...\n");
+	log_info( _("Initializing special inodes...\n"));
 
 	/* Get master dinode */
 	sdp->master_dir = gfs2_load_inode(sdp,
@@ -234,42 +236,42 @@
 
 	/* read in the ji data */
 	if (ji_update(sdp)){
-		log_err("Unable to read in ji inode.\n");
+		log_err( _("Unable to read in ji inode.\n"));
 		return -1;
 	}
 
-	log_warn("Validating Resource Group index.\n");
+	log_warn( _("Validating Resource Group index.\n"));
 	for (trust_lvl = blind_faith; trust_lvl <= distrust; trust_lvl++) {
-		log_warn("Level %d RG check.\n", trust_lvl + 1);
+		log_warn( _("Level %d RG check.\n"), trust_lvl + 1);
 		if ((rg_repair(sdp, trust_lvl, &rgcount) == 0) &&
 		    (ri_update(sdp, 0, &rgcount) == 0)) {
-			log_err("(level %d passed)\n", trust_lvl + 1);
+			log_err( _("(level %d passed)\n"), trust_lvl + 1);
 			break;
 		}
 		else
-			log_err("(level %d failed)\n", trust_lvl + 1);
+			log_err( _("(level %d failed)\n"), trust_lvl + 1);
 	}
 	if (trust_lvl > distrust) {
-		log_err("RG recovery impossible; I can't fix this file system.\n");
+		log_err( _("RG recovery impossible; I can't fix this file system.\n"));
 		return -1;
 	}
-	log_info("%u resource groups found.\n", rgcount);
+	log_info( _("%u resource groups found.\n"), rgcount);
 
 	/*******************************************************************
 	 *******  Now, set boundary fields in the super block  *************
 	 *******************************************************************/
 	if(set_block_ranges(sdp)){
-		log_err("Unable to determine the boundaries of the"
-			" file system.\n");
+		log_err( _("Unable to determine the boundaries of the"
+			" file system.\n"));
 		goto fail;
 	}
 
 	bl = gfs2_block_list_create(sdp, last_fs_block+1, &addl_mem_needed);
 	if (!bl) {
-		log_crit("This system doesn't have enough memory + swap space to fsck this file system.\n");
-		log_crit("Additional memory needed is approximately: %lluMB\n",
+		log_crit( _("This system doesn't have enough memory + swap space to fsck this file system.\n"));
+		log_crit( _("Additional memory needed is approximately: %lluMB\n"),
 			 (unsigned long long)(addl_mem_needed / 1048576ULL));
-		log_crit("Please increase your swap space by that amount and run gfs2_fsck again.\n");
+		log_crit( _("Please increase your swap space by that amount and run gfs2_fsck again.\n"));
 		goto fail;
 	}
 	return 0;
@@ -294,7 +296,7 @@
 	/********************************************************************
 	 ***************** First, initialize all lists **********************
 	 ********************************************************************/
-	log_info("Initializing lists...\n");
+	log_info( _("Initializing lists...\n"));
 	osi_list_init(&sdp->rglist);
 	init_buf_list(sdp, &sdp->buf_list, 128 << 20);
 	init_buf_list(sdp, &sdp->nvbuf_list, 0xffffffff);
@@ -310,8 +312,8 @@
 	sdp->bsize = sdp->sd_sb.sb_bsize;
 
 	if(sizeof(struct gfs2_sb) > sdp->sd_sb.sb_bsize){
-		log_crit("GFS superblock is larger than the blocksize!\n");
-		log_debug("sizeof(struct gfs2_sb) > sdp->sd_sb.sb_bsize\n");
+		log_crit( _("GFS superblock is larger than the blocksize!\n"));
+		log_debug( _("sizeof(struct gfs2_sb) > sdp->sd_sb.sb_bsize\n"));
 		return -1;
 	}
 
@@ -334,13 +336,13 @@
 {
 	if(opts.no) {
 		if ((sbp->device_fd = open(opts.device, O_RDONLY)) < 0) {
-			log_crit("Unable to open device: %s\n", opts.device);
+			log_crit( _("Unable to open device: %s\n"), opts.device);
 			return FSCK_USAGE;
 		}
 	} else {
 		/* read in sb from disk */
 		if ((sbp->device_fd = open(opts.device, O_RDWR)) < 0){
-			log_crit("Unable to open device: %s\n", opts.device);
+			log_crit( _("Unable to open device: %s\n"), opts.device);
 			return FSCK_USAGE;
 		}
 	}
@@ -352,7 +354,7 @@
 	/* Change lock protocol to be fsck_* instead of lock_* */
 	if(!opts.no) {
 		if(block_mounters(sbp, 1)) {
-			log_err("Unable to block other mounters\n");
+			log_err( _("Unable to block other mounters\n"));
 			return FSCK_USAGE;
 		}
 	}
@@ -376,10 +378,10 @@
 {
 	if(!opts.no) {
 		if(block_mounters(sbp, 0)) {
-			log_warn("Unable to unblock other mounters - manual intervention required\n");
-			log_warn("Use 'gfs2_tool sb <device> proto' to fix\n");
+			log_warn( _("Unable to unblock other mounters - manual intervention required\n"));
+			log_warn( _("Use 'gfs2_tool sb <device> proto' to fix\n"));
 		}
-		log_info("Syncing the device.\n");
+		log_info( _("Syncing the device.\n"));
 		fsync(sbp->device_fd);
 	}
 	empty_super_block(sbp);
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/link.c cluster-3.0.0.rc3/gfs2/fsck/link.c
--- cluster-3.0.0.rc2/gfs2/fsck/link.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/link.c	2009-06-11 11:02:55.000000000 +0200
@@ -3,6 +3,8 @@
 #include <stdint.h>
 #include <string.h>
 #include <unistd.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "fsck.h"
@@ -12,15 +14,15 @@
 int set_link_count(struct gfs2_sbd *sbp, uint64_t inode_no, uint32_t count)
 {
 	struct inode_info *ii = NULL;
-	log_debug("Setting link count to %u for %" PRIu64 " (0x%" PRIx64 ")\n",
+	log_debug( _("Setting link count to %u for %" PRIu64 " (0x%" PRIx64 ")\n"),
 			  count, inode_no, inode_no);
 	/* If the list has entries, look for one that matches
 	 * inode_no */
 	ii = inode_hash_search(inode_hash, inode_no);
 	if(ii) {
 		if(ii->link_count) {
-			log_err("Link count already set for inode #%" PRIu64 " (0x%"
-					PRIx64 ")!\n", inode_no, inode_no);
+			log_err( _("Link count already set for inode #%" PRIu64 " (0x%"
+					PRIx64 ")!\n"), inode_no, inode_no);
 			stack;
 			return -1;
 		}
@@ -31,7 +33,7 @@
 		/* If not match was found, add a new entry and set it's
 		 * link count to count*/
 		if(!(ii = (struct inode_info *) malloc(sizeof(*ii)))) {
-			log_err("Unable to allocate inode_info structure\n");
+			log_err( _("Unable to allocate inode_info structure\n"));
 			stack;
 			return -1;
 		}
@@ -52,21 +54,21 @@
 	 * inode_no */
 	if(ii) {
 		ii->counted_links++;
-		log_debug("Incremented counted links to %u for %"PRIu64" (0x%"
-				  PRIx64 ")\n", ii->counted_links, inode_no, inode_no);
+		log_debug( _("Incremented counted links to %u for %"PRIu64" (0x%"
+				  PRIx64 ")\n"), ii->counted_links, inode_no, inode_no);
 		return 0;
 	}
-	log_debug("No match found when incrementing link for %" PRIu64
-			  " (0x%" PRIx64 ")!\n", inode_no, inode_no);
+	log_debug( _("No match found when incrementing link for %" PRIu64
+			  " (0x%" PRIx64 ")!\n"), inode_no, inode_no);
 	/* If no match was found, add a new entry and set its
 	 * counted links to 1 */
 	if(!(ii = (struct inode_info *) malloc(sizeof(*ii)))) {
-		log_err("Unable to allocate inode_info structure\n");
+		log_err( _("Unable to allocate inode_info structure\n"));
 		stack;
 		return -1;
 	}
 	if(!memset(ii, 0, sizeof(*ii))) {
-		log_err("Unable to zero inode_info structure\n");
+		log_err( _("Unable to zero inode_info structure\n"));
 		stack;
 		return -1;
 	}
@@ -84,13 +86,13 @@
 	ii = inode_hash_search(inode_hash, inode_no);
 	/* If the list has entries, look for one that matches
 	 * inode_no */
-	log_err("Decrementing %"PRIu64" (0x%" PRIx64 ")\n", inode_no, inode_no);
+	log_err( _("Decrementing %"PRIu64" (0x%" PRIx64 ")\n"), inode_no, inode_no);
 	if(ii) {
 		ii->counted_links--;
 		return 0;
 	}
-	log_debug("No match found when decrementing link for %" PRIu64
-			  " (0x%" PRIx64 ")!\n", inode_no, inode_no);
+	log_debug( _("No match found when decrementing link for %" PRIu64
+			  " (0x%" PRIx64 ")!\n"), inode_no, inode_no);
 	return -1;
 
 }
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/lost_n_found.c cluster-3.0.0.rc3/gfs2/fsck/lost_n_found.c
--- cluster-3.0.0.rc2/gfs2/fsck/lost_n_found.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/lost_n_found.c	2009-06-11 11:02:55.000000000 +0200
@@ -5,6 +5,8 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <dirent.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "fsck.h"
 #include "libgfs2.h"
@@ -29,7 +31,7 @@
 	if(!lf_dip) {
 		struct gfs2_block_query q = {0};
 
-		log_info("Locating/Creating lost and found directory\n");
+		log_info( _("Locating/Creating lost and found directory\n"));
 
         lf_dip = createi(ip->i_sbd->md.rooti, "lost+found", S_IFDIR | 0700, 0);
 	if(gfs2_block_check(ip->i_sbd, bl, lf_dip->i_di.di_num.no_addr, &q)) {
@@ -54,30 +56,30 @@
 		}
 	}
 	if(ip->i_di.di_num.no_addr == lf_dip->i_di.di_num.no_addr) {
-		log_err("Trying to add lost+found to itself...skipping");
+		log_err( _("Trying to add lost+found to itself...skipping"));
 		return 0;
 	}
 	switch(ip->i_di.di_mode & S_IFMT){
 	case S_IFDIR:
-		log_info("Adding .. entry pointing to lost+found for %llu\n",
+		log_info( _("Adding .. entry pointing to lost+found for %llu\n"),
 				 (unsigned long long)ip->i_di.di_num.no_addr);
 		sprintf(tmp_name, "..");
 		filename_len = strlen(tmp_name);  /* no trailing NULL */
 		if(!(filename = malloc((sizeof(char) * filename_len) + 1))) {
-			log_err("Unable to allocate name\n");
+			log_err( _("Unable to allocate name\n"));
 			stack;
 			return -1;
 		}
 		if(!memset(filename, 0, (sizeof(char) * filename_len) + 1)) {
-			log_err("Unable to zero name\n");
+			log_err( _("Unable to zero name\n"));
 			stack;
 			return -1;
 		}
 		memcpy(filename, tmp_name, filename_len);
 
 		if(gfs2_dirent_del(ip, NULL, filename, filename_len))
-			log_warn("add_inode_to_lf:  "
-					 "Unable to remove \"..\" directory entry.\n");
+			log_warn( _("add_inode_to_lf:  "
+					 "Unable to remove \"..\" directory entry.\n"));
 
 		dir_add(ip, filename, filename_len, &(lf_dip->i_di.di_num), DT_DIR);
 		free(filename);
@@ -123,12 +125,12 @@
 	}
 	filename_len = strlen(tmp_name);  /* no trailing NULL */
 	if(!(filename = malloc(sizeof(char) * filename_len))) {
-		log_err("Unable to allocate name\n");
+		log_err( _("Unable to allocate name\n"));
 			stack;
 			return -1;
 		}
 	if(!memset(filename, 0, sizeof(char) * filename_len)) {
-		log_err("Unable to zero name\n");
+		log_err( _("Unable to zero name\n"));
 		stack;
 		return -1;
 	}
@@ -140,7 +142,7 @@
 		increment_link(ip->i_sbd, lf_dip->i_di.di_num.no_addr);
 
 	free(filename);
-	log_notice("Added inode #%llu to lost+found dir\n",
+	log_notice( _("Added inode #%llu to lost+found dir\n"),
 		   (unsigned long long)ip->i_di.di_num.no_addr);
 	return 0;
 }
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/main.c cluster-3.0.0.rc3/gfs2/fsck/main.c
--- cluster-3.0.0.rc2/gfs2/fsck/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -7,6 +7,9 @@
 #include <stdarg.h>
 #include <ctype.h>
 #include <signal.h>
+#include <libintl.h>
+#include <locale.h>
+#define _(String) gettext(String)
 
 #include "copyright.cf"
 #include "libgfs2.h"
@@ -24,7 +27,6 @@
 const char *pass = "";
 uint64_t last_data_block;
 uint64_t first_data_block;
-char *prog_name = "gfs2_fsck"; /* needed by libgfs2 */
 
 /* This function is for libgfs2's sake.                                      */
 void print_it(const char *label, const char *fmt, const char *fmt2, ...)
@@ -37,19 +39,19 @@
 	va_end(args);
 }
 
-void usage(char *name)
+static void usage(char *name)
 {
-	printf("Usage: %s [-hnqvVy] <device> \n", basename(name));
+	printf( _("Usage: %s [-hnqvVy] <device> \n"), basename(name));
 }
 
-void version(void)
+static void version(void)
 {
-	printf("GFS2 fsck %s (built %s %s)\n",
+	printf( _("GFS2 fsck %s (built %s %s)\n"),
 	       RELEASE_VERSION, __DATE__, __TIME__);
-	printf("%s\n", REDHAT_COPYRIGHT);
+	printf( _(REDHAT_COPYRIGHT "\n"));
 }
 
-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;
 
@@ -61,7 +63,7 @@
 			exit(FSCK_OK);
 			break;
 		case 'n':
-			opts->no = 1;
+			gopts->no = 1;
 			break;
 		case 'q':
 			decrease_verbosity();
@@ -74,47 +76,47 @@
 			exit(FSCK_OK);
 			break;
 		case 'y':
-			opts->yes = 1;
+			gopts->yes = 1;
 			break;
 		case ':':
 		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
+			fprintf(stderr, _("Please use '-h' for usage.\n"));
 			return FSCK_USAGE;
 		default:
-			fprintf(stderr, "Bad programmer! You forgot to catch"
-				" the %c flag\n", c);
+			fprintf(stderr, _("Bad programmer! You forgot to catch"
+				" the %c flag\n"), c);
 			return FSCK_USAGE;
 
 		}
 	}
 	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 {
-		fprintf(stderr, "No device specified.  Use '-h' for usage.\n");
+		fprintf(stderr, _("No device specified.  Use '-h' for usage.\n"));
 		return FSCK_USAGE;
 	}
 	return 0;
 }
 
-void interrupt(int sig)
+static void interrupt(int sig)
 {
 	char response;
 	char progress[PATH_MAX];
 
 	if (!last_reported_block || last_reported_block == last_fs_block)
-		sprintf(progress, "progress unknown.\n");
+		sprintf(progress, _("progress unknown.\n"));
 	else
-		sprintf(progress, "processing block %" PRIu64 " out of %"
-			PRIu64 "\n", last_reported_block, last_fs_block);
+		sprintf(progress, _("processing block %" PRIu64 " out of %"
+			PRIu64 "\n"), last_reported_block, last_fs_block);
 	
 	response = generic_interrupt("gfs2_fsck", pass, progress,
-				     "Do you want to abort gfs2_fsck, skip " \
+				     _("Do you want to abort gfs2_fsck, skip " \
 				     "the rest of this pass or continue " \
-				     "(a/s/c)?", "asc");
+				     "(a/s/c)?"), "asc");
 	if(tolower(response) == 's') {
 		skip_this_pass = TRUE;
 		return;
@@ -127,27 +129,27 @@
 
 /* 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,
 		       int builder(struct gfs2_sbd *sbp),
 		       enum gfs2_mark_block mark)
 {
 	uint64_t iblock = 0;
 	struct dir_status ds = {0};
 
-	log_info("Checking system inode '%s'\n", filename);
+	log_info( _("Checking system inode '%s'\n"), filename);
 	if (sysinode) {
 		/* Read in the system inode, look at its dentries, and start
 		 * reading through them */
 		iblock = sysinode->i_di.di_num.no_addr;
-		log_info("System inode for '%s' is located at block %"
-			 PRIu64 " (0x%" PRIx64 ")\n", filename,
+		log_info( _("System inode for '%s' is located at block %"
+			 PRIu64 " (0x%" PRIx64 ")\n"), filename,
 			 iblock, iblock);
 		
 		/* FIXME: check this block's validity */
 
 		if(gfs2_block_check(sysinode->i_sbd, bl, iblock, &ds.q)) {
-			log_crit("Can't get %s inode block %" PRIu64 " (0x%"
-				 PRIx64 ") from block list\n", filename,
+			log_crit( _("Can't get %s inode block %" PRIu64 " (0x%"
+				 PRIx64 ") from block list\n"), filename,
 				 iblock, iblock);
 			return -1;
 		}
@@ -156,7 +158,7 @@
 		/* bitmap.  In that case, don't rebuild the inode.  */
 		/* Just reuse the inode and fix the bitmap.         */
 		if (ds.q.block_type == gfs2_block_free) {
-			log_info("The inode exists but the block is not marked 'in use'; fixing it.\n");
+			log_info( _("The inode exists but the block is not marked 'in use'; fixing it.\n"));
 			gfs2_block_set(sysinode->i_sbd, bl,
 				       sysinode->i_di.di_num.no_addr,
 				       mark);
@@ -167,16 +169,16 @@
 		}
 	}
 	else
-		log_info("System inode for '%s' is missing.\n", filename);
+		log_info( _("System inode for '%s' is missing.\n"), filename);
 	/* If there are errors with the inode here, we need to
 	 * create a new inode and get it all setup - of course,
 	 * everything will be in lost+found then, but we *need* our
 	 * system inodes before we can do any of that. */
 	if(!sysinode || ds.q.block_type != mark) {
-		log_err("Invalid or missing %s system inode.\n", filename);
+		log_err( _("Invalid or missing %s system inode.\n"), filename);
 		errors_found++;
 		if ((errors_corrected +=
-		    query(&opts, "Create new %s system inode? (y/n) ",
+		    query(&opts, _("Create new %s system inode? (y/n) "),
 			  filename))) {
 			builder(sysinode->i_sbd);
 			gfs2_block_set(sysinode->i_sbd, bl,
@@ -188,7 +190,7 @@
 						sysinode->i_di.di_num.no_addr);
 		}
 		else {
-			log_err("Cannot continue without valid %s inode\n",
+			log_err( _("Cannot continue without valid %s inode\n"),
 				filename);
 			return -1;
 		}
@@ -197,7 +199,7 @@
 	return 0;
 }
 
-int check_system_inodes(struct gfs2_sbd *sdp)
+static int check_system_inodes(struct gfs2_sbd *sdp)
 {
 	/*******************************************************************
 	 *******  Check the system inode integrity             *************
@@ -253,27 +255,30 @@
 	enum update_flags update_sys_files;
 	int error = 0;
 
+	setlocale(LC_ALL, "");
+	textdomain("fsck.gfs2");
+
 	memset(sbp, 0, sizeof(*sbp));
 
 	if((error = read_cmdline(argc, argv, &opts)))
 		exit(error);
 	setbuf(stdout, NULL);
-	log_notice("Initializing fsck\n");
+	log_notice( _("Initializing fsck\n"));
 	if ((error = initialize(sbp)))
 		exit(error);
 
 	signal(SIGINT, interrupt);
-	log_notice("Starting pass1\n");
+	log_notice( _("Starting pass1\n"));
 	pass = "pass 1";
 	last_reported_block = 0;
 	if ((error = pass1(sbp)))
 		exit(error);
 	if (skip_this_pass || fsck_abort) {
 		skip_this_pass = FALSE;
-		log_notice("Pass1 interrupted   \n");
+		log_notice( _("Pass1 interrupted   \n"));
 	}
 	else
-		log_notice("Pass1 complete      \n");
+		log_notice( _("Pass1 complete      \n"));
 
 	/* Make sure the system inodes are okay & represented in the bitmap. */
 	check_system_inodes(sbp);
@@ -281,81 +286,81 @@
 	if (!fsck_abort) {
 		last_reported_block = 0;
 		pass = "pass 1b";
-		log_notice("Starting pass1b\n");
+		log_notice( _("Starting pass1b\n"));
 		if((error = pass1b(sbp)))
 			exit(error);
 		if (skip_this_pass || fsck_abort) {
 			skip_this_pass = FALSE;
-			log_notice("Pass1b interrupted   \n");
+			log_notice( _("Pass1b interrupted   \n"));
 		}
 		else
-			log_notice("Pass1b complete\n");
+			log_notice( _("Pass1b complete\n"));
 	}
 	if (!fsck_abort) {
 		last_reported_block = 0;
 		pass = "pass 1c";
-		log_notice("Starting pass1c\n");
+		log_notice( _("Starting pass1c\n"));
 		if((error = pass1c(sbp)))
 			exit(error);
 		if (skip_this_pass || fsck_abort) {
 			skip_this_pass = FALSE;
-			log_notice("Pass1c interrupted   \n");
+			log_notice( _("Pass1c interrupted   \n"));
 		}
 		else
-			log_notice("Pass1c complete\n");
+			log_notice( _("Pass1c complete\n"));
 	}
 	if (!fsck_abort) {
 		last_reported_block = 0;
 		pass = "pass 2";
-		log_notice("Starting pass2\n");
+		log_notice( _("Starting pass2\n"));
 		if ((error = pass2(sbp)))
 			exit(error);
 		if (skip_this_pass || fsck_abort) {
 			skip_this_pass = FALSE;
-			log_notice("Pass2 interrupted   \n");
+			log_notice( _("Pass2 interrupted   \n"));
 		}
 		else
-			log_notice("Pass2 complete      \n");
+			log_notice( _("Pass2 complete      \n"));
 	}
 	if (!fsck_abort) {
 		last_reported_block = 0;
 		pass = "pass 3";
-		log_notice("Starting pass3\n");
+		log_notice( _("Starting pass3\n"));
 		if ((error = pass3(sbp)))
 			exit(error);
 		if (skip_this_pass || fsck_abort) {
 			skip_this_pass = FALSE;
-			log_notice("Pass3 interrupted   \n");
+			log_notice( _("Pass3 interrupted   \n"));
 		}
 		else
-			log_notice("Pass3 complete      \n");
+			log_notice( _("Pass3 complete      \n"));
 	}
 	if (!fsck_abort) {
 		last_reported_block = 0;
 		pass = "pass 4";
-		log_notice("Starting pass4\n");
+		log_notice( _("Starting pass4\n"));
 		if ((error = pass4(sbp)))
 			exit(error);
 		if (skip_this_pass || fsck_abort) {
 			skip_this_pass = FALSE;
-			log_notice("Pass4 interrupted   \n");
+			log_notice( _("Pass4 interrupted   \n"));
 		}
 		else
-			log_notice("Pass4 complete      \n");
+			log_notice( _("Pass4 complete      \n"));
 	}
 	if (!fsck_abort) {
 		last_reported_block = 0;
 		pass = "pass 5";
-		log_notice("Starting pass5\n");
+		log_notice( _("Starting pass5\n"));
 		if ((error = pass5(sbp)))
 			exit(error);
 		if (skip_this_pass || fsck_abort) {
 			skip_this_pass = FALSE;
-			log_notice("Pass5 interrupted   \n");
+			log_notice( _("Pass5 interrupted   \n"));
 			error = FSCK_CANCELED;
 		}
 		else
-			log_notice("Pass5 complete      \n");
+			log_notice( _("Pass5 complete      \n"));
 	} else {
 		error = FSCK_CANCELED;
 	}
@@ -375,11 +380,11 @@
 		inode_put(lf_dip, update_sys_files);
 
 	if (!opts.no)
-		log_notice("Writing changes to disk\n");
+		log_notice( _("Writing changes to disk\n"));
 	bsync(&sbp->buf_list);
 	bsync(&sbp->nvbuf_list);
 	destroy(sbp);
-	log_notice("gfs2_fsck complete    \n");
+	log_notice( _("gfs2_fsck complete    \n"));
 
 	if (!error) {
 		if (!errors_found)
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/metawalk.c cluster-3.0.0.rc3/gfs2/fsck/metawalk.c
--- cluster-3.0.0.rc2/gfs2/fsck/metawalk.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/metawalk.c	2009-06-11 11:02:55.000000000 +0200
@@ -5,6 +5,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "fsck.h"
@@ -63,7 +65,7 @@
 
 	ip = calloc(1, sizeof(struct gfs2_inode));
 	if (ip == NULL) {
-		fprintf(stderr, "Out of memory in %s\n", __FUNCTION__);
+		fprintf(stderr, _("Out of memory in %s\n"), __FUNCTION__);
 		exit(-1);
 	}
 	gfs2_dinode_in(&ip->i_di, bh->b_data);
@@ -94,7 +96,7 @@
 	}
 }
 
-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)
 {
@@ -133,8 +135,8 @@
 	return 0;
 }
 
-int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
-		  int index, int type, enum update_flags *update,
+static int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
+		  int eindex, int type, enum update_flags *update,
 		  uint16_t *count, struct metawalk_fxns *pass)
 {
 	struct gfs2_leaf *leaf = NULL;
@@ -153,11 +155,11 @@
 	else if (type == DIR_EXHASH) {
 		dent = (struct gfs2_dirent *)(bh->b_data + sizeof(struct gfs2_leaf));
 		leaf = (struct gfs2_leaf *)bh->b_data;
-		log_debug("Checking leaf %" PRIu64 " (0x%" PRIx64 ")\n",
+		log_debug( _("Checking leaf %" PRIu64 " (0x%" PRIx64 ")\n"),
 				  bh->b_blocknr, bh->b_blocknr);
 	}
 	else {
-		log_err("Invalid directory type %d specified\n", type);
+		log_err( _("Invalid directory type %d specified\n"), type);
 		return -1;
 	}
 
@@ -172,16 +174,16 @@
 
 		if (de.de_rec_len < sizeof(struct gfs2_dirent) +
 		    de.de_name_len || !de.de_name_len) {
-			log_err("Directory block %llu (0x%llx"
+			log_err( _("Directory block %llu (0x%llx"
 				"), entry %d of directory %llu"
-				"(0x%llx) is corrupt.\n",
+				"(0x%llx) is corrupt.\n"),
 				(unsigned long long)bh->b_blocknr,
 				(unsigned long long)bh->b_blocknr,
 				(*count) + 1,
 				(unsigned long long)ip->i_di.di_num.no_addr,
 				(unsigned long long)ip->i_di.di_num.no_addr);
 			errors_found++;
-			if (query(&opts, "Attempt to repair it? (y/n) ")) {
+			if (query(&opts, _("Attempt to repair it? (y/n) "))) {
 				if (dirent_repair(ip, bh, &de, dent, type,
 						  first))
 					break;
@@ -191,21 +193,21 @@
 				}
 			}
 			else {
-				log_err("Corrupt directory entry ignored, "
-					"stopped after checking %d entries.\n",
+				log_err( _("Corrupt directory entry ignored, "
+					"stopped after checking %d entries.\n"),
 					*count);
 				break;
 			}
 		}
 		if (!de.de_inum.no_formal_ino){
 			if(first){
-				log_debug("First dirent is a sentinel (place holder).\n");
+				log_debug( _("First dirent is a sentinel (place holder).\n"));
 				first = 0;
 			} else {
 				/* FIXME: Do something about this */
-				log_err("Directory entry with inode number of "
+				log_err( _("Directory entry with inode number of "
 					"zero in leaf %llu (0x%llx) of "
-					"directory %llu (0x%llx)!\n",
+					"directory %llu (0x%llx)!\n"),
 					(unsigned long long)bh->b_blocknr,
 					(unsigned long long)bh->b_blocknr,
 					(unsigned long long)ip->i_di.di_num.no_addr,
@@ -214,7 +216,7 @@
 			}
 		} else {
 			if (!de.de_inum.no_addr && first) { /* reverse sentinel */
-				log_debug("First dirent is a Sentinel (place holder).\n");
+				log_debug( _("First dirent is a Sentinel (place holder).\n"));
 				/* Swap the two to silently make it a proper sentinel */
 				de.de_inum.no_addr = de.de_inum.no_formal_ino;
 				de.de_inum.no_formal_ino = 0;
@@ -239,7 +241,7 @@
 		}
 
 		if ((char *)dent + de.de_rec_len >= bh_end){
-			log_debug("Last entry processed.\n");
+			log_debug( _("Last entry processed.\n"));
 			break;
 		}
 
@@ -258,13 +260,13 @@
 /* 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, int index,
+static void warn_and_patch(struct gfs2_inode *ip, uint64_t *leaf_no, 
+		    uint64_t *bad_leaf, uint64_t old_leaf, int pindex,
 		    const char *msg)
 {
 	if (*bad_leaf != *leaf_no) {
-		log_err("Directory Inode %llu (0x%llx) points to leaf %llu"
-			" (0x%llx) %s.\n",
+		log_err( _("Directory Inode %llu (0x%llx) points to leaf %llu"
+			" (0x%llx) %s.\n"),
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)*leaf_no,
@@ -272,39 +274,39 @@
 	}
 	errors_found++;
 	if (*leaf_no == *bad_leaf ||
-	    query(&opts, "Attempt to patch around it? (y/n) ")) {
+	    query(&opts, _("Attempt to patch around it? (y/n) "))) {
 		errors_corrected++;
-		gfs2_put_leaf_nr(ip, index, old_leaf);
+		gfs2_put_leaf_nr(ip, pindex, old_leaf);
 	}
 	else
-		log_err("Bad leaf left in place.\n");
+		log_err( _("Bad leaf left in place.\n"));
 	*bad_leaf = *leaf_no;
 	*leaf_no = old_leaf;
 }
 
 /* Checks exhash directory entries */
-int check_leaf(struct gfs2_inode *ip, enum update_flags *update,
+static int check_leaf(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;
 	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;
 
 	old_leaf = 0;
 	memset(&oldleaf, 0, sizeof(oldleaf));
-	for(index = 0; index < (1 << ip->i_di.di_depth); index++) {
-		gfs2_get_leaf_nr(ip, index, &leaf_no);
+	for(lindex = 0; lindex < (1 << ip->i_di.di_depth); lindex++) {
+		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;
@@ -314,10 +316,10 @@
 			continue;
 		} else {
 			if(ref_count != exp_count){
-				log_err("Dir #%llu (0x%llx) has an incorrect "
+				log_err( _("Dir #%llu (0x%llx) has an incorrect "
 					"number of pointers to leaf #%llu "
 					" (0x%llx)\n\tFound: %u,  Expected: "
-					"%u\n", (unsigned long long)
+					"%u\n"), (unsigned long long)
 					ip->i_di.di_num.no_addr,
 					(unsigned long long)
 					ip->i_di.di_num.no_addr,
@@ -325,7 +327,7 @@
 					(unsigned long long)old_leaf,
 					ref_count, exp_count);
 				errors_found++;
-				if (query(&opts, "Attempt to fix it? (y/n) "))
+				if (query(&opts, _("Attempt to fix it? (y/n) ")))
 				{
 					int factor = 0, divisor = ref_count;
 
@@ -350,17 +352,17 @@
 		do {
 			/* Make sure the block number is in range. */
 			if(gfs2_check_range(ip->i_sbd, leaf_no)){
-				log_err("Leaf block #%llu (0x%llx) is out "
+				log_err( _("Leaf block #%llu (0x%llx) is out "
 					"of range for directory #%llu (0x%llx"
-					").\n", (unsigned long long)leaf_no,
+					").\n"), (unsigned long long)leaf_no,
 					(unsigned long long)leaf_no,
 					(unsigned long long)
 					ip->i_di.di_num.no_addr,
 					(unsigned long long)
 					ip->i_di.di_num.no_addr);
 				warn_and_patch(ip, &leaf_no, &bad_leaf,
-					       old_leaf, index,
-					       "that is out of range");
+					       old_leaf, lindex,
+					       _("that is out of range"));
 				memcpy(&leaf, &oldleaf, sizeof(oldleaf));
 				break;
 			}
@@ -371,8 +373,8 @@
 			/* 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, index,
-					       "that is not really a leaf");
+					       old_leaf, lindex,
+					       _("that is not really a leaf"));
 				memcpy(&leaf, &oldleaf, sizeof(oldleaf));
 				brelse(lbh, (opts.no ? not_updated : updated));
 				break;
@@ -391,18 +393,18 @@
 			 * values and replace them with the correct value. */
 
 			if (leaf.lf_dirent_format == (GFS2_FORMAT_DE << 16)) {
-				log_debug("incorrect lf_dirent_format at leaf #%" PRIu64 "\n", leaf_no);
+				log_debug( _("incorrect lf_dirent_format at leaf #%" PRIu64 "\n"), leaf_no);
 				leaf.lf_dirent_format = GFS2_FORMAT_DE;
 				gfs2_leaf_out(&leaf, lbh->b_data);
-				log_debug("Fixing lf_dirent_format.\n");
+				log_debug( _("Fixing lf_dirent_format.\n"));
 				*update = (opts.no ? not_updated : updated);
 			}
 
 			/* Make sure it's really a leaf. */
 			if (leaf.lf_header.mh_type != GFS2_METATYPE_LF) {
-				log_err("Inode %llu (0x%llx"
+				log_err( _("Inode %llu (0x%llx"
 					") points to bad leaf %llu"
-					" (0x%llx).\n",
+					" (0x%llx).\n"),
 					(unsigned long long)
 					ip->i_di.di_num.no_addr,
 					(unsigned long long)
@@ -413,12 +415,12 @@
 				break;
 			}
 			exp_count = (1 << (ip->i_di.di_depth - leaf.lf_depth));
-			log_debug("expected count %u - di_depth %u, leaf depth %u\n",
+			log_debug( _("expected count %u - di_depth %u, leaf depth %u\n"),
 					  exp_count, ip->i_di.di_depth, leaf.lf_depth);
 
 			if(pass->check_dentry &&
 			   S_ISDIR(ip->i_di.di_mode)) {
-				error = check_entries(ip, lbh, index,
+				error = check_entries(ip, lbh, lindex,
 						      DIR_EXHASH, update,
 						      &count, pass);
 
@@ -442,11 +444,11 @@
 					lbh = bread(&sbp->buf_list, leaf_no);
 					gfs2_leaf_in(&leaf, lbh->b_data);
 
-					log_err("Leaf %llu (0x%llx) entry "
+					log_err( _("Leaf %llu (0x%llx) entry "
 						"count in directory %llu"
 						" (0x%llx) doesn't match "
 						"number of entries found "
-						"- is %u, found %u\n",
+						"- is %u, found %u\n"),
 						(unsigned long long)leaf_no,
 						(unsigned long long)leaf_no,
 						(unsigned long long)
@@ -455,14 +457,14 @@
 						ip->i_di.di_num.no_addr,
 						leaf.lf_entries, count);
 					errors_found++;
-					if(query(&opts, "Update leaf entry count? (y/n) ")) {
+					if(query(&opts, _("Update leaf entry count? (y/n) "))) {
 						errors_corrected++;
 						leaf.lf_entries = count;
 						gfs2_leaf_out(&leaf, lbh->b_data);
-						log_warn("Leaf entry count updated\n");
+						log_warn( _("Leaf entry count updated\n"));
 						f = updated;
 					} else
-						log_err("Leaf entry count left in inconsistant state\n");
+						log_err( _("Leaf entry count left in inconsistant state\n"));
 					brelse(lbh, f);
 				}
 				/* FIXME: Need to get entry count and
@@ -473,7 +475,7 @@
 				if(!leaf.lf_next)
 					break;
 				leaf_no = leaf.lf_next;
-				log_debug("Leaf chain detected.\n");
+				log_debug( _("Leaf chain detected.\n"));
 			}
 		} while(1);
 		old_leaf = leaf_no;
@@ -532,8 +534,8 @@
 							      update_it,
 							      pass->private)) {
 					errors_found++;
-					if (query(&opts, "Repair the bad EA? "
-						  "(y/n) ")) {
+					if (query(&opts, _("Repair the bad EA? "
+						  "(y/n) "))) {
 						errors_corrected++;
 						ea_hdr->ea_num_ptrs = i;
 						ea_hdr->ea_data_len =
@@ -545,7 +547,7 @@
 						   a single byte. */
 						return -1;
 					}
-					log_err("The bad EA was not fixed.\n");
+					log_err( _("The bad EA was not fixed.\n"));
 				}
 				tot_ealen += sdp->sd_sb.sb_bsize -
 					sizeof(struct gfs2_meta_header);
@@ -580,7 +582,7 @@
 	struct gfs2_buffer_head *bh = NULL;
 	int error = 0;
 
-	log_debug("Checking EA leaf block #%"PRIu64" (0x%" PRIx64 ").\n",
+	log_debug( _("Checking EA leaf block #%"PRIu64" (0x%" PRIx64 ").\n"),
 			  block, block);
 
 	if(pass->check_eattr_leaf) {
@@ -618,7 +620,7 @@
 	struct gfs2_sbd *sdp = ip->i_sbd;
 
 	*want_updated = not_updated;
-	log_debug("Checking EA indirect block #%"PRIu64" (0x%" PRIx64 ").\n",
+	log_debug( _("Checking EA indirect block #%"PRIu64" (0x%" PRIx64 ").\n"),
 			  indirect, indirect);
 
 	if (!pass->check_eattr_indir)
@@ -683,7 +685,7 @@
 		return 0;
 	}
 
-	log_debug("Extended attributes exist for inode #%llu (0x%llx).\n",
+	log_debug( _("Extended attributes exist for inode #%llu (0x%llx).\n"),
 		  (unsigned long long)ip->i_di.di_num.no_addr,
 		  (unsigned long long)ip->i_di.di_num.no_addr);
 
@@ -755,8 +757,8 @@
 					goto fail;
 				}
 				if(err > 0) {
-					log_debug("Skipping block %" PRIu64
-						  " (0x%" PRIx64 ")\n",
+					log_debug( _("Skipping block %" PRIu64
+						  " (0x%" PRIx64 ")\n"),
 						  block, block);
 					continue;
 				}
@@ -816,7 +818,7 @@
 	/* We don't need to record directory blocks - they will be
 	 * recorded later...i think... */
         if (S_ISDIR(ip->i_di.di_mode))
-		log_debug("Directory with height > 0 at %llu (0x%llx)\n",
+		log_debug( _("Directory with height > 0 at %llu (0x%llx)\n"),
 			  (unsigned long long)ip->i_di.di_num.no_addr,
 			  (unsigned long long)ip->i_di.di_num.no_addr);
 
@@ -873,7 +875,7 @@
 }
 
 /* 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;
@@ -952,10 +954,10 @@
 	struct gfs2_block_query q;
 	int error;
 
-	log_debug("Removing dentry %" PRIu64 " (0x%" PRIx64 ") from directory %"
-			  PRIu64" (0x%" PRIx64 ")\n", dentryblock, dentryblock, dir, dir);
+	log_debug( _("Removing dentry %" PRIu64 " (0x%" PRIx64 ") from directory %"
+			  PRIu64" (0x%" PRIx64 ")\n"), dentryblock, dentryblock, dir, dir);
 	if(gfs2_check_range(sbp, dir)) {
-		log_err("Parent directory out of range\n");
+		log_err( _("Parent directory out of range\n"));
 		return 1;
 	}
 	remove_dentry_fxns.private = &dentryblock;
@@ -966,7 +968,7 @@
 		return -1;
 	}
 	if(q.block_type != gfs2_inode_dir) {
-		log_info("Parent block is not a directory...ignoring\n");
+		log_info( _("Parent block is not a directory...ignoring\n"));
 		return 1;
 	}
 	/* Need to run check_dir with a private var of dentryblock,
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/pass1b.c cluster-3.0.0.rc3/gfs2/fsck/pass1b.c
--- cluster-3.0.0.rc2/gfs2/fsck/pass1b.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/pass1b.c	2009-06-11 11:02:55.000000000 +0200
@@ -2,6 +2,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "fsck.h"
@@ -87,10 +89,9 @@
 }
 
 static int check_eattr_entry(struct gfs2_inode *ip,
-							 struct gfs2_buffer_head *leaf_bh,
-							 struct gfs2_ea_header *ea_hdr,
-							 struct gfs2_ea_header *ea_hdr_prev,
-							 void *private)
+			     struct gfs2_buffer_head *leaf_bh,
+			     struct gfs2_ea_header *ea_hdr,
+			     struct gfs2_ea_header *ea_hdr_prev, void *private)
 {
 	return 0;
 }
@@ -132,9 +133,9 @@
 			if(id->block_no == de->de_inum.no_addr) {
 				id->name = strdup(filename);
 				id->parent = ip->i_di.di_num.no_addr;
-				log_debug("Duplicate block %llu (0x%llx"
+				log_debug( _("Duplicate block %llu (0x%llx"
 					  ") is in file or directory %llu"
-					  " (0x%llx) named %s\n",
+					  " (0x%llx) named %s\n"),
 					  (unsigned long long)id->block_no,
 					  (unsigned long long)id->block_no,
 					  (unsigned long long)
@@ -164,12 +165,12 @@
 	if(dh->ref_count == 1)
 		return 1;
 	if(block == dh->b->block_no) {
-		log_err("Found dup in inode \"%s\" (block #%llu"
-			") with block #%llu\n",
-			dh->id->name ? dh->id->name : "unknown name",
+		log_err( _("Found dup in inode \"%s\" (block #%llu"
+			") with block #%llu\n"),
+			dh->id->name ? dh->id->name : _("unknown name"),
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)block);
-		log_err("Inode %s is in directory %"PRIu64" (0x%" PRIx64 ")\n",
+		log_err( _("Inode %s is in directory %"PRIu64" (0x%" PRIx64 ")\n"),
 				dh->id->name ? dh->id->name : "",
 				dh->id->parent, dh->id->parent);
 		inode_hash_remove(inode_hash, ip->i_di.di_num.no_addr);
@@ -189,14 +190,14 @@
 		return 1;
 	}
 	if(block == dh->b->block_no) {
-		log_err("Found dup in inode \"%s\" for block #%llu"
-			" (0x%llx) at block #%llu (0x%llx)\n",
-			dh->id->name ? dh->id->name : "unknown name",
+		log_err( _("Found dup in inode \"%s\" for block #%llu"
+			" (0x%llx) at block #%llu (0x%llx)\n"),
+			dh->id->name ? dh->id->name : _("unknown name"),
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)block,
 			(unsigned long long)block);
-		log_err("Inode %s is in directory %"PRIu64" (0x%" PRIx64 ")\n",
+		log_err( _("Inode %s is in directory %"PRIu64" (0x%" PRIx64 ")\n"),
 				dh->id->name ? dh->id->name : "", dh->id->parent,
 				dh->id->parent);
 		inode_hash_remove(inode_hash, ip->i_di.di_num.no_addr);
@@ -221,14 +222,14 @@
 	if(dh->ref_count == 1)
 		return 1;
 	if(block == dh->b->block_no) {
-		log_err("Found dup in inode \"%s\" with address #%llu"
-			" (0x%llx) with block #%llu (0x%llx)\n",
-			dh->id->name ? dh->id->name : "unknown name",
+		log_err( _("Found dup in inode \"%s\" with address #%llu"
+			" (0x%llx) with block #%llu (0x%llx)\n"),
+			dh->id->name ? dh->id->name : _("unknown name"),
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)block,
 			(unsigned long long)block);
-		log_err("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n",
+		log_err( _("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n"),
 				dh->id->name ? dh->id->name : "",
 				dh->id->parent, dh->id->parent);
 		gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_eattr,
@@ -248,14 +249,14 @@
 	if(dh->ref_count == 1)
 		return 1;
 	if(block == dh->b->block_no) {
-		log_err("Found dup in inode \"%s\" with address #%llu"
-			" (0x%llx) with block #%llu (0x%llx)\n",
-			dh->id->name ? dh->id->name : "unknown name",
+		log_err( _("Found dup in inode \"%s\" with address #%llu"
+			" (0x%llx) with block #%llu (0x%llx)\n"),
+			dh->id->name ? dh->id->name : _("unknown name"),
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)block,
 			(unsigned long long)block);
-		log_err("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n",
+		log_err( _("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n"),
 				dh->id->name ? dh->id->name : "",
 				dh->id->parent, dh->id->parent);
 		/* mark the main eattr block invalid */
@@ -301,7 +302,7 @@
 		if(max_ptrs > ea_hdr->ea_num_ptrs)
 			return 1;
 		else {
-			log_debug("  Pointers Required: %d\n  Pointers Reported: %d\n",
+			log_debug( _("  Pointers Required: %d\n  Pointers Reported: %d\n"),
 					  max_ptrs, ea_hdr->ea_num_ptrs);
 		}
 	}
@@ -322,13 +323,13 @@
 	if(dh->ref_count == 1)
 		return 1;
 	if(block == dh->b->block_no) {
-		log_err("Found dup in inode \"%s\" with address #%llu"
-			" (0x%llx) with block #%llu (0x%llx)\n",
-			dh->id->name ? dh->id->name : "unknown name",
+		log_err( _("Found dup in inode \"%s\" with address #%llu"
+			" (0x%llx) with block #%llu (0x%llx)\n"),
+			dh->id->name ? dh->id->name : _("unknown name"),
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)block, (unsigned long long)block);
-		log_err("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n",
+		log_err( _("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n"),
 				dh->id->name ? dh->id->name : "",
 				dh->id->parent, dh->id->parent);
 		/* mark the main eattr block invalid */
@@ -341,7 +342,7 @@
 }
 
 /* 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};
@@ -360,15 +361,15 @@
 	enum update_flags update;
 
 	ip = fsck_load_inode(sbp, inode); /* bread, inode_get */
-	log_info("Checking inode %" PRIu64 " (0x%" PRIx64
+	log_info( _("Checking inode %" PRIu64 " (0x%" PRIx64
 			 ")'s metatree for references to block %" PRIu64 " (0x%" PRIx64
-			 ")\n", inode, inode, b->block_no, b->block_no);
+			 ")\n"), inode, inode, b->block_no, b->block_no);
 	if(check_metatree(ip, &find_refs)) {
 		stack;
 		fsck_inode_put(ip, not_updated); /* out, brelse, free */
 		return -1;
 	}
-	log_info("Done checking metatree\n");
+	log_info( _("Done checking metatree\n"));
 	/* Check for ea references in the inode */
 	if(check_inode_eattr(ip, &update, &find_refs) < 0){
 		stack;
@@ -377,15 +378,15 @@
 	}
 	if (myfi.found) {
 		if(!(id = malloc(sizeof(*id)))) {
-			log_crit("Unable to allocate inode_with_dups structure\n");
+			log_crit( _("Unable to allocate inode_with_dups structure\n"));
 			return -1;
 		}
 		if(!(memset(id, 0, sizeof(*id)))) {
-			log_crit("Unable to zero inode_with_dups structure\n");
+			log_crit( _("Unable to zero inode_with_dups structure\n"));
 			return -1;
 		}
-		log_debug("Found %d entries with block %" PRIu64
-				  " (0x%" PRIx64 ") in inode #%" PRIu64 " (0x%" PRIx64 ")\n",
+		log_debug( _("Found %d entries with block %" PRIu64
+				  " (0x%" PRIx64 ") in inode #%" PRIu64 " (0x%" PRIx64 ")\n"),
 				  myfi.found, b->block_no, b->block_no, inode, inode);
 		id->dup_count = myfi.found;
 		id->block_no = inode;
@@ -396,7 +397,7 @@
 	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;
@@ -420,19 +421,19 @@
 		dh.ref_inode_count++;
 		dh.ref_count += id->dup_count;
 	}
-	log_notice("Block %llu (0x%llx) has %d inodes referencing it"
-		   " for a total of %d duplicate references\n",
+	log_notice( _("Block %llu (0x%llx) has %d inodes referencing it"
+		   " for a total of %d duplicate references\n"),
 		   (unsigned long long)b->block_no,
 		   (unsigned long long)b->block_no,
 		   dh.ref_inode_count, dh.ref_count);
 
 	osi_list_foreach(tmp, &b->ref_inode_list) {
 		id = osi_list_entry(tmp, struct inode_with_dups, list);
-		log_warn("Inode %s has %d reference(s) to block %"PRIu64
-				 " (0x%" PRIx64 ")\n", id->name, id->dup_count, b->block_no,
+		log_warn( _("Inode %s has %d reference(s) to block %"PRIu64
+				 " (0x%" PRIx64 ")\n"), id->name, id->dup_count, b->block_no,
 				 b->block_no);
 		/* FIXME: User input */
-		log_warn("Clearing...\n");
+		log_warn( _("Clearing...\n"));
 		ip = fsck_load_inode(sbp, id->block_no);
 		dh.b = b;
 		dh.id = id;
@@ -466,27 +467,27 @@
 	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");
+	log_info( _("Looking for duplicate blocks...\n"));
 
 	/* If there were no dups in the bitmap, we don't need to do anymore */
 	if(osi_list_empty(&sbp->dup_blocks.list)) {
-		log_info("No duplicate blocks found\n");
+		log_info( _("No duplicate blocks found\n"));
 		return FSCK_OK;
 	}
 
 	/* Rescan the fs looking for pointers to blocks that are in
 	 * the duplicate block map */
-	log_info("Scanning filesystem for inodes containing duplicate blocks...\n");
-	log_debug("Filesystem has %"PRIu64" (0x%" PRIx64 ") blocks total\n",
+	log_info( _("Scanning filesystem for inodes containing duplicate blocks...\n"));
+	log_debug( _("Filesystem has %"PRIu64" (0x%" PRIx64 ") blocks total\n"),
 			  last_fs_block, last_fs_block);
 	for(i = 0; i < last_fs_block; i += 1) {
 		warm_fuzzy_stuff(i);
 		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
 			goto out;
-		log_debug("Scanning block %" PRIu64 " (0x%" PRIx64 ") for inodes\n",
+		log_debug( _("Scanning block %" PRIu64 " (0x%" PRIx64 ") for inodes\n"),
 				  i, i);
 		if(gfs2_block_check(sbp, bl, i, &q)) {
 			stack;
@@ -517,7 +518,7 @@
 
 	/* Fix dups here - it's going to slow things down a lot to fix
 	 * it later */
-	log_info("Handling duplicate blocks\n");
+	log_info( _("Handling duplicate blocks\n"));
 out:
 	while (!osi_list_empty(&sbp->dup_blocks.list)) {
 		b = osi_list_entry(sbp->dup_blocks.list.next,
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/pass1.c cluster-3.0.0.rc3/gfs2/fsck/pass1.c
--- cluster-3.0.0.rc2/gfs2/fsck/pass1.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/pass1.c	2009-06-11 11:02:55.000000000 +0200
@@ -16,6 +16,8 @@
 #include <time.h>
 #include <sys/ioctl.h>
 #include <inttypes.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "fsck.h"
@@ -72,7 +74,7 @@
 {
 	struct block_count *bc = (struct block_count *) private;
 
-	log_debug("\tLeaf block at %15" PRIu64 " (0x%" PRIx64 ")\n",
+	log_debug( _("\tLeaf block at %15" PRIu64 " (0x%" PRIx64 ")\n"),
 			  block, block);
 	gfs2_block_set(ip->i_sbd, bl, block, gfs2_leaf_blk);
 	bc->indir_count++;
@@ -92,7 +94,7 @@
 	if (gfs2_check_range(ip->i_sbd, block)){ /* blk outside of FS */
 		gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_num.no_addr,
 			       gfs2_bad_block);
-		log_debug("Bad indirect block pointer (out of range).\n");
+		log_debug( _("Bad indirect block pointer (out of range).\n"));
 
 		return 1;
 	}
@@ -101,16 +103,16 @@
 		return -1;
 	}
 	if(q.block_type != gfs2_block_free) {
-		log_debug("Found duplicate block in indirect block -"
-				  " was marked %d\n", q.block_type);
+		log_debug( _("Found duplicate block in indirect block -"
+				  " was marked %d\n"), q.block_type);
 		gfs2_block_mark(ip->i_sbd, bl, block, gfs2_dup_block);
 		found_dup = 1;
 	}
 	nbh = bread(&ip->i_sbd->buf_list, block);
 
 	if (gfs2_check_meta(nbh, GFS2_METATYPE_IN)){
-		log_debug("Bad indirect block pointer "
-				  "(points to something that is not an indirect block).\n");
+		log_debug( _("Bad indirect block pointer "
+				  "(points to something that is not an indirect block).\n"));
 		if(!found_dup) {
 			gfs2_block_set(ip->i_sbd, bl, block, gfs2_meta_inval);
 			brelse(nbh, not_updated);
@@ -119,7 +121,7 @@
 	}else  /* blk check ok */
 		*bh = nbh;
 
-	log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to indirect block.\n",
+	log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to indirect block.\n"),
 			  block, block);
 	gfs2_block_set(ip->i_sbd, bl, block, gfs2_indir_blk);
 	bc->indir_count++;
@@ -133,7 +135,7 @@
 	struct block_count *bc = (struct block_count *) private;
 
 	if (gfs2_check_range(ip->i_sbd, block)) {
-		log_err( "Bad data block pointer (out of range)\n");
+		log_err( _("Bad data block pointer (out of range)\n"));
 		/* Mark the owner of this block with the bad_block
 		 * designator so we know to check it for out of range blocks later */
 		gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_num.no_addr,
@@ -145,13 +147,13 @@
 		return -1;
 	}
 	if(q.block_type != gfs2_block_free) {
-		log_debug("Found duplicate block at %" PRIu64 " (0x%"PRIx64 ")\n",
+		log_debug( _("Found duplicate block at %" PRIu64 " (0x%"PRIx64 ")\n"),
 				  block, block);
 		gfs2_block_mark(ip->i_sbd, bl, block, gfs2_dup_block);
 		bc->data_count++;
 		return 1;
 	}
-	log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to data block\n", block,
+	log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to data block\n"), block,
 			  block);
 	gfs2_block_set(ip->i_sbd, bl, block, gfs2_block_used);
 	bc->data_count++;
@@ -174,15 +176,15 @@
 	struct gfs2_sbd *sdp = ip->i_sbd;
 
 	*want_updated = not_updated;
-	log_err("Inode #%llu (0x%llx): %s",
+	log_err( _("Inode #%llu (0x%llx): %s"),
 		(unsigned long long)ip->i_di.di_num.no_addr,
 		(unsigned long long)ip->i_di.di_num.no_addr, emsg);
 	if (block)
-		log_err(" at block #%" PRIu64 " (0x%" PRIx64 ")",
+		log_err( _(" at block #%" PRIu64 " (0x%" PRIx64 ")"),
 			block, block);
 	log_err(".\n");
 	errors_found++;
-	if ((errors_corrected += query(&opts, "Clear the bad EA? (y/n) "))) {
+	if ((errors_corrected += query(&opts, _("Clear the bad EA? (y/n) ")))) {
 		if (block == 0)
 			block = ip->i_di.di_eattr;
 		gfs2_block_clear(sdp, bl, block, gfs2_eattr_block);
@@ -200,7 +202,7 @@
 		*want_updated = updated;
 		return 1;
 	} else {
-		log_err("The bad EA was not fixed.\n");
+		log_err( _("The bad EA was not fixed.\n"));
 		bc->ea_count++;
 		return 0;
 	}
@@ -238,18 +240,18 @@
 	if(gfs2_check_meta(*bh, GFS2_METATYPE_IN)) {
 		if(q.block_type != gfs2_block_free) { /* Duplicate? */
 			if (!clear_eas(ip, bc, indirect, 1, want_updated,
-				       "Bad indirect EA duplicate found"))
+				       _("Bad indirect EA duplicate found")))
 				gfs2_block_set(sdp, bl, indirect,
 					       gfs2_dup_block);
 			return 1;
 		}
 		clear_eas(ip, bc, indirect, 0, want_updated,
-			  "EA indirect block has incorrect type");
+			  _("EA indirect block has incorrect type"));
 		return 1;
 	}
 	if(q.block_type != gfs2_block_free) { /* Duplicate? */
-		log_err("Inode #%llu (0x%llx): Duplicate EA indirect "
-			"block found at #%llu (0x%llx).\n",
+		log_err( _("Inode #%llu (0x%llx): Duplicate EA indirect "
+			"block found at #%llu (0x%llx).\n"),
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)indirect,
@@ -258,8 +260,8 @@
 		bc->ea_count++;
 		ret = 1;
 	} else {
-		log_debug("Setting #%" PRIu64 " (0x%" PRIx64
-			  ") to indirect EA block\n", indirect, indirect);
+		log_debug( _("Setting #%" PRIu64 " (0x%" PRIx64
+			  ") to indirect EA block\n"), indirect, indirect);
 		gfs2_block_set(sdp, bl, indirect, gfs2_indir_blk);
 		bc->ea_count++;
 	}
@@ -270,7 +272,7 @@
 			      enum update_flags *want_updated, void *private)
 {
 	if (indir_ok) {
-		log_debug("Marking inode #%llu (0x%llx) with eattr block\n",
+		log_debug( _("Marking inode #%llu (0x%llx) with eattr block\n"),
 			  (unsigned long long)ip->i_di.di_num.no_addr,
 			  (unsigned long long)ip->i_di.di_num.no_addr);
 		/* Mark the inode as having an eattr in the block map
@@ -280,7 +282,7 @@
 		return 0;
 	}
 	clear_eas(ip, (struct block_count *)private, 0, 0, want_updated,
-		  "has unrecoverable indirect EA errors");
+		  _("has unrecoverable indirect EA errors"));
 	return 0;
 }
 
@@ -310,8 +312,8 @@
 	int ret = 0;
 
 	if(gfs2_check_range(sdp, el_blk)){
-		log_err("Inode #%llu (0x%llx): EA extended "
-			"leaf block #%llu (0x%llx) is out of range.\n",
+		log_err( _("Inode #%llu (0x%llx): EA extended "
+			"leaf block #%llu (0x%llx) is out of range.\n"),
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)el_blk,
@@ -333,22 +335,22 @@
 	if(gfs2_check_meta(el_buf, GFS2_METATYPE_ED)) {
 		if(q.block_type != gfs2_block_free) /* Duplicate? */
 			clear_eas(ip, bc, el_blk, 1, want_updated,
-				  "has bad extended EA duplicate");
+				  _("has bad extended EA duplicate"));
 		else
 			clear_eas(ip, bc, el_blk, 0, want_updated,
-				  "EA extended leaf block has incorrect type");
+				  _("EA extended leaf block has incorrect type"));
 		ret = 1;
 	} else { /* If this looks like an EA */
 		if(q.block_type != gfs2_block_free) { /* Duplicate? */
-			log_debug("Duplicate block found at #%" PRIu64
-				  " (0x%" PRIx64 ").\n",
+			log_debug( _("Duplicate block found at #%" PRIu64
+				  " (0x%" PRIx64 ").\n"),
 				  el_blk, el_blk);
 			gfs2_block_set(sdp, bl, el_blk, gfs2_dup_block);
 			bc->ea_count++;
 			ret = 1;
 		} else {
-			log_debug("Setting block #%" PRIu64
-				  " (0x%" PRIx64 ") to eattr block\n",
+			log_debug( _("Setting block #%" PRIu64
+				  " (0x%" PRIx64 ") to eattr block\n"),
 				  el_blk, el_blk);
 			gfs2_block_set(sdp, bl, el_blk, gfs2_meta_eattr);
 			bc->ea_count++;
@@ -372,13 +374,13 @@
 	/* This inode contains an eattr - it may be invalid, but the
 	 * eattr attributes points to a non-zero block */
 	if (parent != ip->i_di.di_num.no_addr) { /* if parent isn't the inode */
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to eattr block\n",
+		log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to eattr block\n"),
 				  parent, parent);
 		gfs2_block_set(sdp, bl, parent, gfs2_eattr_block);
 	}
 	if(gfs2_check_range(sdp, block)){
-		log_warn("Inode #%llu (0x%llx): EA leaf block #%llu (0x%llx"
-			 ") is out of range.\n",
+		log_warn( _("Inode #%llu (0x%llx): EA leaf block #%llu (0x%llx"
+			 ") is out of range.\n"),
 			 (unsigned long long)ip->i_di.di_num.no_addr,
 			 (unsigned long long)ip->i_di.di_num.no_addr,
 			 (unsigned long long)block, (unsigned long long)block);
@@ -398,25 +400,25 @@
 		if(gfs2_check_meta(leaf_bh, GFS2_METATYPE_EA)) {
 			if(q.block_type != gfs2_block_free) { /* Duplicate? */
 				clear_eas(ip, bc, block, 1, want_updated,
-					  "Bad EA duplicate found");
+					  _("Bad EA duplicate found"));
 			} else {
 				clear_eas(ip, bc, block, 0, want_updated,
-					  "EA leaf block has incorrect type");
+					  _("EA leaf block has incorrect type"));
 			}
 			ret = 1;
 			brelse(leaf_bh, not_updated);
 		} else { /* If this looks like an EA */
 			if(q.block_type != gfs2_block_free) { /* Duplicate? */
-				log_debug("Duplicate block found at #%" PRIu64
-					  " (0x%" PRIx64 ").\n",
+				log_debug( _("Duplicate block found at #%" PRIu64
+					  " (0x%" PRIx64 ").\n"),
 					  block, block);
 				gfs2_block_set(sdp, bl, block, gfs2_dup_block);
 				bc->ea_count++;
 				ret = 1;
 				brelse(leaf_bh, not_updated);
 			} else {
-				log_debug("Setting block #%" PRIu64
-					  " (0x%" PRIx64 ") to eattr block\n",
+				log_debug( _("Setting block #%" PRIu64
+					  " (0x%" PRIx64 ") to eattr block\n"),
 					  block, block);
 				gfs2_block_set(sdp, bl, block,
 					       gfs2_meta_eattr);
@@ -464,14 +466,14 @@
 		if(max_ptrs > ea_hdr->ea_num_ptrs) {
 			return 1;
 		} else {
-			log_debug("  Pointers Required: %d\n  Pointers Reported: %d\n",
+			log_debug( _("  Pointers Required: %d\n  Pointers Reported: %d\n"),
 				  max_ptrs, ea_hdr->ea_num_ptrs);
 		}
 	}
 	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};
@@ -489,7 +491,7 @@
 	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};
 
@@ -505,7 +507,7 @@
 
 }
 
-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};
@@ -516,7 +518,7 @@
 		return -1;
 	}
 	if(!q.dup_block) {
-		log_crit("Setting leaf #%" PRIu64 " (0x%" PRIx64 ") invalid\n",
+		log_crit( _("Setting leaf #%" PRIu64 " (0x%" PRIx64 ") invalid\n"),
 				 block, block);
 		if(gfs2_block_set(ip->i_sbd, bl, block, gfs2_block_free)) {
 			stack;
@@ -539,17 +541,17 @@
 	 * matter too much */
 	find_di(sbp, block, &di);
 	if(di) {
-		log_err("Attempting to add directory block #%" PRIu64
-				" (0x%" PRIx64 ") which is already in list\n", block, block);
+		log_err( _("Attempting to add directory block #%" PRIu64
+				" (0x%" PRIx64 ") which is already in list\n"), block, block);
 		return -1;
 	}
 
 	if(!(newdi = (struct dir_info *) malloc(sizeof(struct dir_info)))) {
-		log_crit("Unable to allocate dir_info structure\n");
+		log_crit( _("Unable to allocate dir_info structure\n"));
 		return -1;
 	}
 	if(!memset(newdi, 0, sizeof(*newdi))) {
-		log_crit("Error while zeroing dir_info structure\n");
+		log_crit( _("Error while zeroing dir_info structure\n"));
 		return -1;
 	}
 
@@ -558,7 +560,7 @@
 	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};
@@ -575,21 +577,21 @@
 
 	ip = fsck_inode_get(sdp, bh);
 	if (ip->i_di.di_num.no_addr != block) {
-		log_err("Inode #%llu (0x%llx): Bad inode address found: %llu "
-			"(0x%llx)\n", (unsigned long long)block,
+		log_err( _("Inode #%llu (0x%llx): Bad inode address found: %llu "
+			"(0x%llx)\n"), (unsigned long long)block,
 			(unsigned long long)block,
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)ip->i_di.di_num.no_addr);
 		errors_found++;
 		if((errors_corrected +=
-		    query(&opts, "Fix address in inode at block #%"
-			  PRIu64 " (0x%" PRIx64 ")? (y/n) ", block, block))) {
+		    query(&opts, _("Fix address in inode at block #%"
+			  PRIu64 " (0x%" PRIx64 ")? (y/n) "), block, block))) {
 			ip->i_di.di_num.no_addr = ip->i_di.di_num.no_formal_ino = block;
 			gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
 			f = updated;
 		} else
-			log_err("Address in inode at block #%" PRIu64
-				 " (0x%" PRIx64 ") not fixed\n", block, block);
+			log_err( _("Address in inode at block #%" PRIu64
+				 " (0x%" PRIx64 ") not fixed\n"), block, block);
 	}
 
 	if(gfs2_block_check(sdp, bl, block, &q)) {
@@ -598,7 +600,7 @@
 		return -1;
 	}
 	if(q.block_type != gfs2_block_free) {
-		log_debug("Found duplicate block at #%" PRIu64 " (0x%" PRIx64 ")\n",
+		log_debug( _("Found duplicate block at #%" PRIu64 " (0x%" PRIx64 ")\n"),
 				  block, block);
 		if(gfs2_block_mark(sdp, bl, block, gfs2_dup_block)) {
 			stack;
@@ -612,7 +614,7 @@
 	switch(ip->i_di.di_mode & S_IFMT) {
 
 	case S_IFDIR:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to directory inode.\n",
+		log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to directory inode.\n"),
 				  block, block);
 		if(gfs2_block_set(sdp, bl, block, gfs2_inode_dir)) {
 			stack;
@@ -626,7 +628,7 @@
 		}
 		break;
 	case S_IFREG:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to file inode.\n",
+		log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to file inode.\n"),
 				  block, block);
 		if(gfs2_block_set(sdp, bl, block, gfs2_inode_file)) {
 			stack;
@@ -635,7 +637,7 @@
 		}
 		break;
 	case S_IFLNK:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to symlink inode.\n",
+		log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to symlink inode.\n"),
 				  block, block);
 		if(gfs2_block_set(sdp, bl, block, gfs2_inode_lnk)) {
 			stack;
@@ -644,7 +646,7 @@
 		}
 		break;
 	case S_IFBLK:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to block dev inode.\n",
+		log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to block dev inode.\n"),
 				  block, block);
 		if(gfs2_block_set(sdp, bl, block, gfs2_inode_blk)) {
 			stack;
@@ -653,7 +655,7 @@
 		}
 		break;
 	case S_IFCHR:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to char dev inode.\n",
+		log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to char dev inode.\n"),
 				  block, block);
 		if(gfs2_block_set(sdp, bl, block, gfs2_inode_chr)) {
 			stack;
@@ -662,7 +664,7 @@
 		}
 		break;
 	case S_IFIFO:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to fifo inode.\n",
+		log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to fifo inode.\n"),
 				  block, block);
 		if(gfs2_block_set(sdp, bl, block, gfs2_inode_fifo)) {
 			stack;
@@ -671,7 +673,7 @@
 		}
 		break;
 	case S_IFSOCK:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to socket inode.\n",
+		log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to socket inode.\n"),
 				  block, block);
 		if(gfs2_block_set(sdp, bl, block, gfs2_inode_sock)) {
 			stack;
@@ -680,7 +682,7 @@
 		}
 		break;
 	default:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to invalid.\n",
+		log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to invalid.\n"),
 				  block, block);
 		if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) {
 			stack;
@@ -697,38 +699,17 @@
 		return -1;
 	}
 
-	/* FIXME: fix height and depth here - wasn't implemented in
-	 * old fsck either, so no biggy... */
-	if (ip->i_di.di_height < compute_height(sdp, ip->i_di.di_size)){
-		log_warn("Dinode #%llu (0x%llx) has bad height  "
-			 "Found %u, Expected >= %u\n",
-			 (unsigned long long)ip->i_di.di_num.no_addr,
-			 (unsigned long long)ip->i_di.di_num.no_addr,
-			 ip->i_di.di_height,
-			 compute_height(sdp, ip->i_di.di_size));
-			/* once implemented, remove continue statement */
-		log_warn("Marking inode invalid\n");
-		if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) {
-			stack;
-			fsck_inode_put(ip, f);
-			return -1;
-		}
-		gfs2_set_bitmap(sdp, block, GFS2_BLKST_FREE);
-		fsck_inode_put(ip, f);
-		return 0;
-	}
-
 	if (S_ISDIR(ip->i_di.di_mode) &&
 	    (ip->i_di.di_flags & GFS2_DIF_EXHASH)) {
 		if (((1 << ip->i_di.di_depth) * sizeof(uint64_t)) != ip->i_di.di_size){
-			log_warn("Directory dinode #%llu (0x%llx"
-				 ") has bad depth.  Found %u, Expected %u\n",
+			log_warn( _("Directory dinode #%llu (0x%llx"
+				 ") has bad depth.  Found %u, Expected %u\n"),
 				 (unsigned long long)ip->i_di.di_num.no_addr,
 				 (unsigned long long)ip->i_di.di_num.no_addr,
 				 ip->i_di.di_depth,
 				 (1 >> (ip->i_di.di_size/sizeof(uint64_t))));
 			/* once implemented, remove continue statement */
-			log_warn("Marking inode invalid\n");
+			log_warn( _("Marking inode invalid\n"));
 			if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) {
 				stack;
 				fsck_inode_put(ip, f);
@@ -748,7 +729,7 @@
 		return 0;
 	}
 	if(error > 0) {
-		log_warn("Marking inode #%llu (0x%llx) invalid\n",
+		log_warn( _("Marking inode #%llu (0x%llx) invalid\n"),
 			 (unsigned long long)ip->i_di.di_num.no_addr,
 			 (unsigned long long)ip->i_di.di_num.no_addr);
 		/* FIXME: Must set all leaves invalid as well */
@@ -764,8 +745,8 @@
 
 	if (ip->i_di.di_blocks != 
 		(1 + bc.indir_count + bc.data_count + bc.ea_count)) {
-		log_err("Inode #%llu (0x%llx): Ondisk block count (%llu"
-			") does not match what fsck found (%llu)\n",
+		log_err( _("Inode #%llu (0x%llx): Ondisk block count (%llu"
+			") does not match what fsck found (%llu)\n"),
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)ip->i_di.di_blocks,
@@ -773,14 +754,14 @@
 			bc.data_count + bc.ea_count);
 		errors_found++;
 		if ((errors_corrected +=
-		     query(&opts, "Fix ondisk block count? (y/n) "))) {
+		     query(&opts, _("Fix ondisk block count? (y/n) ")))) {
 			ip->i_di.di_blocks = 1 + bc.indir_count + bc.data_count +
 				bc.ea_count;
 			gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
 			f = updated;
 		} else
-			log_err("Bad block count for #%llu (0x%llx"
-				") not fixed\n",
+			log_err( _("Bad block count for #%llu (0x%llx"
+				") not fixed\n"),
 				(unsigned long long)ip->i_di.di_num.no_addr,
 				(unsigned long long)ip->i_di.di_num.no_addr);
 	}
@@ -789,11 +770,11 @@
 	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)) {
-		log_debug("Found invalid metadata at #%" PRIu64 " (0x%" PRIx64 ")\n",
+		log_debug( _("Found invalid metadata at #%" PRIu64 " (0x%" PRIx64 ")\n"),
 				  block, block);
 		if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) {
 			stack;
@@ -803,7 +784,7 @@
 		return 0;
 	}
 
-	log_debug("Checking metadata block #%" PRIu64 " (0x%" PRIx64 ")\n", block,
+	log_debug( _("Checking metadata block #%" PRIu64 " (0x%" PRIx64 ")\n"), block,
 			  block);
 
 	if (!gfs2_check_meta(bh, GFS2_METATYPE_DI)) {
@@ -867,14 +848,14 @@
 
 	for (tmp = sbp->rglist.next; tmp != &sbp->rglist;
 	     tmp = tmp->next, rg_count++){
-		log_info("Checking metadata in Resource Group #%" PRIu64 "\n",
+		log_info( _("Checking metadata in Resource Group #%" PRIu64 "\n"),
 				 rg_count);
 		rgd = osi_list_entry(tmp, struct rgrp_list, list);
 		if(gfs2_rgrp_read(sbp, rgd)){
 			stack;
 			return FSCK_ERROR;
 		}
-		log_debug("RG at %llu (0x%llx) is %u long\n",
+		log_debug( _("RG at %llu (0x%llx) is %u long\n"),
 			  (unsigned long long)rgd->ri.ri_addr,
 			  (unsigned long long)rgd->ri.ri_addr,
 			  rgd->ri.ri_length);
@@ -900,7 +881,7 @@
 				return FSCK_OK;
 			}
 			if (skip_this_pass) {
-				printf("Skipping pass 1 is not a good idea.\n");
+				printf( _("Skipping pass 1 is not a good idea.\n"));
 				skip_this_pass = FALSE;
 				fflush(stdout);
 			}
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/pass1c.c cluster-3.0.0.rc3/gfs2/fsck/pass1c.c
--- cluster-3.0.0.rc2/gfs2/fsck/pass1c.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/pass1c.c	2009-06-11 11:02:55.000000000 +0200
@@ -2,6 +2,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "fsck.h"
@@ -13,21 +15,23 @@
 			      struct gfs2_ea_header *curr,
 			      struct gfs2_ea_header *prev)
 {
-	log_warn("Removing EA located in block #%"PRIu64" (0x%" PRIx64 ").\n",
+	log_warn( _("Removing EA located in block #%"PRIu64" (0x%" PRIx64 ").\n"),
 		 leaf_bh->b_blocknr, leaf_bh->b_blocknr);
 	if(!prev)
 		curr->ea_type = GFS2_EATYPE_UNUSED;
 	else {
 		prev->ea_rec_len =
-			cpu_to_be32(be32_to_cpu(curr->ea_rec_len) +
-						be32_to_cpu(prev->ea_rec_len));
+			be32_to_cpu(curr->ea_rec_len);
+			be32_to_cpu(prev->ea_rec_len);
+			cpu_to_be32(curr->ea_rec_len + prev->ea_rec_len);
+
 		if (curr->ea_flags & GFS2_EAFLAG_LAST)
 			prev->ea_flags |= GFS2_EAFLAG_LAST;	
 	}
 	return 0;
 }
 
-int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
+static int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
 		      uint64_t parent, struct gfs2_buffer_head **bh,
 		      enum update_flags *update, void *private)
 {
@@ -37,9 +41,9 @@
 
 	*update = not_updated;
 	if(gfs2_check_range(sbp, block)) {
-		log_err("Extended attributes indirect block #%llu"
+		log_err( _("Extended attributes indirect block #%llu"
 			" (0x%llx) for inode #%llu"
-			" (0x%llx) out of range...removing\n",
+			" (0x%llx) out of range...removing\n"),
 			(unsigned long long)block,
 			(unsigned long long)block,
 			(unsigned long long)ip->i_di.di_num.no_addr,
@@ -53,9 +57,9 @@
 		return -1;
 	}
 	else if(q.block_type != gfs2_indir_blk) {
-		log_err("Extended attributes indirect block #%llu"
+		log_err( _("Extended attributes indirect block #%llu"
 			" (0x%llx) for inode #%llu"
-			" (0x%llx) invalid...removing\n",
+			" (0x%llx) invalid...removing\n"),
 			(unsigned long long)block,
 			(unsigned long long)block,
 			(unsigned long long)ip->i_di.di_num.no_addr,
@@ -71,7 +75,7 @@
 	return 0;
 }
 
-int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
+static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
 		     uint64_t parent, struct gfs2_buffer_head **bh,
 		     enum update_flags *update, void *private)
 {
@@ -80,8 +84,8 @@
 
 	*update = not_updated;
 	if(gfs2_check_range(sbp, block)) {
-		log_err("Extended attributes block for inode #%llu"
-			" (0x%llx) out of range...removing\n",
+		log_err( _("Extended attributes block for inode #%llu"
+			" (0x%llx) out of range...removing\n"),
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)ip->i_di.di_num.no_addr);
 		ip->i_di.di_eattr = 0;
@@ -93,8 +97,8 @@
 		return -1;
 	}
 	else if(q.block_type != gfs2_meta_eattr) {
-		log_err("Extended attributes block for inode #%llu"
-			" (0x%llx) invalid...removing\n",
+		log_err( _("Extended attributes block for inode #%llu"
+			" (0x%llx) invalid...removing\n"),
 			(unsigned long long)ip->i_di.di_num.no_addr,
 			(unsigned long long)ip->i_di.di_num.no_addr);
 		ip->i_di.di_eattr = 0;
@@ -120,7 +124,7 @@
 	uint32_t max_size = sdp->sd_sb.sb_bsize;
 
 	if(!ea_hdr->ea_name_len){
-		log_err("EA has name length == 0\n");
+		log_err( _("EA has name length == 0\n"));
 		ea_hdr->ea_flags |= GFS2_EAFLAG_LAST;
 		ea_hdr->ea_rec_len = cpu_to_be32(max_size - offset);
 		if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
@@ -130,7 +134,7 @@
 		return 1;
 	}
 	if(offset + be32_to_cpu(ea_hdr->ea_rec_len) > max_size){
-		log_err("EA rec length too long\n");
+		log_err( _("EA rec length too long\n"));
 		ea_hdr->ea_flags |= GFS2_EAFLAG_LAST;
 		ea_hdr->ea_rec_len = cpu_to_be32(max_size - offset);
 		if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
@@ -141,7 +145,7 @@
 	}
 	if(offset + be32_to_cpu(ea_hdr->ea_rec_len) == max_size &&
 	   (ea_hdr->ea_flags & GFS2_EAFLAG_LAST) == 0){
-		log_err("last EA has no last entry flag\n");
+		log_err( _("last EA has no last entry flag\n"));
 		ea_hdr->ea_flags |= GFS2_EAFLAG_LAST;
 		if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
 			stack;
@@ -150,7 +154,7 @@
 		return 1;
 	}
 	if(!ea_hdr->ea_name_len){
-		log_err("EA has name length == 0\n");
+		log_err( _("EA has name length == 0\n"));
 		if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
 			stack;
 			return -1;
@@ -164,7 +168,7 @@
 
 	if(!GFS2_EATYPE_VALID(ea_hdr->ea_type) &&
 	   ((ea_hdr_prev) || (!ea_hdr_prev && ea_hdr->ea_type))){
-		log_err("EA (%s) type is invalid (%d > %d).\n",
+		log_err( _("EA (%s) type is invalid (%d > %d).\n"),
 			ea_name, ea_hdr->ea_type, GFS2_EATYPE_LAST);
 		if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
 			stack;
@@ -181,9 +185,9 @@
 		max_ptrs = (be32_to_cpu(ea_hdr->ea_data_len)+avail_size-1)/avail_size;
 
 		if(max_ptrs > ea_hdr->ea_num_ptrs){
-			log_err("EA (%s) has incorrect number of pointers.\n", ea_name);
-			log_err("  Required:  %d\n"
-				"  Reported:  %d\n",
+			log_err( _("EA (%s) has incorrect number of pointers.\n"), ea_name);
+			log_err( _("  Required:  %d\n"
+				"  Reported:  %d\n"),
 				max_ptrs, ea_hdr->ea_num_ptrs);
 			if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
 				stack;
@@ -191,14 +195,14 @@
 			}
 			return 1;
 		} else {
-			log_debug("  Pointers Required: %d\n  Pointers Reported: %d\n",
+			log_debug( _("  Pointers Required: %d\n  Pointers Reported: %d\n"),
 					  max_ptrs, ea_hdr->ea_num_ptrs);
 		}
 	}
 	return 0;
 }
 
-int check_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_ptr,
+static int check_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_ptr,
 			 struct gfs2_buffer_head *leaf_bh,
 			 struct gfs2_ea_header *ea_hdr,
 			 struct gfs2_ea_header *ea_hdr_prev,
@@ -241,7 +245,7 @@
 	pass1c_fxns.check_eattr_extentry = &check_eattr_extentry;
 	pass1c_fxns.private = NULL;
 
-	log_info("Looking for inodes containing ea blocks...\n");
+	log_info( _("Looking for inodes containing ea blocks...\n"));
 	osi_list_foreach_safe(tmp, &sbp->eattr_blocks.list, x) {
 		ea_block = osi_list_entry(tmp, struct special_blocks, list);
 		block_no = ea_block->block;
@@ -250,12 +254,12 @@
 			return FSCK_OK;
 		bh = bread(&sbp->buf_list, block_no);
 		if (gfs2_check_meta(bh, GFS2_METATYPE_IN)) { /* if a dinode */
-			log_info("EA in inode %"PRIu64" (0x%" PRIx64 ")\n",
+			log_info( _("EA in inode %"PRIu64" (0x%" PRIx64 ")\n"),
 				 block_no, block_no);
 			gfs2_block_clear(sbp, bl, block_no, gfs2_eattr_block);
 			ip = fsck_inode_get(sbp, bh);
 
-			log_debug("Found eattr at %llu (0x%llx)\n",
+			log_debug( _("Found eattr at %llu (0x%llx)\n"),
 				  (unsigned long long)ip->i_di.di_eattr,
 				  (unsigned long long)ip->i_di.di_eattr);
 			/* FIXME: Handle walking the eattr here */
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/pass2.c cluster-3.0.0.rc3/gfs2/fsck/pass2.c
--- cluster-3.0.0.rc2/gfs2/fsck/pass2.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/pass2.c	2009-06-11 11:02:55.000000000 +0200
@@ -4,6 +4,8 @@
 #include <string.h>
 #include <inttypes.h>
 #include <sys/stat.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "fsck.h"
@@ -16,7 +18,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;
@@ -24,9 +26,9 @@
 	if(!find_di(sbp, childblock, &di)) {
 		if(di->dinode == childblock) {
 			if (di->treewalk_parent) {
-				log_err("Another directory at block %" PRIu64
+				log_err( _("Another directory at block %" PRIu64
 						" (0x%" PRIx64 ") already contains"
-						" this child - checking %" PRIu64 " (0x%" PRIx64 ")\n",
+						" this child - checking %" PRIu64 " (0x%" PRIx64 ")\n"),
 						di->treewalk_parent, di->treewalk_parent,
 						parentblock, parentblock);
 				return 1;
@@ -34,8 +36,8 @@
 			di->treewalk_parent = parentblock;
 		}
 	} else {
-		log_err("Unable to find block %"PRIu64" (0x%" PRIx64
-				") in dir_info list\n",	childblock,	childblock);
+		log_err( _("Unable to find block %"PRIu64" (0x%" PRIx64
+				") in dir_info list\n"),	childblock,	childblock);
 		return -1;
 	}
 
@@ -43,7 +45,7 @@
 }
 
 /* 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;
@@ -55,17 +57,17 @@
 			if(di->dotdot_parent && sbp->md.rooti->i_di.di_num.no_addr
 			   != di->dinode) {
 				/* This should never happen */
-				log_crit("Dotdot parent already set for"
+				log_crit( _("Dotdot parent already set for"
 						 " block %"PRIu64" (0x%" PRIx64 ") -> %" PRIu64
-						 " (0x%" PRIx64 ")\n", childblock, childblock,
+						 " (0x%" PRIx64 ")\n"), childblock, childblock,
 						 di->dotdot_parent, di->dotdot_parent);
 				return -1;
 			}
 			di->dotdot_parent = parentblock;
 		}
 	} else {
-		log_err("Unable to find block %"PRIu64" (0x%" PRIx64
-				") in dir_info list\n", childblock, childblock);
+		log_err( _("Unable to find block %"PRIu64" (0x%" PRIx64
+				") in dir_info list\n"), childblock, childblock);
 		return -1;
 	}
 
@@ -90,7 +92,7 @@
 	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",
@@ -133,7 +135,7 @@
 			return 1;
 		break;
 	default:
-		log_err("Invalid block type\n");
+		log_err( _("Invalid block type\n"));
 		return -1;
 		break;
 	}
@@ -142,7 +144,7 @@
 
 /* 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)
@@ -172,9 +174,9 @@
 
 	/* Start of checks */
 	if (de->de_rec_len < GFS2_DIRENT_SIZE(de->de_name_len)){
-		log_err("Dir entry with bad record or name length\n"
+		log_err( _("Dir entry with bad record or name length\n"
 			"\tRecord length = %u\n"
-			"\tName length = %u\n",
+			"\tName length = %u\n"),
 			de->de_rec_len,
 			de->de_name_len);
 		gfs2_block_set(sbp, bl, ip->i_di.di_num.no_addr,
@@ -186,23 +188,23 @@
 	
 	calculated_hash = gfs2_disk_hash(filename, de->de_name_len);
 	if (de->de_hash != calculated_hash){
-	        log_err("Dir entry with bad hash or name length\n"
+	        log_err( _("Dir entry with bad hash or name length\n"
 					"\tHash found         = %u (0x%x)\n"
-					"\tFilename           = %s\n", de->de_hash, de->de_hash,
+					"\tFilename           = %s\n"), de->de_hash, de->de_hash,
 					filename);
-			log_err("\tName length found  = %u\n"
-					"\tHash expected      = %u (0x%x)\n",
+			log_err( _("\tName length found  = %u\n"
+					"\tHash expected      = %u (0x%x)\n"),
 					de->de_name_len, calculated_hash, calculated_hash);
 			errors_found++;
-			if(query(&opts, "Fix directory hash for %s? (y/n) ",
+			if(query(&opts, _("Fix directory hash for %s? (y/n) "),
 					 filename)) {
 				errors_corrected++;
 				de->de_hash = calculated_hash;
 				gfs2_dirent_out(de, (char *)dent);
-				log_err("Directory entry hash for %s fixed.\n", filename);
+				log_err( _("Directory entry hash for %s fixed.\n"), filename);
 			}
 			else {
-				log_err("Directory entry hash for %s not fixed.\n", filename);
+				log_err( _("Directory entry hash for %s not fixed.\n"), filename);
 				return 1;
 			}
 	}
@@ -215,18 +217,18 @@
 		strncpy(tmp_name, filename, MAX_FILENAME - 1);
 
 	if(gfs2_check_range(ip->i_sbd, entryblock)) {
-		log_err("Block # referenced by directory entry %s is out of range\n",
+		log_err( _("Block # referenced by directory entry %s is out of range\n"),
 				tmp_name);
 		errors_found++;
 		if(query(&opts, 
-				 "Clear directory entry tp out of range block? (y/n) ")) {
+				 _("Clear directory entry tp out of range block? (y/n) "))) {
 			errors_corrected++;
-			log_err("Clearing %s\n", tmp_name);
+			log_err( _("Clearing %s\n"), tmp_name);
 			dirent2_del(ip, bh, prev_de, dent);
 			*update = updated;
 			return 1;
 		} else {
-			log_err("Directory entry to out of range block remains\n");
+			log_err( _("Directory entry to out of range block remains\n"));
 			(*count)++;
 			ds->entry_count++;
 			return 0;
@@ -243,10 +245,10 @@
 		/* FIXME: user interface */
 		/* FIXME: do i want to kill the inode here? */
 		/* Handle bad blocks */
-		log_err("Found a bad directory entry: %s\n", filename);
+		log_err( _("Found a bad directory entry: %s\n"), filename);
 
 		errors_found++;
-		if(query(&opts, "Clear entry to inode containing bad blocks? (y/n)")) {
+		if(query(&opts, _("Clear entry to inode containing bad blocks? (y/n)"))) {
 
 			errors_corrected++;
 			entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
@@ -263,7 +265,7 @@
 			*update = updated;
 			return 1;
 		} else {
-			log_warn("Entry to inode containing bad blocks remains\n");
+			log_warn( _("Entry to inode containing bad blocks remains\n"));
 			(*count)++;
 			ds->entry_count++;
 			return 0;
@@ -274,9 +276,9 @@
 	   q.block_type != gfs2_inode_lnk && q.block_type != gfs2_inode_blk &&
 	   q.block_type != gfs2_inode_chr && q.block_type != gfs2_inode_fifo &&
 	   q.block_type != gfs2_inode_sock) {
-		log_err("Directory entry '%s' at block %llu (0x%llx"
+		log_err( _("Directory entry '%s' at block %llu (0x%llx"
 			") in dir inode %llu (0x%llx"
-			") has an invalid block type: %d.\n", tmp_name,
+			") has an invalid block type: %d.\n"), tmp_name,
 			(unsigned long long)de->de_inum.no_addr,
 			(unsigned long long)de->de_inum.no_addr,
 			(unsigned long long)ip->i_di.di_num.no_addr,
@@ -284,16 +286,16 @@
 			q.block_type);
 
 		errors_found++;
-		if(query(&opts, "Clear directory entry to non-inode block? (y/n) ")) {
+		if(query(&opts, _("Clear directory entry to non-inode block? (y/n) "))) {
 			/* FIXME: make sure all blocks referenced by
 			 * this inode are cleared in the bitmap */
 			errors_corrected++;
 			dirent2_del(ip, bh, prev_de, dent);
 			*update = updated;
-			log_warn("Directory entry '%s' cleared\n", tmp_name);
+			log_warn( _("Directory entry '%s' cleared\n"), tmp_name);
 			return 1;
 		} else {
-			log_err("Directory entry to non-inode block remains\n");
+			log_err( _("Directory entry to non-inode block remains\n"));
 			(*count)++;
 			ds->entry_count++;
 			return 0;
@@ -306,14 +308,14 @@
 		return -1;
 	}
 	if(error > 0) {
-		log_warn("Type '%s' in dir entry (%s, %llu/0x%llx) conflicts"
-			 " with type '%s' in dinode. (Dir entry is stale.)\n",
+		log_warn( _("Type '%s' in dir entry (%s, %llu/0x%llx) conflicts"
+			 " with type '%s' in dinode. (Dir entry is stale.)\n"),
 			 de_type_string(de->de_type), tmp_name,
 			 (unsigned long long)de->de_inum.no_addr,
 			 (unsigned long long)de->de_inum.no_addr,
 			 block_type_string(&q));
 		errors_found++;
-		if(query(&opts, "Clear stale directory entry? (y/n) ")) {
+		if(query(&opts, _("Clear stale directory entry? (y/n) "))) {
 			errors_corrected++;
 			entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
 			check_inode_eattr(entry_ip, update, &clear_eattrs);
@@ -323,7 +325,7 @@
 			*update = updated;
 			return 1;
 		} else {
-			log_err("Stale directory entry remains\n");
+			log_err( _("Stale directory entry remains\n"));
 			(*count)++;
 			ds->entry_count++;
 			return 0;
@@ -331,15 +333,15 @@
 	}
 
 	if(!strcmp(".", tmp_name)) {
-		log_debug("Found . dentry\n");
+		log_debug( _("Found . dentry\n"));
 
 		if(ds->dotdir) {
-			log_err("Already found '.' entry in directory %llu"
-				" (0x%llx)\n",
+			log_err( _("Already found '.' entry in directory %llu"
+				" (0x%llx)\n"),
 				(unsigned long long)ip->i_di.di_num.no_addr,
 				(unsigned long long)ip->i_di.di_num.no_addr);
 			errors_found++;
-			if(query(&opts, "Clear duplicate '.' entry? (y/n) ")) {
+			if(query(&opts, _("Clear duplicate '.' entry? (y/n) "))) {
 
 				errors_corrected++;
 				entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
@@ -351,7 +353,7 @@
 				*update = updated;
 				return 1;
 			} else {
-				log_err("Duplicate '.' entry remains\n");
+				log_err( _("Duplicate '.' entry remains\n"));
 				/* FIXME: Should we continue on here
 				 * and check the rest of the '.'
 				 * entry? */
@@ -367,10 +369,10 @@
 
 		/* check that '.' refers to this inode */
 		if(de->de_inum.no_addr != ip->i_di.di_num.no_addr) {
-			log_err("'.' entry's value incorrect in directory %llu"
+			log_err( _("'.' entry's value incorrect in directory %llu"
 				" (0x%llx).  Points to %llu"
 				" (0x%llx) when it should point to %llu"
-				" (0x%llx).\n",
+				" (0x%llx).\n"),
 				(unsigned long long)de->de_inum.no_addr,
 				(unsigned long long)de->de_inum.no_addr,
 				(unsigned long long)de->de_inum.no_addr,
@@ -378,7 +380,7 @@
 				(unsigned long long)ip->i_di.di_num.no_addr,
 				(unsigned long long)ip->i_di.di_num.no_addr);
 			errors_found++;
-			if(query(&opts, "Remove '.' reference? (y/n) ")) {
+			if(query(&opts, _("Remove '.' reference? (y/n) "))) {
 				errors_corrected++;
 				entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
 				check_inode_eattr(entry_ip, update,
@@ -390,7 +392,7 @@
 				return 1;
 
 			} else {
-				log_err("Invalid '.' reference remains\n");
+				log_err( _("Invalid '.' reference remains\n"));
 				/* Not setting ds->dotdir here since
 				 * this '.' entry is invalid */
 				increment_link(sbp, de->de_inum.no_addr);
@@ -408,14 +410,14 @@
 		return 0;
 	}
 	if(!strcmp("..", tmp_name)) {
-		log_debug("Found .. dentry\n");
+		log_debug( _("Found .. dentry\n"));
 		if(ds->dotdotdir) {
-			log_err("Already found '..' entry in directory %llu"
-				"(0x%llx)\n",
+			log_err( _("Already found '..' entry in directory %llu"
+				"(0x%llx)\n"),
 				(unsigned long long)ip->i_di.di_num.no_addr,
 				(unsigned long long)ip->i_di.di_num.no_addr);
 			errors_found++;
-			if(query(&opts, "Clear duplicate '..' entry? (y/n) ")) {
+			if(query(&opts, _("Clear duplicate '..' entry? (y/n) "))) {
 
 				errors_corrected++;
 				entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
@@ -427,7 +429,7 @@
 				*update = 1;
 				return 1;
 			} else {
-				log_err("Duplicate '..' entry remains\n");
+				log_err( _("Duplicate '..' entry remains\n"));
 				/* FIXME: Should we continue on here
 				 * and check the rest of the '..'
 				 * entry? */
@@ -439,12 +441,12 @@
 		}
 
 		if(q.block_type != gfs2_inode_dir) {
-			log_err("Found '..' entry in directory %llu (0x%llx) "
-				"pointing to something that's not a directory",
+			log_err( _("Found '..' entry in directory %llu (0x%llx) "
+				"pointing to something that's not a directory"),
 				(unsigned long long)ip->i_di.di_num.no_addr,
 				(unsigned long long)ip->i_di.di_num.no_addr);
 			errors_found++;
-			if(query(&opts, "Clear bad '..' directory entry? (y/n) ")) {
+			if(query(&opts, _("Clear bad '..' directory entry? (y/n) "))) {
 				errors_corrected++;
 				entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
 				check_inode_eattr(entry_ip, update,
@@ -455,7 +457,7 @@
 				*update = 1;
 				return 1;
 			} else {
-				log_err("Bad '..' directory entry remains\n");
+				log_err( _("Bad '..' directory entry remains\n"));
 				increment_link(sbp, de->de_inum.no_addr);
 				(*count)++;
 				ds->entry_count++;
@@ -484,7 +486,7 @@
 	/* After this point we're only concerned with
 	 * directories */
 	if(q.block_type != gfs2_inode_dir) {
-		log_debug("Found non-dir inode dentry\n");
+		log_debug( _("Found non-dir inode dentry\n"));
 		increment_link(sbp, de->de_inum.no_addr);
 		*update = (opts.no ? not_updated : updated);
 		(*count)++;
@@ -492,23 +494,23 @@
 		return 0;
 	}
 
-	log_debug("Found plain directory dentry\n");
+	log_debug( _("Found plain directory dentry\n"));
 	error = set_parent_dir(sbp, entryblock, ip->i_di.di_num.no_addr);
 	if(error > 0) {
-		log_err("%s: Hard link to block %" PRIu64" (0x%" PRIx64
-				") detected.\n", filename, entryblock, entryblock);
+		log_err( _("%s: Hard link to block %" PRIu64" (0x%" PRIx64
+				") detected.\n"), filename, entryblock, entryblock);
 
 		errors_found++;
-		if(query(&opts, "Clear hard link to directory? (y/n) ")) {
+		if(query(&opts, _("Clear hard link to directory? (y/n) "))) {
 			errors_corrected++;
 			*update = 1;
 
 			dirent2_del(ip, bh, prev_de, dent);
-			log_warn("Directory entry %s cleared\n", filename);
+			log_warn( _("Directory entry %s cleared\n"), filename);
 
 			return 1;
 		} else {
-			log_err("Hard link to directory remains\n");
+			log_err( _("Hard link to directory remains\n"));
 			(*count)++;
 			ds->entry_count++;
 			return 0;
@@ -540,7 +542,7 @@
 
 /* Check system directory inode                                           */
 /* Should work for all system directories: root, master, jindex, per_node */
-int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
+static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
 		     int builder(struct gfs2_sbd *sbp))
 {
 	uint64_t iblock = 0;
@@ -552,7 +554,7 @@
 	enum update_flags update = not_updated;
 	int error = 0;
 
-	log_info("Checking system directory inode '%s'\n", dirname);
+	log_info( _("Checking system directory inode '%s'\n"), dirname);
 
 	if (sysinode) {
 		iblock = sysinode->i_di.di_num.no_addr;
@@ -582,21 +584,21 @@
 		return -1;
 	}
 	if(!ds.dotdir) {
-		log_err("No '.' entry found for %s directory.\n", dirname);
+		log_err( _("No '.' entry found for %s directory.\n"), dirname);
 		sprintf(tmp_name, ".");
 		filename_len = strlen(tmp_name);  /* no trailing NULL */
 		if(!(filename = malloc(sizeof(char) * filename_len))) {
-			log_err("Unable to allocate name string\n");
+			log_err( _("Unable to allocate name string\n"));
 			stack;
 			return -1;
 		}
 		if(!(memset(filename, 0, sizeof(char) * filename_len))) {
-			log_err("Unable to zero name string\n");
+			log_err( _("Unable to zero name string\n"));
 			stack;
 			return -1;
 		}
 		memcpy(filename, tmp_name, filename_len);
-		log_warn("Adding '.' entry\n");
+		log_warn( _("Adding '.' entry\n"));
 		dir_add(sysinode, filename, filename_len,
 				&(sysinode->i_di.di_num), DT_DIR);
 		increment_link(sysinode->i_sbd,
@@ -606,23 +608,23 @@
 		update = 1;
 	}
 	if(sysinode->i_di.di_entries != ds.entry_count) {
-		log_err("%s inode %llu (0x%llx"
-			"): Entries is %d - should be %d\n", dirname,
+		log_err( _("%s inode %llu (0x%llx"
+			"): Entries is %d - should be %d\n"), dirname,
 			(unsigned long long)sysinode->i_di.di_num.no_addr,
 			(unsigned long long)sysinode->i_di.di_num.no_addr,
 			sysinode->i_di.di_entries, ds.entry_count);
 		errors_found++;
-		if(query(&opts, "Fix entries for %s inode %llu (0x%llx"
-			 ")? (y/n) ", dirname,
+		if(query(&opts, _("Fix entries for %s inode %llu (0x%llx"
+			 ")? (y/n) "), dirname,
 			 (unsigned long long)sysinode->i_di.di_num.no_addr,
 			 (unsigned long long)sysinode->i_di.di_num.no_addr)) {
 			errors_corrected++;
 			sysinode->i_di.di_entries = ds.entry_count;
-			log_warn("Entries updated\n");
+			log_warn( _("Entries updated\n"));
 			update = 1;
 		} else {
-			log_err("Entries for inode %llu (0x%llx"
-				") left out of sync\n",
+			log_err( _("Entries for inode %llu (0x%llx"
+				") left out of sync\n"),
 				(unsigned long long)
 				sysinode->i_di.di_num.no_addr,
 				(unsigned long long)
@@ -687,7 +689,7 @@
 		stack;
 		return FSCK_ERROR;
 	}
-	log_info("Checking directory inodes.\n");
+	log_info( _("Checking directory inodes.\n"));
 	/* Grab each directory inode, and run checks on it */
 	for(i = 0; i < last_fs_block; i++) {
 		warm_fuzzy_stuff(i);
@@ -699,16 +701,16 @@
 			continue;
 
 		if(gfs2_block_check(sbp, bl, i, &q)) {
-			log_err("Can't get block %"PRIu64 " (0x%" PRIx64
-					") from block list\n", i, i);
+			log_err( _("Can't get block %"PRIu64 " (0x%" PRIx64
+					") from block list\n"), i, i);
 			return FSCK_ERROR;
 		}
 
 		if(q.block_type != gfs2_inode_dir)
 			continue;
 
-		log_debug("Checking directory inode at block %"PRIu64" (0x%"
-				  PRIx64 ")\n", i, i);
+		log_debug( _("Checking directory inode at block %"PRIu64" (0x%"
+				  PRIx64 ")\n"), i, i);
 
 		memset(&ds, 0, sizeof(ds));
 		pass2_fxns.private = (void *) &ds;
@@ -738,9 +740,9 @@
 			if(error == 0) {
 				/* FIXME: factor */
 				errors_found++;
-				if(query(&opts, "Remove directory entry for bad"
+				if(query(&opts, _("Remove directory entry for bad"
 						 " inode %"PRIu64" (0x%" PRIx64 ") in %"PRIu64
-						 " (0x%" PRIx64 ")? (y/n)", i, i, di->treewalk_parent,
+						 " (0x%" PRIx64 ")? (y/n)"), i, i, di->treewalk_parent,
 						 di->treewalk_parent)) {
 					errors_corrected++;
 					error = remove_dentry_from_dir(sbp, di->treewalk_parent,
@@ -750,30 +752,30 @@
 						return FSCK_ERROR;
 					}
 					if(error > 0) {
-						log_warn("Unable to find dentry for %"
+						log_warn( _("Unable to find dentry for %"
 								 PRIu64 " (0x%" PRIx64 ") in %" PRIu64
-								 " (0x%" PRIx64 ")\n", i, i,
+								 " (0x%" PRIx64 ")\n"), i, i,
 								 di->treewalk_parent, di->treewalk_parent);
 					}
-					log_warn("Directory entry removed\n");
+					log_warn( _("Directory entry removed\n"));
 				} else
-					log_err("Directory entry to invalid inode remains.\n");
+					log_err( _("Directory entry to invalid inode remains.\n"));
 			}
 			gfs2_block_set(sbp, bl, i, gfs2_meta_inval);
 		}
 		bh = bread(&sbp->buf_list, i);
 		ip = fsck_inode_get(sbp, bh);
 		if(!ds.dotdir) {
-			log_err("No '.' entry found\n");
+			log_err( _("No '.' entry found\n"));
 			sprintf(tmp_name, ".");
 			filename_len = strlen(tmp_name);  /* no trailing NULL */
 			if(!(filename = malloc(sizeof(char) * filename_len))) {
-				log_err("Unable to allocate name string\n");
+				log_err( _("Unable to allocate name string\n"));
 				stack;
 				return FSCK_ERROR;
 			}
 			if(!memset(filename, 0, sizeof(char) * filename_len)) {
-				log_err("Unable to zero name string\n");
+				log_err( _("Unable to zero name string\n"));
 				stack;
 				return FSCK_ERROR;
 			}
@@ -790,8 +792,8 @@
 		bh = bread(&sbp->buf_list, i);
 		ip = fsck_inode_get(sbp, bh);
 		if(ip->i_di.di_entries != ds.entry_count) {
-			log_err("Entries is %d - should be %d for inode "
-				"block %llu (0x%llx)\n",
+			log_err( _("Entries is %d - should be %d for inode "
+				"block %llu (0x%llx)\n"),
 				ip->i_di.di_entries, ds.entry_count,
 				(unsigned long long)ip->i_di.di_num.no_addr,
 				(unsigned long long)ip->i_di.di_num.no_addr);
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/pass3.c cluster-3.0.0.rc3/gfs2/fsck/pass3.c
--- cluster-3.0.0.rc2/gfs2/fsck/pass3.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/pass3.c	2009-06-11 11:02:55.000000000 +0200
@@ -3,6 +3,8 @@
 #include <inttypes.h>
 #include <string.h>
 #include <dirent.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "osi_list.h"
@@ -12,7 +14,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;
@@ -29,14 +31,14 @@
 
 	filename_len = strlen("..");
 	if(!(filename = malloc((sizeof(char) * filename_len) + 1))) {
-		log_err("Unable to allocate name\n");
+		log_err( _("Unable to allocate name\n"));
 		fsck_inode_put(ip, not_updated);
 		fsck_inode_put(pip, not_updated);
 		stack;
 		return -1;
 	}
 	if(!memset(filename, 0, (sizeof(char) * filename_len) + 1)) {
-		log_err("Unable to zero name\n");
+		log_err( _("Unable to zero name\n"));
 		fsck_inode_put(ip, not_updated);
 		fsck_inode_put(pip, not_updated);
 		stack;
@@ -44,7 +46,7 @@
 	}
 	memcpy(filename, "..", filename_len);
 	if(gfs2_dirent_del(ip, NULL, filename, filename_len))
-		log_warn("Unable to remove \"..\" directory entry.\n");
+		log_warn( _("Unable to remove \"..\" directory entry.\n"));
 	else
 		decrement_link(sbp, olddotdot);
 	dir_add(ip, filename, filename_len, &pip->i_di.di_num, DT_DIR);
@@ -54,7 +56,7 @@
 	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;
@@ -66,22 +68,22 @@
 		return NULL;
 
 	if(di->dotdot_parent != di->treewalk_parent) {
-		log_warn("Directory '..' and treewalk connections disagree for inode %"
-				 PRIu64 " (0x%" PRIx64 ")\n", di->dinode, di->dinode);
-		log_notice("'..' has %" PRIu64" (0x%" PRIx64 "), treewalk has %"
-				   PRIu64" (0x%" PRIx64 ")\n", di->dotdot_parent,
+		log_warn( _("Directory '..' and treewalk connections disagree for inode %"
+				 PRIu64 " (0x%" PRIx64 ")\n"), di->dinode, di->dinode);
+		log_notice( _("'..' has %" PRIu64" (0x%" PRIx64 "), treewalk has %"
+				   PRIu64" (0x%" PRIx64 ")\n"), di->dotdot_parent,
 				   di->dotdot_parent, di->treewalk_parent,
 				   di->treewalk_parent);
 		if(gfs2_block_check(sbp, bl, di->dotdot_parent, &q_dotdot)) {
-			log_err("Unable to find block %"PRIu64
-					" (0x%" PRIx64 ") in block map.\n",
+			log_err( _("Unable to find block %"PRIu64
+					" (0x%" PRIx64 ") in block map.\n"),
 					di->dotdot_parent, di->dotdot_parent);
 			return NULL;
 		}
 		if(gfs2_block_check(sbp, bl, di->treewalk_parent,
 				    &q_treewalk)) {
-			log_err("Unable to find block %"PRIu64
-					" (0x%" PRIx64 ") in block map\n",
+			log_err( _("Unable to find block %"PRIu64
+					" (0x%" PRIx64 ") in block map\n"),
 					di->treewalk_parent, di->treewalk_parent);
 			return NULL;
 		}
@@ -94,12 +96,12 @@
 		 */
 		if(q_dotdot.block_type != gfs2_inode_dir) {
 			if(q_treewalk.block_type != gfs2_inode_dir) {
-				log_err( "Orphaned directory, move to lost+found\n");
+				log_err( _("Orphaned directory, move to lost+found\n"));
 				return NULL;
 			}
 			else {
-				log_warn("Treewalk parent is correct,"
-						 " fixing dotdot -> %"PRIu64" (0x%" PRIx64 ")\n",
+				log_warn( _("Treewalk parent is correct,"
+						 " fixing dotdot -> %"PRIu64" (0x%" PRIx64 ")\n"),
 						 di->treewalk_parent, di->treewalk_parent);
 				attach_dotdot_to(sbp, di->treewalk_parent,
 								 di->dotdot_parent, di->dinode);
@@ -109,15 +111,15 @@
 		else {
 			if(q_treewalk.block_type != gfs2_inode_dir) {
 				int error = 0;
-				log_warn(".. parent is valid, but treewalk"
-						 "is bad - reattaching to lost+found");
+				log_warn( _(".. parent is valid, but treewalk"
+						 "is bad - reattaching to lost+found"));
 
 				/* FIXME: add a dinode for this entry instead? */
 
 				errors_found++;
-				if(query(&opts, "Remove directory entry for bad"
+				if(query(&opts, _("Remove directory entry for bad"
 						 " inode %"PRIu64" (0x%" PRIx64 ") in %"PRIu64
-						 " (0x%" PRIx64 ")? (y/n)", di->dinode, di->dinode,
+						 " (0x%" PRIx64 ")? (y/n)"), di->dinode, di->dinode,
 						 di->treewalk_parent, di->treewalk_parent)) {
 					errors_corrected++;
 					error = remove_dentry_from_dir(sbp, di->treewalk_parent,
@@ -127,23 +129,23 @@
 						return NULL;
 					}
 					if(error > 0) {
-						log_warn("Unable to find dentry for block %"
+						log_warn( _("Unable to find dentry for block %"
 								 PRIu64" (0x%" PRIx64 ") in %" PRIu64 " (0x%"
-								 PRIx64 ")\n",di->dinode, di->dinode,
+								 PRIx64 ")\n"),di->dinode, di->dinode,
 								 di->treewalk_parent, di->treewalk_parent);
 					}
-					log_warn("Directory entry removed\n");
+					log_warn( _("Directory entry removed\n"));
 				} else {
-					log_err("Directory entry to invalid inode remains\n");
+					log_err( _("Directory entry to invalid inode remains\n"));
 				}
-				log_info("Marking directory unlinked\n");
+				log_info( _("Marking directory unlinked\n"));
 
 				return NULL;
 			}
 			else {
-				log_err("Both .. and treewalk parents are "
+				log_err( _("Both .. and treewalk parents are "
 						"directories, going with treewalk for "
-						"now...\n");
+						"now...\n"));
 				attach_dotdot_to(sbp, di->treewalk_parent,
 								 di->dotdot_parent, di->dinode);
 				di->dotdot_parent = di->treewalk_parent;
@@ -152,14 +154,14 @@
 	}
 	else {
 		if(gfs2_block_check(sbp, bl, di->dotdot_parent, &q_dotdot)) {
-			log_err("Unable to find parent block %"PRIu64
-					" (0x%" PRIx64 ")  in block map\n",
+			log_err( _("Unable to find parent block %"PRIu64
+					" (0x%" PRIx64 ")  in block map\n"),
 					di->dotdot_parent, di->dotdot_parent);
 			return NULL;
 		}
 		if(q_dotdot.block_type != gfs2_inode_dir) {
-			log_err("Orphaned directory at block %" PRIu64 " (0x%" PRIx64
-					") moved to lost+found\n", di->dinode, di->dinode);
+			log_err( _("Orphaned directory at block %" PRIu64 " (0x%" PRIx64
+					") moved to lost+found\n"), di->dinode, di->dinode);
 			return NULL;
 		}
 	}
@@ -184,12 +186,12 @@
 
 	find_di(sbp, sbp->md.rooti->i_di.di_num.no_addr, &di);
 	if(di) {
-		log_info("Marking root inode connected\n");
+		log_info( _("Marking root inode connected\n"));
 		di->checked = 1;
 	}
 	find_di(sbp, sbp->master_dir->i_di.di_num.no_addr, &di);
 	if(di) {
-		log_info("Marking master directory inode connected\n");
+		log_info( _("Marking master directory inode connected\n"));
 		di->checked = 1;
 	}
 
@@ -197,7 +199,7 @@
 	 * until we find one that's been checked already.  If we don't
 	 * find a parent, put in lost+found.
 	 */
-	log_info("Checking directory linkage.\n");
+	log_info( _("Checking directory linkage.\n"));
 	for(i = 0; i < FSCK_HASH_SIZE; i++) {
 	osi_list_foreach(tmp, &dir_hash[i]) {
 		di = osi_list_entry(tmp, struct dir_info, list);
@@ -216,17 +218,17 @@
 					return FSCK_ERROR;
 				}
 				if(q.bad_block) {
-					log_err("Found unlinked directory containing bad block\n");
+					log_err( _("Found unlinked directory containing bad block\n"));
 					errors_found++;
 					if(query(&opts,
-					   "Clear unlinked directory with bad blocks? (y/n) ")) {
+					   _("Clear unlinked directory with bad blocks? (y/n) "))) {
 						errors_corrected++;
 						gfs2_block_set(sbp, bl,
 							       di->dinode,
 							       gfs2_block_free);
 						break;
 					} else
-						log_err("Unlinked directory with bad block remains\n");
+						log_err( _("Unlinked directory with bad block remains\n"));
 				}
 				if(q.block_type != gfs2_inode_dir &&
 				   q.block_type != gfs2_inode_file &&
@@ -235,22 +237,22 @@
 				   q.block_type != gfs2_inode_chr &&
 				   q.block_type != gfs2_inode_fifo &&
 				   q.block_type != gfs2_inode_sock) {
-					log_err("Unlinked block marked as inode not an inode\n");
+					log_err( _("Unlinked block marked as inode not an inode\n"));
 					gfs2_block_set(sbp, bl, di->dinode,
 						       gfs2_block_free);
-					log_err("Cleared\n");
+					log_err( _("Cleared\n"));
 					break;
 				}
 
-				log_err("Found unlinked directory at block %" PRIu64
-						" (0x%" PRIx64 ")\n", di->dinode, di->dinode);
+				log_err( _("Found unlinked directory at block %" PRIu64
+						" (0x%" PRIx64 ")\n"), di->dinode, di->dinode);
 				ip = fsck_load_inode(sbp, di->dinode);
 				/* Don't skip zero size directories
 				 * with eattrs */
 				if(!ip->i_di.di_size && !ip->i_di.di_eattr){
-					log_err("Unlinked directory has zero size.\n");
+					log_err( _("Unlinked directory has zero size.\n"));
 					errors_found++;
-					if(query(&opts, "Remove zero-size unlinked directory? (y/n) ")) {
+					if(query(&opts, _("Remove zero-size unlinked directory? (y/n) "))) {
 						errors_corrected++;
 						gfs2_block_set(sbp, bl,
 							       di->dinode,
@@ -258,34 +260,34 @@
 						fsck_inode_put(ip, not_updated);
 						break;
 					} else {
-						log_err("Zero-size unlinked directory remains\n");
+						log_err( _("Zero-size unlinked directory remains\n"));
 					}
 				}
 				errors_found++;
-				if(query(&opts, "Add unlinked directory to lost+found? (y/n) ")) {
+				if(query(&opts, _("Add unlinked directory to lost+found? (y/n) "))) {
 					errors_corrected++;
 					if(add_inode_to_lf(ip)) {
 						fsck_inode_put(ip, not_updated);
 						stack;
 						return FSCK_ERROR;
 					}
-					log_warn("Directory relinked to lost+found\n");
+					log_warn( _("Directory relinked to lost+found\n"));
 				} else {
-					log_err("Unlinked directory remains unlinked\n");
+					log_err( _("Unlinked directory remains unlinked\n"));
 				}
 				fsck_inode_put(ip, not_updated);
 				break;
 			}
 			else {
-				log_debug("Directory at block %" PRIu64 " (0x%" 
-						  PRIx64 ") connected\n", di->dinode, di->dinode);
+				log_debug( _("Directory at block %" PRIu64 " (0x%" 
+						  PRIx64 ") connected\n"), di->dinode, di->dinode);
 			}
 			di = tdi;
 		}
 	}
 	}
 	if(lf_dip)
-		log_debug("At end of pass3, lost+found entries is %u\n",
+		log_debug( _("At end of pass3, lost+found entries is %u\n"),
 				  lf_dip->i_di.di_entries);
 	return FSCK_OK;
 }
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/pass4.c cluster-3.0.0.rc3/gfs2/fsck/pass4.c
--- cluster-3.0.0.rc2/gfs2/fsck/pass4.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/pass4.c	2009-06-11 11:02:55.000000000 +0200
@@ -1,6 +1,8 @@
 #include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "fsck.h"
@@ -9,24 +11,24 @@
 
 /* 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",
+	log_info( _("Fixing inode count for %llu (0x%llx) \n"),
 		 (unsigned long long)ip->i_di.di_num.no_addr,
 		 (unsigned long long)ip->i_di.di_num.no_addr);
 	if(ip->i_di.di_nlink == ii->counted_links)
 		return 0;
 	ip->i_di.di_nlink = ii->counted_links;
 
-	log_debug("Changing inode %llu (0x%llx) to have %u links\n",
+	log_debug( _("Changing inode %llu (0x%llx) to have %u links\n"),
 		  (unsigned long long)ip->i_di.di_num.no_addr,
 		  (unsigned long long)ip->i_di.di_num.no_addr,
 		  ii->counted_links);
 	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;
@@ -41,32 +43,32 @@
 			return 0;
 		f = not_updated;
 		if(!(ii = osi_list_entry(tmp, struct inode_info, list))) {
-			log_crit("osi_list_foreach broken in scan_info_list!!\n");
+			log_crit( _("osi_list_foreach broken in scan_info_list!!\n"));
 			exit(FSCK_ERROR);
 		}
-		log_debug("Checking reference count on inode at block %" PRIu64
-				  " (0x%" PRIx64 ")\n", ii->inode, ii->inode);
+		log_debug( _("Checking reference count on inode at block %" PRIu64
+				  " (0x%" PRIx64 ")\n"), ii->inode, ii->inode);
 		if(ii->counted_links == 0) {
-			log_err("Found unlinked inode at %" PRIu64 " (0x%" PRIx64 ")\n",
+			log_err( _("Found unlinked inode at %" PRIu64 " (0x%" PRIx64 ")\n"),
 					ii->inode, ii->inode);
 			if(gfs2_block_check(sbp, bl, ii->inode, &q)) {
 				stack;
 				return -1;
 			}
 			if(q.bad_block) {
-				log_err("Unlinked inode %llu (0x%llx) contains"
-					"bad blocks\n",
+				log_err( _("Unlinked inode %llu (0x%llx) contains"
+					"bad blocks\n"),
 					(unsigned long long)ii->inode,
 					(unsigned long long)ii->inode);
 				errors_found++;
 				if(query(&opts,
-						 "Clear unlinked inode with bad blocks? (y/n) ")) {
+						 _("Clear unlinked inode with bad blocks? (y/n) "))) {
 					errors_corrected++;
 					gfs2_block_set(sbp, bl, ii->inode,
 						       gfs2_block_free);
 					continue;
 				} else
-					log_err("Unlinked inode with bad blocks not cleared\n");
+					log_err( _("Unlinked inode with bad blocks not cleared\n"));
 			}
 			if(q.block_type != gfs2_inode_dir &&
 			   q.block_type != gfs2_inode_file &&
@@ -75,10 +77,10 @@
 			   q.block_type != gfs2_inode_chr &&
 			   q.block_type != gfs2_inode_fifo &&
 			   q.block_type != gfs2_inode_sock) {
-				log_err("Unlinked block marked as inode not an inode\n");
+				log_err( _("Unlinked block marked as inode not an inode\n"));
 				gfs2_block_set(sbp, bl, ii->inode,
 					       gfs2_block_free);
-				log_err("Cleared\n");
+				log_err( _("Cleared\n"));
 				continue;
 			}
 			ip = fsck_load_inode(sbp, ii->inode);
@@ -87,9 +89,9 @@
 			 * eattrs - there might be relevent info in
 			 * them. */
 			if(!ip->i_di.di_size && !ip->i_di.di_eattr){
-				log_err("Unlinked inode has zero size\n");
+				log_err( _("Unlinked inode has zero size\n"));
 				errors_found++;
-				if(query(&opts, "Clear zero-size unlinked inode? (y/n) ")) {
+				if(query(&opts, _("Clear zero-size unlinked inode? (y/n) "))) {
 					errors_corrected++;
 					gfs2_block_set(sbp, bl, ii->inode,
 						       gfs2_block_free);
@@ -99,7 +101,7 @@
 
 			}
 			errors_found++;
-			if(query(&opts, "Add unlinked inode to lost+found? (y/n)")) {
+			if(query(&opts, _("Add unlinked inode to lost+found? (y/n)"))) {
 				errors_corrected++;
 				f = updated;
 				if(add_inode_to_lf(ip)) {
@@ -112,37 +114,37 @@
 					lf_addition = 1;
 				}
 			} else
-				log_err("Unlinked inode left unlinked\n");
+				log_err( _("Unlinked inode left unlinked\n"));
 			fsck_inode_put(ip, f);
 		} /* if(ii->counted_links == 0) */
 		else if(ii->link_count != ii->counted_links) {
-			log_err("Link count inconsistent for inode %" PRIu64
-					" (0x%" PRIx64 ") has %u but fsck found %u.\n", ii->inode, 
+			log_err( _("Link count inconsistent for inode %" PRIu64
+					" (0x%" PRIx64 ") has %u but fsck found %u.\n"), ii->inode, 
 					ii->inode, ii->link_count, ii->counted_links);
 			/* Read in the inode, adjust the link count,
 			 * and write it back out */
 			errors_found++;
-			if(query(&opts, "Update link count for inode %"
-				 PRIu64 " (0x%" PRIx64 ") ? (y/n) ", ii->inode, ii->inode)) {
+			if(query(&opts, _("Update link count for inode %"
+				 PRIu64 " (0x%" PRIx64 ") ? (y/n) "), ii->inode, ii->inode)) {
 				errors_corrected++;
 				ip = fsck_load_inode(sbp, ii->inode); /* bread, inode_get */
 				fix_inode_count(sbp, ii, ip);
 				fsck_inode_put(ip, updated); /* out, brelse, free */
-				log_warn("Link count updated for inode %"
-						 PRIu64 " (0x%" PRIx64 ") \n", ii->inode, ii->inode);
+				log_warn( _("Link count updated for inode %"
+						 PRIu64 " (0x%" PRIx64 ") \n"), ii->inode, ii->inode);
 			} else {
-				log_err("Link count for inode %" PRIu64 " (0x%" PRIx64
-						") still incorrect\n", ii->inode, ii->inode);
+				log_err( _("Link count for inode %" PRIu64 " (0x%" PRIx64
+						") still incorrect\n"), ii->inode, ii->inode);
 			}
 		}
-		log_debug("block %" PRIu64 " (0x%" PRIx64 ") has link count %d\n",
+		log_debug( _("block %" PRIu64 " (0x%" PRIx64 ") has link count %d\n"),
 				  ii->inode, ii->inode, ii->link_count);
 	} /* osi_list_foreach(tmp, list) */
 
 	if (lf_addition) {
 		if(!(ii = inode_hash_search(inode_hash,
 									lf_dip->i_di.di_num.no_addr))) {
-			log_crit("Unable to find lost+found inode in inode_hash!!\n");
+			log_crit( _("Unable to find lost+found inode in inode_hash!!\n"));
 			return -1;
 		} else {
 			fix_inode_count(sbp, ii, lf_dip);
@@ -166,9 +168,9 @@
 	uint32_t i;
 	osi_list_t *list;
 	if(lf_dip)
-		log_debug("At beginning of pass4, lost+found entries is %u\n",
+		log_debug( _("At beginning of pass4, lost+found entries is %u\n"),
 				  lf_dip->i_di.di_entries);
-	log_info("Checking inode reference counts.\n");
+	log_info( _("Checking inode reference counts.\n"));
 	for (i = 0; i < FSCK_HASH_SIZE; i++) {
 		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
 			return FSCK_OK;
@@ -180,7 +182,7 @@
 	}
 
 	if(lf_dip)
-		log_debug("At end of pass4, lost+found entries is %u\n",
+		log_debug( _("At end of pass4, lost+found entries is %u\n"),
 				  lf_dip->i_di.di_entries);
 	return FSCK_OK;
 }
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/pass5.c cluster-3.0.0.rc3/gfs2/fsck/pass5.c
--- cluster-3.0.0.rc2/gfs2/fsck/pass5.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/pass5.c	2009-06-11 11:02:55.000000000 +0200
@@ -2,13 +2,15 @@
 #include <string.h>
 #include <inttypes.h>
 #include <stdlib.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "fsck.h"
 #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]++;
@@ -45,13 +47,13 @@
 		return GFS2_BLKST_USED;
 
 	default:
-		log_err("Invalid state %d found\n", q->block_type);
+		log_err( _("Invalid state %d found\n"), q->block_type);
 		return -1;
 	}
 	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;
@@ -82,31 +84,31 @@
 		   So we ignore it. */
 		if (rg_status == GFS2_BLKST_UNLINKED &&
 		    block_status == GFS2_BLKST_FREE) {
-			log_warn("Unlinked block found at block %"
-				 PRIu64" (0x%" PRIx64 "), left unchanged.\n",
+			log_warn( _("Unlinked block found at block %"
+				 PRIu64" (0x%" PRIx64 "), left unchanged.\n"),
 				 block, block);
 		} else if (rg_status != block_status) {
 			const char *blockstatus[] = {"Free", "Data", "Unlinked", "inode"};
 
-			log_err("Ondisk and fsck bitmaps differ at"
-					" block %"PRIu64" (0x%" PRIx64 ") \n", block, block);
-			log_err("Ondisk status is %u (%s) but FSCK thinks it should be ",
+			log_err( _("Ondisk and fsck bitmaps differ at"
+					" block %"PRIu64" (0x%" PRIx64 ") \n"), block, block);
+			log_err( _("Ondisk status is %u (%s) but FSCK thinks it should be "),
 					rg_status, blockstatus[rg_status]);
 			log_err("%u (%s)\n", block_status, blockstatus[block_status]);
-			log_err("Metadata type is %u (%s)\n", q.block_type,
+			log_err( _("Metadata type is %u (%s)\n"), q.block_type,
 					block_type_string(&q));
 
 			errors_found++;
-			if(query(&opts, "Fix bitmap for block %"
-					 PRIu64" (0x%" PRIx64 ") ? (y/n) ", block, block)) {
+			if(query(&opts, _("Fix bitmap for block %"
+					 PRIu64" (0x%" PRIx64 ") ? (y/n) "), block, block)) {
 				errors_corrected++;
 				if(gfs2_set_bitmap(sbp, block, block_status))
-					log_err("Failed.\n");
+					log_err( _("Failed.\n"));
 				else
-					log_err("Succeeded.\n");
+					log_err( _("Succeeded.\n"));
 			} else
-				log_err("Bitmap at block %"PRIu64" (0x%" PRIx64
-						") left inconsistent\n", block, block);
+				log_err( _("Bitmap at block %"PRIu64" (0x%" PRIx64
+						") left inconsistent\n"), block, block);
 		}
 		(*rg_block)++;
 		bit += GFS2_BIT_SIZE;
@@ -119,7 +121,7 @@
 	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;
@@ -139,8 +141,8 @@
 
 	/* actually adjust counters and write out to disk */
 	if(rgp->rg.rg_free != count[0]) {
-		log_err("RG #%llu (0x%llx) free count inconsistent: "
-			"is %u should be %u\n",
+		log_err( _("RG #%llu (0x%llx) free count inconsistent: "
+			"is %u should be %u\n"),
 			(unsigned long long)rgp->ri.ri_addr,
 			(unsigned long long)rgp->ri.ri_addr,
 			rgp->rg.rg_free, count[0]);
@@ -148,7 +150,7 @@
 		update = 1;
 	}
 	if(rgp->rg.rg_dinodes != count[1]) {
-		log_err("Inode count inconsistent: is %u should be %u\n",
+		log_err( _("Inode count inconsistent: is %u should be %u\n"),
 				rgp->rg.rg_dinodes, count[1]);
 		rgp->rg.rg_dinodes = count[1];
 		update = 1;
@@ -157,19 +159,19 @@
 		/* FIXME not sure how to handle this case ATM - it
 		 * means that the total number of blocks we've counted
 		 * exceeds the blocks in the rg */
-		log_err("Internal fsck error - AAHHH!\n");
+		log_err( _("Internal fsck error - AAHHH!\n"));
 		exit(FSCK_ERROR);
 	}
 	if(update) {
 		errors_found++;
-		if(query(&opts, "Update resource group counts? (y/n) ")) {
+		if(query(&opts, _("Update resource group counts? (y/n) "))) {
 			errors_corrected++;
-			log_warn("Resource group counts updated\n");
+			log_warn( _("Resource group counts updated\n"));
 			/* write out the rgrp */
 			gfs2_rgrp_out(&rgp->rg, rgp->bh[0]->b_data);
 			return updated;
 		} else
-			log_err("Resource group counts left inconsistent\n");
+			log_err( _("Resource group counts left inconsistent\n"));
 	}
 	return not_updated;
 }
@@ -193,7 +195,7 @@
 
 		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
 			return FSCK_OK;
-		log_info("Verifying Resource Group #%" PRIu64 "\n", rg_count);
+		log_info( _("Verifying Resource Group #%" PRIu64 "\n"), rg_count);
 		memset(count, 0, sizeof(count));
 		rgp = osi_list_entry(tmp, struct rgrp_list, list);
 
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/rgrepair.c cluster-3.0.0.rc3/gfs2/fsck/rgrepair.c
--- cluster-3.0.0.rc2/gfs2/fsck/rgrepair.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/rgrepair.c	2009-06-11 11:02:55.000000000 +0200
@@ -5,6 +5,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "osi_list.h"
@@ -34,7 +36,7 @@
  * 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;
@@ -45,7 +47,7 @@
 
 	osi_list_init(&false_rgrps.list);
 	for (j = 0; j < sdp->md.journals; j++) {
-		log_debug("Checking for RGs in journal%d.\n", j);
+		log_debug( _("Checking for RGs in journal%d.\n"), j);
 		ip = sdp->md.journal[j];
 		jblocks = ip->i_di.di_size / sdp->sd_sb.sb_bsize;
 		for (b = 0; b < jblocks; b++) {
@@ -55,8 +57,8 @@
 				break;
 			bh = bread(&sdp->buf_list, dblock);
 			if (!gfs2_check_meta(bh, GFS2_METATYPE_RG)) {
-				log_debug("False RG found at block "
-					  "0x%" PRIx64 "\n", dblock);
+				log_debug( _("False RG found at block "
+					  "0x%" PRIx64 "\n"), dblock);
 				gfs2_special_set(&false_rgrps, dblock);
 			}
 			brelse(bh, not_updated);
@@ -64,7 +66,7 @@
 	}
 }
 
-int is_false_rg(uint64_t block)
+static int is_false_rg(uint64_t block)
 {
 	if (blockfind(&false_rgrps, block))
 		return 1;
@@ -96,7 +98,7 @@
  * 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;
@@ -131,7 +133,7 @@
 		if (((blk == sdp->sb_addr + 1) ||
 		    (!gfs2_check_meta(bh, GFS2_METATYPE_RG))) &&
 		    !is_false_rg(blk)) {
-			log_debug("RG found at block 0x%" PRIx64 "\n", blk);
+			log_debug( _("RG found at block 0x%" PRIx64 "\n"), blk);
 			if (blk > sdp->sb_addr + 1) {
 				uint64_t rgdist;
 				
@@ -152,7 +154,7 @@
 					first_rg_dist = rgdist;
 				if (rgdist < shortest_dist_btwn_rgs) {
 					shortest_dist_btwn_rgs = rgdist;
-					log_debug("(shortest so far)\n");
+					log_debug( _("(shortest so far)\n"));
 				}
 				else
 					log_debug("\n");
@@ -171,8 +173,8 @@
 	/* first_rg_dist would measure from #1 to #3, which would be bad. */
 	/* We need to take remedial measures to fix it (from the index).  */
 	/* -------------------------------------------------------------- */
-	log_debug("First RG distance: 0x%" PRIx64 "\n", first_rg_dist);
-	log_debug("Distance between RGs: 0x%" PRIx64 "\n",
+	log_debug( _("First RG distance: 0x%" PRIx64 "\n"), first_rg_dist);
+	log_debug( _("Distance between RGs: 0x%" PRIx64 "\n"),
 		  shortest_dist_btwn_rgs);
 	if (first_rg_dist >= shortest_dist_btwn_rgs +
 	    (shortest_dist_btwn_rgs / 4)) {
@@ -182,18 +184,18 @@
 			   sizeof(struct gfs2_rindex));
 		gfs2_rindex_in(&tmpndx, (char *)&buf);
 		if (tmpndx.ri_addr > sdp->sb_addr + 1) { /* sanity check */
-			log_warn("RG 2 is damaged: getting dist from index: ");
+			log_warn( _("RG 2 is damaged: getting dist from index: "));
 			first_rg_dist = tmpndx.ri_addr - (sdp->sb_addr + 1);
 			log_warn("0x%" PRIx64 "\n", first_rg_dist);
 		}
 		else {
-			log_warn("RG index 2 is damaged: extrapolating dist: ");
+			log_warn( _("RG index 2 is damaged: extrapolating dist: "));
 			first_rg_dist = sdp->device.length -
 				(sdp->rgrps - 1) *
 				(sdp->device.length / sdp->rgrps);
 			log_warn("0x%" PRIx64 "\n", first_rg_dist);
 		}
-		log_debug("Adjusted first RG distance: 0x%" PRIx64 "\n",
+		log_debug( _("Adjusted first RG distance: 0x%" PRIx64 "\n"),
 			  first_rg_dist);
 	} /* if first RG distance is within tolerance */
 	/* -------------------------------------------------------------- */
@@ -204,14 +206,14 @@
 	block_bump = first_rg_dist;
 	for (blk = sdp->sb_addr + 1; blk <= sdp->device.length;
 	     blk += block_bump) {
-		log_debug("Block 0x%" PRIx64 "\n", blk);
+		log_debug( _("Block 0x%" PRIx64 "\n"), blk);
 		bh = bread(&sdp->nvbuf_list, blk);
 		rg_was_fnd = (!gfs2_check_meta(bh, GFS2_METATYPE_RG));
 		brelse(bh, not_updated);
 		/* Allocate a new RG and index. */
 		calc_rgd = malloc(sizeof(struct rgrp_list));
 		if (!calc_rgd) {
-			log_crit("Can't allocate memory for rg repair.\n");
+			log_crit( _("Can't allocate memory for rg repair.\n"));
 			return -1;
 		}
 		memset(calc_rgd, 0, sizeof(struct rgrp_list));
@@ -224,11 +226,11 @@
 			/* ------------------------------------------------- */
 			corrupt_rgs++;
 			if (corrupt_rgs < 5)
-				log_debug("Missing or damaged RG at block %" 
-					  PRIu64 " (0x%" PRIx64 ")\n",
+				log_debug( _("Missing or damaged RG at block %" 
+					  PRIu64 " (0x%" PRIx64 ")\n"),
 					  blk, blk);
 			else {
-				log_crit("Error: too many bad RGs.\n");
+				log_crit( _("Error: too many bad RGs.\n"));
 				return -1;
 			}
 		}
@@ -250,11 +252,11 @@
 		} /* for subsequent bitmaps */
 		
 		gfs2_compute_bitstructs(sdp, calc_rgd);
-		log_debug("Memory allocated for rg at 0x%llx, bh: %p\n",
+		log_debug( _("Memory allocated for rg at 0x%llx, bh: %p\n"),
 			  (unsigned long long)calc_rgd->ri.ri_addr,
 			  calc_rgd->bh);
 		if (!calc_rgd->bh) {
-			log_crit("Can't allocate memory for bitmap repair.\n");
+			log_crit( _("Can't allocate memory for bitmap repair.\n"));
 			return -1;
 		}
 		calc_rgd->ri.ri_data0 = calc_rgd->ri.ri_addr +
@@ -271,11 +273,11 @@
 				GFS2_NBBY;
 			prev_rgd->ri.ri_bitbytes = prev_rgd->ri.ri_data /
 				GFS2_NBBY;
-			log_debug("Prev ri_data set to: %" PRIx32 ".\n",
+			log_debug( _("Prev ri_data set to: %" PRIx32 ".\n"),
 				  prev_rgd->ri.ri_data);
 		}
 		number_of_rgs++;
-		log_warn("%c RG %d at block 0x%" PRIX64 " %s",
+		log_warn( _("%c RG %d at block 0x%" PRIX64 " %s"),
 			 (rg_was_fnd ? ' ' : '*'), number_of_rgs, blk,
 			 (rg_was_fnd ? "intact" : "*** DAMAGED ***"));
 		prev_rgd = calc_rgd;
@@ -286,7 +288,7 @@
 		else
 			block_bump = shortest_dist_btwn_rgs;
 		if (block_bump != 1)
-			log_warn(" [length 0x%" PRIx64 "]\n", block_bump);
+			log_warn( _(" [length 0x%" PRIx64 "]\n"), block_bump);
 	} /* for each rg block */
 	/* ----------------------------------------------------------------- */
 	/* If we got to the end of the fs, we still need to fix the          */
@@ -302,14 +304,14 @@
 		prev_rgd->ri.ri_data = rgblocks;
 		prev_rgd->ri.ri_data -= prev_rgd->ri.ri_data % GFS2_NBBY;
 		prev_rgd->ri.ri_bitbytes = prev_rgd->ri.ri_data / GFS2_NBBY;
-		log_debug("Prev ri_data set to: %" PRIx32 ".\n",
+		log_debug( _("Prev ri_data set to: %" PRIx32 ".\n"),
 			  prev_rgd->ri.ri_data);
 		prev_rgd = NULL; /* make sure we don't use it later */
 	}
         /* ---------------------------------------------- */
         /* Now dump out the information (if verbose mode) */      
         /* ---------------------------------------------- */
-        log_debug("RG index rebuilt as follows:\n");
+        log_debug( _("RG index rebuilt as follows:\n"));
         for (tmp = ret_list, rgi = 0; tmp != ret_list;
 	     tmp = tmp->next, rgi++) {
                 calc_rgd = osi_list_entry(tmp, struct rgrp_list, list);
@@ -337,13 +339,13 @@
  * 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);
 	sdp->rgsize = GFS2_DEFAULT_RGSIZE; /* compute_rgrp_layout adjusts */
 	if (device_geometry(sdp)) {
-		fprintf(stderr, "Geometry error\n");
+		fprintf(stderr, _("Geometry error\n"));
 		exit(-1);
 	}
 	if (fix_device_geometry(sdp)) {
@@ -356,7 +358,7 @@
 	compute_rgrp_layout(sdp, FALSE);
 	build_rgrps(sdp, FALSE); /* FALSE = calc but don't write to disk. */
 	*num_rgs = 0;
-	log_debug("fs_total_size = 0x%" PRIX64 " blocks.\n",
+	log_debug( _("fs_total_size = 0x%" PRIX64 " blocks.\n"),
 		  sdp->device.length);
 	/* ----------------------------------------------------------------- */
 	/* Calculate how many RGs there are supposed to be based on the      */
@@ -366,7 +368,7 @@
 	/* the index.                                                        */
 	/* ----------------------------------------------------------------- */
 	*num_rgs = sdp->md.riinode->i_di.di_size / sizeof(struct gfs2_rindex);
-	log_warn("L2: number of rgs in the index = %d.\n", *num_rgs);
+	log_warn( _("L2: number of rgs in the index = %d.\n"), *num_rgs);
 	return 0;
 }
 
@@ -374,20 +376,20 @@
  * 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;
 
-	log_err("Block #%"PRIu64" (0x%" PRIx64") (%d of %d) is neither"
-		" GFS2_METATYPE_RB nor GFS2_METATYPE_RG.\n",
+	log_err( _("Block #%"PRIu64" (0x%" PRIx64") (%d of %d) is neither"
+		" GFS2_METATYPE_RB nor GFS2_METATYPE_RG.\n"),
 		rg->bh[x]->b_blocknr, rg->bh[x]->b_blocknr,
 		(int)x+1, (int)rg->ri.ri_length);
 	errors_found++;
 	if (query(&opts, "Fix the RG? (y/n)")) {
 
 		errors_corrected++;
-		log_err("Attempting to repair the RG.\n");
+		log_err( _("Attempting to repair the RG.\n"));
 		rg->bh[x] = bread(&sdp->nvbuf_list, rg->ri.ri_addr + x);
 		if (x) {
 			struct gfs2_meta_header mh;
@@ -422,7 +424,7 @@
 {
 	int error, descrepencies;
 	osi_list_t expected_rglist;
-	int calc_rg_count, rgcount_from_index, rg;
+	int calc_rg_count = 0, rgcount_from_index, rg;
 	osi_list_t *exp, *act; /* expected, actual */
 	struct gfs2_rindex buf;
 
@@ -441,7 +443,7 @@
 		error = gfs2_rindex_rebuild(sdp, &expected_rglist,
 					     &calc_rg_count);
 		if (error) {
-			log_crit("Error rebuilding rg list.\n");
+			log_crit( _("Error rebuilding rg list.\n"));
 			gfs2_rgrp_free(&expected_rglist, not_updated);
 			return -1;
 		}
@@ -451,16 +453,16 @@
 	osi_list_init(&sdp->rglist); /* Just to be safe */
 	rindex_read(sdp, 0, &rgcount_from_index);
 	if (sdp->md.riinode->i_di.di_size % sizeof(struct gfs2_rindex)) {
-		log_warn("WARNING: rindex file is corrupt.\n");
+		log_warn( _("WARNING: rindex file is corrupt.\n"));
 		gfs2_rgrp_free(&expected_rglist, not_updated);
 		gfs2_rgrp_free(&sdp->rglist, not_updated);
 		return -1;
 	}
-	log_warn("L%d: number of rgs expected     = %lld.\n", trust_lvl + 1,
+	log_warn( _("L%d: number of rgs expected     = %lld.\n"), trust_lvl + 1,
 		 (unsigned long long)sdp->rgrps);
 	if (calc_rg_count != sdp->rgrps) {
-		log_warn("L%d: They don't match; either (1) the fs was extended, (2) an odd\n", trust_lvl + 1);
-		log_warn("L%d: rg size was used, or (3) we have a corrupt rg index.\n", trust_lvl + 1);
+		log_warn( _("L%d: They don't match; either (1) the fs was extended, (2) an odd\n"), trust_lvl + 1);
+		log_warn( _("L%d: rg size was used, or (3) we have a corrupt rg index.\n"), trust_lvl + 1);
 		gfs2_rgrp_free(&expected_rglist, not_updated);
 		gfs2_rgrp_free(&sdp->rglist, not_updated);
 		return -1;
@@ -489,9 +491,9 @@
 		}
 	}
 	if (trust_lvl < distrust && descrepencies > (trust_lvl * 8)) {
-		log_warn("Level %d didn't work.  Too many descepencies.\n",
+		log_warn( _("Level %d didn't work.  Too many descepencies.\n"),
 			 trust_lvl + 1);
-		log_warn("%d out of %d RGs did not match what was expected.\n",
+		log_warn( _("%d out of %d RGs did not match what was expected.\n"),
 			 descrepencies, rg);
 		gfs2_rgrp_free(&expected_rglist, not_updated);
 		gfs2_rgrp_free(&sdp->rglist, not_updated);
@@ -517,7 +519,7 @@
 		/* If we modified the index, write it back to disk. */
 		if (rindex_modified) {
 			errors_found++;
-			if (query(&opts, "Fix the index? (y/n)")) {
+			if (query(&opts, _("Fix the index? (y/n)"))) {
 				errors_corrected++;
 				gfs2_rindex_out(&expected->ri, (char *)&buf);
 				gfs2_writei(sdp->md.riinode, (char *)&buf,
@@ -540,7 +542,7 @@
 				gfs2_compute_bitstructs(sdp, actual);
 			}
 			else
-				log_err("RG index not fixed.\n");
+				log_err( _("RG index not fixed.\n"));
 			rindex_modified = FALSE;
 			
 		}
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/util.c cluster-3.0.0.rc3/gfs2/fsck/util.c
--- cluster-3.0.0.rc2/gfs2/fsck/util.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/util.c	2009-06-11 11:02:55.000000000 +0200
@@ -4,42 +4,13 @@
 #include <unistd.h>
 #include <sys/time.h>
 #include <stdio.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "fs_bits.h"
 #include "util.h"
 
-/**
- * compute_height
- * @sdp:
- * @sz:
- *
- */
-int compute_height(struct gfs2_sbd *sdp, uint64_t sz)
-{
-	unsigned int height;
-	uint64_t space, old_space;
-	unsigned int bsize = sdp->sd_sb.sb_bsize;
-	
-	if (sz <= (bsize - sizeof(struct gfs2_dinode)))
-		return 0;
-	
-	height = 1;
-	space = sdp->sd_diptrs * bsize;
-	
-	while (sz > space) {
-		old_space = space;
-		
-		height++;
-		space *= sdp->sd_inptrs;
-		
-		if (space / sdp->sd_inptrs != old_space ||
-			space % sdp->sd_inptrs != 0)
-			break;
-	}
-	return height;
-}
-
 /* Put out a warm, fuzzy message every second so the user     */
 /* doesn't think we hung.  (This may take a long time).       */
 void warm_fuzzy_stuff(uint64_t block)
@@ -61,7 +32,7 @@
 			seconds = tv.tv_sec;
 			if (last_fs_block) {
 				percent = (block * 100) / last_fs_block;
-				log_notice("\r%" PRIu64 " percent complete.\r", percent);
+				log_notice( _("\r%" PRIu64 " percent complete.\r"), percent);
 			}
 		}
 	}
diff -Naurd cluster-3.0.0.rc2/gfs2/fsck/util.h cluster-3.0.0.rc3/gfs2/fsck/util.h
--- cluster-3.0.0.rc2/gfs2/fsck/util.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/fsck/util.h	2009-06-11 11:02:55.000000000 +0200
@@ -6,7 +6,6 @@
 #define fsck_lseek(fd, off) \
   ((lseek((fd), (off), SEEK_SET) == (off)) ? 0 : -1)
 
-int compute_height(struct gfs2_sbd *sdp, uint64_t sz);
 struct di_info *search_list(osi_list_t *list, uint64_t addr);
 void warm_fuzzy_stuff(uint64_t block);
 const char *block_type_string(struct gfs2_block_query *q);
diff -Naurd cluster-3.0.0.rc2/gfs2/libgfs2/block_list.c cluster-3.0.0.rc3/gfs2/libgfs2/block_list.c
--- cluster-3.0.0.rc2/gfs2/libgfs2/block_list.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/libgfs2/block_list.c	2009-06-11 11:02:55.000000000 +0200
@@ -182,7 +182,7 @@
 	}
 }
 
-void gfs2_dup_free(struct dup_blocks *blist)
+static void gfs2_dup_free(struct dup_blocks *blist)
 {
 	struct dup_blocks *f;
 
@@ -209,7 +209,7 @@
 	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;
@@ -238,7 +238,7 @@
 	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;
 
diff -Naurd cluster-3.0.0.rc2/gfs2/libgfs2/buf.c cluster-3.0.0.rc3/gfs2/libgfs2/buf.c
--- cluster-3.0.0.rc2/gfs2/libgfs2/buf.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/libgfs2/buf.c	2009-06-11 11:02:55.000000000 +0200
@@ -172,11 +172,11 @@
 	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) {
 		fprintf(stderr, "buffer count underflow for block %" PRIu64
diff -Naurd cluster-3.0.0.rc2/gfs2/libgfs2/fs_geometry.c cluster-3.0.0.rc3/gfs2/libgfs2/fs_geometry.c
--- cluster-3.0.0.rc2/gfs2/libgfs2/fs_geometry.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/libgfs2/fs_geometry.c	2009-06-11 11:02:55.000000000 +0200
@@ -178,7 +178,7 @@
  * 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;
@@ -215,7 +215,7 @@
 		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 -Naurd cluster-3.0.0.rc2/gfs2/libgfs2/fs_ops.c cluster-3.0.0.rc3/gfs2/libgfs2/fs_ops.c
--- cluster-3.0.0.rc2/gfs2/libgfs2/fs_ops.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/libgfs2/fs_ops.c	2009-06-11 11:02:55.000000000 +0200
@@ -43,11 +43,11 @@
 	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);
 }
 
@@ -666,6 +666,7 @@
 	do {
 		uint16_t cur_rec_len;
 		uint16_t cur_name_len;
+		uint16_t new_rec_len;
 
 		cur_rec_len = be16_to_cpu(dent->de_rec_len);
 		cur_name_len = be16_to_cpu(dent->de_name_len);
@@ -681,8 +682,10 @@
 				new->de_rec_len = cpu_to_be16(cur_rec_len -
 											  GFS2_DIRENT_SIZE(cur_name_len));
 				new->de_name_len = cpu_to_be16(name_len);
-				dent->de_rec_len = cpu_to_be16(cur_rec_len -
-											   be16_to_cpu(new->de_rec_len));
+
+				new_rec_len = be16_to_cpu(new->de_rec_len);
+				dent->de_rec_len = cpu_to_be16(cur_rec_len - new_rec_len);
+
 				*dent_out = new;
 				return 0;
 			}
@@ -714,14 +717,14 @@
 	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");
@@ -741,7 +744,7 @@
 		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;
@@ -771,7 +774,7 @@
 	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));
 
 	lp = calloc(1, half_len * sizeof(uint64_t));
 	if (lp == NULL) {
@@ -920,12 +923,12 @@
  * Returns: 0 on success, error code otherwise
  */
 
-static int get_first_leaf(struct gfs2_inode *dip, uint32_t index,
+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;
 }
@@ -952,13 +955,13 @@
 	return 0;
 }
 
-static void dir_e_add(struct gfs2_inode *dip, char *filename, int len,
+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;
 
@@ -966,11 +969,11 @@
 	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);
@@ -980,7 +983,7 @@
 
 			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) {
@@ -1071,7 +1074,8 @@
 			break;
 	} while (gfs2_dirent_next(dip, bh, &dent) == 0);
 
-	dent->de_rec_len = cpu_to_be16(be16_to_cpu(dent->de_rec_len) +
+	dent->de_rec_len = be16_to_cpu(dent->de_rec_len);
+	dent->de_rec_len = cpu_to_be16(dent->de_rec_len +
 		sizeof(struct gfs2_dinode) - sizeof(struct gfs2_leaf));
 
 	brelse(bh, updated);
@@ -1092,7 +1096,7 @@
 	dip->i_di.di_depth = y;
 }
 
-static void dir_l_add(struct gfs2_inode *dip, char *filename, int len,
+static void dir_l_add(struct gfs2_inode *dip, const char *filename, int len,
 		      struct gfs2_inum *inum, unsigned int type)
 {
 	struct gfs2_dirent *dent;
@@ -1112,7 +1116,7 @@
 	dip->i_di.di_entries++;
 }
 
-void dir_add(struct gfs2_inode *dip, char *filename, int len,
+void dir_add(struct gfs2_inode *dip, const char *filename, int len,
 	     struct gfs2_inum *inum, unsigned int type)
 {
 	if (dip->i_di.di_flags & GFS2_DIF_EXHASH)
@@ -1183,7 +1187,7 @@
 	return bh;
 }
 
-struct gfs2_inode *createi(struct gfs2_inode *dip, char *filename,
+struct gfs2_inode *createi(struct gfs2_inode *dip, const char *filename,
 			   unsigned int mode, uint32_t flags)
 {
 	struct gfs2_sbd *sdp = dip->i_sbd;
@@ -1303,7 +1307,7 @@
 			      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;
 
@@ -1314,9 +1318,9 @@
 	/*  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;
 
@@ -1438,17 +1442,17 @@
 
 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);
diff -Naurd cluster-3.0.0.rc2/gfs2/libgfs2/gfs1.c cluster-3.0.0.rc3/gfs2/libgfs2/gfs1.c
--- cluster-3.0.0.rc2/gfs2/libgfs2/gfs1.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/libgfs2/gfs1.c	2009-06-11 11:02:55.000000000 +0200
@@ -156,7 +156,7 @@
 	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 not_new = 0;
 	int journaled = fs_is_jdata(ip);
 	int copied = 0;
+	char *buf = bufin;
 
 	if (offset >= ip->i_di.di_size)
 		return 0;
@@ -328,7 +329,7 @@
 /* ------------------------------------------------------------------------ */
 /* 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 -Naurd cluster-3.0.0.rc2/gfs2/libgfs2/gfs2_log.c cluster-3.0.0.rc3/gfs2/libgfs2/gfs2_log.c
--- cluster-3.0.0.rc2/gfs2/libgfs2/gfs2_log.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/libgfs2/gfs2_log.c	2009-06-11 11:02:55.000000000 +0200
@@ -27,7 +27,7 @@
 	_state.print_level--;
 }
 
-static void print_msg(int priority, char *file, int line, const char *format,
+static void print_msg(int priority, const char *file, int line, const char *format,
 		      va_list args) {
 
 	switch (priority) {
@@ -53,7 +53,7 @@
 }
 
 
-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, ...)
 {
 
diff -Naurd cluster-3.0.0.rc2/gfs2/libgfs2/libgfs2.h cluster-3.0.0.rc3/gfs2/libgfs2/libgfs2.h
--- cluster-3.0.0.rc2/gfs2/libgfs2/libgfs2.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/libgfs2/libgfs2.h	2009-06-11 11:02:55.000000000 +0200
@@ -390,7 +390,7 @@
 extern struct gfs2_buffer_head *__bread(struct buf_list *bl, uint64_t num,
 					int line, const char *caller);
 extern struct gfs2_buffer_head *bhold(struct gfs2_buffer_head *bh);
-extern void brelse(struct gfs2_buffer_head *bh, enum update_flags updated);
+extern void brelse(struct gfs2_buffer_head *bh, enum update_flags is_updated);
 extern void __bsync(struct buf_list *bl, int line, const char *caller);
 extern void __bcommit(struct buf_list *bl, int line, const char *caller);
 
@@ -454,14 +454,14 @@
 					    struct gfs2_inum *inum,
 					    unsigned int mode, uint32_t flags,
 					    struct gfs2_inum *parent);
-extern struct gfs2_inode *createi(struct gfs2_inode *dip, char *filename,
+extern struct gfs2_inode *createi(struct gfs2_inode *dip, const char *filename,
 				  unsigned int mode, uint32_t flags);
 extern void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
 			struct gfs2_dirent *prev, struct gfs2_dirent *cur);
 extern struct gfs2_inode *gfs2_load_inode(struct gfs2_sbd *sbp, uint64_t block);
 extern int gfs2_lookupi(struct gfs2_inode *dip, const char *filename, int len,
 			struct gfs2_inode **ipp);
-extern void dir_add(struct gfs2_inode *dip, char *filename, int len,
+extern void dir_add(struct gfs2_inode *dip, const char *filename, int len,
 		    struct gfs2_inum *inum, unsigned int type);
 extern int gfs2_dirent_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
 			   const char *filename, int filename_len);
@@ -620,7 +620,7 @@
 
 extern void increase_verbosity(void);
 extern void decrease_verbosity(void);
-extern void print_fsck_log(int iif, int priority, char *file, int line,
+extern void print_fsck_log(int iif, int priority, const char *file, int line,
 			   const char *format, ...)
 	__attribute__((format(printf,5,6)));
 extern char generic_interrupt(const char *caller, const char *where,
@@ -642,10 +642,9 @@
 extern void cleanup_metafs(struct gfs2_sbd *sdp);
 extern char *find_debugfs_mount(void);
 extern char *mp2fsname(char *mp);
-extern char *mp2fsname2(char *mp);
-extern char *get_sysfs(char *fsname, char *filename);
-extern int get_sysfs_uint(char *fsname, char *filename, unsigned int *val);
-extern int set_sysfs(char *fsname, char *filename, char *val);
+extern char *get_sysfs(const char *fsname, const char *filename);
+extern int get_sysfs_uint(const char *fsname, const char *filename, unsigned int *val);
+extern int set_sysfs(const char *fsname, const char *filename, const char *val);
 extern int is_fsname(char *name);
 
 /* recovery.c */
diff -Naurd cluster-3.0.0.rc2/gfs2/libgfs2/misc.c cluster-3.0.0.rc3/gfs2/libgfs2/misc.c
--- cluster-3.0.0.rc2/gfs2/libgfs2/misc.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/libgfs2/misc.c	2009-06-11 11:02:55.000000000 +0200
@@ -207,7 +207,7 @@
 		rmdir(sdp->metafs_path);
 }
 
-static char *__get_sysfs(char *fsname, char *filename)
+static char *__get_sysfs(const char *fsname, const char *filename)
 {
 	char path[PATH_MAX];
 	int fd, rv;
@@ -229,7 +229,7 @@
 	return sysfs_buf;
 }
 
-char *get_sysfs(char *fsname, char *filename)
+char *get_sysfs(const char *fsname, const char *filename)
 {
 	char *s;
 	char *p;
@@ -243,7 +243,7 @@
 	return sysfs_buf;
 }
 
-int get_sysfs_uint(char *fsname, char *filename, unsigned int *val)
+int get_sysfs_uint(const char *fsname, const char *filename, unsigned int *val)
 {
 	char *s = __get_sysfs(fsname, filename);
 	int ret;
@@ -257,7 +257,7 @@
 	return 0;
 }
 
-int set_sysfs(char *fsname, char *filename, char *val)
+int set_sysfs(const char *fsname, const char *filename, const char *val)
 {
 	char path[PATH_MAX];
 	int fd, rv, len;
@@ -315,90 +315,6 @@
 	return NULL;
 }
 
-/*
- * Same as mp2fsname, except that this function doesn't stat() the mountpoint
- * to get the device no. Used by gfs2_tool freeze/unfreeze where we don't want
- * to touch the potentially frozen filesytem and hang gfs2_tool itself.
- */
-char *
-mp2fsname2(char *mp)
-{
-	char device_id[PATH_MAX], *fsname = NULL;
-	struct stat statbuf;
-	DIR *d;
-	struct dirent *de;
-	FILE *fp;
-	char buffer[PATH_MAX], device_name[PATH_MAX];
-	int fsdump, fspass, ret, found = 0;
-	char fspath[PATH_MAX], fsoptions[PATH_MAX], fstype[80];
-	char *id;
-
-	/* Take care of trailing '/' */
-	if (mp[strlen(mp) - 1] == '/')
-		mp[strlen(mp) - 1] = 0;
-
-	fp = fopen("/proc/mounts", "r");
-	if (fp == NULL) {
-		return NULL;
-	}
-
-	while ((fgets(buffer, PATH_MAX - 1, fp)) != NULL) {
-		buffer[PATH_MAX - 1] = 0;
-		if (strstr(buffer, "0") == 0)
-			continue;
-
-		if ((ret = sscanf(buffer, "%s %s %s %s %d %d",
-				  device_name, fspath,
-				  fstype, fsoptions, &fsdump, &fspass)) != 6)
-			continue;
-
-		if (strcmp(fstype, "gfs2") != 0)
-			continue;
-
-		if (strcmp(fspath, mp) != 0)
-			continue;
-
-		found = 1;
-		break;
-	}
-	fclose(fp);
-
-	if (!found) {
-		errno = ENOENT;
-		return NULL;
-	}
-
-	if (stat(device_name, &statbuf))
-		return NULL;
-
-	memset(device_id, 0, sizeof(device_id));
-	sprintf(device_id, "%u:%u", (uint32_t)MAJOR(statbuf.st_rdev),
-		(uint32_t)MINOR(statbuf.st_rdev));
-
-	d = opendir(SYS_BASE);
-	if (!d)
-		return NULL;
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		id = get_sysfs(de->d_name, "id");
-		if (!id)
-			continue;
-		if (strcmp(id, device_id) == 0) {
-			fsname = strdup(de->d_name);
-			break;
-		}
-	}
-
-	closedir(d);
-
-	if (!fsname)
-		errno = ENOENT;
-	return fsname;
-}
-
 /**
  * mp2fsname - Find the name for a filesystem given its mountpoint
  *
diff -Naurd cluster-3.0.0.rc2/gfs2/libgfs2/rgrp.c cluster-3.0.0.rc3/gfs2/libgfs2/rgrp.c
--- cluster-3.0.0.rc2/gfs2/libgfs2/rgrp.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/libgfs2/rgrp.c	2009-06-11 11:02:55.000000000 +0200
@@ -136,15 +136,15 @@
 	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;
 
@@ -152,7 +152,7 @@
 		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 -Naurd cluster-3.0.0.rc2/gfs2/man/gfs2_convert.8 cluster-3.0.0.rc3/gfs2/man/gfs2_convert.8
--- cluster-3.0.0.rc2/gfs2/man/gfs2_convert.8	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/man/gfs2_convert.8	2009-06-11 11:02:55.000000000 +0200
@@ -8,7 +8,21 @@
 [\fIOPTION\fR]... \fIDEVICE\fR
 
 .SH DESCRIPTION
-gfs2_convert is used to convert a filesystem from GFS1 to GFS2.
+gfs2_convert is used to convert a filesystem from GFS1 to GFS2. Do not
+attempt to convert a GFS1 filesystem which is not clean - the process
+of conversion will reinitialise the journals. We highly recommend that
+.B fsck.gfs
+is run successfully before attempting to convert a filesystem. Many
+of the on-disk structures are identical between GFS1 and GFS2, so
+the conversion process updates the journals, a few items of incompatible
+metadata (mostly indirect pointers and inodes) and adds the per-node
+directories required by the gfs2meta filesystem. The conversion process
+is performed in-place and does not require any extra disk space so that
+it is possible to successfully convert a GFS1 filesystem that is
+completely full.
+
+Always ensure you have a complete backup of the data on any filesystem
+before starting the conversion process.
 
 .SH OPTIONS
 .TP
diff -Naurd cluster-3.0.0.rc2/gfs2/man/gfs2_grow.8 cluster-3.0.0.rc3/gfs2/man/gfs2_grow.8
--- cluster-3.0.0.rc2/gfs2/man/gfs2_grow.8	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/man/gfs2_grow.8	2009-06-11 11:02:55.000000000 +0200
@@ -5,7 +5,7 @@
 
 .SH SYNOPSIS
 .B gfs2_grow
-[\fIOPTION\fR]... <\fIDEVICE\fR|\fIMOINTPOINT\fR>...
+[\fIOPTION\fR]... <\fIDEVICE\fR|\fIMOUNTPOINT\fR>...
 
 .SH DESCRIPTION
 gfs2_grow is used to expand a GFS2 filesystem after the device
@@ -57,5 +57,10 @@
 \fB-V\fP
 Version. Print out version information, then exit.
 
+.SH BUGS
+
+There is no way to shrink a GFS2 filesystem.
+
 .SH SEE ALSO
 mkfs.gfs2(8) gfs2_jadd(8)
+
diff -Naurd cluster-3.0.0.rc2/gfs2/man/gfs2_quota.8 cluster-3.0.0.rc3/gfs2/man/gfs2_quota.8
--- cluster-3.0.0.rc2/gfs2/man/gfs2_quota.8	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/man/gfs2_quota.8	2009-06-11 11:02:55.000000000 +0200
@@ -11,7 +11,7 @@
 gfs2_quota is used to examine and change quota values in a GFS2 filesystem.
 This command has a number of different actions.
 
-GFS2(5.1) introduced a new linked list format for the quotas in the quota file.
+GFS2 introduced a new linked list format for the quotas in the quota file.
 This list format allows for faster \fBlist\fP, \fBcheck\fP and \fBinit\fP 
 operations. Older GFS2 quota files may be migrated to this newer format using 
 the \fBgfs2_quota reset\fP command.
diff -Naurd cluster-3.0.0.rc2/gfs2/man/gfs2_tool.8 cluster-3.0.0.rc3/gfs2/man/gfs2_tool.8
--- cluster-3.0.0.rc2/gfs2/man/gfs2_tool.8	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/man/gfs2_tool.8	2009-06-11 11:02:55.000000000 +0200
@@ -8,64 +8,34 @@
 \fICOMMAND\fR [\fIOPTION\fR]...
 
 .SH DESCRIPTION
-gfs2_tool is an interface to a variety of the GFS2 ioctl/sysfs calls.
+gfs2_tool is an interface to a variety of the GFS2 ioctl/sysfs calls. Some
+of the functions of gfs_tool have been replaced by standard system tools
+such as mount and chattr, so gfs2_tool doesn't have as many options
+as gfs_tool used to.
 
 .SH COMMANDS
 .TP
 \fBclearflag\fP \fIFlag\fR \fIFile1\fR \fIFile2\fR \fI...\fR 
 Clear an attribute flag on a file. See \fBsetflag\fP for available flags.
 .TP
-\fBdf\fP \fIMountPoint\fR 
-Print out a space usage summary of a given filesystem.  The information
-printed is more detailed than a standard "df".
-.\".TP
-.\"\fBflush\fP \fIFile\fR
-.\"Sync out any dirty data for a file and drop its lock.
-.TP
 \fBfreeze\fP \fIMountPoint\fR
 Freeze (quiesce) a GFS2 cluster.
 .TP
-\fBgetargs\fP \fIMountPoint\fR
-Get the GFS-specific mount arguments used to mount a filesystem.
-.\".TP
-.\"\fBgetsb\fP \fIMountPoint\fR
-.\"Print out the superblock of a mounted filesystem.
-.TP
 \fBgettune\fP \fIMountPoint\fR
 Print out the current values of the tuning parameters in a running
-filesystem.
+filesystem. A better source of similar (more comprehensive) information
+is that in the /proc/mounts file. Running the mount command with no
+arguments will also provide the same information. This option is
+considered obsolete and will probably be removed at some future
+date.
 .TP
 \fBjournals\fP \fIMountPoint\fR
 Print out information about the journals in a mounted filesystem.
-.\".TP
-.\"\fBjindex\fP \fIMountPoint\fR
-.\"Print out the journal index of a mounted filesystem.
-.\".TP
-.\"\fBlayout\fP \fIFile\fR \fI[buffersize]\fR
-.\"Print out on-disk layout information about a file or directory.
-.\"Buffersize is the size of the buffer (in bytes) that gfs2_tool allocates
-.\"to store the file's metadata during processing.  It defaults to 4194304
-.\"bytes.  If you are printing a very big directory you may need to specify
-.\"a bigger size.
-.TP
-\fBlist\fP
-List the currently mounted GFS2 filesystems.  Each line represents
-a filesystem.  The columns represent (in order): 1) An identifier that
-represents the mounted filesystem. 2) The name of the
-device that holds the filesystem (well, the name as the Linux
-kernel knows it).
 .TP
 \fBlockdump\fP \fIMountPoint\fR
 Print out information about the locks this machine holds for a given
-filesystem.
-.\".TP
-.\"\fBmargs\fP \fIarguments\fR
-.\"This loads arguments into the module what will override the mount
-.\"options passed with the -o field on the next mount.  See gfs2_mount(8).
-.\".TP
-.\"\fBquota\fP \fIMountPoint\fR
-.\"Print out the quota file of a mounted filesystem.  Also see
-.\"the "gfs2_quota list" command.
+filesystem. This information is also available via the debugfs
+glock dump file.
 .\".TP
 .\"\fBrindex\fP \fIMountPoint\fR
 .\"Print out the resource group index of a mounted filesystem.
@@ -101,8 +71,9 @@
 .TP
 \fBsetflag\fP \fIFlag\fR \fIFile1\fR \fIFile2\fR \fI...\fR 
 Set an attribute flag on a file.  The currently supported flags are 
-jdata, immutable, appendonly, noatime, and sync.  In most cases, the 
-chattr command may be used rather than gfs2_tool to set attributes.
+jdata, immutable, appendonly, noatime, and sync.  The 
+chattr command is the preferred way to set attributes on
+files.
 
 The \fIjdata\fR flag causes all the data written to a file
 to be journaled.  If the \fIjdata\fR flag is set for a directory,
@@ -125,13 +96,9 @@
 .TP
 \fBsettune\fP \fIMountPoint\fR \fIparameter\fR \fInewvalue\fR
 Set the value of tuning parameter.  Use \fBgettune\fP for a listing of 
-tunable parameters.
-.TP
-\fBshrink\fP \fIMountPoint\fR
-Causes any unused locks to be thrown out of memory.
-.\".TP
-.\"\fBstat\fP \fIFile\fR
-.\"Print out extended stat information about a file.
+tunable parameters. The mount -oremount command is the preferred way
+to set the values of tunable parameters. At some future stage, when
+all parameters can be set via mount, this option will be removed.
 .TP
 \fBunfreeze\fP \fIMountPoint\fR
 Unfreeze a GFS2 cluster.
diff -Naurd cluster-3.0.0.rc2/gfs2/man/mount.gfs2.8 cluster-3.0.0.rc3/gfs2/man/mount.gfs2.8
--- cluster-3.0.0.rc2/gfs2/man/mount.gfs2.8	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/man/mount.gfs2.8	2009-06-11 11:02:55.000000000 +0200
@@ -41,23 +41,9 @@
 and non-GFS2 options may be intermingled after the \fB-o\fP, separated by
 commas (but no spaces).
 
-As an alternative to mount command line options, you may send mount
-options to gfs2 using "gfs2_tool margs" (after loading the gfs2 kernel
-module, but before mounting GFS2).  For example, you may need to do
-this when working from an initial ramdisk \fBinitrd\fP(4).  The
-options are restricted to the ones described on this man page (no
-general \fBmount\fP(8) options will be recognized), must not be
-preceded by -o, and must be separated by commas (no spaces).  Example:
-
-# gfs2_tool margs "lockproto=lock_nolock,ignore_local_fs"
-
-Options loaded via "gfs2_tool margs" have a lifetime of only one GFS2
-mount.  If you wish to mount another GFS2 filesystem, you must set
-another group of options with "gfs2_tool margs".
-
-The options debug, acl, quota, suiddir, and data can be
+The options debug, commit, discard, acl, quota, suiddir, and data can be
 changed after mount using the "mount -o remount,option /mountpoint" command.
-The options debug, acl, and suiddir support the "no"
+The options debug, quota, discard, acl, and suiddir support the "no"
 prefix.  For example, "noacl" turns off what "acl" turns on.
 
 If you have trouble mounting GFS2, check the syslog (e.g. /var/log/messages)
@@ -142,15 +128,6 @@
 \fB-o upgrade\fP option.  When upgrading, only one node may mount the GFS2
 filesystem.
 .TP
-\fBnum_glockd=\fP\fINumber\fR
-Tunes GFS2 to alleviate memory pressure when rapidly acquiring many locks (e.g.
-several processes scanning through huge directory trees).  GFS2' glockd kernel
-daemon cleans up memory for no-longer-needed glocks.  Multiple instances
-of the daemon clean up faster than a single instance.  The default value is
-one daemon, with a maximum of 16.  Since this option was introduced, other
-methods of rapid cleanup have been developed within GFS2, so this option may go
-away in the future.
-.TP
 \fBacl\fP
 Enables POSIX Access Control List \fBacl\fP(5) support within GFS2.
 .TP
@@ -172,6 +149,18 @@
 correctly maintained by the filesystem, limit and warn values are
 ignored.  The default value is "off".
 .TP
+\fBdiscard\fP
+Causes GFS2 to generate "discard" I/O requests for blocks which have
+been freed. These can be used by suitable hardware to implement
+thin-provisioning and similar schemes. This feature is supported
+in kernel version 2.6.30 and above.
+.TP
+\fBcommit=\fP\fIsecs\fR
+This is similar to the ext3 \fBcommit=\fP option in that it sets
+the maximum number of seconds between journal commits if there is
+dirty data in the journal. The default is 60 seconds. This option
+is only provided in kernel versions 2.6.31 and above.
+.TP
 \fBdata=\fP\fI[ordered/writeback]\fR
 When data=ordered is set, the user data modified by a transaction is
 flushed to the disk before the transaction is committed to disk.  This
diff -Naurd cluster-3.0.0.rc2/gfs2/mkfs/gfs2_mkfs.h cluster-3.0.0.rc3/gfs2/mkfs/gfs2_mkfs.h
--- cluster-3.0.0.rc2/gfs2/mkfs/gfs2_mkfs.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/mkfs/gfs2_mkfs.h	2009-06-11 11:02:55.000000000 +0200
@@ -64,6 +64,4 @@
 #define FS_FL_USER_VISIBLE              0x0003DFFF /* User visible flags */
 #define FS_FL_USER_MODIFIABLE           0x000380FF /* User modifiable flags */
 
-extern char *prog_name;
-
 #endif /* __GFS2_MKFS_DOT_H__ */
diff -Naurd cluster-3.0.0.rc2/gfs2/mkfs/main.c cluster-3.0.0.rc3/gfs2/mkfs/main.c
--- cluster-3.0.0.rc2/gfs2/mkfs/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/mkfs/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -10,13 +10,14 @@
 #include <time.h>
 #include <errno.h>
 #include <libgen.h>
+#include <libintl.h>
+#include <locale.h>
+#define _(String) gettext(String)
 
 #include <linux/types.h>
 #include "libgfs2.h"
 #include "gfs2_mkfs.h"
 
-char *prog_name;
-
 /**
  * main - do everything
  * @argc:
@@ -30,10 +31,12 @@
 {
 	char *p, *whoami;
 
-	prog_name = argv[0];
+	setlocale(LC_ALL, "");
+	textdomain("mkfs.gfs2");
+
 	srandom(time(NULL) ^ getpid());
 
-	p = strdup(prog_name);
+	p = strdup(argv[0]);
 	whoami = basename(p);
 	
 	if (!strcmp(whoami, "gfs2_jadd"))
@@ -42,14 +45,10 @@
 		main_mkfs(argc, argv);
 	else if (!strcmp(whoami, "gfs2_grow"))
 		main_grow(argc, argv);
-#if 0
-	else if (!strcmp(whoami, "gfs2_shrink"))
-		main_shrink(argc, argv);
-#endif
 	else
-		die("I don't know who I am!\n");
+		die( _("I don't know who I am!\n"));
 
 	free(p);
 
-	return EXIT_SUCCESS;
+	return 0;
 }
diff -Naurd cluster-3.0.0.rc2/gfs2/mkfs/main_grow.c cluster-3.0.0.rc3/gfs2/mkfs/main_grow.c
--- cluster-3.0.0.rc2/gfs2/mkfs/main_grow.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/mkfs/main_grow.c	2009-06-11 11:02:55.000000000 +0200
@@ -16,6 +16,8 @@
 #include <errno.h>
 #include <stdarg.h>
 #include <linux/types.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include "libgfs2.h"
 #include "gfs2_mkfs.h"
@@ -44,7 +46,7 @@
 static void usage(void)
 {
 	fprintf(stdout,
-		"Usage:\n"
+		_("Usage:\n"
 		"\n"
 		"gfs2_grow [options] /path/to/filesystem\n"
 		"\n"
@@ -53,10 +55,10 @@
 		"  -q               Quiet, reduce verbosity\n"
 		"  -T               Test, do everything except update FS\n"
 		"  -V               Version information\n"
-		"  -v               Verbose, increase verbosity\n");
+		"  -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;
 
@@ -69,7 +71,7 @@
 		case 'V':
 			printf("%s %s (built %s %s)\n", argv[0],
 			       RELEASE_VERSION, __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
+			printf( _(REDHAT_COPYRIGHT "\n"));
 			exit(0);
 		case 'h':
 			usage();
@@ -78,8 +80,8 @@
 			decrease_verbosity();
 			break;
 		case 'T':
-			printf("(Test mode--File system will not "
-			       "be changed)\n");
+			printf( _("(Test mode--File system will not "
+			       "be changed)\n"));
 			test = 1;
 			break;
 		case 'v':
@@ -88,11 +90,11 @@
 		case ':':
 		case '?':
 			/* Unknown flag */
-			fprintf(stderr, "Please use '-h' for usage.\n");
+			fprintf(stderr, _("Please use '-h' for usage.\n"));
 			exit(EXIT_FAILURE);
 		default:
-			fprintf(stderr, "Bad programmer! You forgot"
-				" to catch the %c flag\n", opt);
+			fprintf(stderr, _("Bad programmer! You forgot"
+				" to catch the %c flag\n"), opt);
 			exit(EXIT_FAILURE);
 			break;
 		}
@@ -107,7 +109,7 @@
 /**
  * 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;
@@ -116,7 +118,7 @@
 	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;
 }
 
 /**
@@ -128,7 +130,7 @@
  * 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;
@@ -150,7 +152,7 @@
 /**
  * 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;
@@ -179,7 +181,7 @@
 /**
  * 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;
@@ -191,11 +193,11 @@
 	rg = 0;
 	osi_list_foreach(tmp, &sdp->rglist)
 		rg++;
-	log_info("%d new rindex entries.\n", rg);
+	log_info( _("%d new rindex entries.\n"), rg);
 	writelen = rg * sizeof(struct gfs2_rindex);
 	buf = calloc(1, writelen);
 	if (buf == NULL) {
-		fprintf(stderr, "Out of memory in %s\n", __FUNCTION__);
+		fprintf(stderr, _("Out of memory in %s\n"), __FUNCTION__);
 		exit(-1);
 	}
 	/* Now add the new rg entries to the rg index.  Here we     */
@@ -268,7 +270,7 @@
 		if (check_for_gfs2(sdp)) {
 			if (errno == EINVAL)
 				fprintf(stderr,
-					"Not a valid GFS2 mount point: %s\n",
+					_("Not a valid GFS2 mount point: %s\n"),
 					sdp->path_name);
 			else
 				fprintf(stderr, "%s\n", strerror(errno));
@@ -277,13 +279,13 @@
 		sdp->device_fd = open(sdp->device_name,
 				      (test ? O_RDONLY : O_RDWR));
 		if (sdp->device_fd < 0)
-			die("can't open device %s: %s\n",
+			die( _("can't open device %s: %s\n"),
 			    sdp->device_name, strerror(errno));
 		if (device_geometry(sdp)) {
-			fprintf(stderr, "Geometry error\n");
+			fprintf(stderr, _("Geometry error\n"));
 			exit(-1);
 		}
-		log_info("Initializing lists...\n");
+		log_info( _("Initializing lists...\n"));
 		osi_list_init(&sdp->rglist);
 		init_buf_list(sdp, &sdp->buf_list, 128 << 20);
 		init_buf_list(sdp, &sdp->nvbuf_list, 0xffffffff);
@@ -295,7 +297,7 @@
 			exit(-1);
 		}
 		if(read_sb(sdp) < 0)
-			die("gfs: Error reading superblock.\n");
+			die( _("gfs: Error reading superblock.\n"));
 
 		if (fix_device_geometry(sdp)) {
 			fprintf(stderr, "Device is too small (%"PRIu64" bytes)\n",
@@ -304,7 +306,7 @@
 		}
 
 		if (mount_gfs2_meta(sdp)) {
-			fprintf(stderr, "Error mounting GFS2 metafs: %s\n",
+			fprintf(stderr, _("Error mounting GFS2 metafs: %s\n"),
 					strerror(errno));
 			exit(-1);
 		}
@@ -313,7 +315,7 @@
 		rindex_fd = open(rindex_name, (test ? O_RDONLY : O_RDWR));
 		if (rindex_fd < 0) {
 			cleanup_metafs(sdp);
-			die("GFS2 rindex not found.  Please run gfs2_fsck.\n");
+			die( _("GFS2 rindex not found.  Please run gfs2_fsck.\n"));
 		}
 		/* Get master dinode */
 		sdp->master_dir =
@@ -329,11 +331,11 @@
 		figure_out_rgsize(sdp, &rgsize);
 		fsgrowth = ((sdp->device.length - fssize) * sdp->bsize);
 		if (fsgrowth < rgsize * sdp->bsize) {
-			log_err("Error: The device has grown by less than "
-				"one Resource Group (RG).\n");
-			log_err("The device grew by %" PRIu64 "MB.  ",
+			log_err( _("Error: The device has grown by less than "
+				"one Resource Group (RG).\n"));
+			log_err( _("The device grew by %" PRIu64 "MB.  "),
 				fsgrowth / MB);
-			log_err("One RG is %uMB for this file system.\n",
+			log_err( _("One RG is %uMB for this file system.\n"),
 				(rgsize * sdp->bsize) / MB);
 		}
 		else {
@@ -353,5 +355,5 @@
 	}
 	close(sdp->path_fd);
 	sync();
-	log_notice("gfs2_grow complete.\n");
+	log_notice( _("gfs2_grow complete.\n"));
 }
diff -Naurd cluster-3.0.0.rc2/gfs2/mkfs/main_jadd.c cluster-3.0.0.rc3/gfs2/mkfs/main_jadd.c
--- cluster-3.0.0.rc2/gfs2/mkfs/main_jadd.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/mkfs/main_jadd.c	2009-06-11 11:02:55.000000000 +0200
@@ -15,6 +15,8 @@
 #include <time.h>
 #include <errno.h>
 #include <stdarg.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include <linux/types.h>
 #include "libgfs2.h"
@@ -23,63 +25,57 @@
 #define BUF_SIZE 4096
 #define RANDOM(values) ((values) * (random() / (RAND_MAX + 1.0)))
 
-void
-make_jdata(int fd, char *value)
+void make_jdata(int fd, const char *value)
 {
         int err;
         uint32_t val;
 
         err = ioctl(fd, FS_IOC_GETFLAGS, &val);
         if (err)
-                die("error doing get flags (%d): %s\n", err, strerror(errno));
+                die( _("error doing get flags (%d): %s\n"), err, strerror(errno));
         if (strcmp(value, "set") == 0)
                 val |= FS_JOURNAL_DATA_FL;
         if (strcmp(value, "clear") == 0)
                 val &= ~FS_JOURNAL_DATA_FL;
         err = ioctl(fd, FS_IOC_SETFLAGS, &val);
         if (err)
-                die("error doing set flags (%d): %s\n", err, strerror(errno));
+                die( _("error doing set flags (%d): %s\n"), err, strerror(errno));
 }
 
-int 
-rename2system(struct gfs2_sbd *sdp, char *new_dir, char *new_name)
+int rename2system(struct gfs2_sbd *sdp, const char *new_dir, const char *new_name)
 {
 	char oldpath[PATH_MAX], newpath[PATH_MAX];
 	int error = 0;
 	error = snprintf(oldpath, PATH_MAX, "%s/new_inode", 
 			 sdp->metafs_path);
 	if (error >= PATH_MAX)
-		die("rename2system (1)\n");
+		die( _("rename2system (1)\n"));
 
 	error = snprintf(newpath, PATH_MAX, "%s/%s/%s",
 			 sdp->metafs_path, new_dir, new_name);
 	if (error >= PATH_MAX)
-		die("rename2system (2)\n");
+		die( _("rename2system (2)\n"));
 	
 	return rename(oldpath, newpath);
 }
 
 /**
  * print_usage - print out usage information
- *
+ * @prog_name: The name of this program
  */
 
-static void 
-print_usage(void)
+static void print_usage(const char *prog_name)
 {
-	printf("Usage:\n");
-	printf("\n");
-	printf("%s [options] /path/to/filesystem\n", prog_name);
-	printf("\n");
-	printf("Options:\n");
-	printf("\n");
-	printf("  -c <MB>           Size of quota change file\n");
-	printf("  -D                Enable debugging code\n");
-	printf("  -h                Print this help, then exit\n");
-	printf("  -J <MB>           Size of journals\n");
-	printf("  -j <num>          Number of journals\n");
-	printf("  -q                Don't print anything\n");
-	printf("  -V                Print program version information, then exit\n");
+	printf( _("Usage:\n\n"
+		"%s [options] /path/to/filesystem\n\n"
+		"Options:\n\n"
+		"  -c <MB>           Size of quota change file\n"
+		"  -D                Enable debugging code\n"
+		"  -h                Print this help, then exit\n"
+		"  -J <MB>           Size of journals\n"
+		"  -j <num>          Number of journals\n"
+		"  -q                Don't print anything\n"
+		"  -V                Print program version information, then exit\n"), prog_name);
 }
 
 /**
@@ -90,8 +86,7 @@
  *
  */
 
-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;
@@ -107,8 +102,8 @@
 			sdp->debug = TRUE;
 			break;
 		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
+			print_usage(argv[0]);
+			exit(0);
 			break;
 		case 'J':
 			sdp->jsize = atoi(optarg);
@@ -122,22 +117,22 @@
 		case 'V':
 			printf("gfs2_jadd %s (built %s %s)\n", RELEASE_VERSION,
 			       __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
+			printf( _(REDHAT_COPYRIGHT "\n"));
+			exit(0);
 			break;
 		case 'X':
 			sdp->expert = TRUE;
 			break;
 		case ':':
 		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
+			fprintf(stderr, _("Please use '-h' for usage.\n"));
 			exit(EXIT_FAILURE);
 			break;
 		case EOF:
 			cont = FALSE;
 			break;
 		default:
-			die("unknown option: %c\n", optchar);
+			die( _("unknown option: %c\n"), optchar);
 			break;
 		};
 	}
@@ -146,13 +141,13 @@
 		sdp->path_name = argv[optind];
 		optind++;
 	} else
-		die("no path specified (try -h for help)\n");
+		die( _("no path specified (try -h for help)\n"));
 	
 	if (optind < argc)
-		die("Unrecognized option: %s\n", argv[optind]);
+		die( _("Unrecognized option: %s\n"), argv[optind]);
 
 	if (sdp->debug) {
-		printf("Command Line Arguments:\n");
+		printf( _("Command Line Arguments:\n"));
 		printf("  qcsize = %u\n", sdp->qcsize);
 		printf("  jsize = %u\n", sdp->jsize);
 		printf("  journals = %u\n", sdp->md.journals);
@@ -165,11 +160,11 @@
 verify_arguments(struct gfs2_sbd *sdp)
 {
 	if (!sdp->md.journals)
-		die("no journals specified\n");
+		die( _("no journals specified\n"));
 	if (sdp->jsize < 32 || sdp->jsize > 1024)
-		die("bad journal size\n");
+		die( _("bad journal size\n"));
 	if (!sdp->qcsize || sdp->qcsize > 64)
-		die("bad quota change size\n");
+		die( _("bad quota change size\n"));
 }
 
 /**
@@ -189,13 +184,13 @@
 	if (sdp->expert)
 		printf("Expert mode:            on\n");
 
-	printf("Filesystem:            %s\n", sdp->path_name);
-	printf("Old Journals           %u\n", sdp->orig_journals);
-	printf("New Journals           %u\n", sdp->md.journals);
+	printf( _("Filesystem:            %s\n"), sdp->path_name);
+	printf( _("Old Journals           %u\n"), sdp->orig_journals);
+	printf( _("New Journals           %u\n"), sdp->md.journals);
 
 }
 
-int 
+static int
 create_new_inode(struct gfs2_sbd *sdp)
 {
 	char name[PATH_MAX];
@@ -213,17 +208,16 @@
 		if (errno == EEXIST) {
 			error = unlink(name);
 			if (error)
-				die("can't unlink %s: %s\n",
+				die( _("can't unlink %s: %s\n"),
 				    name, strerror(errno));
 		} else
-			die("can't create %s: %s\n", name, strerror(errno));
+			die( _("can't create %s: %s\n"), name, strerror(errno));
 	}
 	
 	return fd;
 }
 
-void 
-add_ir(struct gfs2_sbd *sdp)
+void add_ir(struct gfs2_sbd *sdp)
 {
 	int fd;
 	char new_name[256];
@@ -237,8 +231,8 @@
 		memset(&ir, 0, sizeof(struct gfs2_inum_range));
 		if (write(fd, (void*)&ir, sizeof(struct gfs2_inum_range)) !=
 		    sizeof(struct gfs2_inum_range)) {
-			fprintf(stderr, "write error: %s from %s:%d: "
-				"offset 0\n", strerror(errno),
+			fprintf(stderr, _( "write error: %s from %s:%d: "
+				"offset 0\n"), strerror(errno),
 				__FUNCTION__, __LINE__);
 			exit(-1);
 		}
@@ -249,11 +243,11 @@
 	sprintf(new_name, "inum_range%u", sdp->md.journals);
 	error = rename2system(sdp, "per_node", new_name);
 	if (error < 0 && errno != EEXIST)
-		die("can't rename2system %s (%d): %s\n", 
+		die( _("can't rename2system %s (%d): %s\n"), 
 		new_name, error, strerror(errno));
 }
 
-void 
+static void 
 add_sc(struct gfs2_sbd *sdp)
 {
 	int fd;
@@ -269,8 +263,8 @@
 		memset(&sc, 0, sizeof(struct gfs2_statfs_change));
 		if (write(fd, (void*)&sc, sizeof(struct gfs2_statfs_change)) !=
 		    sizeof(struct gfs2_statfs_change)) {
-			fprintf(stderr, "write error: %s from %s:%d: "
-				"offset 0\n", strerror(errno),
+			fprintf(stderr, _("write error: %s from %s:%d: "
+				"offset 0\n"), strerror(errno),
 				__FUNCTION__, __LINE__);
 			exit(-1);
 		}
@@ -281,11 +275,11 @@
 	sprintf(new_name, "statfs_change%u", sdp->md.journals);
 	error = rename2system(sdp, "per_node", new_name);
 	if (error < 0 && errno != EEXIST)
-		die("can't rename2system %s (%d): %s\n",
+		die( _("can't rename2system %s (%d): %s\n"),
 		    new_name, error, strerror(errno));
 }
 
-void 
+static void 
 add_qc(struct gfs2_sbd *sdp)
 {
 	int fd;
@@ -306,8 +300,8 @@
 
 		for (x=0; x<blocks; x++) {
 			if (write(fd, buf, sdp->bsize) != sdp->bsize) {
-				fprintf(stderr, "write error: %s from %s:%d: "
-					"block %lld (0x%llx)\n",
+				fprintf(stderr, _("write error: %s from %s:%d: "
+					"block %lld (0x%llx)\n"),
 					strerror(errno),
 					__FUNCTION__, __LINE__,
 					(unsigned long long)x,
@@ -326,8 +320,8 @@
 
 		for (x=0; x<blocks; x++) {
 			if (write(fd, buf, sdp->bsize) != sdp->bsize) {
-				fprintf(stderr, "write error: %s from %s:%d: "
-					"block %lld (0x%llx)\n",
+				fprintf(stderr, _("write error: %s from %s:%d: "
+					"block %lld (0x%llx)\n"),
 					strerror(errno),
 					__FUNCTION__, __LINE__,
 					(unsigned long long)x,
@@ -338,7 +332,7 @@
 
 		error = fsync(fd);
 		if (error)
-			die("can't fsync: %s\n",
+			die( _("can't fsync: %s\n"),
 			    strerror(errno));
 	}
 
@@ -347,22 +341,22 @@
 	sprintf(new_name, "quota_change%u", sdp->md.journals);
 	error = rename2system(sdp, "per_node", new_name);
 	if (error < 0 && errno != EEXIST)
-		die("can't rename2system %s (%d): %s\n",
+		die( _("can't rename2system %s (%d): %s\n"),
 		    new_name, error, strerror(errno));
 }
 
-void 
+static void 
 gather_info(struct gfs2_sbd *sdp)
 {
 	struct statfs statbuf;
 	if (statfs(sdp->path_name, &statbuf) < 0) {
-		die("Could not statfs the filesystem %s: %s\n",
+		die( _("Could not statfs the filesystem %s: %s\n"),
 		    sdp->path_name, strerror(errno));
 	}
 	sdp->bsize = statbuf.f_bsize;
 }
 
-void 
+static void 
 find_current_journals(struct gfs2_sbd *sdp)
 {
 	char jindex[PATH_MAX];
@@ -373,8 +367,8 @@
 	sprintf(jindex, "%s/jindex", sdp->metafs_path);
 	dirp = opendir(jindex);
 	if (!dirp) {
-		die("Could not find the jindex directory "
-		    "in gfs2meta mount! error: %s\n", strerror(errno));
+		die( _("Could not find the jindex directory "
+		    "in gfs2meta mount! error: %s\n"), strerror(errno));
 	}
 	while (dirp) {
 		if ((dp = readdir(dirp)) != NULL) {
@@ -386,14 +380,14 @@
 close:
 	closedir(dirp);
 	if (existing_journals <= 0) {
-		die("There are no journals for this "
-		    "gfs2 fs! Did you mkfs.gfs2 correctly?\n");
+		die( _("There are no journals for this "
+		    "gfs2 fs! Did you mkfs.gfs2 correctly?\n"));
 	}
 
 	sdp->orig_journals = existing_journals;
 }
 
-void 
+static void 
 add_j(struct gfs2_sbd *sdp)
 {
 	int fd;
@@ -414,8 +408,8 @@
 		memset(buf, 0, sdp->bsize);
 		for (x=0; x<blocks; x++) {
 			if (write(fd, buf, sdp->bsize) != sdp->bsize) {
-				fprintf(stderr, "write error: %s from %s:%d: "
-					"block %lld (0x%llx)\n",
+				fprintf(stderr, _("write error: %s from %s:%d: "
+					"block %lld (0x%llx)\n"),
 					strerror(errno),
 					__FUNCTION__, __LINE__,
 					(unsigned long long)x,
@@ -442,8 +436,8 @@
 			((struct gfs2_log_header *)buf)->lh_hash = cpu_to_be32(hash);
 
 			if (write(fd, buf, sdp->bsize) != sdp->bsize) {
-				fprintf(stderr, "write error: %s from %s:%d: "
-					"block %lld (0x%llx)\n",
+				fprintf(stderr, _("write error: %s from %s:%d: "
+					"block %lld (0x%llx)\n"),
 					strerror(errno),
 					__FUNCTION__, __LINE__,
 					(unsigned long long)x,
@@ -457,7 +451,7 @@
 
 		error = fsync(fd);
 		if (error)
-			die("can't fsync: %s\n",
+			die( _("can't fsync: %s\n"),
 			    strerror(errno));
 	}
 
@@ -466,7 +460,7 @@
 	sprintf(new_name, "journal%u", sdp->md.journals);
 	error = rename2system(sdp, "jindex", new_name);
 	if (error < 0 && errno != EEXIST)
-		die("can't rename2system %s (%d): %s\n",
+		die( _("can't rename2system %s (%d): %s\n"),
 		    new_name, error, strerror(errno));
 }
 
@@ -477,8 +471,7 @@
  *
  */
 
-void 
-main_jadd(int argc, char *argv[])
+void main_jadd(int argc, char *argv[])
 {
 	struct gfs2_sbd sbd, *sdp = &sbd;
 	unsigned int total;
@@ -493,12 +486,12 @@
 	
 	sdp->path_fd = open(sdp->path_name, O_RDONLY);
 	if (sdp->path_fd < 0)
-		die("can't open root directory %s: %s\n",
+		die( _("can't open root directory %s: %s\n"),
 		    sdp->path_name, strerror(errno));
 
 	if (check_for_gfs2(sdp)) {
 		if (errno == EINVAL)
-			fprintf(stderr, "Not a valid GFS2 mount point: %s\n",
+			fprintf(stderr, _("Not a valid GFS2 mount point: %s\n"),
 					sdp->path_name);
 		else
 			fprintf(stderr, "%s\n", strerror(errno));
@@ -508,7 +501,7 @@
 	gather_info(sdp);
 
 	if (mount_gfs2_meta(sdp)) {
-		fprintf(stderr, "Error mounting GFS2 metafs: %s\n",
+		fprintf(stderr, _("Error mounting GFS2 metafs: %s\n"),
 				strerror(errno));
 		exit(-1);
 	}
diff -Naurd cluster-3.0.0.rc2/gfs2/mkfs/main_mkfs.c cluster-3.0.0.rc3/gfs2/mkfs/main_mkfs.c
--- cluster-3.0.0.rc2/gfs2/mkfs/main_mkfs.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/mkfs/main_mkfs.c	2009-06-11 11:02:55.000000000 +0200
@@ -13,14 +13,14 @@
 #include <mntent.h>
 #include <ctype.h>
 #include <sys/time.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include <linux/types.h>
 #include "libgfs2.h"
 #include "gfs2_mkfs.h"
 #include "libvolume_id.h"
 
-char *prog_name;
-
 /**
  * This function is for libgfs2's sake.
  */
@@ -36,31 +36,28 @@
 
 /**
  * print_usage - print out usage information
- *
+ * @prog_name: The name of this program
  */
 
 static void
-print_usage(void)
+print_usage(const char *prog_name)
 {
-	printf("Usage:\n");
-	printf("\n");
-	printf("%s [options] <device> [ block-count ]\n", prog_name);
-	printf("\n");
-	printf("Options:\n");
-	printf("\n");
-	printf("  -b <bytes>       Filesystem block size\n");
-	printf("  -c <MB>          Size of quota change file\n");
-	printf("  -D               Enable debugging code\n");
-	printf("  -h               Print this help, then exit\n");
-	printf("  -J <MB>          Size of journals\n");
-	printf("  -j <num>         Number of journals\n");
-	printf("  -O               Don't ask for confirmation\n");
-	printf("  -p <name>        Name of the locking protocol\n");
-	printf("  -q               Don't print anything\n");
-	printf("  -r <MB>          Resource Group Size\n");
-	printf("  -t <name>        Name of the lock table\n");
-	printf("  -u <MB>          Size of unlinked file\n");
-	printf("  -V               Print program version information, then exit\n");
+	printf( _("Usage:\n\n"
+		"%s [options] <device> [ block-count ]\n\n"
+		"Options:\n\n"
+		"  -b <bytes>       Filesystem block size\n"
+		"  -c <MB>          Size of quota change file\n"
+		"  -D               Enable debugging code\n"
+		"  -h               Print this help, then exit\n"
+		"  -J <MB>          Size of journals\n"
+		"  -j <num>         Number of journals\n"
+		"  -O               Don't ask for confirmation\n"
+		"  -p <name>        Name of the locking protocol\n"
+		"  -q               Don't print anything\n"
+		"  -r <MB>          Resource Group Size\n"
+		"  -t <name>        Name of the lock table\n"
+		"  -u <MB>          Size of unlinked file\n"
+		"  -V               Print program version information, then exit\n"), prog_name);
 }
 
 /**
@@ -71,8 +68,7 @@
  *
  */
 
-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;
@@ -98,8 +94,8 @@
 			break;
 
 		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
+			print_usage(argv[0]);
+			exit(0);
 			break;
 
 		case 'J':
@@ -116,7 +112,7 @@
 
 		case 'p':
 			if (strlen(optarg) >= GFS2_LOCKNAME_LEN)
-				die("lock protocol name %s is too long\n",
+				die( _("lock protocol name %s is too long\n"),
 				    optarg);
 			strcpy(sdp->lockproto, optarg);
 			break;
@@ -131,7 +127,7 @@
 
 		case 't':
 			if (strlen(optarg) >= GFS2_LOCKNAME_LEN)
-				die("lock table name %s is too long\n", optarg);
+				die( _("lock table name %s is too long\n"), optarg);
 			strcpy(sdp->locktable, optarg);
 			break;
 
@@ -142,7 +138,7 @@
 		case 'V':
 			printf("gfs2_mkfs %s (built %s %s)\n", RELEASE_VERSION,
 			       __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
+			printf( _(REDHAT_COPYRIGHT "\n"));
 			exit(EXIT_SUCCESS);
 			break;
 
@@ -152,7 +148,7 @@
 
 		case ':':
 		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
+			fprintf(stderr, _("Please use '-h' for usage.\n"));
 			exit(EXIT_FAILURE);
 			break;
 
@@ -169,11 +165,11 @@
 				 isdigit(optarg[0]))
 				sdp->orig_fssize = atol(optarg);
 			else
-				die("More than one device specified (try -h for help)\n");
+				die( _("More than one device specified (try -h for help)\n"));
 			break;
 
 		default:
-			die("unknown option: %c\n", optchar);
+			die( _("unknown option: %c\n"), optchar);
 			break;
 		};
 	}
@@ -182,16 +178,16 @@
 		strcpy(sdp->device_name, argv[optind++]);
 
 	if (sdp->device_name[0] == '\0')
-		die("no device specified (try -h for help)\n");
+		die( _("no device specified (try -h for help)\n"));
 
 	if (optind < argc)
 		sdp->orig_fssize = atol(argv[optind++]);
 
 	if (optind < argc)
-		die("Unrecognized argument: %s\n", argv[optind]);
+		die( _("Unrecognized argument: %s\n"), argv[optind]);
 
 	if (sdp->debug) {
-		printf("Command Line Arguments:\n");
+		printf( _("Command Line Arguments:\n"));
 		printf("  bsize = %u\n", sdp->bsize);
 		printf("  qcsize = %u\n", sdp->qcsize);
 		printf("  jsize = %u\n", sdp->jsize);
@@ -200,7 +196,7 @@
 		printf("  proto = %s\n", sdp->lockproto);
 		printf("  quiet = %d\n", sdp->quiet);
 		if (sdp->rgsize==-1)
-			printf("  rgsize = optimize for best performance\n");
+			printf( _("  rgsize = optimize for best performance\n"));
 		else
 			printf("  rgsize = %u\n", sdp->rgsize);
 		printf("  table = %s\n", sdp->locktable);
@@ -229,33 +225,33 @@
 		   strcmp(lockproto, "lock_dlm") == 0) {
 		for (c = locktable; *c; c++) {
 			if (isspace(*c))
-				die("locktable error: contains space characters\n");
+				die( _("locktable error: contains space characters\n"));
 			if (!isprint(*c))
-				die("locktable error: contains unprintable characters\n");
+				die( _("locktable error: contains unprintable characters\n"));
 		}
 
 		c = strstr(locktable, ":");
 		if (!c)
-			die("locktable error: missing colon in the locktable\n");
+			die( _("locktable error: missing colon in the locktable\n"));
 
 		if (c == locktable)
-			die("locktable error: missing cluster name\n");
+			die( _("locktable error: missing cluster name\n"));
 		if (c - locktable > 16)
-			die("locktable error: cluster name too long\n");
+			die( _("locktable error: cluster name too long\n"));
 
 		c++;
 		if (!c)
-			die("locktable error: missing filesystem name\n");
+			die( _("locktable error: missing filesystem name\n"));
 
 		if (strstr(c, ":"))
-			die("locktable error: more than one colon present\n");
+			die( _("locktable error: more than one colon present\n"));
 
 		if (!strlen(c))
-			die("locktable error: missing filesystem name\n");
+			die( _("locktable error: missing filesystem name\n"));
 		if (strlen(c) > 16)
-			die("locktable error: filesystem name too long\n");
+			die( _("locktable error: filesystem name too long\n"));
 	} else {
-		die("lockproto error: %s unknown\n", lockproto);
+		die( _("lockproto error: %s unknown\n"), lockproto);
 	}
 }
 
@@ -273,28 +269,28 @@
 			break;
 
 	if (!x || sdp->bsize > 65536)
-		die("block size must be a power of two between 512 and 65536\n");
+		die( _("block size must be a power of two between 512 and 65536\n"));
 
 	/* Look at this!  Why can't we go bigger than 2GB? */
 	if (sdp->expert) {
 		if (1 > sdp->rgsize || sdp->rgsize > 2048)
-			die("bad resource group size\n");
+			die( _("bad resource group size\n"));
 	} else {
 		if (32 > sdp->rgsize || sdp->rgsize > 2048)
-			die("bad resource group size\n");
+			die( _("bad resource group size\n"));
 	}
 
 	if (!sdp->md.journals)
-		die("no journals specified\n");
+		die( _("no journals specified\n"));
 
 	if (sdp->jsize < 8 || sdp->jsize > 1024)
-		die("bad journal size\n");
+		die( _("bad journal size\n"));
 
 	if (!sdp->utsize || sdp->utsize > 64)
-		die("bad unlinked size\n");
+		die( _("bad unlinked size\n"));
 
 	if (!sdp->qcsize || sdp->qcsize > 64)
-		die("bad quota change size\n");
+		die( _("bad quota change size\n"));
 }
 
 /**
@@ -311,14 +307,14 @@
 
 	fd = open(sdp->device_name, O_RDONLY);
 	if (fd < 0)
-		die("Error: device %s not found.\n", sdp->device_name);
+		die( _("Error: device %s not found.\n"), sdp->device_name);
 	vid = volume_id_open_fd(fd);
 	if (vid == NULL) {
 		close(fd);
-		die("error identifying the contents of %s: %s\n",
+		die( _("error identifying the contents of %s: %s\n"),
 		    sdp->device_name, strerror(errno));
 	}
-	printf("This will destroy any data on %s.\n", sdp->device_name);
+	printf( _("This will destroy any data on %s.\n"), sdp->device_name);
 	if (volume_id_probe_all(vid, 0, sdp->device_size) == 0) {
 		const char *fstype, *fsusage;
 		int rc;
@@ -328,18 +324,18 @@
 			rc = volume_id_get_usage(vid, &fsusage);
 			if (!rc || strncmp(fsusage, "other", 5) == 0)
 				fsusage = "partition";
-			printf("  It appears to contain a %s %s.\n", fstype,
+			printf( _("  It appears to contain a %s %s.\n"), fstype,
 			       fsusage);
 		}
 	}
 	volume_id_close(vid);
 	close(fd);
-	printf("\nAre you sure you want to proceed? [y/n] ");
+	printf( _("\nAre you sure you want to proceed? [y/n] "));
 	if(!fgets(input, 32, stdin))
-		die("unable to read from stdin\n");
+		die( _("unable to read from stdin\n"));
 
 	if (input[0] != 'y')
-		die("aborted\n");
+		die( _("aborted\n"));
 	else
 		printf("\n");
 }
@@ -350,21 +346,21 @@
  *
  */
 
-void check_mount(char *device)
+static void check_mount(char *device)
 {
 	struct stat st_buf;
 	int fd;
 
 	if (stat(device, &st_buf) < 0)
-		die("could not stat device %s\n", device);
+		die( _("could not stat device %s\n"), device);
 	if (!S_ISBLK(st_buf.st_mode))
-		die("%s is not a block device\n", device);
+		die( _("%s is not a block device\n"), device);
 
 	fd = open(device, O_RDONLY | O_NONBLOCK | O_EXCL);
 
 	if (fd < 0) {
 		if (errno == EBUSY) {
-			die("device %s is busy\n", device);
+			die( _("device %s is busy\n"), device);
 		}
 	}
 	else {
@@ -434,31 +430,31 @@
 		return;
 
 	if (sdp->expert)
-		printf("Expert mode:               on\n");
+		printf( _("Expert mode:               on\n"));
 
-	printf("Device:                    %s\n", sdp->device_name);
+	printf( _("Device:                    %s\n"), sdp->device_name);
 
-	printf("Blocksize:                 %u\n", sdp->bsize);
-	printf("Device Size                %.2f GB (%"PRIu64" blocks)\n",
+	printf( _("Blocksize:                 %u\n"), sdp->bsize);
+	printf( _("Device Size                %.2f GB (%"PRIu64" blocks)\n"),
 	       real_device_size / ((float)(1 << 30)),
 	       real_device_size / sdp->bsize);
-	printf("Filesystem Size:           %.2f GB (%"PRIu64" blocks)\n",
+	printf( _("Filesystem Size:           %.2f GB (%"PRIu64" blocks)\n"),
 	       sdp->fssize / ((float)(1 << 30)) * sdp->bsize, sdp->fssize);
 
-	printf("Journals:                  %u\n", sdp->md.journals);
-	printf("Resource Groups:           %"PRIu64"\n", sdp->rgrps);
+	printf( _("Journals:                  %u\n"), sdp->md.journals);
+	printf( _("Resource Groups:           %"PRIu64"\n"), sdp->rgrps);
 
-	printf("Locking Protocol:          \"%s\"\n", sdp->lockproto);
-	printf("Lock Table:                \"%s\"\n", sdp->locktable);
+	printf( _("Locking Protocol:          \"%s\"\n"), sdp->lockproto);
+	printf( _("Lock Table:                \"%s\"\n"), sdp->locktable);
 
 	if (sdp->debug) {
 		printf("\n");
-		printf("Spills:                    %u\n",
+		printf( _("Spills:                    %u\n"),
 		       sdp->buf_list.spills);
-		printf("Writes:                    %u\n", sdp->writes);
+		printf( _("Writes:                    %u\n"), sdp->writes);
 	}
 
-	printf("UUID:                      %s\n", str_uuid(uuid));
+	printf( _("UUID:                      %s\n"), str_uuid(uuid));
 	printf("\n");
 }
 
@@ -469,8 +465,7 @@
  *
  */
 
-void
-main_mkfs(int argc, char *argv[])
+void main_mkfs(int argc, char *argv[])
 {
 	struct gfs2_sbd sbd, *sdp = &sbd;
 	int error;
@@ -502,7 +497,7 @@
 
 	sdp->device_fd = open(sdp->device_name, O_RDWR);
 	if (sdp->device_fd < 0)
-		die("can't open device %s: %s\n",
+		die( _("can't open device %s: %s\n"),
 		    sdp->device_name, strerror(errno));
 
 	if (!sdp->override)
@@ -517,7 +512,7 @@
 
 	device_size(sdp->device_fd, &real_device_size);
 	if (device_geometry(sdp)) {
-		fprintf(stderr, "Geometry error\n");
+		fprintf(stderr, _("Geometry error\n"));
 		exit(-1);
 	}
 	/* Convert optional block-count to basic blocks */
@@ -525,9 +520,9 @@
 		sdp->orig_fssize *= sdp->bsize;
 		sdp->orig_fssize >>= GFS2_BASIC_BLOCK_SHIFT;
 		if (sdp->orig_fssize > sdp->device.length) {
-			fprintf(stderr, "%s: Specified block count is bigger "
-				"than the actual device.\n", prog_name);
-			die("Device Size is %.2f GB (%"PRIu64" blocks)\n",
+			fprintf(stderr, _("%s: Specified block count is bigger "
+				"than the actual device.\n"), argv[0]);
+			die( _("Device Size is %.2f GB (%"PRIu64" blocks)\n"),
 			       real_device_size / ((float)(1 << 30)),
 			       real_device_size / sdp->bsize);
 		}
@@ -572,11 +567,11 @@
 
 	error = fsync(sdp->device_fd);
 	if (error)
-		die("can't fsync device (%d): %s\n",
+		die( _("can't fsync device (%d): %s\n"),
 		    error, strerror(errno));
 	error = close(sdp->device_fd);
 	if (error)
-		die("error closing device (%d): %s\n",
+		die( _("error closing device (%d): %s\n"),
 		    error, strerror(errno));
 
 	print_results(sdp, real_device_size, uuid);
diff -Naurd cluster-3.0.0.rc2/gfs2/mkfs/Makefile cluster-3.0.0.rc3/gfs2/mkfs/Makefile
--- cluster-3.0.0.rc2/gfs2/mkfs/Makefile	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/mkfs/Makefile	2009-06-11 11:02:55.000000000 +0200
@@ -21,11 +21,9 @@
 
 CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE
 CFLAGS += -I${KERNEL_SRC}/include/
-CFLAGS += -I${volidincdir}
 CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
 CFLAGS += -I${incdir}
 
-LDFLAGS += -L${volidlibdir} -lvolume_id
 LDFLAGS += -L../libgfs2 -lgfs2
 LDFLAGS += -L${libdir}
 
diff -Naurd cluster-3.0.0.rc2/gfs2/mount/mount.gfs2.c cluster-3.0.0.rc3/gfs2/mount/mount.gfs2.c
--- cluster-3.0.0.rc2/gfs2/mount/mount.gfs2.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/mount/mount.gfs2.c	2009-06-11 11:02:55.000000000 +0200
@@ -1,7 +1,6 @@
 #include "util.h"
 
-char *prog_name;
-char *fsname;
+const char *fsname;
 int verbose, fake_mount = 0, no_mtab = 0;
 static sigset_t old_sigset;
 
@@ -155,30 +154,6 @@
 		lock_dlm_leave(mo, sb, mnterr);
 }
 
-#if 0
-static void check_sys_fs(char *fsname)
-{
-	DIR *d;
-	struct dirent *de;
-
-	d = opendir("/sys/fs/");
-	if (!d)
-		die("no /sys/fs/ directory found: %d\n", errno);
-
-	while ((de = readdir(d))) {
-		if (strnlen(fsname, 5) != strnlen(de->d_name, 5))
-			continue;
-		if (!strncmp(fsname, de->d_name, strnlen(fsname, 5))) {
-			closedir(d);
-			return;
-		}
-	}
-	closedir(d);
-	die("fs type \"%s\" not found in /sys/fs/, is the module loaded?\n",
-	    fsname);
-}
-#endif
-
 int main(int argc, char **argv)
 {
 	struct mount_options mo;
@@ -189,12 +164,10 @@
 	memset(&mo, 0, sizeof(mo));
 	memset(&sb, 0, sizeof(sb));
 
-	prog_name = argv[0];
-
-	if (!strstr(prog_name, "gfs"))
-		die("invalid mount helper name \"%s\"\n", prog_name);
+	if (!strstr(argv[0], "gfs"))
+		die("invalid mount helper name \"%s\"\n", argv[0]);
 
-	fsname = (strstr(prog_name, "gfs2")) ? "gfs2" : "gfs";
+	fsname = (strstr(argv[0], "gfs2")) ? "gfs2" : "gfs";
 	strcpy(mo.type, fsname);
 
 	if (argc < 2) {
diff -Naurd cluster-3.0.0.rc2/gfs2/mount/mtab.c cluster-3.0.0.rc3/gfs2/mount/mtab.c
--- cluster-3.0.0.rc2/gfs2/mount/mtab.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/mount/mtab.c	2009-06-11 11:02:55.000000000 +0200
@@ -1,6 +1,5 @@
 #include "util.h"
 
-extern char *prog_name;
 extern char *fsname;
 extern int verbose;
 static int ignoring_mtab;
diff -Naurd cluster-3.0.0.rc2/gfs2/mount/util.c cluster-3.0.0.rc3/gfs2/mount/util.c
--- cluster-3.0.0.rc2/gfs2/mount/util.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/mount/util.c	2009-06-11 11:02:55.000000000 +0200
@@ -43,7 +43,6 @@
 
 #endif  /*  __BYTE_ORDER == __LITTLE_ENDIAN  */
 
-extern char *prog_name;
 extern char *fsname;
 extern int verbose;
 
@@ -52,7 +51,7 @@
 /* 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 */
@@ -258,7 +257,7 @@
 	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;
 
@@ -266,7 +265,7 @@
 	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;
 
@@ -275,7 +274,7 @@
 	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;
 
@@ -574,7 +573,7 @@
 int lock_dlm_remount(struct mount_options *mo, struct gen_sb *sb)
 {
 	struct gfsc_mount_args ma;
-	char *mode;
+	const char *mode;
 	int fd, rv, result;
 
 	memset(&ma, 0, sizeof(ma));
diff -Naurd cluster-3.0.0.rc2/gfs2/mount/util.h cluster-3.0.0.rc3/gfs2/mount/util.h
--- cluster-3.0.0.rc2/gfs2/mount/util.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/mount/util.h	2009-06-11 11:02:55.000000000 +0200
@@ -23,20 +23,19 @@
 
 #define die(fmt, args...) \
 do { \
-	fprintf(stderr, "%s: ", prog_name); \
 	fprintf(stderr, fmt, ##args); \
 	exit(EXIT_FAILURE); \
 } while (0)
 
 #define warn(fmt, args...) \
 do { \
-	fprintf(stderr, "%s: " fmt "\n", prog_name, ##args); \
+	fprintf(stderr, fmt "\n", ##args); \
 } while (0)
 
 #define log_debug(fmt, args...) \
 do { \
 	if (verbose) \
-		printf("%s: " fmt "\n", prog_name, ##args); \
+		printf(fmt "\n", ##args); \
 } while (0)
 
 #define do_read(fd, buff, len) \
diff -Naurd cluster-3.0.0.rc2/gfs2/quota/check.c cluster-3.0.0.rc3/gfs2/quota/check.c
--- cluster-3.0.0.rc2/gfs2/quota/check.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/quota/check.c	2009-06-11 11:02:55.000000000 +0200
@@ -267,27 +267,6 @@
 }
 
 /**
- * print_list - print the contents of an ID list
- * @str: a string describing the list
- * @list: the list
- *
- */
-
-static void
-print_list(char *str, osi_list_t *list)
-{
-#if 0
-	osi_list_t *tmp;
-	values_t *v;
-
-	for (tmp = list->next; tmp != list; tmp = tmp->next) {
-		v = osi_list_entry(tmp, values_t, v_list);
-		printf("%s %10u: %"PRId64"\n", str, v->v_id, v->v_blocks);
-	}
-#endif
-}
-
-/**
  * do_compare - compare to ID lists and see if they match
  * @type: the type of list (UID or GID)
  * @fs_list: the list derived from scaning the FS
@@ -297,7 +276,7 @@
  */
 
 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;
@@ -426,11 +405,6 @@
 	scan_fs(device, comline->filesystem, &fs_uid, &fs_gid, &hl);
 	read_quota_file(sdp, comline, &qf_uid, &qf_gid);
 
-	print_list("fs user ", &fs_uid);
-	print_list("fs group", &fs_gid);
-	print_list("qf user ", &qf_uid);
-	print_list("qf group", &qf_gid);
-
 	mismatch = do_compare("user", &fs_uid, &qf_uid);
 	mismatch |= do_compare("group", &fs_gid, &qf_gid);
 
@@ -565,11 +539,6 @@
 	v->v_blocks = 0;
 	osi_list_add(&v->v_list, &qf_gid);
 
-	print_list("fs user ", &fs_uid);
-	print_list("fs group", &fs_gid);
-	print_list("qf user ", &qf_uid);
-	print_list("qf group", &qf_gid);
-
 	set_list(sdp, comline, TRUE, &qf_uid, 0);
 	set_list(sdp, comline, FALSE, &qf_gid, 0);
 	set_list(sdp, comline, TRUE, &fs_uid, 1);
diff -Naurd cluster-3.0.0.rc2/gfs2/quota/gfs2_quota.h cluster-3.0.0.rc3/gfs2/quota/gfs2_quota.h
--- cluster-3.0.0.rc2/gfs2/quota/gfs2_quota.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/quota/gfs2_quota.h	2009-06-11 11:02:55.000000000 +0200
@@ -58,13 +58,11 @@
 };
 typedef struct commandline commandline_t;
 
-extern char *prog_name;
-
 /*  main.c  */
 
 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);
 void get_last_quota_id(int fd, uint32_t *max_id);
 int is_valid_quota_list(int fd);
@@ -72,7 +70,7 @@
 				struct gfs2_quota *q);
 inline void write_quota_internal(int fd, unsigned int id, int id_type, 
 				 struct gfs2_quota *q);
-void print_quota_list_warning();
+void print_quota_list_warning(void);
 
 /*  check.c  */
 
diff -Naurd cluster-3.0.0.rc2/gfs2/quota/main.c cluster-3.0.0.rc3/gfs2/quota/main.c
--- cluster-3.0.0.rc2/gfs2/quota/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/quota/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -29,8 +29,6 @@
 
 #define OPTION_STRING ("bdf:g:hkl:mnsu:V")
 
-char *prog_name;
-
 /**
  * This function is for libgfs2's sake.
  */
@@ -46,11 +44,11 @@
 
 /**
  * print_usage - print usage info to the user
- *
+ * @prog_name: The name of this program
  */
 
 static void
-print_usage()
+print_usage(const char *prog_name)
 {
 	printf("Usage:\n");
 	printf("\n");
@@ -153,7 +151,7 @@
 			break;
 
 		case 'h':
-			print_usage();
+			print_usage(argv[0]);
 			exit(EXIT_SUCCESS);
 			break;
 
@@ -841,7 +839,7 @@
 	int fd;
 	uint64_t offset;
 	uint64_t new_value;
-	int error, adj_flag = 0;;
+	int error, adj_flag = 0;
 	char quota_file[BUF_SIZE];
 	char id_str[16];
 	struct stat stat_buf;
@@ -1032,8 +1030,6 @@
     struct gfs2_sbd sbd, *sdp = &sbd;
 	commandline_t comline;
 
-	prog_name = argv[0];
-
 	memset(sdp, 0, sizeof(struct gfs2_sbd));
 	memset(&comline, 0, sizeof(commandline_t));
 
diff -Naurd cluster-3.0.0.rc2/gfs2/tool/df.c cluster-3.0.0.rc3/gfs2/tool/df.c
--- cluster-3.0.0.rc2/gfs2/tool/df.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/tool/df.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,290 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <linux/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <limits.h>
-#include <errno.h>
-
-#define __user
-#include <linux/gfs2_ondisk.h>
-
-#include "gfs2_tool.h"
-#include "libgfs2.h"
-
-/**
- * anthropomorphize - make a uint64_t number more human
- */
-static const char *anthropomorphize(unsigned long long inhuman_value)
-{
-	const char *symbols = " KMGTPE";
-	int i;
-	unsigned long long val = inhuman_value;
-	static char out_val[32];
-
-	memset(out_val, 0, sizeof(out_val));
-	for (i = 0; i < 6 && val > 1024; i++)
-		val /= 1024;
-	sprintf(out_val, "%llu%c", val, symbols[i]);
-	return out_val;
-}
-
-/**
- * printit - parse out and print values according to the output type
- */
-static void printit(unsigned long long block_size, const char *label,
-		    unsigned long long total, unsigned long long used,
-		    unsigned long long free, unsigned int percentage)
-{
-	switch (output_type) {
-	case OUTPUT_BLOCKS:
-		printf("  %-15s%-15llu%-15llu%-15llu%u%%\n",
-		       label, total, used, free, percentage);
-		break;
-	case OUTPUT_K:
-		printf("  %-15s%-15llu%-15llu%-15llu%u%%\n",
-		       label, (total * block_size) / 1024,
-		       (used * block_size) / 1024, (free * block_size) / 1024,
-		       percentage);
-		break;
-	case OUTPUT_HUMAN:
-		/* Need to do three separate printfs here because function
-		   anthropomorphize re-uses the same static space. */
-		printf("  %-15s%-15s", label,
-		       anthropomorphize(total * block_size));
-		printf("%-15s", anthropomorphize(used * block_size));
-		printf("%-15s%u%%\n", anthropomorphize(free * block_size),
-		       percentage);
-		break;
-	}
-}
-
-/**
- * do_df_one - print out information about one filesystem
- * @path: the path to the filesystem
- *
- */
-
-static void
-do_df_one(char *path)
-{
-	unsigned int percentage;
-	unsigned int journals;
-	uint64_t rgrps;
-	unsigned int flags;
-	char *value, *fs;
-	int statfs_fd;
-	struct gfs2_sbd sbd;
-	char buf[GFS2_DEFAULT_BSIZE], statfs_fn[PATH_MAX];
-	struct gfs2_statfs_change sc;
-
-	memset(&sbd, 0, sizeof(struct gfs2_sbd));
-	sbd.path_name = path;
-	if (check_for_gfs2(&sbd)) {
-		if (errno == EINVAL)
-			fprintf(stderr, "Not a valid GFS2 mount point: %s\n",
-					sbd.path_name);
-		else
-			fprintf(stderr, "%s\n", strerror(errno));
-		exit(-1);
-	}
-	fs = mp2fsname(sbd.path_name);
-	if (!fs) {
-		fprintf(stderr, "Couldn't find GFS2 filesystem mounted at %s\n",
-				sbd.path_name);
-		exit(-1);
-	}
-
-	sbd.device_fd = open(sbd.device_name, O_RDONLY);
-	if (sbd.device_fd < 0)
-		die("can't open %s: %s\n", path, strerror(errno));
-
-	sbd.bsize = GFS2_DEFAULT_BSIZE;
-	sbd.jsize = GFS2_DEFAULT_JSIZE;
-	sbd.rgsize = GFS2_DEFAULT_RGSIZE;
-	sbd.utsize = GFS2_DEFAULT_UTSIZE;
-	sbd.qcsize = GFS2_DEFAULT_QCSIZE;
-	osi_list_init(&sbd.rglist);
-	init_buf_list(&sbd, &sbd.buf_list, 128 << 20);
-	init_buf_list(&sbd, &sbd.nvbuf_list, 0xffffffff);
-
-	if (lseek(sbd.device_fd, 0x10 * sbd.bsize, SEEK_SET) !=
-	    0x10 * sbd.bsize) {
-		fprintf(stderr, "bad seek: %s from %s:%d: superblock\n",
-			strerror(errno), __FUNCTION__, __LINE__);
-		exit(-1);
-	}
-	if (read(sbd.device_fd, buf, sbd.bsize) != sbd.bsize) {
-		fprintf(stderr, "bad read: %s from %s:%d: superblock\n",
-			strerror(errno), __FUNCTION__, __LINE__);
-		exit(-1);
-	}
-
-	gfs2_sb_in(&sbd.sd_sb, buf); /* parse it out into the sb structure */
-	sbd.bsize = sbd.sd_sb.sb_bsize;
-	if (compute_constants(&sbd)) {
-		fprintf(stderr, "Bad constants (1)\n");
-		exit(-1);
-	}
-
-	sbd.master_dir = gfs2_load_inode(&sbd,
-					 sbd.sd_sb.sb_master_dir.no_addr);
-
-	gfs2_lookupi(sbd.master_dir, "rindex", 6, &sbd.md.riinode);
-	gfs2_lookupi(sbd.master_dir, "jindex", 6, &sbd.md.jiinode);
-	close(sbd.device_fd);
-
-	journals = sbd.md.jiinode->i_di.di_entries - 2;
-
-	rgrps = sbd.md.riinode->i_di.di_size;
-	if (rgrps % sizeof(struct gfs2_rindex))
-		die("bad rindex size\n");
-	rgrps /= sizeof(struct gfs2_rindex);
-
-	printf("%s:\n", path);
-	printf("  SB lock proto = \"%s\"\n", sbd.sd_sb.sb_lockproto);
-	printf("  SB lock table = \"%s\"\n", sbd.sd_sb.sb_locktable);
-	printf("  SB ondisk format = %u\n", sbd.sd_sb.sb_fs_format);
-	printf("  SB multihost format = %u\n", sbd.sd_sb.sb_multihost_format);
-	printf("  Block size = %u\n", sbd.sd_sb.sb_bsize);
-	printf("  Journals = %u\n", journals);
-	printf("  Resource Groups = %"PRIu64"\n", rgrps);
-	value = get_sysfs(fs, "args/lockproto");
-	if (value)
-		printf("  Mounted lock proto = \"%s\"\n",
-			value[0] ? value : sbd.sd_sb.sb_lockproto);
-	else
-		printf("  Mounted lock proto = (Not found: %s)\n",
-				strerror(errno));
-
-	value = get_sysfs(fs, "args/locktable");
-	if (value)
-		printf("  Mounted lock table = \"%s\"\n",
-			value[0] ? value : sbd.sd_sb.sb_locktable);
-	else
-		printf("  Mounted lock table = (Not found: %s)\n",
-				strerror(errno));
-
-	printf("  Mounted host data = \"%s\"\n",
-	       get_sysfs(fs, "args/hostdata"));
-	printf("  Journal number = %s\n", get_sysfs(fs, "lockstruct/jid"));
-
-	if (get_sysfs_uint(fs, "lockstruct/flags", &flags))
-		printf("  Lock module flags = (Not found: %s)\n", strerror(errno));
-	else
-		printf("  Lock module flags = %x\n", flags);
-
-	if (get_sysfs_uint(fs, "args/localflocks", &flags))
-		printf("  Lock flocks = (Not found: %s)\n", strerror(errno));
-	else
-		printf("  Local flocks = %s\n", flags ? "TRUE" : "FALSE");
-
-	if (get_sysfs_uint(fs, "args/localcaching", &flags))
-		printf("  Lock caching = (Not found: %s)\n", strerror(errno));
-	else
-		printf("  Local caching = %s\n", flags ? "TRUE" : "FALSE");
-
-	/* Read the master statfs file */
-	if (mount_gfs2_meta(&sbd)) {
-		fprintf(stderr, "Error mounting GFS2 metafs: %s\n",
-			strerror(errno));
-		exit(-1);
-	}
-
-	sprintf(statfs_fn, "%s/statfs", sbd.metafs_path);
-	statfs_fd = open(statfs_fn, O_RDONLY);
-	if (read(statfs_fd, buf, sizeof(struct gfs2_statfs_change)) !=
-	    sizeof(struct gfs2_statfs_change)) {
-		fprintf(stderr, "bad read: %s from %s:%d: superblock\n",
-			strerror(errno), __FUNCTION__, __LINE__);
-		exit(-1);
-	}
-	gfs2_statfs_change_in(&sc, (char *)&buf);
-
-	close(statfs_fd);
-
-	cleanup_metafs(&sbd);
-
-	printf("\n");
-	switch (output_type) {
-	case OUTPUT_BLOCKS:
-		printf("  %-15s%-15s%-15s%-15s%-15s\n", "Type", "Total Blocks",
-		       "Used Blocks", "Free Blocks", "use%");
-		break;
-	case OUTPUT_K:
-		printf("  %-15s%-15s%-15s%-15s%-15s\n", "Type", "Total K",
-		       "Used K", "Free K", "use%");
-		break;
-	case OUTPUT_HUMAN:
-		printf("  %-15s%-15s%-15s%-15s%-15s\n", "Type", "Total",
-		       "Used", "Free", "use%");
-		break;
-	}
-	printf("  ------------------------------------------------------------------------\n");
-
-	percentage = sc.sc_total ?
-		(100.0 * (sc.sc_total - sc.sc_free)) / sc.sc_total + 0.5 : 0;
-	printit(sbd.sd_sb.sb_bsize, "data", sc.sc_total,
-		sc.sc_total - sc.sc_free, sc.sc_free, percentage);
-
-	percentage = (sc.sc_dinodes + sc.sc_free) ?
-		(100.0 * sc.sc_dinodes / (sc.sc_dinodes + sc.sc_free)) + 0.5 :
-		0;
-	printit(sbd.sd_sb.sb_bsize, "inodes", sc.sc_dinodes + sc.sc_free,
-		sc.sc_dinodes, sc.sc_free, percentage);
-}
-
-
-/**
- * print_df - print out information about filesystems
- * @argc:
- * @argv:
- *
- */
-
-void
-print_df(int argc, char **argv)
-{
-	if (optind < argc) {
-		char buf[PATH_MAX];
-
-		if (!realpath(argv[optind], buf))
-			die("can't determine real path: %s\n", strerror(errno));
-
-		do_df_one(buf);
-
-		return;
-	}
-
-	{
-		FILE *file;
-		char buf[256], device[256], path[256], type[256];
-		int first = TRUE;
-
-		file = fopen("/proc/mounts", "r");
-		if (!file)
-			die("can't open /proc/mounts: %s\n", strerror(errno));
-
-		while (fgets(buf, 256, file)) {
-			if (sscanf(buf, "%s %s %s", device, path, type) != 3)
-				continue;
-			if (strcmp(type, "gfs2") != 0)
-				continue;
-
-			if (first)
-				first = FALSE;
-			else
-				printf("\n");
-
-			do_df_one(path);
-		}
-
-		fclose(file);
-	}
-}
diff -Naurd cluster-3.0.0.rc2/gfs2/tool/gfs2_tool.h cluster-3.0.0.rc3/gfs2/tool/gfs2_tool.h
--- cluster-3.0.0.rc2/gfs2/tool/gfs2_tool.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/tool/gfs2_tool.h	2009-06-11 11:02:55.000000000 +0200
@@ -6,7 +6,6 @@
 #define OUTPUT_K      1
 #define OUTPUT_HUMAN  2
 
-extern char *prog_name;
 extern char *action;
 extern int override;
 extern int expert;
@@ -20,16 +19,6 @@
 void print_counters(int argc, char **argv);
 
 
-/* From df.c */
-
-void print_df(int argc, char **argv);
-
-
-/* From layout.c */
-
-void print_layout(int argc, char **argv);
-
-
 /* From main.c */
 
 void print_usage(void);
@@ -37,20 +26,15 @@
 
 /* From misc.c */
 
-void do_file_flush(int argc, char **argv);
 void do_freeze(int argc, char **argv);
-void margs(int argc, char **argv);
 void print_lockdump(int argc, char **argv);
 void set_flag(int argc, char **argv);
 void print_stat(int argc, char **argv);
 void print_sb(int argc, char **argv);
-void print_args(int argc, char **argv);
 void print_jindex(int argc, char **argv);
 void print_journals(int argc, char **argv);
 void print_rindex(int argc, char **argv);
 void print_quota(int argc, char **argv);
-void print_list(void);
-void do_shrink(int argc, char **argv);
 void do_withdraw(int argc, char **argv);
 
 
diff -Naurd cluster-3.0.0.rc2/gfs2/tool/main.c cluster-3.0.0.rc3/gfs2/tool/main.c
--- cluster-3.0.0.rc2/gfs2/tool/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/tool/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -11,13 +11,15 @@
 #include <limits.h>
 #include <errno.h>
 #include <linux/types.h>
+#include <libintl.h>
+#include <locale.h>
+#define _(String) gettext(String)
 
 #include "copyright.cf"
 
 #include "gfs2_tool.h"
 #include "libgfs2.h"
 
-char *prog_name;
 char *action = NULL;
 int override = FALSE;
 int expert = FALSE;
@@ -26,59 +28,33 @@
 int interval = 1;
 int output_type = OUTPUT_BLOCKS;
 
-static const char *usage[] = {
-	"Clear a flag on a inode\n",
-	"  gfs2_tool clearflag flag <filenames>\n",
-	"\n",
-	"Do a GFS2 specific \"df\":\n",
-	"  gfs2_tool df <mountpoint>\n",
-	"\n",
-	"Freeze a GFS2 cluster:\n",
-	"  gfs2_tool freeze <mountpoint>\n",
-	"\n",
-	"Print the current mount arguments of a mounted filesystem:\n",
-	"  gfs2_tool getargs <mountpoint>\n",
-	"\n",
-	"Get tuneable parameters for a filesystem\n",
-	"  gfs2_tool gettune <mountpoint>\n",
-	"\n",
-	"List the file system's journals:\n",
-	"  gfs2_tool journals <mountpoint>\n",
-	"\n",
-	"List filesystems:\n",
-	"  gfs2_tool list\n",
-	"\n",
-	"Have GFS2 dump its lock state:\n",
-	"  gfs2_tool lockdump <mountpoint> [buffersize]\n",
-	"\n",
-	"Provide arguments for next mount:\n",
-	"  gfs2_tool margs <mountarguments>\n",
-	"\n",
-	"Tune a GFS2 superblock\n",
-	"  gfs2_tool sb <device> proto [newval]\n",
-	"  gfs2_tool sb <device> table [newval]\n",
-	"  gfs2_tool sb <device> ondisk [newval]\n",
-	"  gfs2_tool sb <device> multihost [newval]\n",
-	"  gfs2_tool sb <device> all\n",
-	"\n",
-	"Set a flag on a inode\n",
-	"  gfs2_tool setflag flag <filenames>\n",
-	"\n",
-	"Tune a running filesystem\n",
-	"  gfs2_tool settune <mountpoint> <parameter> <value>\n",
-	"\n",
-	"Shrink a filesystem's inode cache:\n",
-	"  gfs2_tool shrink <mountpoint>\n",
-	"\n",
-	"Unfreeze a GFS2 cluster:\n",
-	"  gfs2_tool unfreeze <mountpoint>\n",
-	"\n",
-	"Print tool version information\n",
-	"  gfs2_tool version\n",
-	"\n",
-	"Withdraw this machine from participating in a filesystem:\n",
-	"  gfs2_tool withdraw <mountpoint>\n",
-	"",
+static const char *usage = {
+	"Clear a flag on a inode\n"
+	"  gfs2_tool clearflag flag <filenames>\n"
+	"Freeze a GFS2 cluster:\n"
+	"  gfs2_tool freeze <mountpoint>\n"
+	"Get tuneable parameters for a filesystem\n"
+	"  gfs2_tool gettune <mountpoint>\n"
+	"List the file system's journals:\n"
+	"  gfs2_tool journals <mountpoint>\n"
+	"Have GFS2 dump its lock state:\n"
+	"  gfs2_tool lockdump <mountpoint> [buffersize]\n"
+	"Tune a GFS2 superblock\n"
+	"  gfs2_tool sb <device> proto [newval]\n"
+	"  gfs2_tool sb <device> table [newval]\n"
+	"  gfs2_tool sb <device> ondisk [newval]\n"
+	"  gfs2_tool sb <device> multihost [newval]\n"
+	"  gfs2_tool sb <device> all\n"
+	"Set a flag on a inode\n"
+	"  gfs2_tool setflag flag <filenames>\n"
+	"Tune a running filesystem\n"
+	"  gfs2_tool settune <mountpoint> <parameter> <value>\n"
+	"Unfreeze a GFS2 cluster:\n"
+	"  gfs2_tool unfreeze <mountpoint>\n"
+	"Print tool version information\n"
+	"  gfs2_tool version\n"
+	"Withdraw this machine from participating in a filesystem:\n"
+	"  gfs2_tool withdraw <mountpoint>\n"
 };
 
 /**
@@ -86,13 +62,9 @@
  *
  */
 
-void
-print_usage(void)
+void print_usage(void)
 {
-	int x;
-
-	for (x = 0; usage[x][0]; x++)
-		printf("%s", usage[x]);
+	puts( _(usage) );
 }
 
 /**
@@ -100,14 +72,10 @@
  *
  */
 
-static void
-print_version(void)
+static void print_version(void)
 {
-	printf("gfs2_tool %s (built %s %s)\n",
-	       RELEASE_VERSION,
-	       __DATE__, __TIME__);
-	printf("%s\n",
-	       REDHAT_COPYRIGHT);
+	printf( _("gfs2_tool " RELEASE_VERSION " (built " __DATE__ " " __TIME__ ")\n"));
+	puts( _(REDHAT_COPYRIGHT "\n") );
 }
 
 /**
@@ -117,8 +85,7 @@
  *
  */
 
-static void
-decode_arguments(int argc, char *argv[])
+static void decode_arguments(int argc, char *argv[])
 {
 	int cont = TRUE;
 	int optchar;
@@ -138,7 +105,7 @@
 
 		case 'h':
 			print_usage();
-			exit(EXIT_SUCCESS);
+			exit(0);
 
 		case 'H':
 			output_type = OUTPUT_HUMAN;
@@ -158,7 +125,7 @@
 
 		case 'V':
 			print_version();
-			exit(EXIT_SUCCESS);
+			exit(0);
 
 		case 'X':
 			expert = TRUE;
@@ -169,15 +136,16 @@
 			break;
 
 		default:
-			die("unknown option: %c\n", optchar);
+			die( _("unknown option: %c\n"), optchar);
 		};
 	}
 
 	if (optind < argc) {
 		action = argv[optind];
 		optind++;
-	} else
-		die("no action specified\n");
+	} else {
+		die( _("no action specified\n"));
+	}
 }
 
 /**
@@ -187,44 +155,34 @@
  *
  */
 
-int
-main(int argc, char *argv[])
+int main(int argc, char *argv[])
 {
-	prog_name = argv[0];
+	setlocale(LC_ALL, "");
+	textdomain("gfs2_tool");
 
 	if (argc < 2) {
 		print_usage();
-		exit(EXIT_SUCCESS);
+		return 0;
 	}
 
 	decode_arguments(argc, argv);
 
 	if (strcmp(action, "clearflag") == 0)
 		set_flag(argc, argv);
-	else if (strcmp(action, "df") == 0)
-		print_df(argc, argv);
 	else if (strcmp(action, "freeze") == 0)
 		do_freeze(argc, argv);
-	else if (strcmp(action, "getargs") == 0)
-		print_args(argc, argv);
 	else if (strcmp(action, "gettune") == 0)
 		get_tune(argc, argv);
 	else if (strcmp(action, "journals") == 0)
 		print_journals(argc, argv);
-	else if (strcmp(action, "list") == 0)
-		print_list();
 	else if (strcmp(action, "lockdump") == 0)
 		print_lockdump(argc, argv);
-	else if (strcmp(action, "margs") == 0)
-		margs(argc, argv);
 	else if (strcmp(action, "sb") == 0)
 		do_sb(argc, argv);
 	else if (strcmp(action, "setflag") == 0)
 		set_flag(argc, argv);
 	else if (strcmp(action, "settune") == 0)
 		set_tune(argc, argv);
-	else if (strcmp(action, "shrink") == 0)
-		do_shrink(argc, argv);
 	else if (strcmp(action, "unfreeze") == 0)
 		do_freeze(argc, argv);
 	else if (strcmp(action, "version") == 0)
@@ -232,8 +190,7 @@
 	else if (strcmp(action, "withdraw") == 0)
 		do_withdraw(argc, argv);
 	else
-		die("unknown action: %s\n",
-		    action);
+		die( _("unknown action: %s\n"), action);
 
-	exit(EXIT_SUCCESS);
+	return 0;
 }
diff -Naurd cluster-3.0.0.rc2/gfs2/tool/Makefile cluster-3.0.0.rc3/gfs2/tool/Makefile
--- cluster-3.0.0.rc2/gfs2/tool/Makefile	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/tool/Makefile	2009-06-11 11:02:55.000000000 +0200
@@ -10,8 +10,7 @@
 include $(OBJDIR)/make/install.mk
 include $(OBJDIR)/make/uninstall.mk
 
-OBJS=	df.o \
-	main.o \
+OBJS=	main.o \
 	misc.o \
 	ondisk.o \
 	sb.o \
diff -Naurd cluster-3.0.0.rc2/gfs2/tool/misc.c cluster-3.0.0.rc3/gfs2/tool/misc.c
--- cluster-3.0.0.rc2/gfs2/tool/misc.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/tool/misc.c	2009-06-11 11:02:55.000000000 +0200
@@ -12,6 +12,8 @@
 #include <limits.h>
 #include <errno.h>
 #include <dirent.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #define __user
 #include <linux/gfs2_ondisk.h>
@@ -21,7 +23,10 @@
 #include "gfs2_tool.h"
 #include "iflags.h"
 
-#define SYS_BASE "/sys/fs/gfs2" /* FIXME: Look in /proc/mounts to find this */
+#ifndef FIFREZE
+#define FIFREEZE        _IOWR('X', 119, int)    /* Freeze */
+#define FITHAW          _IOWR('X', 120, int)    /* Thaw */
+#endif
 
 /**
  * do_freeze - freeze a GFS2 filesystem
@@ -30,37 +35,35 @@
  *
  */
 
-void
-do_freeze(int argc, char **argv)
+void do_freeze(int argc, char **argv)
 {
 	char *command = argv[optind - 1];
-	char *name;
+	int fd;
 
 	if (optind == argc)
 		die("Usage: gfs2_tool %s <mountpoint>\n", command);
 
-	name = mp2fsname2(argv[optind]);
-	if (!name) {
-		fprintf(stderr, "Couldn't find a GFS2 filesystem mounted at %s\n",
+	fd = open(argv[optind], O_NOCTTY|O_RDONLY);
+	if (fd < 0) {
+		fprintf(stderr, _("Couldn't find a GFS2 filesystem mounted at %s\n"),
 				argv[optind]);
 		exit(-1);
 	}
 
 	if (strcmp(command, "freeze") == 0) {
-		if (set_sysfs(name, "freeze", "1")) {
-			fprintf(stderr, "Error writing to sysfs freeze file: %s\n",
+		if (ioctl(fd, FIFREEZE, 0)) {
+			fprintf(stderr, _("Error freezing fs: %s\n"),
 					strerror(errno));
 			exit(-1);
 		}
 	} else if (strcmp(command, "unfreeze") == 0) {
-		if (set_sysfs(name, "freeze", "0")) {
-			fprintf(stderr, "Error writing to sysfs freeze file: %s\n",
+		if (ioctl(fd, FITHAW, 0)) {
+			fprintf(stderr, _("Error thawing fs: %s\n"),
 					strerror(errno));
 			exit(-1);
 		}
 	}
-
-	sync();
+	close(fd);
 }
 
 /**
@@ -70,8 +73,7 @@
  *
  */
 
-void
-print_lockdump(int argc, char **argv)
+void print_lockdump(int argc, char **argv)
 {
 	char path[PATH_MAX];
 	char *name, line[PATH_MAX];
@@ -90,8 +92,7 @@
 		sprintf(debugfs, "/tmp/debugfs.XXXXXX");
 
 		if (!mkdtemp(debugfs)) {
-			fprintf(stderr,
-				"Can't create %s mount point.\n",
+			fprintf(stderr,_("Can't create %s mount point.\n"),
 				debugfs);
 			free(debugfs);
 			exit(-1);
@@ -100,8 +101,8 @@
 		rc = mount("none", debugfs, "debugfs", 0, NULL);
 		if (rc) {
 			fprintf(stderr,
-				"Can't mount debugfs.  "
-				"Maybe your kernel doesn't support it.\n");
+				_("Can't mount debugfs. "
+				"Maybe your kernel doesn't support it.\n"));
 				free(debugfs);
 				exit(-1);
 		}
@@ -117,11 +118,11 @@
 			}
 			fclose(file);
 		} else {
-			fprintf(stderr, "Can't open %s: %s\n", path,
+			fprintf(stderr, _("Can't open %s: %s\n"), path,
 				strerror(errno));
 		}
 	} else {
-		fprintf(stderr, "Unable to locate sysfs for mount point %s.\n",
+		fprintf(stderr, _("Unable to locate sysfs for mount point %s.\n"),
 			argv[optind]);
 	}
 	/* Check if we mounted the debugfs and if so, unmount it. */
@@ -133,29 +134,15 @@
 }
 
 /**
- * margs -
- * @argc:
- * @argv:
- *
- */
-
-void
-margs(int argc, char **argv)
-{
-	die("margs not implemented\n");
-}
-
-/**
  * print_flags - print the flags in a dinode's di_flags field
  * @di: the dinode structure
  *
  */
 
-static void
-print_flags(struct gfs2_dinode *di)
+static void print_flags(struct gfs2_dinode *di)
 {
 	if (di->di_flags) {
-		printf("Flags:\n");
+		printf( _("Flags:\n"));
 		if (di->di_flags & GFS2_DIF_JDATA)
 			printf("  jdata\n");
 		if (di->di_flags & GFS2_DIF_EXHASH)
@@ -167,7 +154,7 @@
 		if (di->di_flags & GFS2_DIF_APPENDONLY)
 			printf("  appendonly\n");
 		if (di->di_flags & GFS2_DIF_NOATIME)
-			printf("  noatime\n");
+			printf( _("  noatime\n"));
 		if (di->di_flags & GFS2_DIF_SYNC)
 			printf("  sync\n");
 		if (di->di_flags & GFS2_DIF_TRUNC_IN_PROG)
@@ -179,8 +166,7 @@
  * Use FS_XXX_FL flags defined in <linux/fs.h> which correspond to
  * GFS2_DIF_XXX
  */
-static unsigned int 
-get_flag_from_name(char *name)
+static unsigned int get_flag_from_name(char *name)
 {
 	if (strncmp(name, "jdata", 5) == 0)
 		return FS_JOURNAL_DATA_FL;
@@ -204,8 +190,7 @@
  * @argv:
  *
  */
-void
-set_flag(int argc, char **argv)
+void set_flag(int argc, char **argv)
 {
 	struct gfs2_dinode di;
 	char *flstr;
@@ -221,91 +206,35 @@
 	set = (strcmp(argv[optind -1], "setflag") == 0) ? 1 : 0;
 	flstr = argv[optind++];
 	if (!(flag = get_flag_from_name(flstr)))
-		die("unrecognized flag %s\n", argv[optind -1]);
+		die( _("unrecognized flag %s\n"), argv[optind -1]);
 	
 	for (; optind < argc; optind++) {
 		fd = open(argv[optind], O_RDONLY);
 		if (fd < 0)
-			die("can't open %s: %s\n", argv[optind], strerror(errno));
+			die( _("can't open %s: %s\n"), argv[optind], strerror(errno));
 		/* first get the existing flags on the file */
 		error = ioctl(fd, FS_IOC_GETFLAGS, &newflags);
 		if (error)
-			die("can't get flags on %s: %s\n", 
+			die( _("can't get flags on %s: %s\n"), 
 			    argv[optind], strerror(errno));
 		newflags = set ? newflags | flag : newflags & ~flag;
 		/* new flags */
 		error = ioctl(fd, FS_IOC_SETFLAGS, &newflags);
 		if (error)
-			die("can't set flags on %s: %s\n", 
+			die( _("can't set flags on %s: %s\n"), 
 			    argv[optind], strerror(errno));
 		close(fd);
 	}
 }
 
 /**
- * print_args -
- * @argc:
- * @argv:
- *
- */
-
-
-void
-print_args(int argc, char **argv)
-{
-	char *fs;
-	DIR *d;
-	struct dirent *de;
-	char path[PATH_MAX];
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool getargs <mountpoint>\n");
-
-	sbd.path_name = argv[optind];
-	if (check_for_gfs2(&sbd)) {
-		if (errno == EINVAL)
-			fprintf(stderr, "Not a valid GFS2 mount point: %s\n",
-					sbd.path_name);
-		else
-			fprintf(stderr, "%s\n", strerror(errno));
-		exit(-1);
-	}
-	fs = mp2fsname(argv[optind]);
-	if (!fs) {
-		fprintf(stderr, "Couldn't find GFS2 filesystem mounted at %s\n",
-				argv[optind]);
-		exit(-1);
-	}
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX - 1, "%s/%s/args/", SYS_BASE, fs);
-
-	d = opendir(path);
-	if (!d)
-		die("can't open %s: %s\n", path, strerror(errno));
-
-	while((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		snprintf(path, PATH_MAX - 1, "args/%s", de->d_name);
-		printf("%s %s\n", de->d_name, get_sysfs(fs, path));
-	}
-
-	closedir(d);
-	
-}
-
-/**
  * print_journals - print out the file system journal information
  * @argc:
  * @argv:
  *
  */
 
-void
-print_journals(int argc, char **argv)
+void print_journals(int argc, char **argv)
 {
 	struct gfs2_sbd sbd;
 	DIR *jindex;
@@ -328,7 +257,7 @@
 		    sbd.path_name, strerror(errno));
 	if (check_for_gfs2(&sbd)) {
 		if (errno == EINVAL)
-			fprintf(stderr, "Not a valid GFS2 mount point: %s\n",
+			fprintf(stderr, _("Not a valid GFS2 mount point: %s\n"),
 					sbd.path_name);
 		else
 			fprintf(stderr, "%s\n", strerror(errno));
@@ -336,11 +265,11 @@
 	}
 	sbd.device_fd = open(sbd.device_name, O_RDONLY);
 	if (sbd.device_fd < 0)
-		die("can't open device %s: %s\n",
+		die( _("can't open device %s: %s\n"),
 		    sbd.device_name, strerror(errno));
 
 	if (mount_gfs2_meta(&sbd)) {
-		fprintf(stderr, "Error mounting GFS2 metafs: %s\n",
+		fprintf(stderr, _("Error mounting GFS2 metafs: %s\n"),
 			strerror(errno));
 		exit(-1);
 	}
@@ -348,7 +277,7 @@
 	sprintf(jindex_name, "%s/jindex", sbd.metafs_path);
 	jindex = opendir(jindex_name);
 	if (!jindex) {
-		die("Can't open %s\n", jindex_name);
+		die( _("Can't open %s\n"), jindex_name);
 	} else {
 		jcount = 0;
 		while ((journal = readdir(jindex))) {
@@ -364,7 +293,7 @@
 			       (unsigned long long)statbuf.st_size / 1048576);
 		}
 
-		printf("%d journal(s) found.\n", jcount);
+		printf( _("%d journal(s) found.\n"), jcount);
 		closedir(jindex);
 	}
 	cleanup_metafs(&sbd);
@@ -373,117 +302,13 @@
 }
 
 /**
- * print_list - print the list of mounted filesystems
- *
- */
-
-#define LIST_SIZE 1048576
-
-void
-print_list(void)
-{
-	char path[PATH_MAX];
-	char s_id[PATH_MAX];
-	char *list, *p;
-	int rv, fd, x = 0, total = 0;
-	DIR *d;
-	struct dirent *de;
-
-	list = malloc(LIST_SIZE);
-	if (!list)
-		die("out of memory\n");
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s", SYS_BASE);
-
-	d = opendir(path);
-	if (!d)
-		die("can't open %s: %s\n", SYS_BASE, strerror(errno));
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s/id", SYS_BASE, de->d_name);
-
-		fd = open(path, O_RDONLY);
-		if (fd < 0)
-			die("can't open %s: %s\n", path, strerror(errno));
-
-		memset(s_id, 0, PATH_MAX);
-
-		rv = read(fd, s_id, sizeof(s_id));
-		if (rv < 0)
-			die("can't read %s: %s\n", path, strerror(errno));
-
-		close(fd);
-
-		p = strstr(s_id, "\n");
-		if (p)
-			*p = '\0';
-
-		total += strlen(s_id) + strlen(de->d_name) + 2;
-		if (total > LIST_SIZE)
-			break;
-
-		x += sprintf(list + x, "%s %s\n", s_id, de->d_name);
-
-	}
-
-	closedir(d);
-	printf("%s", list);
-	free(list);
-}
-
-/**
- * do_shrink - shrink the inode cache for a filesystem
- * @argc:
- * @argv:
- *
- */
-
-void
-do_shrink(int argc, char **argv)
-{
-	char *fs;
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool shrink <mountpoint>\n");
-
-	sbd.path_name = argv[optind];
-	if (check_for_gfs2(&sbd)) {
-		if (errno == EINVAL)
-			fprintf(stderr, "Not a valid GFS2 mount point: %s\n",
-					sbd.path_name);
-		else
-			fprintf(stderr, "%s\n", strerror(errno));
-		exit(-1);
-	}
-	fs = mp2fsname(argv[optind]);
-	if (!fs) {
-		fprintf(stderr, "Couldn't find GFS2 filesystem mounted at %s\n",
-				argv[optind]);
-		exit(-1);
-	}
-	
-	if (set_sysfs(fs, "shrink", "1")) {
-		fprintf(stderr, "Error writing to sysfs shrink file: %s\n",
-				strerror(errno));
-		exit(-1);
-	}
-}
-
-/**
  * do_withdraw - withdraw a GFS2 filesystem
  * @argc:
  * @argv:
  *
  */
 
-void
-do_withdraw(int argc, char **argv)
+void do_withdraw(int argc, char **argv)
 {
 	char *name;
 	struct gfs2_sbd sbd;
@@ -494,7 +319,7 @@
 	sbd.path_name = argv[optind];
 	if (check_for_gfs2(&sbd)) {
 		if (errno == EINVAL)
-			fprintf(stderr, "Not a valid GFS2 mount point: %s\n",
+			fprintf(stderr, _("Not a valid GFS2 mount point: %s\n"),
 					sbd.path_name);
 		else
 			fprintf(stderr, "%s\n", strerror(errno));
@@ -502,13 +327,13 @@
 	}
 	name = mp2fsname(argv[optind]);
 	if (!name) {
-		fprintf(stderr, "Couldn't find GFS2 filesystem mounted at %s\n",
+		fprintf(stderr, _("Couldn't find GFS2 filesystem mounted at %s\n"),
 				argv[optind]);
 		exit(-1);
 	}
 
 	if (set_sysfs(name, "withdraw", "1")) {
-		fprintf(stderr, "Error writing to sysfs withdraw file: %s\n",
+		fprintf(stderr, _("Error writing to sysfs withdraw file: %s\n"),
 				strerror(errno));
 		exit(-1);
 	}
diff -Naurd cluster-3.0.0.rc2/gfs2/tool/sb.c cluster-3.0.0.rc3/gfs2/tool/sb.c
--- cluster-3.0.0.rc2/gfs2/tool/sb.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/tool/sb.c	2009-06-11 11:02:55.000000000 +0200
@@ -13,6 +13,8 @@
 #include <limits.h>
 #include <errno.h>
 #include <ctype.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include <linux/gfs2_ondisk.h>
 
@@ -34,7 +36,7 @@
  * 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;
 
@@ -92,25 +94,25 @@
 		die("can't open %s: %s\n", device, strerror(errno));
 
 	if (newval && !override) {
-		printf("You shouldn't change any of these values if the filesystem is mounted.\n");
-		printf("\nAre you sure? [y/n] ");
+		printf( _("You shouldn't change any of these values if the filesystem is mounted.\n"));
+		printf( _("\nAre you sure? [y/n] "));
 		if(!fgets((char*)input, 255, stdin))
-			die("unable to read from stdin\n");
+			die( _("unable to read from stdin\n"));
 
 		if (input[0] != 'y')
-			die("aborted\n");
+			die( _("aborted\n"));
 
 		printf("\n");
 	}
 
 	if (lseek(fd, GFS2_SB_ADDR * GFS2_BASIC_BLOCK, SEEK_SET) !=
 	    GFS2_SB_ADDR * GFS2_BASIC_BLOCK) {
-		fprintf(stderr, "bad seek: %s from %s:%d: superblock\n",
+		fprintf(stderr, _("bad seek: %s from %s:%d: superblock\n"),
 			strerror(errno), __FUNCTION__, __LINE__);
 		exit(-1);
 	}
 	if (read(fd, buf, GFS2_BASIC_BLOCK) != GFS2_BASIC_BLOCK) {
-		fprintf(stderr, "bad read: %s from %s:%d: superblock\n",
+		fprintf(stderr, _("bad read: %s from %s:%d: superblock\n"),
 			strerror(errno), __FUNCTION__, __LINE__);
 		exit(-1);
 	}
@@ -119,104 +121,104 @@
 
 	if (sb.sb_header.mh_magic != GFS2_MAGIC ||
 	    sb.sb_header.mh_type != GFS2_METATYPE_SB)
-		die("there isn't a GFS2 filesystem on %s\n", device);
+		die( _("there isn't a GFS2 filesystem on %s\n"), device);
 
 	if (strcmp(field, "proto") == 0) {
-		printf("current lock protocol name = \"%s\"\n",
+		printf( _("current lock protocol name = \"%s\"\n"),
 		       sb.sb_lockproto);
 
 		if (newval) {
 			if (strlen(newval) >= GFS2_LOCKNAME_LEN)
-				die("new lockproto name is too long\n");
+				die( _("new lockproto name is too long\n"));
 			strcpy(sb.sb_lockproto, newval);
-			printf("new lock protocol name = \"%s\"\n",
+			printf( _("new lock protocol name = \"%s\"\n"),
 			       sb.sb_lockproto);
 		}
 	} else if (strcmp(field, "table") == 0) {
-		printf("current lock table name = \"%s\"\n",
+		printf( _("current lock table name = \"%s\"\n"),
 		       sb.sb_locktable);
 
 		if (newval) {
 			if (strlen(newval) >= GFS2_LOCKNAME_LEN)
-				die("new locktable name is too long\n");
+				die( _("new locktable name is too long\n"));
 			strcpy(sb.sb_locktable, newval);
-			printf("new lock table name = \"%s\"\n",
+			printf( _("new lock table name = \"%s\"\n"),
 			       sb.sb_locktable);
 		}
 	} else if (strcmp(field, "ondisk") == 0) {
-		printf("current ondisk format = %u\n",
+		printf( _("current ondisk format = %u\n"),
 		       sb.sb_fs_format);
 
 		if (newval) {
 			sb.sb_fs_format = atoi(newval);
-			printf("new ondisk format = %u\n",
+			printf( _("new ondisk format = %u\n"),
 			       sb.sb_fs_format);
 		}
 	} else if (strcmp(field, "multihost") == 0) {
-		printf("current multihost format = %u\n",
+		printf( _("current multihost format = %u\n"),
 		       sb.sb_multihost_format);
 
 		if (newval) {
 			sb.sb_multihost_format = atoi(newval);
-			printf("new multihost format = %u\n",
+			printf( _("new multihost format = %u\n"),
 			       sb.sb_multihost_format);
 		}
 #ifdef GFS2_HAS_UUID
 	} else if (strcmp(field, "uuid") == 0) {
-		printf("current uuid = %s\n", str_uuid(sb.sb_uuid));
+		printf( _("current uuid = %s\n"), str_uuid(sb.sb_uuid));
 
 		if (newval) {
 			int i;
 			unsigned char uuid[16], *cp;
 
 			if (strlen(newval) != 36)
-				die("uuid %s is the wrong length; must be 36 "
-				    "hex characters long.\n", newval);
+				die( _("uuid %s is the wrong length; must be 36 "
+				    "hex characters long.\n"), newval);
 			cp = uuid;
 			for (i = 0; i < 36; i++) {
 				if ((i == 8) || (i == 13) ||
 				    (i == 18) || (i == 23)) {
 					if (newval[i] == '-')
 						continue;
-					die("uuid %s has an invalid format.",
+					die( _("uuid %s has an invalid format."),
 					    newval);
 				}
 				if (!isxdigit(newval[i]))
-					die("uuid %s has an invalid hex "
-					    "digit '%c' at offset %d.\n",
+					die( _("uuid %s has an invalid hex "
+					    "digit '%c' at offset %d.\n"),
 					    newval, newval[i], i + 1);
 				*cp = str_to_hexchar(&newval[i++]);
 				cp++;
 			}
 			memcpy(sb.sb_uuid, uuid, 16);
-			printf("new uuid = %s\n", str_uuid(sb.sb_uuid));
+			printf( _("new uuid = %s\n"), str_uuid(sb.sb_uuid));
 		}
 #endif
 	} else if (strcmp(field, "all") == 0) {
 		gfs2_sb_print(&sb);
 		newval = FALSE;
 	} else
-		die("unknown field %s\n", field);
+		die( _("unknown field %s\n"), field);
 
 	if (newval) {
 		gfs2_sb_out(&sb,(char*) buf);
 
 		if (lseek(fd, GFS2_SB_ADDR * GFS2_BASIC_BLOCK, SEEK_SET) !=
 		    GFS2_SB_ADDR * GFS2_BASIC_BLOCK) {
-			fprintf(stderr, "bad seek: %s from %s:%d: superblock\n",
+			fprintf(stderr, _("bad seek: %s from %s:%d: superblock\n"),
 				strerror(errno), __FUNCTION__, __LINE__);
 			exit(-1);
 		}
 		if (write(fd, buf, GFS2_BASIC_BLOCK) != GFS2_BASIC_BLOCK) {
-			fprintf(stderr, "write error: %s from %s:%d: "
-				"superblock\n", strerror(errno),
+			fprintf(stderr, _("write error: %s from %s:%d: "
+				"superblock\n"), strerror(errno),
 				__FUNCTION__, __LINE__);
 			exit(-1);
 		}
 
 		fsync(fd);
 
-		printf("Done\n");
+		printf( _("Done\n"));
 	}
 
 	close(fd);
diff -Naurd cluster-3.0.0.rc2/gfs2/tool/tune.c cluster-3.0.0.rc3/gfs2/tool/tune.c
--- cluster-3.0.0.rc2/gfs2/tool/tune.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs2/tool/tune.c	2009-06-11 11:02:55.000000000 +0200
@@ -12,6 +12,8 @@
 #include <limits.h>
 #include <errno.h>
 #include <dirent.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #define __user
 
@@ -42,12 +44,12 @@
 	char *value;
 
 	if (optind == argc)
-		die("Usage: gfs2_tool gettune <mountpoint>\n");
+		die( _("Usage: gfs2_tool gettune <mountpoint>\n"));
 
 	sbd.path_name = argv[optind];
 	if (check_for_gfs2(&sbd)) {
 		if (errno == EINVAL)
-			fprintf(stderr, "Not a valid GFS2 mount point: %s\n",
+			fprintf(stderr, _("Not a valid GFS2 mount point: %s\n"),
 					sbd.path_name);
 		else
 			fprintf(stderr, "%s\n", strerror(errno));
@@ -55,7 +57,7 @@
 	}
 	fs = mp2fsname(argv[optind]);
 	if (!fs) {
-		fprintf(stderr, "Couldn't find GFS2 filesystem mounted at %s\n",
+		fprintf(stderr, _("Couldn't find GFS2 filesystem mounted at %s\n"),
 				argv[optind]);
 		exit(-1);
 	}
@@ -64,7 +66,7 @@
 
 	d = opendir(path);
 	if (!d)
-		die("can't open %s: %s\n", path, strerror(errno));
+		die( _("can't open %s: %s\n"), path, strerror(errno));
 
 	while((de = readdir(d))) {
 		if (de->d_name[0] == '.')
@@ -73,13 +75,13 @@
 		if (strcmp(de->d_name, "quota_scale") == 0) {
 			value = get_sysfs(fs, "tune/quota_scale");
 			if (!value) {
-				printf("quota_scale = (Not found: %s)\n",
+				printf( _("quota_scale = (Not found: %s)\n"),
 						strerror(errno));
 				continue;
 			}
 			sscanf(value, "%u %u", &num, &den);
 			ratio = (double)num / den;
-			printf("quota_scale = %.4f   (%u, %u)\n", ratio, num,
+			printf( _("quota_scale = %.4f   (%u, %u)\n"), ratio, num,
 			       den);
 		} else
 			printf("%s = %s\n", de->d_name, get_sysfs(fs, path));
@@ -104,18 +106,18 @@
 	struct gfs2_sbd sbd;
 
 	if (optind == argc)
-		die("Usage: gfs2_tool settune <mountpoint> <parameter> <value>\n");
+		die( _("Usage: gfs2_tool settune <mountpoint> <parameter> <value>\n"));
 	sbd.path_name = argv[optind++];
 	if (optind == argc)
-		die("Usage: gfs2_tool settune <mountpoint> <parameter> <value>\n");
+		die( _("Usage: gfs2_tool settune <mountpoint> <parameter> <value>\n"));
 	param = argv[optind++];
 	if (optind == argc)
-		die("Usage: gfs2_tool settune <mountpoint> <parameter> <value>\n");
+		die( _("Usage: gfs2_tool settune <mountpoint> <parameter> <value>\n"));
 	value = argv[optind++];
 
 	if (check_for_gfs2(&sbd)) {
 		if (errno == EINVAL)
-			fprintf(stderr, "Not a valid GFS2 mount point: %s\n",
+			fprintf(stderr, _("Not a valid GFS2 mount point: %s\n"),
 					sbd.path_name);
 		else
 			fprintf(stderr, "%s\n", strerror(errno));
@@ -123,7 +125,7 @@
 	}
 	fs = mp2fsname(sbd.path_name);
 	if (!fs) {
-		fprintf(stderr, "Couldn't find GFS2 filesystem mounted at %s\n",
+		fprintf(stderr, _("Couldn't find GFS2 filesystem mounted at %s\n"),
 				sbd.path_name);
 		exit(-1);
 	}
@@ -135,7 +137,7 @@
 		value = buf;
 	}
 	if (set_sysfs(fs, strcat(tune_base, param), value)) {
-		fprintf(stderr, "Error writing to sysfs %s tune file: %s\n",
+		fprintf(stderr, _("Error writing to sysfs %s tune file: %s\n"),
 				param, strerror(errno));
 		exit(-1);
 	}
diff -Naurd cluster-3.0.0.rc2/gfs-kernel/src/gfs/gfs.h cluster-3.0.0.rc3/gfs-kernel/src/gfs/gfs.h
--- cluster-3.0.0.rc2/gfs-kernel/src/gfs/gfs.h	2009-05-07 09:29:45.000000000 +0200
+++ cluster-3.0.0.rc3/gfs-kernel/src/gfs/gfs.h	2009-06-11 15:46:20.000000000 +0200
@@ -1,7 +1,7 @@
 #ifndef __GFS_DOT_H__
 #define __GFS_DOT_H__
 
-#define RELEASE_VERSION "3.0.0.rc2"
+#define RELEASE_VERSION "3.0.0.rc3"
 
 #include "lm_interface.h"
 
diff -Naurd cluster-3.0.0.rc2/gfs-kernel/src/gfs/gfs_ondisk.h cluster-3.0.0.rc3/gfs-kernel/src/gfs/gfs_ondisk.h
--- cluster-3.0.0.rc2/gfs-kernel/src/gfs/gfs_ondisk.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs-kernel/src/gfs/gfs_ondisk.h	2009-06-11 11:02:55.000000000 +0200
@@ -695,7 +695,7 @@
 void gfs_quota_print(struct gfs_quota *quota);
 void gfs_dinode_print(struct gfs_dinode *dinode);
 void gfs_indirect_print(struct gfs_indirect *indirect);
-void gfs_dirent_print(struct gfs_dirent *dirent, char *name);
+void gfs_dirent_print(struct gfs_dirent *dirent, const char *name);
 void gfs_leaf_print(struct gfs_leaf *leaf);
 void gfs_log_header_print(struct gfs_log_header *head);
 void gfs_desc_print(struct gfs_log_descriptor *desc);
@@ -733,7 +733,7 @@
  */
 
 static void
-print_array(char *title, char *buf, int count)
+print_array(const char *title, char *buf, int count)
 {
 	int x;
 
@@ -1016,20 +1016,20 @@
  */
 
 void
-gfs_rindex_in(struct gfs_rindex *rindex, char *buf)
+gfs_rindex_in(struct gfs_rindex *grindex, char *buf)
 {
 	struct gfs_rindex *str = (struct gfs_rindex *)buf;
 
-	CPIN_64(rindex, str, ri_addr);
-	CPIN_32(rindex, str, ri_length);
-	CPIN_32(rindex, str, ri_pad);
+	CPIN_64(grindex, str, ri_addr);
+	CPIN_32(grindex, str, ri_length);
+	CPIN_32(grindex, str, ri_pad);
 
-	CPIN_64(rindex, str, ri_data1);
-	CPIN_32(rindex, str, ri_data);
+	CPIN_64(grindex, str, ri_data1);
+	CPIN_32(grindex, str, ri_data);
 
-	CPIN_32(rindex, str, ri_bitbytes);
+	CPIN_32(grindex, str, ri_bitbytes);
 
-	CPIN_08(rindex, str, ri_reserved, 64);
+	CPIN_08(grindex, str, ri_reserved, 64);
 }
 
 /**
@@ -1040,20 +1040,20 @@
  */
 
 void
-gfs_rindex_out(struct gfs_rindex *rindex, char *buf)
+gfs_rindex_out(struct gfs_rindex *grindex, char *buf)
 {
 	struct gfs_rindex *str = (struct gfs_rindex *)buf;
 
-	CPOUT_64(rindex, str, ri_addr);
-	CPOUT_32(rindex, str, ri_length);
-	CPOUT_32(rindex, str, ri_pad);
+	CPOUT_64(grindex, str, ri_addr);
+	CPOUT_32(grindex, str, ri_length);
+	CPOUT_32(grindex, str, ri_pad);
 
-	CPOUT_64(rindex, str, ri_data1);
-	CPOUT_32(rindex, str, ri_data);
+	CPOUT_64(grindex, str, ri_data1);
+	CPOUT_32(grindex, str, ri_data);
 
-	CPOUT_32(rindex, str, ri_bitbytes);
+	CPOUT_32(grindex, str, ri_bitbytes);
 
-	CPOUT_08(rindex, str, ri_reserved, 64);
+	CPOUT_08(grindex, str, ri_reserved, 64);
 }
 
 /**
@@ -1454,7 +1454,7 @@
  */
 
 void
-gfs_dirent_print(struct gfs_dirent *de, char *name)
+gfs_dirent_print(struct gfs_dirent *de, const char *name)
 {
 	char buf[GFS_FNAMESIZE + 1];
 
diff -Naurd cluster-3.0.0.rc2/gfs-kernel/src/gfs/ioctl.c cluster-3.0.0.rc3/gfs-kernel/src/gfs/ioctl.c
--- cluster-3.0.0.rc2/gfs-kernel/src/gfs/ioctl.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs-kernel/src/gfs/ioctl.c	2009-06-11 11:02:55.000000000 +0200
@@ -8,6 +8,7 @@
 #include <asm/uaccess.h>
 #include <linux/compat.h>
 #include <linux/cred.h>
+#include <linux/vmalloc.h>
 
 #include "gfs_ioctl.h"
 #include "gfs.h"
@@ -55,7 +56,7 @@
 	if (size > gi->gi_size)
 		size = gi->gi_size;
 
-        buf = kmalloc(size, GFP_KERNEL);
+        buf = vmalloc(size);
         if (!buf)
                 return -ENOMEM;
 
@@ -69,7 +70,7 @@
 		error = count + 1;
 
  out:
-	kfree(buf);
+	vfree(buf);
 
 	return error;
 }
diff -Naurd cluster-3.0.0.rc2/gfs-kernel/src/gfs/ops_fstype.c cluster-3.0.0.rc3/gfs-kernel/src/gfs/ops_fstype.c
--- cluster-3.0.0.rc2/gfs-kernel/src/gfs/ops_fstype.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/gfs-kernel/src/gfs/ops_fstype.c	2009-06-11 11:02:55.000000000 +0200
@@ -809,7 +809,7 @@
 
 struct file_system_type gfs_fs_type = {
 	.name = "gfs",
-	.fs_flags = FS_REQUIRES_DEV,
+	.fs_flags = FS_REQUIRES_DEV | FS_HAS_FREEZE,
 	.get_sb = gfs_get_sb,
 	.kill_sb = gfs_kill_sb,
 	.owner = THIS_MODULE,
diff -Naurd cluster-3.0.0.rc2/group/daemon/app.c cluster-3.0.0.rc3/group/daemon/app.c
--- cluster-3.0.0.rc2/group/daemon/app.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/daemon/app.c	2009-06-11 11:02:55.000000000 +0200
@@ -10,7 +10,7 @@
 	int nodeid;
 };
 
-char *msg_type(int type)
+const char *msg_type(int type)
 {
 	switch (type) {
 	case MSG_APP_STOPPED:
@@ -51,7 +51,7 @@
 	msg->ms_event_id	= le64_to_cpu(msg->ms_event_id);
 }
 
-uint64_t make_event_id(group_t *g, int state, int nodeid)
+static uint64_t make_event_id(group_t *g, int state, int nodeid)
 {
 	uint64_t id;
 	uint32_t n = nodeid;
@@ -79,7 +79,7 @@
 	return id;
 }
 
-void free_event(event_t *ev)
+static void free_event(event_t *ev)
 {
 	struct nodeid *id, *id_safe;
 
@@ -90,7 +90,7 @@
 	free(ev);
 }
 
-int event_id_to_nodeid(uint64_t id)
+static int event_id_to_nodeid(uint64_t id)
 {
 	int nodeid;
 	uint64_t n = id >> 32;
@@ -98,7 +98,7 @@
 	return nodeid;
 }
 
-int event_id_to_type(uint64_t id)
+static int event_id_to_type(uint64_t id)
 {
 	uint64_t n;
 	n = id & 0x000000000000FFFF;
@@ -119,7 +119,7 @@
 	struct save_msg *save, *tmp;
 	node_t *node;
 	int nodeid, type;
-	char *state_str;
+	const char *state_str;
 
 	list_for_each_entry_safe(save, tmp, &g->messages, list) {
 		if (save->msg.ms_type == MSG_APP_INTERNAL)
@@ -296,7 +296,7 @@
 	return rs;
 }
 
-void _del_recovery_set(group_t *g, int nodeid, int purge)
+static void _del_recovery_set(group_t *g, int nodeid, int purge)
 {
 	struct recovery_set *rs, *rs2;
 	struct recovery_entry *re, *re2;
@@ -352,7 +352,7 @@
    one failed nodeid).  Remove this group from recovery sets for those nodeids
    and free any recovery sets that are now completed. */
 
-void del_recovery_set(group_t *g, event_t *ev, int purge)
+static void del_recovery_set(group_t *g, event_t *ev, int purge)
 {
 	struct nodeid *id;
 
@@ -374,7 +374,7 @@
    callbacks, not cman callbacks, so that's why we might be trying
    to do recovery without having heard from cman yet.] */
 
-int cman_quorum_updated(void)
+static int cman_quorum_updated(void)
 {
 	struct recovery_set *rs;
 
@@ -388,7 +388,7 @@
 	return 1;
 }
 
-int is_recovery_event(event_t *ev)
+static int is_recovery_event(event_t *ev)
 {
 	if (event_id_to_type(ev->id) == 3)
 		return 1;
@@ -447,6 +447,7 @@
 	return 1;
 }
 
+#if 0
 void dump_recovery_sets(void)
 {
 	struct recovery_set *rs;
@@ -461,6 +462,7 @@
 		}
 	}
 }
+#endif
 
 static int group_in_recovery_set(struct recovery_set *rs, group_t *g)
 {
@@ -600,7 +602,7 @@
 	}
 }
 
-event_t *search_event(group_t *g, int nodeid)
+static event_t *search_event(group_t *g, int nodeid)
 {
 	event_t *ev;
 
@@ -611,7 +613,7 @@
 	return NULL;
 }
 
-void dump_queued_events(group_t *g)
+static void dump_queued_events(group_t *g)
 {
 	event_t *ev;
 
@@ -755,7 +757,7 @@
    groupd_down() will fill in stops for us for nodes that fail before
    sending stopped for our leave. */
 
-void finalize_our_leave(group_t *g)
+static void finalize_our_leave(group_t *g)
 {
 	struct recovery_set *rs;
 	struct recovery_entry *re, *re2;
@@ -851,7 +853,7 @@
 {
 	group_t *g;
 	event_t *ev;
-	char *state;
+	const char *state;
 
 	g = find_group_level(name, level);
 	if (!g) {
@@ -877,7 +879,7 @@
 	return send_started(g);
 }
 
-char *ev_state_str(event_t *ev)
+const char *ev_state_str(event_t *ev)
 {
 	switch (ev->state) {
 	case EST_JOIN_BEGIN:
@@ -927,7 +929,7 @@
 	return i;
 }
 
-int event_state_begin(app_t *a)
+static int event_state_begin(app_t *a)
 {
 	if (a->current_event->state == EST_JOIN_BEGIN ||
 	    a->current_event->state == EST_LEAVE_BEGIN ||
@@ -954,6 +956,7 @@
 	return FALSE;
 }
 
+#if 0
 int event_state_all_stopped(app_t *a)
 {
 	if (a->current_event->state == EST_JOIN_ALL_STOPPED ||
@@ -962,8 +965,9 @@
 		return TRUE;
 	return FALSE;
 }
+#endif
 
-int event_state_all_started(app_t *a)
+static int event_state_all_started(app_t *a)
 {
 	if (a->current_event->state == EST_JOIN_ALL_STARTED ||
 	    a->current_event->state == EST_LEAVE_ALL_STARTED ||
@@ -1498,7 +1502,7 @@
 /* handle a node failure while processing an event. returning > 0 means
    we want process_current_event() to be called for the group */
 
-int recover_current_event(group_t *g)
+static int recover_current_event(group_t *g)
 {
 	app_t *a = g->app;
 	event_t *ev, *rev;
diff -Naurd cluster-3.0.0.rc2/group/daemon/cpg.c cluster-3.0.0.rc3/group/daemon/cpg.c
--- cluster-3.0.0.rc2/group/daemon/cpg.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/daemon/cpg.c	2009-06-11 11:02:55.000000000 +0200
@@ -48,7 +48,7 @@
 
 static void block_old_nodes(void);
 
-static char *mode_str(int m)
+static const char *mode_str(int m)
 {
 	switch (m) {
 	case GROUP_PENDING:
@@ -476,7 +476,7 @@
 	return send_message_groupd(&g, &msg, sizeof(msg), MSG_GLOBAL_ID);
 }
 
-void process_groupd_confchg(void)
+static void process_groupd_confchg(void)
 {
 	group_t *g;
 	struct recovery_set *rs;
@@ -598,7 +598,7 @@
 	return 0;
 }
 
-group_t *find_group_by_handle(cpg_handle_t h)
+static group_t *find_group_by_handle(cpg_handle_t h)
 {
 	group_t *g;
 
@@ -609,7 +609,7 @@
 	return NULL;
 }
 
-void deliver_cb(cpg_handle_t handle,
+static void deliver_cb(cpg_handle_t handle,
 		const struct cpg_name *group_name,
 		uint32_t nodeid, uint32_t pid,
 		void *data, size_t data_len)
@@ -650,7 +650,7 @@
 		g = find_group_level(name, msg->ms_level);
 		if (!g) {
 			if (daemon_debug_verbose > 1) {
-				log_print("%d:%s RECV len %d %s from %d, "
+				log_print("%d:%s RECV len %zd %s from %d, "
 					  "no group",
 				  	  msg->ms_level, name, data_len,
 				  	  msg_type(msg->ms_type), nodeid);
@@ -675,7 +675,7 @@
 	}
 
 	if (daemon_debug_verbose > 1)
-		log_group(g, "RECV len %d %s from %d", data_len,
+		log_group(g, "RECV len %zd %s from %d", data_len,
 			  msg_type(msg->ms_type), nodeid);
 
 	save = malloc(sizeof(struct save_msg));
@@ -696,7 +696,7 @@
 	queue_app_message(g, save);
 }
 
-void process_confchg(void)
+static void process_confchg(void)
 {
 	group_t *g;
 	int i;
@@ -744,7 +744,7 @@
 	}
 }
 
-void confchg_cb(cpg_handle_t handle,
+static void confchg_cb(cpg_handle_t handle,
 	        const struct cpg_name *group_name,
 		const struct cpg_address *member_list,
 		size_t member_list_entries,
@@ -754,7 +754,7 @@
 		size_t joined_list_entries)
 {
 	group_t *g;
-	char *name = "unknown";
+	const char *name = "unknown";
 	int i, level = -1;
 
 	if (handle == groupd_handle)
@@ -775,15 +775,15 @@
 	saved_handle = handle;
 
 	if (left_list_entries > MAX_GROUP_MEMBERS) {
-		log_debug("left_list_entries %d", left_list_entries);
+		log_debug("left_list_entries %zd", left_list_entries);
 		left_list_entries = MAX_GROUP_MEMBERS;
 	}
 	if (joined_list_entries > MAX_GROUP_MEMBERS) {
-		log_debug("joined_list_entries %d", joined_list_entries);
+		log_debug("joined_list_entries %zd", joined_list_entries);
 		joined_list_entries = MAX_GROUP_MEMBERS;
 	}
 	if (member_list_entries > MAX_GROUP_MEMBERS) {
-		log_debug("member_list_entries %d", joined_list_entries);
+		log_debug("member_list_entries %zd", joined_list_entries);
 		member_list_entries = MAX_GROUP_MEMBERS;
 	}
 
@@ -812,7 +812,7 @@
 	.cpg_confchg_fn = confchg_cb,
 };
 
-void process_cpg(int ci)
+static void process_cpg(int ci)
 {
 	group_t *g = NULL;
 	cpg_error_t error;
@@ -1047,7 +1047,7 @@
 	return _send_message(g->cpg_handle, g, buf, len);
 }
 
-static void block_old_group(char *name, int level)
+static void block_old_group(const char *name, int level)
 {
 	group_t *g;
 	app_t *a;
diff -Naurd cluster-3.0.0.rc2/group/daemon/gd_internal.h cluster-3.0.0.rc3/group/daemon/gd_internal.h
--- cluster-3.0.0.rc2/group/daemon/gd_internal.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/daemon/gd_internal.h	2009-06-11 11:02:55.000000000 +0200
@@ -256,7 +256,7 @@
 int queue_app_message(group_t *g, struct save_msg *save);
 int do_stopdone(char *name, int level);
 int do_startdone(char *name, int level, int event_nr);
-char *ev_state_str(event_t *ev);
+const char *ev_state_str(event_t *ev);
 event_t *find_queued_recover_event(group_t *g);
 void extend_recover_event(group_t *g, event_t *ev, int nodeid);
 int process_apps(void);
@@ -270,15 +270,15 @@
 void msg_bswap_in(msg_t *msg);
 struct recovery_set *get_recovery_set(int nodeid);
 void groupd_down(int nodeid);
-char *msg_type(int type);
+const char *msg_type(int type);
 int process_app(group_t *g);
 int is_our_join(event_t *ev);
 void purge_node_messages(group_t *g, int nodeid);
 
 /* main.c */
-void read_ccs_name(char *path, char *name);
-void read_ccs_yesno(char *path, int *yes, int *no);
-void read_ccs_int(char *path, int *config_val);
+void read_ccs_name(const char *path, char *name);
+void read_ccs_yesno(const char *path, int *yes, int *no);
+void read_ccs_int(const char *path, int *config_val);
 void app_stop(app_t *a);
 void app_setid(app_t *a);
 void app_start(app_t *a);
@@ -312,13 +312,13 @@
 int do_leave(char *name, int level);
 node_t *new_node(int nodeid);
 group_t *find_group_level(char *name, int level);
-int create_group(char *name, int level, group_t **g_out);
+int create_group(const char *name, int level, group_t **g_out);
 app_t *create_app(group_t *g);
 
 /* logging.c */
 
 void init_logging(void);
-void setup_logging();
+void setup_logging(void);
 void close_logging(void);
 
 #endif				/* __GD_INTERNAL_DOT_H__ */
diff -Naurd cluster-3.0.0.rc2/group/daemon/joinleave.c cluster-3.0.0.rc3/group/daemon/joinleave.c
--- cluster-3.0.0.rc2/group/daemon/joinleave.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/daemon/joinleave.c	2009-06-11 11:02:55.000000000 +0200
@@ -15,7 +15,7 @@
 	return NULL;
 }
 
-int create_group(char *name, int level, group_t **g_out)
+int create_group(const char *name, int level, group_t **g_out)
 {
 	group_t *g;
 
@@ -38,7 +38,7 @@
 	return 0;
 }
 
-void free_group_memb(group_t *g)
+static void free_group_memb(group_t *g)
 {
 	node_t *node, *n;
 
diff -Naurd cluster-3.0.0.rc2/group/daemon/main.c cluster-3.0.0.rc3/group/daemon/main.c
--- cluster-3.0.0.rc2/group/daemon/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/daemon/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -30,7 +30,7 @@
 	int rv, off = 0;
 
 	while (off < count) {
-		rv = read(fd, buf + off, count - off);
+		rv = read(fd, (char *)buf + off, count - off);
 		if (rv == 0)
 			return -1;
 		if (rv == -1 && errno == EINTR)
@@ -47,7 +47,7 @@
 	int rv, off = 0;
 
  retry:
-	rv = write(fd, buf + off, count);
+	rv = write(fd, (char *)buf + off, count);
 	if (rv == -1 && errno == EINTR)
 		goto retry;
 	if (rv < 0) {
@@ -63,7 +63,7 @@
 	return 0;
 }
 
-void read_ccs_name(char *path, char *name)
+void read_ccs_name(const char *path, char *name)
 {
 	char *str;
 	int error;
@@ -77,7 +77,7 @@
 	free(str);
 }
 
-void read_ccs_yesno(char *path, int *yes, int *no)
+void read_ccs_yesno(const char *path, int *yes, int *no)
 {
 	char *str;
 	int error;
@@ -98,7 +98,7 @@
 	free(str);
 }
 
-void read_ccs_int(char *path, int *config_val)
+void read_ccs_int(const char *path, int *config_val)
 {
 	char *str;
 	int val;
@@ -124,7 +124,7 @@
 #define GROUPD_WAIT_PATH "/cluster/group/@groupd_wait"
 #define GROUPD_MODE_DELAY_PATH "/cluster/group/@groupd_mode_delay"
 
-int setup_ccs(void)
+static int setup_ccs(void)
 {
 	int cd;
 
@@ -150,7 +150,7 @@
 	return 0;
 }
 
-void close_ccs(void)
+static void close_ccs(void)
 {
 	ccs_disconnect(ccs_handle);
 }
@@ -297,7 +297,7 @@
 	DO_GET_VERSION,
 };
 
-int get_action(char *buf)
+static int get_action(char *buf)
 {
 	char act[16];
 	int i;
@@ -441,7 +441,7 @@
 	data->id = g->global_id;
 
 	if (g->app && g->app->current_event) {
-		event_t *ev = g->app->current_event;
+		ev = g->app->current_event;
 		data->event_state = ev->state;
 		data->event_nodeid = ev->nodeid;
 		data->event_id = ev->id;
@@ -697,7 +697,7 @@
 	log_debug("client connection %d fd %d", i, fd);
 }
 
-static int setup_listener(char *sock_path)
+static int setup_listener(const char *sock_path)
 {
 	struct sockaddr_un addr;
 	socklen_t addrlen;
diff -Naurd cluster-3.0.0.rc2/group/dlm_controld/action.c cluster-3.0.0.rc3/group/dlm_controld/action.c
--- cluster-3.0.0.rc2/group/dlm_controld/action.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/dlm_controld/action.c	2009-06-11 11:02:55.000000000 +0200
@@ -18,7 +18,8 @@
 static int get_mountgroup_name(uint32_t mg_id)
 {
 	char path[PATH_MAX];
-	char *fsname, *fsdir;
+	char *fsname;
+	const char *fsdir;
 	DIR *d;
 	FILE *file;
 	struct dirent *de;
@@ -153,7 +154,7 @@
 	ls->associated_mg_id = mg_id;
 }
 
-static int do_sysfs(char *name, char *file, char *val)
+static int do_sysfs(const char *name, const char *file, char *val)
 {
 	char fname[512];
 	int rv, fd;
@@ -246,7 +247,7 @@
 	return 0;
 }
 
-static int create_path(char *path)
+static int create_path(const char *path)
 {
 	mode_t old_umask;
 	int rv;
@@ -685,7 +686,7 @@
 		return -1;
 	}
 
-	rv = do_write(fd, "1", strlen("1"));
+	rv = do_write(fd, (void *)"1", strlen("1"));
 	if (rv < 0) {
 		log_error("%s: write failed: %d", path, errno);
 		close(fd);
@@ -877,7 +878,7 @@
 		log_error("Is dlm missing from kernel? No misc devices found.");
 }
 
-static int find_udev_device(char *path, uint32_t minor)
+static int find_udev_device(const char *path, uint32_t minor)
 {
 	struct stat st;
 	int i;
diff -Naurd cluster-3.0.0.rc2/group/dlm_controld/config.c cluster-3.0.0.rc3/group/dlm_controld/config.c
--- cluster-3.0.0.rc2/group/dlm_controld/config.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/dlm_controld/config.c	2009-06-11 11:02:55.000000000 +0200
@@ -127,7 +127,7 @@
 	return w;
 }
 
-void read_ccs_name(char *path, char *name)
+void read_ccs_name(const char *path, char *name)
 {
 	char *str;
 	int error;
@@ -141,7 +141,7 @@
 	free(str);
 }
 
-void read_ccs_yesno(char *path, int *yes, int *no)
+void read_ccs_yesno(const char *path, int *yes, int *no)
 {
 	char *str;
 	int error;
@@ -162,7 +162,7 @@
 	free(str);
 }
 
-int read_ccs_int(char *path, int *config_val)
+int read_ccs_int(const char *path, int *config_val)
 {
 	char *str;
 	int val;
@@ -185,7 +185,7 @@
 	return 0;
 }
 
-static void read_ccs_protocol(char *path, int *config_val)
+static void read_ccs_protocol(const char *path, int *config_val)
 {
 	char *str;
 	int val;
diff -Naurd cluster-3.0.0.rc2/group/dlm_controld/cpg.c cluster-3.0.0.rc3/group/dlm_controld/cpg.c
--- cluster-3.0.0.rc2/group/dlm_controld/cpg.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/dlm_controld/cpg.c	2009-06-11 11:02:55.000000000 +0200
@@ -127,7 +127,7 @@
 	}
 }
 
-char *msg_name(int type)
+const char *msg_name(int type)
 {
 	switch (type) {
 	case DLM_MSG_PROTOCOL:
@@ -1369,7 +1369,7 @@
 	}
 
 	if (len < sizeof(*hd)) {
-		log_error("deliver_cb short message %d", len);
+		log_error("deliver_cb short message %zd", len);
 		return;
 	}
 
@@ -1960,7 +1960,7 @@
 	struct dlm_header *hd;
 
 	if (len < sizeof(*hd)) {
-		log_error("deliver_cb short message %d", len);
+		log_error("deliver_cb short message %zd", len);
 		return;
 	}
 
diff -Naurd cluster-3.0.0.rc2/group/dlm_controld/deadlock.c cluster-3.0.0.rc3/group/dlm_controld/deadlock.c
--- cluster-3.0.0.rc2/group/dlm_controld/deadlock.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/dlm_controld/deadlock.c	2009-06-11 11:02:55.000000000 +0200
@@ -97,7 +97,7 @@
 	return __dlm_compat_matrix[mode1 + 1][mode2 + 1];
 }
 
-static char *status_str(int lksts)
+static const char *status_str(int lksts)
 {
 	switch (lksts) {
 	case DLM_LKSTS_WAITING:
diff -Naurd cluster-3.0.0.rc2/group/dlm_controld/dlm_daemon.h cluster-3.0.0.rc3/group/dlm_controld/dlm_daemon.h
--- cluster-3.0.0.rc2/group/dlm_controld/dlm_daemon.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/dlm_controld/dlm_daemon.h	2009-06-11 11:02:55.000000000 +0200
@@ -225,9 +225,9 @@
 /* config.c */
 int setup_ccs(void);
 void close_ccs(void);
-void read_ccs_name(char *path, char *name);
-void read_ccs_yesno(char *path, int *yes, int *no);
-int read_ccs_int(char *path, int *config_val);
+void read_ccs_name(const char *path, char *name);
+void read_ccs_yesno(const char *path, int *yes, int *no);
+int read_ccs_int(const char *path, int *config_val);
 int get_weight(int nodeid, char *lockspace);
 
 /* cpg.c */
@@ -239,7 +239,7 @@
 void dlm_send_message(struct lockspace *ls, char *buf, int len);
 int dlm_join_lockspace(struct lockspace *ls);
 int dlm_leave_lockspace(struct lockspace *ls);
-char *msg_name(int type);
+const char *msg_name(int type);
 void update_flow_control_status(void);
 int set_node_info(struct lockspace *ls, int nodeid, struct dlmc_node *node);
 int set_lockspace_info(struct lockspace *ls, struct dlmc_lockspace *lockspace);
@@ -274,7 +274,7 @@
 void client_back(int ci, int fd);
 struct lockspace *find_ls(char *name);
 struct lockspace *find_ls_id(uint32_t id);
-char *dlm_mode_str(int mode);
+const char *dlm_mode_str(int mode);
 void cluster_dead(int ci);
 
 /* member_cman.c */
@@ -344,7 +344,7 @@
 
 /* logging.c */
 void init_logging(void);
-void setup_logging();
+void setup_logging(void);
 void close_logging(void);
 
 /* crc.c */
diff -Naurd cluster-3.0.0.rc2/group/dlm_controld/main.c cluster-3.0.0.rc3/group/dlm_controld/main.c
--- cluster-3.0.0.rc2/group/dlm_controld/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/dlm_controld/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -32,7 +32,7 @@
 	int rv, off = 0;
 
 	while (off < count) {
-		rv = read(fd, buf + off, count - off);
+		rv = read(fd, (char *)buf + off, count - off);
 		if (rv == 0)
 			return -1;
 		if (rv == -1 && errno == EINTR)
@@ -49,7 +49,7 @@
 	int rv, off = 0;
 
  retry:
-	rv = write(fd, buf + off, count);
+	rv = write(fd, (char *)buf + off, count);
 	if (rv == -1 && errno == EINTR)
 		goto retry;
 	if (rv < 0) {
@@ -268,7 +268,7 @@
 	return rp;
 }
 
-char *dlm_mode_str(int mode)
+const char *dlm_mode_str(int mode)
 {
 	switch (mode) {
 	case DLM_LOCK_IV:
@@ -719,7 +719,7 @@
 	log_debug("client connection %d fd %d", i, fd);
 }
 
-static int setup_listener(char *sock_path)
+static int setup_listener(const char *sock_path)
 {
 	struct sockaddr_un addr;
 	socklen_t addrlen;
@@ -754,12 +754,12 @@
 	return s;
 }
 
-void query_lock(void)
+static void query_lock(void)
 {
 	pthread_mutex_lock(&query_mutex);
 }
 
-void query_unlock(void)
+static void query_unlock(void)
 {
 	pthread_mutex_unlock(&query_mutex);
 }
@@ -1276,7 +1276,7 @@
 	}
 	lockfile();
 	init_logging();
-	log_level(LOG_INFO, "dlm_controld %s", RELEASE_VERSION);
+	log_level(LOG_INFO, "dlm_controld %s started", RELEASE_VERSION);
 	signal(SIGTERM, sigterm_handler);
 	set_scheduler();
 	set_oom_adj(-16);
diff -Naurd cluster-3.0.0.rc2/group/dlm_controld/netlink.c cluster-3.0.0.rc3/group/dlm_controld/netlink.c
--- cluster-3.0.0.rc2/group/dlm_controld/netlink.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/dlm_controld/netlink.c	2009-06-11 11:02:55.000000000 +0200
@@ -9,7 +9,7 @@
 
 /* FIXME: look into using libnl/libnetlink */
 
-#define GENLMSG_DATA(glh)       ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN))
+#define GENLMSG_DATA(glh)       ((void *)((char *)NLMSG_DATA(glh) + GENL_HDRLEN))
 #define GENLMSG_PAYLOAD(glh)    (NLMSG_PAYLOAD(glh, 0) - GENL_HDRLEN)
 #define NLA_DATA(na)	    	((void *)((char*)(na) + NLA_HDRLEN))
 #define NLA_PAYLOAD(len)	(len - NLA_HDRLEN)
diff -Naurd cluster-3.0.0.rc2/group/dlm_controld/plock.c cluster-3.0.0.rc3/group/dlm_controld/plock.c
--- cluster-3.0.0.rc2/group/dlm_controld/plock.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/dlm_controld/plock.c	2009-06-11 11:02:55.000000000 +0200
@@ -114,7 +114,7 @@
 	i->owner	= le64_to_cpu(i->owner);
 }
 
-static char *op_str(int optype)
+static const char *op_str(int optype)
 {
 	switch (optype) {
 	case DLM_PLOCK_OP_LOCK:
@@ -128,7 +128,7 @@
 	}
 }
 
-static char *ex_str(int optype, int ex)
+static const char *ex_str(int optype, int ex)
 {
 	if (optype == DLM_PLOCK_OP_UNLOCK || optype == DLM_PLOCK_OP_GET)
 		return "-";
@@ -1544,11 +1544,6 @@
 	}
 }
 
-void plock_exit(void)
-{
-	saCkptFinalize(system_ckpt_handle);
-}
-
 /* locks still marked SYNCING should not go into the ckpt; the new node
    will get those locks by receiving PLOCK_SYNC messages */
 
@@ -1670,7 +1665,7 @@
 	log_group(ls, "unlink ckpt %llx", (unsigned long long)h);
 
 	if (!h)
-		return;
+		return ret;
 
  unlink_retry:
 	rv = saCkptCheckpointUnlink(system_ckpt_handle, name);
diff -Naurd cluster-3.0.0.rc2/group/gfs_control/main.c cluster-3.0.0.rc3/group/gfs_control/main.c
--- cluster-3.0.0.rc2/group/gfs_control/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/gfs_control/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -23,7 +23,6 @@
 #define OP_LEAVE			5
 #define OP_JOINLEAVE			6
 
-static char *prog_name;
 static char *fsname;
 static int operation;
 static int opt_ind;
@@ -36,7 +35,7 @@
 struct gfsc_node nodes[MAX_NODES];
 
 
-static void print_usage(void)
+static void print_usage(const char *prog_name)
 {
 	printf("Usage:\n");
 	printf("\n");
@@ -64,13 +63,13 @@
 			break;
 
 		case 'h':
-			print_usage();
+			print_usage(argv[0]);
 			exit(EXIT_SUCCESS);
 			break;
 
 		case 'V':
 			printf("%s %s (built %s %s)\n",
-				prog_name, RELEASE_VERSION, __DATE__, __TIME__);
+				argv[0], RELEASE_VERSION, __DATE__, __TIME__);
 			/* printf("%s\n", REDHAT_COPYRIGHT); */
 			exit(EXIT_SUCCESS);
 			break;
@@ -124,7 +123,7 @@
 	}
 
 	if (!operation || !opt_ind) {
-		print_usage();
+		print_usage(argv[0]);
 		exit(EXIT_FAILURE);
 	}
 
@@ -141,7 +140,7 @@
 	int rv, off = 0;
 
  retry:
-	rv = write(fd, buf + off, count);
+	rv = write(fd, (char *)buf + off, count);
 	if (rv == -1 && errno == EINTR)
 		goto retry;
 	if (rv < 0)
@@ -155,7 +154,7 @@
 	return 0;
 }
 
-void do_leave(char *table)
+static void do_leave(char *table)
 {
 	struct gfsc_mount_args ma;
 	int rv;
@@ -169,7 +168,7 @@
 		fprintf(stderr, "gfs_controld leave error %d\n", rv);
 }
 
-char *mg_flags_str(uint32_t flags)
+static char *mg_flags_str(uint32_t flags)
 {
 	static char str[128];
 	int i = 0;
@@ -214,7 +213,7 @@
 	return str;
 }
 
-char *node_mount_str(uint32_t flags)
+static char *node_mount_str(uint32_t flags)
 {
 	static char str[128];
 	int i = 0;
@@ -246,7 +245,7 @@
 	return str;
 }
 
-int member_int(struct gfsc_node *n)
+static int member_int(struct gfsc_node *n)
 {
 	if (n->flags & GFSC_NF_DISALLOWED)
 		return -1;
@@ -255,7 +254,7 @@
 	return 0;
 }
 
-char *condition_str(int cond)
+static const char *condition_str(int cond)
 {
 	switch (cond) {
 	case 0:
@@ -273,9 +272,9 @@
 	}
 }
 
-static void show_nodeids(int count, struct gfsc_node *nodes)
+static void show_nodeids(int count, struct gfsc_node *nodes_in)
 {
-	struct gfsc_node *n = nodes;
+	struct gfsc_node *n = nodes_in;
 	int i;
 
 	for (i = 0; i < count; i++) {
@@ -346,9 +345,9 @@
 	show_nodeids(node_count, nodes);
 }
 
-static void show_all_nodes(int count, struct gfsc_node *nodes)
+static void show_all_nodes(int count, struct gfsc_node *nodes_in)
 {
-	struct gfsc_node *n = nodes;
+	struct gfsc_node *n = nodes_in;
 	int i;
 
 	for (i = 0; i < count; i++) {
@@ -439,7 +438,6 @@
 
 int main(int argc, char **argv)
 {
-	prog_name = argv[0];
 	decode_arguments(argc, argv);
 
 	switch (operation) {
diff -Naurd cluster-3.0.0.rc2/group/gfs_controld/config.c cluster-3.0.0.rc3/group/gfs_controld/config.c
--- cluster-3.0.0.rc2/group/gfs_controld/config.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/gfs_controld/config.c	2009-06-11 11:02:55.000000000 +0200
@@ -53,7 +53,7 @@
 int cfgd_drop_resources_count	= DEFAULT_DROP_RESOURCES_COUNT;
 int cfgd_drop_resources_age	= DEFAULT_DROP_RESOURCES_AGE;
 
-void read_ccs_name(char *path, char *name)
+void read_ccs_name(const char *path, char *name)
 {
 	char *str;
 	int error;
@@ -67,7 +67,7 @@
 	free(str);
 }
 
-void read_ccs_yesno(char *path, int *yes, int *no)
+void read_ccs_yesno(const char *path, int *yes, int *no)
 {
 	char *str;
 	int error;
@@ -88,7 +88,7 @@
 	free(str);
 }
 
-int read_ccs_int(char *path, int *config_val)
+int read_ccs_int(const char *path, int *config_val)
 {
 	char *str;
 	int val;
diff -Naurd cluster-3.0.0.rc2/group/gfs_controld/cpg-new.c cluster-3.0.0.rc3/group/gfs_controld/cpg-new.c
--- cluster-3.0.0.rc2/group/gfs_controld/cpg-new.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/gfs_controld/cpg-new.c	2009-06-11 11:02:55.000000000 +0200
@@ -261,7 +261,7 @@
 static void send_withdraw_acks(struct mountgroup *mg);
 static void leave_mountgroup(struct mountgroup *mg, int mnterr);
 
-static char *msg_name(int type)
+static const char *msg_name(int type)
 {
 	switch (type) {
 	case GFS_MSG_PROTOCOL:
@@ -2544,7 +2544,7 @@
 	}
 
 	if (len < sizeof(*hd)) {
-		log_error("deliver_cb short message %d", len);
+		log_error("deliver_cb short message %zd", len);
 		return;
 	}
 
@@ -3150,7 +3150,7 @@
 	struct gfs_header *hd;
 
 	if (len < sizeof(*hd)) {
-		log_error("deliver_cb short message %d", len);
+		log_error("deliver_cb short message %zd", len);
 		return;
 	}
 
diff -Naurd cluster-3.0.0.rc2/group/gfs_controld/cpg-old.c cluster-3.0.0.rc3/group/gfs_controld/cpg-old.c
--- cluster-3.0.0.rc2/group/gfs_controld/cpg-old.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/gfs_controld/cpg-old.c	2009-06-11 11:02:55.000000000 +0200
@@ -45,7 +45,7 @@
 static void send_journals(struct mountgroup *mg, int nodeid);
 
 
-static char *msg_name(int type)
+static const char *msg_name(int type)
 {
 	switch (type) {
 	case MSG_JOURNAL:
@@ -183,7 +183,7 @@
 	sm->len = len;
 	sm->nodeid = from;
 
-	log_group(mg, "save %s from %d len %d", msg_name(type), from, len);
+	log_group(mg, "save %s from %d len %zd", msg_name(type), from, len);
 
 	list_add_tail(&sm->list, &mg->saved_messages);
 }
@@ -209,7 +209,7 @@
 	return 0;
 }
 
-int remote_first_mounter_recovery(struct mountgroup *mg)
+static int remote_first_mounter_recovery(struct mountgroup *mg)
 {
 	int nodeid;
 
@@ -345,7 +345,7 @@
 			break;
 		}
 
-		log_group(mg, "receive_recovery_status from %d len %d "
+		log_group(mg, "receive_recovery_status from %d len %zd "
 			  "nodeid %d jid %d status %d found %d",
 			  from, len, nodeid, jid, status, found);
 	}
@@ -506,7 +506,7 @@
 static void receive_mount_status(struct mountgroup *mg, char *buf, size_t len,
 				 int from)
 {
-	log_group(mg, "receive_mount_status from %d len %d last_cb %d",
+	log_group(mg, "receive_mount_status from %d len %zd last_cb %d",
 		  from, len, mg->last_callback);
 
 	if (!mg->got_our_options) {
@@ -917,7 +917,7 @@
 	struct gdlm_header *hd = (struct gdlm_header *)buf;
 	struct mg_member *memb;
 
-	log_group(mg, "receive_options from %d len %d last_cb %d",
+	log_group(mg, "receive_options from %d len %zd last_cb %d",
 		  from, len, mg->last_callback);
 
 	if (hd->nodeid == our_nodeid) {
@@ -1123,7 +1123,7 @@
 
 	count = (len - sizeof(struct gdlm_header)) / (NUM * sizeof(int));
 
-	log_group(mg, "receive_journals from %d to %d len %d count %d cb %d",
+	log_group(mg, "receive_journals from %d to %d len %zd count %d cb %d",
 		  from, hd->to_nodeid, len, count, mg->last_callback);
 
 	/* just like we can receive an options msg from a newly added node
@@ -1611,7 +1611,7 @@
 {
 	struct mountgroup *mg;
 	struct mg_member *memb;
-	char *ss;
+	const char *ss;
 	int rv, found = 0;
 
 	mg = find_mg(name);
@@ -2268,7 +2268,7 @@
 	   discard them since they're only relevant to the app group. */
 
 	if (!mg->last_callback) {
-		log_group(mg, "discard %s len %d from %d",
+		log_group(mg, "discard %s len %zd from %d",
 			  msg_name(hd->type), len, nodeid);
 		return;
 	}
diff -Naurd cluster-3.0.0.rc2/group/gfs_controld/gfs_daemon.h cluster-3.0.0.rc3/group/gfs_controld/gfs_daemon.h
--- cluster-3.0.0.rc2/group/gfs_controld/gfs_daemon.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/gfs_controld/gfs_daemon.h	2009-06-11 11:02:55.000000000 +0200
@@ -214,9 +214,9 @@
 /* config.c */
 int setup_ccs(void);
 void close_ccs(void);
-void read_ccs_name(char *path, char *name);
-void read_ccs_yesno(char *path, int *yes, int *no);
-int read_ccs_int(char *path, int *config_val);
+void read_ccs_name(const char *path, char *name);
+void read_ccs_yesno(const char *path, int *yes, int *no);
+int read_ccs_int(const char *path, int *config_val);
 void read_ccs_nodir(struct mountgroup *mg, char *buf);
 
 /* cpg-new.c */
@@ -317,8 +317,8 @@
 
 /* util.c */
 int we_are_in_fence_domain(void);
-int set_sysfs(struct mountgroup *mg, char *field, int val);
-int read_sysfs_int(struct mountgroup *mg, char *field, int *val_out);
+int set_sysfs(struct mountgroup *mg, const char *field, int val);
+int read_sysfs_int(struct mountgroup *mg, const char *field, int *val_out);
 int run_dmsetup_suspend(struct mountgroup *mg, char *dev);
 void update_dmsetup_wait(void);
 void update_flow_control_status(void);
@@ -326,7 +326,7 @@
 
 /* logging.c */
 void init_logging(void);
-void setup_logging();
+void setup_logging(void);
 void close_logging(void);
 
 /* crc.c */
diff -Naurd cluster-3.0.0.rc2/group/gfs_controld/group.c cluster-3.0.0.rc3/group/gfs_controld/group.c
--- cluster-3.0.0.rc2/group/gfs_controld/group.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/gfs_controld/group.c	2009-06-11 11:02:55.000000000 +0200
@@ -286,7 +286,7 @@
 	return 0;
 }
 
-int list_count(struct list_head *head)
+static int list_count(struct list_head *head)
 {
 	struct list_head *tmp;
 	int count = 0;
diff -Naurd cluster-3.0.0.rc2/group/gfs_controld/main.c cluster-3.0.0.rc3/group/gfs_controld/main.c
--- cluster-3.0.0.rc2/group/gfs_controld/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/gfs_controld/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -30,7 +30,7 @@
 	int rv, off = 0;
 
 	while (off < count) {
-		rv = read(fd, buf + off, count - off);
+		rv = read(fd, (char *)buf + off, count - off);
 		if (rv == 0)
 			return -1;
 		if (rv == -1 && errno == EINTR)
@@ -47,7 +47,7 @@
 	int rv, off = 0;
 
  retry:
-	rv = write(fd, buf + off, count);
+	rv = write(fd, (char *)buf + off, count);
 	if (rv == -1 && errno == EINTR)
 		goto retry;
 	if (rv < 0) {
@@ -984,7 +984,7 @@
 	log_debug("client connection %d fd %d", i, fd);
 }
 
-static int setup_listener(char *sock_path)
+static int setup_listener(const char *sock_path)
 {
 	struct sockaddr_un addr;
 	socklen_t addrlen;
@@ -1525,7 +1525,7 @@
 	}
 	lockfile();
 	init_logging();
-	log_level(LOG_INFO, "gfs_controld %s", RELEASE_VERSION);
+	log_level(LOG_INFO, "gfs_controld %s started", RELEASE_VERSION);
 	signal(SIGTERM, sigterm_handler);
 	set_scheduler();
 	set_oom_adj(-16);
diff -Naurd cluster-3.0.0.rc2/group/gfs_controld/plock.c cluster-3.0.0.rc3/group/gfs_controld/plock.c
--- cluster-3.0.0.rc2/group/gfs_controld/plock.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/gfs_controld/plock.c	2009-06-11 11:02:55.000000000 +0200
@@ -107,7 +107,7 @@
 	i->owner	= le64_to_cpu(i->owner);
 }
 
-static char *op_str(int optype)
+static const char *op_str(int optype)
 {
 	switch (optype) {
 	case DLM_PLOCK_OP_LOCK:
@@ -121,7 +121,7 @@
 	}
 }
 
-static char *ex_str(int optype, int ex)
+static const char *ex_str(int optype, int ex)
 {
 	if (optype == DLM_PLOCK_OP_UNLOCK || optype == DLM_PLOCK_OP_GET)
 		return "-";
@@ -1615,12 +1615,6 @@
 	}
 }
 
-void plock_exit(void)
-{
-	if (cfgd_enable_plock)
-		saCkptFinalize(ckpt_handle);
-}
-
 /* locks still marked SYNCING should not go into the ckpt; the new node
    will get those locks by receiving PLOCK_SYNC messages */
 
@@ -2326,7 +2320,7 @@
 		log_error("Is lock_dlm or dlm missing from kernel? No misc devices found.");
 }
 
-static int find_udev_device(char *path, uint32_t minor)
+static int find_udev_device(const char *path, uint32_t minor)
 {
 	struct stat st;
 	int i;
diff -Naurd cluster-3.0.0.rc2/group/gfs_controld/util.c cluster-3.0.0.rc3/group/gfs_controld/util.c
--- cluster-3.0.0.rc2/group/gfs_controld/util.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/gfs_controld/util.c	2009-06-11 11:02:55.000000000 +0200
@@ -47,7 +47,7 @@
 #define SYSFS_DIR       "/sys/fs"
 #define SYSFS_BUFLEN    64
 
-int set_sysfs(struct mountgroup *mg, char *field, int val)
+int set_sysfs(struct mountgroup *mg, const char *field, int val)
 {
 	char fname[PATH_MAX];
 	char out[SYSFS_BUFLEN];
@@ -78,7 +78,7 @@
 	return rv;
 }
 
-static int get_sysfs(struct mountgroup *mg, char *field, char *buf, int len)
+static int get_sysfs(struct mountgroup *mg, const char *field, char *buf, int len)
 {
 	char fname[PATH_MAX], *p;
 	int fd, rv;
@@ -108,7 +108,7 @@
 	return rv;
 }
 
-int read_sysfs_int(struct mountgroup *mg, char *field, int *val_out)
+int read_sysfs_int(struct mountgroup *mg, const char *field, int *val_out)
 {
 	char buf[SYSFS_BUFLEN];
 	int rv;
@@ -213,7 +213,7 @@
 	}
 }
 
-static int ignore_nolock(char *sysfs_dir, char *table)
+static int ignore_nolock(const char *sysfs_dir, char *table)
 {
 	char path[PATH_MAX];
 	int fd;
diff -Naurd cluster-3.0.0.rc2/group/lib/libgroup.c cluster-3.0.0.rc3/group/lib/libgroup.c
--- cluster-3.0.0.rc2/group/lib/libgroup.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/lib/libgroup.c	2009-06-11 11:02:55.000000000 +0200
@@ -131,7 +131,7 @@
 	int rv, off = 0;
 
  retry:
-	rv = write(fd, buf + off, count);
+	rv = write(fd, (char *)buf + off, count);
 	if (rv == -1 && errno == EINTR)
 		goto retry;
 	if (rv < 0)
@@ -150,7 +150,7 @@
 	int rv, off = 0;
 
 	while (off < count) {
-		rv = read(fd, buf + off, count - off);
+		rv = read(fd, (char *)buf + off, count - off);
 		if (rv == 0)
 			return -1;
 		if (rv == -1 && errno == EINTR)
@@ -172,7 +172,7 @@
 	char prog_name[32];
 };
 
-static int _joinleave(group_handle_t handle, char *name, char *cmd)
+static int _joinleave(group_handle_t handle, const char *name, const char *cmd)
 {
 	char buf[GROUPD_MSGLEN];
 	struct group_handle *h = (struct group_handle *) handle;
@@ -259,7 +259,7 @@
 	return fd;
 }
 
-group_handle_t group_init(void *private, char *prog_name, int level,
+group_handle_t group_init(void *private, const char *prog_name, int level,
 			  group_callbacks_t *cbs, int timeout)
 {
 	struct group_handle *h;
diff -Naurd cluster-3.0.0.rc2/group/lib/libgroup.h cluster-3.0.0.rc3/group/lib/libgroup.h
--- cluster-3.0.0.rc2/group/lib/libgroup.h	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/lib/libgroup.h	2009-06-11 11:02:55.000000000 +0200
@@ -36,7 +36,7 @@
 	group_deliver_t deliver;
 } group_callbacks_t;
 
-group_handle_t group_init(void *priv, char *prog_name, int level, group_callbacks_t *cbs, int timeout);
+group_handle_t group_init(void *priv, const char *prog_name, int level, group_callbacks_t *cbs, int timeout);
 int group_exit(group_handle_t handle);
 
 int group_join(group_handle_t handle, char *name);
diff -Naurd cluster-3.0.0.rc2/group/libgfscontrol/main.c cluster-3.0.0.rc3/group/libgfscontrol/main.c
--- cluster-3.0.0.rc2/group/libgfscontrol/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/libgfscontrol/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -16,7 +16,7 @@
 	int rv, off = 0;
 
 	while (off < count) {
-		rv = read(fd, buf + off, count - off);
+		rv = read(fd, (char *)buf + off, count - off);
 		if (rv == 0)
 			return -1;
 		if (rv == -1 && errno == EINTR)
@@ -33,7 +33,7 @@
 	int rv, off = 0;
 
  retry:
-	rv = write(fd, buf + off, count);
+	rv = write(fd, (char *)buf + off, count);
 	if (rv == -1 && errno == EINTR)
 		goto retry;
 	if (rv < 0) {
@@ -48,7 +48,7 @@
 	return 0;
 }
 
-static int do_connect(char *sock_path)
+static int do_connect(const char *sock_path)
 {
 	struct sockaddr_un sun;
 	socklen_t addrlen;
@@ -86,7 +86,7 @@
 		strncpy(h->name, name, GFS_MOUNTGROUP_LEN);
 }
 
-int do_dump(int cmd, char *name, char *buf)
+static int do_dump(int cmd, char *name, char *buf)
 {
 	struct gfsc_header h, *rh;
 	char *reply;
diff -Naurd cluster-3.0.0.rc2/group/tool/main.c cluster-3.0.0.rc3/group/tool/main.c
--- cluster-3.0.0.rc2/group/tool/main.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/group/tool/main.c	2009-06-11 11:02:55.000000000 +0200
@@ -48,7 +48,7 @@
 	int rv, off = 0;
 
  retry:
-	rv = write(fd, buf + off, count);
+	rv = write(fd, (char *)buf + off, count);
 	if (rv == -1 && errno == EINTR)
 		goto retry;
 	if (rv < 0)
@@ -67,7 +67,7 @@
 	int rv, off = 0;
 
 	while (off < count) {
-		rv = read(fd, buf + off, count - off);
+		rv = read(fd, (char *)buf + off, count - off);
 		if (rv == 0)
 			return -1;
 		if (rv == -1 && errno == EINTR)
@@ -207,7 +207,7 @@
 #define EST_FAIL_START_WAIT   14
 #define EST_FAIL_ALL_STARTED  15
 
-char *ev_state_str(state)
+static const char *ev_state_str(int state)
 {
 	switch (state) {
 	case EST_JOIN_BEGIN:
@@ -245,10 +245,10 @@
 	}
 }
 
-char *state_str(group_data_t *data)
+static const char *state_str(group_data_t *data)
 {
 	static char buf[128];
-	
+
 	memset(buf, 0, sizeof(buf));
 
 	if (!data->event_state && !data->event_nodeid)
@@ -283,7 +283,8 @@
 {
 	group_data_t data[MAX_GROUPS];
 	int i, j, rv, count = 0, level, ret = 0;
-	char *name, *state_header;
+	char *name;
+	const char *state_header;
 	int type_width = 16;
 	int level_width = 5;
 	int name_width = 32;
@@ -301,7 +302,8 @@
 		count = 1;
 
 		/* don't output if there's no group at all */
-		if (data[0].id == 0) {
+		if (data[0].id == 0 && !strlen(data[0].name) && 
+		    !strlen(data[0].client_name)) {
 			fprintf(stderr, "groupd has no information about "
 			        "the specified group\n");
 			return 1;
@@ -557,7 +559,7 @@
 }
 #endif
 
-static int connect_daemon(char *path)
+static int connect_daemon(const char *path)
 {
 	struct sockaddr_un sun;
 	socklen_t addrlen;
diff -Naurd cluster-3.0.0.rc2/make/clean.mk cluster-3.0.0.rc3/make/clean.mk
--- cluster-3.0.0.rc2/make/clean.mk	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/make/clean.mk	2009-06-11 11:02:55.000000000 +0200
@@ -3,5 +3,5 @@
 	rm -rf core core.* .depend cscope.* *.orig *.rej
 	rm -rf linux .*.o.cmd .*.ko.cmd *.mod.c .tmp_versions
 	rm -rf Module.symvers Module.markers .*.o.d modules.order
-	rm -rf ${TARGET} ${TARGETS} ${TARGET}_test ${TARGET}.pc
+	rm -rf ${TARGET} ${TARGETS} ${TARGET}_test *.pc
 	rm -rf ${TARGET1} ${TARGET2} ${TARGET3} ${TARGET4} ${TARGET5} ${TARGET6}
diff -Naurd cluster-3.0.0.rc2/make/defines.mk.input cluster-3.0.0.rc3/make/defines.mk.input
--- cluster-3.0.0.rc2/make/defines.mk.input	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/make/defines.mk.input	2009-06-11 11:02:55.000000000 +0200
@@ -47,8 +47,6 @@
 fencelibdir ?= @FENCELIBDIR@
 logtincdir ?= @LOGTINCDIR@
 logtlibdir ?= @LOGTLIBDIR@
-volidincdir ?= @VOLIDINCDIR@
-volidlibdir ?= @VOLIDLIBDIR@
 readlineincdir ?= @READLINEINCDIR@
 readlinelibdir ?= @READLINELIBDIR@
 ncursesincdir ?= @NCURSESINCDIR@
@@ -80,7 +78,6 @@
 without_gfs-kernel/src/gfs ?= @DISABLE_GFSKERNEL@
 without_common ?= @DISABLE_COMMON@
 without_config ?= @DISABLE_CONFIG@
-without_cman/lib ?= @DISABLE_CMAN@
 without_cman ?= @DISABLE_CMAN@
 without_dlm ?= @DISABLE_DLM@
 without_group ?= @DISABLE_GROUP@
diff -Naurd cluster-3.0.0.rc2/make/official_release_version cluster-3.0.0.rc3/make/official_release_version
--- cluster-3.0.0.rc2/make/official_release_version	2009-05-07 09:29:45.000000000 +0200
+++ cluster-3.0.0.rc3/make/official_release_version	2009-06-11 15:46:20.000000000 +0200
@@ -1,2 +1,2 @@
 SONAME "3.0"
-VERSION "3.0.0.rc2"
+VERSION "3.0.0.rc3"
diff -Naurd cluster-3.0.0.rc2/make/perl-binding-common.mk cluster-3.0.0.rc3/make/perl-binding-common.mk
--- cluster-3.0.0.rc2/make/perl-binding-common.mk	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/make/perl-binding-common.mk	2009-06-11 11:02:55.000000000 +0200
@@ -27,4 +27,4 @@
 
 clean:
 	-${MAKE} -f Makefile clean
-	rm -f $(TARGET) Makefile.old
+	rm -f $(TARGET) Makefile.old *.d
diff -Naurd cluster-3.0.0.rc2/make/release.mk cluster-3.0.0.rc3/make/release.mk
--- cluster-3.0.0.rc2/make/release.mk	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/make/release.mk	2009-06-11 11:02:55.000000000 +0200
@@ -19,59 +19,65 @@
 
 else
 
+ifdef RELEASE
+TEST=""
+else
+TEST="test"
+endif
+
 ## setup stuff
 
 MASTERPROJECT=cluster
+
+ifdef RELEASE
 MASTERPV=$(MASTERPROJECT)-$(VERSION)
-MASTERTGZ=$(MASTERPV).tar.gz
-TESTTGZ=TEST-$(MASTERTGZ)
+else
+MASTERPV=HEAD
+endif
+MASTERTGZ=$(TEST)$(MASTERPROJECT)-$(VERSION).tar.gz
 
 # fence-agents
 FENCEPROJECT=fence-agents
 FENCEPV=$(FENCEPROJECT)-$(VERSION)
-FENCETGZ=$(FENCEPV).tar.gz
+FENCETGZ=$(TEST)$(FENCEPV).tar.gz
 
 # resource-agents
 RASPROJECT=resource-agents
 RASPV=$(RASPROJECT)-$(VERSION)
-RASTGZ=$(RASPV).tar.gz
-
-all: test-tarball
-
-test-tarball:
-	git archive \
-		--format=tar \
-		--prefix=$(MASTERPV)/ \
-		HEAD | \
-		gzip -9 \
-		> ../$(TESTTGZ)
+RASTGZ=$(TEST)$(RASPV).tar.gz
 
-release: tag tarballs
+all: tag tarballs
 
+ifdef RELEASE
 tag:
 	git tag -a -m "$(MASTERPV) release" $(MASTERPV) HEAD
 
+else
+tag:
+
+endif
+
 tarballs: master-tarball fence-agents-tarball resource-agents-tarball
 
 master-tarball:
 	git archive \
 		--format=tar \
-		--prefix=$(MASTERPV)/ \
+		--prefix=$(MASTERPROJECT)-$(VERSION)/ \
 		$(MASTERPV) | \
 		tar xp
 	sed -i -e \
 		's#<CVS>#$(VERSION)#g' \
-		$(MASTERPV)/gfs-kernel/src/gfs/gfs.h
+		$(MASTERPROJECT)-$(VERSION)/gfs-kernel/src/gfs/gfs.h
 	echo "VERSION \"$(VERSION)\"" \
-		>> $(MASTERPV)/make/official_release_version
-	tar cp $(MASTERPV) | \
+		>> $(MASTERPROJECT)-$(VERSION)/make/official_release_version
+	tar cp $(MASTERPROJECT)-$(VERSION) | \
 		gzip -9 \
 		> ../$(MASTERTGZ)
-	rm -rf $(MASTERPV)
+	rm -rf $(MASTERPROJECT)-$(VERSION)
 
 fence-agents-tarball:
 	tar zxpf ../$(MASTERTGZ)
-	mv $(MASTERPV) $(FENCEPV)
+	mv $(MASTERPROJECT)-$(VERSION) $(FENCEPV)
 	cd $(FENCEPV) && \
 		rm -rf bindings cman common config contrib dlm gfs* group rgmanager && \
 		rm -rf fence/fenced fence/fence_node fence/fence_tool fence/include fence/libfence fence/libfenced && \
@@ -84,7 +90,7 @@
 
 resource-agents-tarball:
 	tar zxpf ../$(MASTERTGZ)
-	mv $(MASTERPV) $(RASPV)
+	mv $(MASTERPROJECT)-$(VERSION) $(RASPV)
 	cd $(RASPV) && \
 		rm -rf bindings cman common config contrib dlm fence gfs* group && \
 		rm -rf rgmanager/ChangeLog rgmanager/errors.txt rgmanager/event-script.txt \
diff -Naurd cluster-3.0.0.rc2/Makefile cluster-3.0.0.rc3/Makefile
--- cluster-3.0.0.rc2/Makefile	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/Makefile	2009-06-11 11:02:55.000000000 +0200
@@ -1,7 +1,7 @@
 include make/defines.mk
 
 REALSUBDIRS = gfs-kernel/src/gfs \
-	      common cman/lib config cman dlm fence/libfenced group \
+	      common config cman dlm fence/libfenced group \
 	      fence gfs gfs2 rgmanager bindings doc \
 	      contrib
 
@@ -9,7 +9,6 @@
 	  $(if ${without_common},common) \
 	  $(if ${without_gfs-kernel/src/gfs},gfs-kernel/src/gfs) \
 	  $(if ${without_config},config) \
-	  $(if ${without_cman},cman/lib) \
 	  $(if ${without_cman},cman) \
 	  $(if ${without_dlm},dlm) \
 	  $(if ${without_fence},fence/libfenced) \
@@ -33,7 +32,7 @@
 # Dependencies
 
 common:
-config: cman/lib
+config:
 cman: common config
 dlm: config
 fence/libfenced:
diff -Naurd cluster-3.0.0.rc2/rgmanager/src/clulib/Makefile cluster-3.0.0.rc3/rgmanager/src/clulib/Makefile
--- cluster-3.0.0.rc2/rgmanager/src/clulib/Makefile	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/rgmanager/src/clulib/Makefile	2009-06-11 11:02:55.000000000 +0200
@@ -16,7 +16,7 @@
 
 OBJS2= msgtest.o
 
-CFLAGS += -Werror -Wstrict-prototypes -Wshadow -fPIC -D_GNU_SOURCE
+CFLAGS += -fPIC -D_GNU_SOURCE
 CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir}
 CFLAGS += -I${logtincdir}
 CFLAGS += -I$(S)/../../include
diff -Naurd cluster-3.0.0.rc2/rgmanager/src/daemons/Makefile cluster-3.0.0.rc3/rgmanager/src/daemons/Makefile
--- cluster-3.0.0.rc2/rgmanager/src/daemons/Makefile	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/rgmanager/src/daemons/Makefile	2009-06-11 11:02:55.000000000 +0200
@@ -47,7 +47,7 @@
 		event_config-noccs.o
 
 CFLAGS += -DSHAREDIR=\"${sharedir}\"
-CFLAGS += -Werror -Wstrict-prototypes -Wshadow -fPIC
+CFLAGS += -fPIC
 CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir} -I${logtincdir}
 CFLAGS += `xml2-config --cflags` -I${readlineincdir} -I${slangincdir}
 CFLAGS += -I$(S)/../../include
diff -Naurd cluster-3.0.0.rc2/rgmanager/src/daemons/watchdog.c cluster-3.0.0.rc3/rgmanager/src/daemons/watchdog.c
--- cluster-3.0.0.rc2/rgmanager/src/daemons/watchdog.c	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/rgmanager/src/daemons/watchdog.c	2009-06-11 11:02:55.000000000 +0200
@@ -3,6 +3,7 @@
 #include <sys/wait.h>
 #include <sys/reboot.h>
 #include <stdlib.h>
+#include <sys/mman.h>
 
 #include <signals.h>
 #include <logging.h>
@@ -50,6 +51,7 @@
 		return parent;
 	
 	redirect_signals();
+	mlockall(MCL_CURRENT); /* shouldn't need MCL_FUTURE */
 	
 	while (1) {
 	        if (waitpid(child, &status, 0) <= 0)
@@ -60,20 +62,22 @@
 		
 		if (WIFSIGNALED(status)) {
 		        if (WTERMSIG(status) == SIGKILL) {
-				logt_print(LOG_CRIT, "Watchdog: Daemon killed, exiting\n");
-				raise(SIGKILL);
-				while(1) ;
+				/* Assume the admin did a 'killall' - it will
+				 * kill us within a couple of seconds.  If 
+				 * we are still alive after this sleep, it
+				 * could have been the OOM killer killing
+				 * rgmanager proper and we need to reboot.
+				 */
+				sleep(3);
 			}
-			else {
 #ifdef DEBUG
-			        logt_print(LOG_CRIT, "Watchdog: Daemon died, but not rebooting because DEBUG is set\n");
+		        logt_print(LOG_CRIT, "Watchdog: Daemon died, but not rebooting because DEBUG is set\n");
 #else
-				logt_print(LOG_CRIT, "Watchdog: Daemon died, rebooting...\n");
-				sync();
-			        reboot(RB_AUTOBOOT);
+			logt_print(LOG_CRIT, "Watchdog: Daemon died, rebooting...\n");
+			sync();
+		        reboot(RB_AUTOBOOT);
 #endif
-				exit(255);
-			}
+			exit(255);
 		}
 	}
 }
diff -Naurd cluster-3.0.0.rc2/rgmanager/src/resources/apache.sh cluster-3.0.0.rc3/rgmanager/src/resources/apache.sh
--- cluster-3.0.0.rc2/rgmanager/src/resources/apache.sh	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/rgmanager/src/resources/apache.sh	2009-06-11 11:02:55.000000000 +0200
@@ -116,8 +116,12 @@
 
 	IFS_old="$IFS"
 	IFS=$'\n'
-	for i in `"$APACHE_parseConfig" -D"$OCF_RESKEY_name" < "$originalConfigFile" | grep -E '(^Listen)|(^Port)' | grep -v ':'`; do 
+	for i in `"$APACHE_parseConfig" -D"$OCF_RESKEY_name" < "$originalConfigFile" | grep -P '(^Listen)|(^Port)' `; do 
 		port=`echo $i | sed 's/^Listen \(.*\)/\1/;s/^Port \(.*\)/\1/'`;
+		testcond=`echo $port|grep :`
+		if [ $testcond ]; then
+			port=`echo $port|awk -F : '{print $2}'`
+		fi
 		IFS=$' ';
 		for z in $ip_addresses; do 
 			echo "Listen $z:$port" >> "$generatedConfigFile";
diff -Naurd cluster-3.0.0.rc2/rgmanager/src/resources/default_event_script.sl cluster-3.0.0.rc3/rgmanager/src/resources/default_event_script.sl
--- cluster-3.0.0.rc2/rgmanager/src/resources/default_event_script.sl	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/rgmanager/src/resources/default_event_script.sl	2009-06-11 11:02:55.000000000 +0200
@@ -254,6 +254,154 @@
 	return anodes;
 }
 
+%
+% Returns the set of online nodes in preferred/shuffled order which
+% are allowed to run this service.  Gives highest preference to current
+% owner if nofailback is specified.
+% 
+define allowed_nodes(service)
+{
+	variable anodes;
+	variable online;
+	variable nodes_domain;
+	variable ordered, restricted, nofailback;
+	variable state, owner;
+	variable depends;
+
+	(nofailback, restricted, ordered, nodes_domain) =
+			service_domain_info(service);
+	(owner, state) = service_status(service);
+
+	anodes = nodes_online();
+
+	% Shuffle the array so we don't start all services on the same
+	% node.  TODO - add RR, Least-services, placement policies...
+	online = shuffle(anodes);
+
+	if (restricted == 1) {
+		anodes = intersection(nodes_domain, online);
+	} else {
+		% Ordered failover domains (nodes_domain) unioned with the
+		% online nodes basically just reorders the online node list
+		% according to failover domain priority rules.
+		anodes = union(intersection(nodes_domain, online),
+			       online);
+	}
+
+	if ((nofailback == 1) or (ordered == 0)) {
+		
+		if ((owner < 0) or (node_in_set(anodes, owner) == 0)) {
+			return anodes;
+		}
+		
+		% Because union takes left as priority, we can
+		% return the union of the current owner with the
+		% allowed node list.  This means the service will
+		% remain on the same node it's currently on.
+		return union(owner, anodes);
+	}
+
+	return anodes;
+}
+
+define string_list(thelist, delimiter)
+{
+	variable index;
+	variable output="";
+
+	if (length(thelist) == 0) {
+		return output;
+	}
+  
+	for (index=0; index < length(thelist)-1; index++) {
+		output=output+string(thelist[index])+delimiter;
+	}
+	return output+thelist[index];
+}
+
+% this function gets the smallest property from a given list of services
+% if the list only exists of one element the property itself is returned
+% if the given property is not found 0 is returned
+define services_min_attribute(services, property)
+{
+	variable x;
+	variable min_property=-1;
+	variable tmp_property;
+
+	for (x = 0; x < length(services); x++) {
+		tmp_property=service_property(services[x], property);
+		if (tmp_property == NULL) {
+			tmp_property=0;
+		} else {
+			tmp_property=atoi(tmp_property);
+		}
+		if ((min_property < 0) or (tmp_property < min_property)) {
+			min_property=tmp_property;
+		}
+		%debug("services_min_attribute: ",services[x]," attribute: ",min_property, "tmp: ", tmp_property, " min: ", min_property);
+	}
+
+	%debug("services_min_attribute: (", string_list(services, ", "),")[",property,"]: ",min_property);
+
+	return min_property;
+}
+
+% This function will sort a given service_list by the given attribute name and
+% return the list
+define sorted_service_list(services, attribute)
+{
+	variable work_queue={};
+	variable sorted_list={}, tmp, tmp2;
+	variable x, y;
+	variable cur_min_prop=0;
+	variable service_prop=0;
+
+	y=0;
+	%debug("sorted_service_list: ", strjoin(services, ", "));
+	for (x=0; x<length(services); x++) {
+		list_append(work_queue, string(services[x]));
+	}
+
+	%debug("sorted_service_list: work_queue ", string_list(work_queue, ", "));
+	while (length(work_queue) > 0) {
+		cur_min_prop=services_min_attribute(work_queue, attribute);
+		%debug("sorted_service_list sorting services list for attribute ", attribute, " cur_min: ",cur_min_prop);
+		for (x = 0; x < length(work_queue); x++) {
+			service_prop=service_property(work_queue[x], "priority");
+			if (service_prop == NULL) {
+				service_prop=0;
+			} else {
+				service_prop=atoi(service_prop);
+			}
+			%debug("sorted_service_list: ",work_queue[x], " property[", attribute,"]: ",service_prop);
+			if (cur_min_prop==service_prop) {
+				%debug("sorted_service_list: adding service ",work_queue[x]," to sorted. work_queue: ", string_list(work_queue, ", "));
+				list_append(sorted_list, work_queue[x]);
+				%debug("sorted_service_list: sorted_list: ", string_list(sorted_list, ", "));
+				%debug("sorted_service_list: removing service ",work_queue[x], " from work_queue ", string_list(work_queue, ", "));
+				list_delete(work_queue, x);
+				x=x-1;
+				%debug("sorted_service_list: work_queue: ",string_list(work_queue, ", "));
+				y=y+1;
+			}
+		}
+	}
+
+	debug("sorted_service_list ", string_list(sorted_list, ", "));
+	return sorted_list;
+}
+
+define sortedservices_node_event_handler(services, attribute) {
+	variable x;
+	variable nodes;
+
+	services=sorted_service_list(services, attribute);
+	for (x = 0; x < length(services); x++) {
+		debug("Executing sortedservices node event handler for service: ", services[x]);
+		nodes = allowed_nodes(services[x]);
+		()=move_or_start(services[x], nodes);
+	}
+}
 
 define default_node_event_handler()
 {
@@ -447,7 +595,7 @@
 }
 
 if (event_type == EVENT_NODE)
-	default_node_event_handler();
+	sortedservices_node_event_handler(service_list(), "priority");
 if (event_type == EVENT_SERVICE)
 	default_service_event_handler();
 if (event_type == EVENT_CONFIG)
diff -Naurd cluster-3.0.0.rc2/rgmanager/src/resources/oracledb.sh.in cluster-3.0.0.rc3/rgmanager/src/resources/oracledb.sh.in
--- cluster-3.0.0.rc2/rgmanager/src/resources/oracledb.sh.in	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/rgmanager/src/resources/oracledb.sh.in	2009-06-11 11:02:55.000000000 +0200
@@ -217,13 +217,8 @@
 	<action name="status" timeout="10"/>
 	<action name="monitor" timeout="10"/>
 
-	<!-- Checks to see if we can read from the mountpoint -->
-	<action name="status" depth="10" timeout="30" interval="5m"/>
-	<action name="monitor" depth="10" timeout="30" interval="5m"/>
-
-	<!-- Checks to see if we can write to the mountpoint (if !ROFS) -->
-	<action name="status" depth="20" timeout="90" interval="10m"/>
-	<action name="monitor" depth="20" timeout="90" interval="10m"/>
+	<action name="status" depth="10" timeout="30" interval="30"/>
+	<action name="monitor" depth="10" timeout="30" interval="30"/>
 
 	<action name="meta-data" timeout="5"/>
 	<action name="validate-all" timeout="5"/>
@@ -296,9 +291,11 @@
 	# ORA-.....: failure, we failed
 	#
 
-	grep -q "failure" $logfile
+	rm -f $tmpfile
+	grep -q "^ORA-" $logfile
 	if [ $? -eq 0 ]; then
 		echo "ORACLE_SID Incorrectly set?"
+		rm -f $tmpfile
 		echo "See $logfile for more information."
 		return 1
 	fi
@@ -340,7 +337,8 @@
 	# 
 	# If we see 'failure' in the log, we're done.
 	#
-	grep -q failure $logfile
+	rm -f $tmpfile
+	grep -q "^ORA-" $logfile
 	if [ $? -eq 0 ]; then
 		echo_failure
 		echo
@@ -361,7 +359,8 @@
 	declare pids
 	declare pid
 
-	pids=`ps ax | grep $ORACLE_HOME | grep -v grep | awk '{print $1}'`
+	# Patch from Shane Bradley to fix 471266
+	pids=`ps ax | grep $ORACLE_HOME | grep "ora_.*_${ORACLE_SID}" | grep -v grep | awk '{print $1}'`
 
 	initlog -n $SCRIPT -s "<err> Not all Oracle processes exited cleanly, killing"
 	
@@ -809,7 +808,6 @@
 {
 	declare -i subsys_lock=1
 	declare -i last 
-	declare -i depth=$1
 
 	#
 	# Check for lock file.  Crude and rudimentary, but it works
@@ -819,12 +817,12 @@
 	fi
 
 	# Check database status
-	get_db_status $subsys_lock $depth
+	get_db_status $subsys_lock
 	update_status $? # Start
 	last=$?
 
 	# Check & report listener status
-	get_lsnr_status $subsys_lock $depth
+	get_lsnr_status $subsys_lock
 	update_status $? $last
 	last=$?
 	
@@ -835,7 +833,7 @@
 		last=$?
 	elif [ "$ORACLE_TYPE" = "ias" ]; then
 		# Check & report opmn / opmn-managed process status
-		get_opmn_status $subsys_lock $depth
+		get_opmn_status $subsys_lock
 		update_status $? $last
 		last=$?
 	fi
@@ -872,7 +870,7 @@
 		exit $?
 		;;
 	status|monitor)
-		status_oracle $OCF_CHECK_LEVEL
+		status_oracle
 		exit $?
 		;;
 	restart)
diff -Naurd cluster-3.0.0.rc2/rgmanager/src/resources/service.sh cluster-3.0.0.rc3/rgmanager/src/resources/service.sh
--- cluster-3.0.0.rc2/rgmanager/src/resources/service.sh	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/rgmanager/src/resources/service.sh	2009-06-11 11:02:55.000000000 +0200
@@ -197,16 +197,31 @@
             <content type="string" default="0"/>
         </parameter>
 
+	<parameter name="priority">
+	    <longdesc lang="en">
+		Priority for the service.  In a failover scenario, this
+		indicates the ordering of the service (1 is processed
+		first, 2 is processed second, etc.).  This overrides the
+		order presented in cluster.conf.  This option only has
+		an effect if central processing within rgmanager is turned
+		on.
+	    </longdesc>
+	    <shortdesc lang="en">
+		Service priority
+	    </shortdesc>
+	    <content type="integer" default="0"/>
+	</parameter>
+
     </parameters>
 
     <actions>
         <action name="start" timeout="5"/>
         <action name="stop" timeout="5"/>
 	
-	<!-- No-ops.  Groups are abstract resource types.
+	<!-- No-ops.  Groups are abstract resource types. 
         <action name="status" timeout="5" interval="1h"/>
         <action name="monitor" timeout="5" interval="1h"/>
-       	 -->
+ -->
 
         <action name="reconfig" timeout="5"/>
         <action name="recover" timeout="5"/>
diff -Naurd cluster-3.0.0.rc2/rgmanager/src/resources/vm.sh cluster-3.0.0.rc3/rgmanager/src/resources/vm.sh
--- cluster-3.0.0.rc2/rgmanager/src/resources/vm.sh	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/rgmanager/src/resources/vm.sh	2009-06-11 11:02:55.000000000 +0200
@@ -6,12 +6,13 @@
 
 . $(dirname $0)/ocf-shellfuncs || exit 1
 
-. $(dirname $0)/ocf-shellfuncs
-
 #
-# Virtual Machine start/stop script (requires the xm command)
+# Virtual Machine start/stop script (requires the virsh command)
 #
 
+# Indeterminate state: xend/libvirtd is down.
+export OCF_APP_ERR_INDETERMINATE=150
+
 meta_data()
 {
     cat <<EOT
@@ -108,97 +109,26 @@
             <content type="string"/>
         </parameter>
 
-	<parameter name="memory" reconfig="1">
-	    <longdesc lang="en">
-		Memory size.  This can be reconfigured on the fly.
-	    </longdesc>
-	    <shortdesc lang="en">
-		Memory Size
-	    </shortdesc>
-            <content type="integer"/>
-        </parameter>
-
        <parameter name="migration_mapping">
            <longdesc lang="en">
                Mapping of the hostname of a target cluster member to a different hostname
            </longdesc>
            <shortdesc lang="en">
-               memeberhost:targethost,memeberhost:targethost ..
+               memberhost:targethost,memberhost:targethost ..
            </shortdesc>
             <content type="string"/>
         </parameter>
 
-	<parameter name="bootloader">
-	    <longdesc lang="en">
-		Boot loader that can start the VM from physical image
-	    </longdesc>
-	    <shortdesc lang="en">
-		Boot loader that can start the VM from physical image
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-	<parameter name="path">
-	    <longdesc lang="en">
-	    	Path specification 'xm create' will search for the specified
-		VM configuration file
-	    </longdesc>
-	    <shortdesc lang="en">
-	    	Path to virtual machine configuration files
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-
-	<parameter name="rootdisk_physical" unique="1">
-	    <longdesc lang="en">
-		Root disk for the virtual machine.  (physical, on the host)
-	    </longdesc>
-	    <shortdesc lang="en">
-		Root disk (physical)
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-        
-	<parameter name="rootdisk_virtual">
-	    <longdesc lang="en">
-		Root disk for the virtual machine.  (as presented to the VM)
-	    </longdesc>
-	    <shortdesc lang="en">
-		Root disk (virtual)
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-
-	<parameter name="swapdisk_physical" unique="1">
-	    <longdesc lang="en">
-		Swap disk for the virtual machine.  (physical, on the host)
-	    </longdesc>
-	    <shortdesc lang="en">
-		Swap disk (physical)
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-        
-	<parameter name="swapdisk_virtual">
-	    <longdesc lang="en">
-		Swap disk for the virtual machine.  (as presented to the VM)
-	    </longdesc>
-	    <shortdesc lang="en">
-		Swap disk (virtual)
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-	<parameter name="vif">
+	<parameter name="use_virsh">
 	    <longdesc lang="en">
-		Virtual interface MAC address
+	    	Use virsh instead of XM
 	    </longdesc>
 	    <shortdesc lang="en">
-		Virtual interface MAC address
+	    	If set to 1, vm.sh will use the virsh command to manage
+		virtual machines instead of xm.  This is required when
+		using non-Xen virtual machines (e.g. qemu / KVM).
 	    </shortdesc>
-            <content type="string"/>
+            <content type="integer" default="1"/>
         </parameter>
 
 	<parameter name="migrate">
@@ -260,19 +190,41 @@
         </parameter>
 
         <parameter name="restart_expire_time" reconfig="1">
+            <content type="string" default="0"/>
+        </parameter>
+
+	<parameter name="hypervisor">
+            <shortdesc lang="en">
+		Hypervisor
+            </shortdesc >
             <longdesc lang="en">
-	    	Restart expiration time
+		Specify hypervisor tricks to use.  Default = auto.
+		Other supported options are xen and qemu.
             </longdesc>
+	    <content type="string" default="auto" />
+	</parameter>
+
+	<parameter name="hypervisor_uri">
             <shortdesc lang="en">
-	    	Restart expiration time.  A restart is forgotten
-		after this time.  When combined with the max_restarts
-		option, this lets administrators specify a threshold
-		for when to fail over services.  If max_restarts
-		is exceeded in this given expiration time, the service
-		is relocated instead of restarted again.
-            </shortdesc>
-            <content type="string" default="0"/>
-        </parameter>
+		Hypervisor URI
+            </shortdesc >
+            <longdesc lang="en">
+		Hypervisor URI.  Generally, this is keyed off of the
+		hypervisor and does not need to be set.
+            </longdesc>
+	    <content type="string" default="auto" />
+	</parameter>
+
+	<parameter name="migration_uri">
+            <shortdesc lang="en">
+		Migration URI
+            </shortdesc >
+            <longdesc lang="en">
+		Migration URI.  Generally, this is keyed off of the
+		hypervisor and does not need to be set.
+            </longdesc>
+	    <content type="string" default="auto" />
+	</parameter>
 
     </parameters>
 
@@ -287,9 +239,6 @@
 	     NOT OCF COMPATIBLE AT ALL -->
 	<action name="reconfig" timeout="10"/>
 
-	<!-- Suspend: if available, suspend this resource instead of
-	     doing a full stop. -->
-	<!-- <action name="suspend" timeout="10m"/> -->
 	<action name="migrate" timeout="10m"/>
 
         <action name="meta-data" timeout="5"/>
@@ -309,89 +258,79 @@
 }
 
 
+build_virsh_cmdline()
+{
+	declare cmdline=""
+	declare operation=$1
+
+	if [ -n "$OCF_RESKEY_hypervisor_uri" ]; then
+		cmdline="$cmdline -c $OCF_RESKEY_hypervisor_uri"
+	fi
+
+	cmdline="$cmdline $operation $OCF_RESKEY_name"
+		
+	echo $cmdline
+}
+
+
+# this is only used on startup
 build_xm_cmdline()
 {
+	declare operation=$1
 	#
 	# Virtual domains should never restart themselves when 
 	# controlled externally; the external monitoring app
 	# should.
 	#
 	declare cmdline="on_shutdown=\"destroy\" on_reboot=\"destroy\" on_crash=\"destroy\""
-	declare varp val temp
 
-	#
-	# Transliterate the OCF_RESKEY_* to something the xm
-	# command can recognize.
-	#
-	for var in ${!OCF_RESKEY_*}; do
-		varp=${var/OCF_RESKEY_/}
-		val=`eval "echo \\$$var"`
-
-		case $varp in
-		bootloader)
-			cmdline="$cmdline bootloader=\"$val\""
-			;;
-		rootdisk_physical)
-			[ -n "$OCF_RESKEY_rootdisk_virtual" ] || exit 2
-			cmdline="$cmdline disk=\"phy:$val,$OCF_RESKEY_rootdisk_virtual,w\""
-			;;
-		swapdisk_physical)
-			[ -n "$OCF_RESKEY_swapdisk_virtual" ] || exit 2
-			cmdline="$cmdline disk=\"phy:$val,$OCF_RESKEY_swapdisk_virtual,w\""
-			;;
-		vif)
-			cmdline="$cmdline vif=\"mac=$val\""
-			;;
-		recovery|autostart|domain)
-			;;
-		memory)
-			cmdline="$cmdline $varp=$val"
-			;;
-		swapdisk_virtual)
-			;;
-		rootdisk_virtual)
-			;;
-		name)	# Do nothing with name; add it later
-			;;
-		path)
-			cmdline="$cmdline --path=\"$val\""
-			;;
-		migrate)
-			;;
-		snapshot)
-			;;
-		*)
-			cmdline="$cmdline $varp=\"$val\""
-			;;
-		esac
-	done
+	if [ -n "$OCF_RESKEY_path" ]; then
+		operation="$operation --path=\"$OCF_RESKEY_path\""
+	fi
 
 	if [ -n "$OCF_RESKEY_name" ]; then
-		cmdline="$OCF_RESKEY_name $cmdline"
+		cmdline="$operation $OCF_RESKEY_name $cmdline"
 	fi
 
 	echo $cmdline
 }
 
 
+do_xm_start()
+{
+	# Use /dev/null for the configuration file, if xmdefconfig
+	# doesn't exist...
+	#
+	declare cmdline
+
+	echo -n "Virtual machine $OCF_RESKEY_name is "
+	do_status && return 0
+
+	cmdline="`build_xm_cmdline create`"
+
+	ocf_log debug "xm $cmdline"
+
+	eval xm $cmdline
+	return $?
+}
+
+
 #
 # Start a virtual machine given the parameters from
 # the environment.
 #
-do_start()
+do_virsh_start()
 {
-	# Use /dev/null for the configuration file, if xmdefconfig
-	# doesn't exist...
-	#
 	declare cmdline
 	declare snapshotimage
 
-	status && return 0
+	echo -n "Virtual machine $OCF_RESKEY_name is "
+	do_status && return 0
 
 	snapshotimage="$OCF_RESKEY_snapshot/$OCF_RESKEY_name"
 
         if [ -n "$OCF_RESKEY_snapshot" -a -f "$snapshotimage" ]; then
-		eval xm restore $snapshotimage
+		eval virsh restore $snapshotimage
 		if [ $? -eq 0 ]; then
 			rm -f $snapshotimage
 			return 0
@@ -399,38 +338,29 @@
 		return 1
 	fi
 
-	cmdline="`build_xm_cmdline`"
-
-	echo "# xm command line: $cmdline"
+	cmdline="virsh $(build_virsh_cmdline start)"
+	ocf_log debug "$cmdline"
 
-	eval xm create $cmdline
+	$cmdline
 	return $?
 }
 
 
-#
-# Stop a VM.  Try to shut it down.  Wait a bit, and if it
-# doesn't shut down, destroy it.
-#
-do_stop()
+do_xm_stop()
 {
 	declare -i timeout=60
 	declare -i ret=1
 	declare st
 
-	if [ -n "$OCF_RESKEY_snapshot" ]; then
-		xm save $OCF_RESKEY_name "$OCF_RESKEY_snapshot/$OCF_RESKEY_name"
-	fi
-
 	for op in $*; do
-		echo xm $op $OCF_RESKEY_name ...
+		echo "CMD: xm $op $OCF_RESKEY_name"
 		xm $op $OCF_RESKEY_name
 
 		timeout=60
 		while [ $timeout -gt 0 ]; do
 			sleep 5
 			((timeout -= 5))
-			status || return 0
+			do_status&>/dev/null || return 0
 			while read dom state; do
 				#
 				# State is "stopped".  Kill it.
@@ -451,105 +381,394 @@
 
 
 #
-# Reconfigure a running VM.  Currently, all we support is
-# memory ballooning.
+# Stop a VM.  Try to shut it down.  Wait a bit, and if it
+# doesn't shut down, destroy it.
 #
-reconfigure()
+do_virsh_stop()
 {
-	if [ -n "$OCF_RESKEY_memory" ]; then
-		echo "xm balloon $OCF_RESKEY_name $OCF_RESKEY_memory"
-		xm balloon $OCF_RESKEY_name $OCF_RESKEY_memory
+	declare -i timeout=60
+	declare -i ret=1
+	declare state
+
+	state=$(do_status)
+	[ $? -eq 0 ] || return 0
+
+	if [ -n "$OCF_RESKEY_snapshot" ]; then
+		virsh save $OCF_RESKEY_name "$OCF_RESKEY_snapshot/$OCF_RESKEY_name"
+	fi
+
+	for op in $*; do
+		echo virsh $op $OCF_RESKEY_name ...
+		virsh $op $OCF_RESKEY_name
+
+		timeout=60
+		while [ $timeout -gt 0 ]; do
+			sleep 5
+			((timeout -= 5))
+			state=$(do_status)
+			[ $? -eq 0 ] || return 0
+
+			if [ "$state" = "paused" ]; then
+				virsh destroy $OCF_RESKEY_name
+			fi
+		done
+	done
+
+	return 1
+}
+
+
+do_start()
+{
+	if [ "$OCF_RESKEY_use_virsh" = "1" ]; then
+		do_virsh_start $*
 		return $?
 	fi
-	return 0
+
+	do_xm_start $*
+	return $?
+}
+
+
+do_stop()
+{
+	declare domstate rv
+
+	domstate=$(do_status)
+	rv=$?
+	ocf_log debug "Virtual machine $OCF_RESKEY_name is $domstate"
+	if [ $rv -eq $OCF_APP_ERR_INDETERMINATE ]; then
+		ocf_log crit "xend/libvirtd is dead; cannot stop $OCF_RESKEY_name"
+		return 1
+	fi
+
+	if [ "$OCF_RESKEY_use_virsh" = "1" ]; then
+		do_virsh_stop $*
+		return $?
+	fi
+
+	do_xm_stop $*
+	return $?
 }
 
 
 #
-# Simple status check: Find the VM in the list of running
-# VMs
+# Reconfigure a running VM.
 #
-do_status()
+reconfigure()
 {
+	return 0
+}
+
+
+xm_status()
+{
+	service xend status &> /dev/null
+	if [ $? -ne 0 ]; then 
+		# if xend died
+		echo indeterminate
+		return $OCF_APP_ERR_INDETERMINATE
+	fi
+
 	xm list $OCF_RESKEY_name &> /dev/null
 	if [ $? -eq 0 ]; then
+		echo "running"
 		return 0
 	fi
 	xm list migrating-$OCF_RESKEY_name &> /dev/null
+	if [ $? -eq 0 ]; then
+		echo "running"
+		return 0
+	fi
+	echo "not running"
+	return 1
+}
+
+
+virsh_status()
+{
+	declare state pid
+
+	if [ "$OCF_RESKEY_hypervisor" = "xen" ]; then
+		service xend status &> /dev/null
+		if [ $? -ne 0 ]; then 
+			echo indeterminate
+			return $OCF_APP_ERR_INDETERMINATE
+		fi
+	fi
+
+	#
+	# libvirtd is required when using virsh even though
+	# not specifically when also using Xen.  This is because
+	# libvirtd is required for migration.
+	#
+	pid=$(pidof libvirtd)
+	if [ -z "$pid" ]; then 
+		echo indeterminate
+		return $OCF_APP_ERR_INDETERMINATE
+	fi
+
+	state=$(virsh domstate $OCF_RESKEY_name)
+
+	echo $state
+
+	if [ "$state" = "running" ] || [ "$state" = "paused" ] ||
+	   [ "$state" = "idle" ]; then
+		return 0
+	fi
+
+	return 1
+}
+
+
+#
+# Simple status check: Find the VM in the list of running
+# VMs
+#
+do_status()
+{
+	if [ "$OCF_RESKEY_use_virsh" = "1" ]; then
+		virsh_status
+		return $?
+	fi
+
+	xm_status
 	return $?
 }
 
 
-verify_all()
+validate_all()
 {
-	declare errors=0
+	[ "$(id -u)" = "0" ] || return 1
 
-	if [ -n "$OCF_RESKEY_bootloader" ] && \
-	   ! [ -x "$OCF_RESKEY_bootloader" ]; then
-		echo "$OCF_RESKEY_bootloader is not executable"
-		((errors++))
+	#
+	# If someone selects a hypervisor, honor it.
+	# Otherwise, ask virsh what the hypervisor is.
+	#
+	if [ -z "$OCF_RESKEY_hypervisor" ] ||
+	   [ "$OCF_RESKEY_hypervisor" = "auto" ]; then
+		export OCF_RESKEY_hypervisor="`virsh version | grep \"Running hypervisor:\" | awk '{print $3}' | tr A-Z a-z`"
+		if [ -z "$OCF_RESKEY_hypervisor" ]; then
+			ocf_log err "Could not determine Hypervisor"
+			return $OCF_ERR_ARGS
+		fi
+		echo Hypervisor: $OCF_RESKEY_hypervisor 
+	fi
+
+	#
+	# Xen hypervisor only for when use_virsh = 0.
+	#
+	if [ "$OCF_RESKEY_use_virsh" = "0" ]; then
+		if [ "$OCF_RESKEY_hypervisor" != "xen" ]; then
+			ocf_log err "Cannot use $OCF_RESKEY_hypervisor hypervisor without using virsh"
+			return $OCF_ERR_ARGS
+		fi
+	else
+	
+		#
+		# If no path is set, use virsh.  Otherwise, use xm.
+		# xm only works with Xen.
+		#
+		if [ -z "$OCF_RESKEY_path" ] ||
+		   [ "$OCF_RESKEY_path" = "/etc/xen" ]; then
+			echo "Management tool: virsh"
+			export OCF_RESKEY_use_virsh=1
+		else
+			echo "Management tool: xm"
+			export OCF_RESKEY_use_virsh=0
+		fi
 	fi
+
+	#
+	# Set the hypervisor URI
+	#
+	if [ -z "$OCF_RESKEY_hypervisor_uri" -o "$OCF_RESKEY_hypervisor_uri" = "auto" ] &&
+	   [ "$OCF_RESKEY_use_virsh" = "1" ]; then
+
+		# Virsh makes it easier to do this.  Really.
+		if [ "$OCF_RESKEY_hypervisor" = "qemu" ]; then
+			OCF_RESKEY_hypervisor_uri="qemu:///system"
+		fi
+
+		# I just need to believe in it more.
+		if [ "$OCF_RESKEY_hypervisor" = "xen" ]; then
+			OCF_RESKEY_hypervisor_uri="xen:///"
+		fi
+
+		echo Hypervisor URI: $OCF_RESKEY_hypervisor_uri
+	fi
+
+	#
+	# Set the migration URI
+	#
+	if [ -z "$OCF_RESKEY_migration_uri" -o "$OCF_RESKEY_migration_uri" = "auto" ] &&
+	   [ "$OCF_RESKEY_use_virsh" = "1" ]; then
+
+		# Virsh makes it easier to do this.  Really.
+		if [ "$OCF_RESKEY_hypervisor" = "qemu" ]; then
+			export OCF_RESKEY_migration_uri="qemu+ssh://%s/system"
+		fi
+
+		# I just need to believe in it more.
+		if [ "$OCF_RESKEY_hypervisor" = "xen" ]; then
+			export OCF_RESKEY_migration_uri="xenmigr://%s/"
+		fi
+
+		[ -n "$OCF_RESKEY_migration_uri" ] && echo Migration URI format: $(printf $OCF_RESKEY_migration_uri target_host)
+	fi
+
+	if [ -z "$OCF_RESKEY_name" ]; then
+		echo No domain name specified
+		return $OCF_ERR_ARGS
+	fi
+
+	#virsh list --all | awk '{print $2}' | grep -q "^$OCF_RESKEY_name\$"
+	return $?
 }
 
 
-migrate()
+virsh_migrate()
+{
+	declare $target=$1
+	declare rv=1
+
+	#
+	# Xen and qemu have different migration mechanisms
+	#
+	if [ "$OCF_RESKEY_hypervisor" = "xen" ]; then 
+		cmd="virsh migrate $migrate_opt $OCF_RESKEY_name $OCF_RESKEY_hypervisor_uri $(printf $OCF_RESKEY_migration_uri $target)"
+		ocf_log debug "$cmd"
+		
+		err=$($cmd 2>&1 | head -1; exit ${PIPESTATUS[0]})
+		rv=$?
+	elif [ "$OCF_RESKEY_hypervisor" = "qemu" ]; then
+		cmd="virsh migrate $migrate_opt $OCF_RESKEY_name $(printf $OCF_RESKEY_migration_uri $target)"
+		ocf_log debug "$cmd"
+		
+		err=$($cmd 2>&1 | head -1; exit ${PIPESTATUS[0]})
+		rv=$?
+	fi
+
+	if [ $rv -ne 0 ]; then
+		ocf_log err "Migrate $OCF_RESKEY_name to $target failed:"
+		ocf_log err "$err"
+
+		if [ "$err" != "${err/does not exist/}" ]; then
+			return $OCF_NOT_RUNNING
+		fi
+		if [ "$err" != "${err/Domain not found/}" ]; then
+			return $OCF_NOT_RUNNING
+		fi
+		if [ "$err" != "${err/Connection refused/}" ]; then
+			return $OCF_ERR_CONFIGURED
+		fi
+
+		return $OCF_ERR_GENERIC
+	fi
+
+	return $rv
+}
+
+
+#
+# XM migrate
+#
+xm_migrate()
 {
 	declare target=$1
-	declare errstr rv migrate_opt
+	declare errstr rv migrate_opt cmd
+
+	rv=1
 
 	if [ "$OCF_RESKEY_migrate" = "live" ]; then
 		migrate_opt="-l"
 	fi
 
-	# Patch from Marcelo Azevedo to migrate over private
-	# LANs instead of public LANs
-        if [ -n "$OCF_RESKEY_migration_mapping" ] ; then
-                target=${OCF_RESKEY_migration_mapping#*$target:} target=${target%%,*}
-        fi
+	# migrate() function  sets target using migration_mapping;
+	# no need to do it here anymore
+	cmd="xm migrate $migrate_opt $OCF_RESKEY_name $target"
+	ocf_log debug "$cmd"
 
-	err=$(xm migrate $migrate_opt $OCF_RESKEY_name $target 2>&1 | head -1; exit ${PIPESTATUS[0]})
+	err=$($cmd 2>&1 | head -1; exit ${PIPESTATUS[0]})
 	rv=$?
 
 	if [ $rv -ne 0 ]; then
+		ocf_log err "Migrate $OCF_RESKEY_name to $target failed:"
+		ocf_log err "$err"
+
 		if [ "$err" != "${err/does not exist/}" ]; then
-			ocf_log warn "Trying to migrate '$OCF_RESKEY_name' - domain does not exist"
 			return $OCF_NOT_RUNNING
 		fi
 		if [ "$err" != "${err/Connection refused/}" ]; then
-			ocf_log warn "Trying to migrate '$OCF_RESKEY_name' - connect refused"
 			return $OCF_ERR_CONFIGURED
 		fi
+
+		return $OCF_ERR_GENERIC
 	fi
 
 	return $?
 }
 
+# 
+# Virsh migrate
+#
+migrate()
+{
+	declare target=$1
+	declare rv migrate_opt
+
+	if [ "$OCF_RESKEY_migrate" = "live" ]; then
+		migrate_opt="--live"
+	fi
+
+	# Patch from Marcelo Azevedo to migrate over private
+	# LANs instead of public LANs
+        if [ -n "$OCF_RESKEY_migration_mapping" ] ; then
+                target=${OCF_RESKEY_migration_mapping#*$target:} target=${target%%,*}
+        fi
+
+	if [ "$OCF_RESKEY_use_virsh" = "1" ]; then
+		virsh_migrate $target
+		rv=$?
+	else
+		xm_migrate $target
+		rv=$?
+	fi
+
+	return $rv
+}
+
+#
 #
-# A Resource group is abstract, but the OCF RA API doesn't allow for abstract
-# resources, so here it is.
 #
 
 case $1 in
 	start)
+		validate_all || exit $OCF_ERR_ARGS
 		do_start
 		exit $?
 		;;
 	stop)
+		validate_all || exit $OCF_ERR_ARGS
 		do_stop shutdown destroy
 		exit $?
 		;;
 	kill)
-		stop destroy
+		validate_all || exit $OCF_ERR_ARGS
+		do_stop destroy
 		exit $?
 		;;
 	recover|restart)
 		exit 0
 		;;
 	status|monitor)
+		validate_all || exit $OCF_ERR_ARGS
+		echo -n "Virtual machine $OCF_RESKEY_name is "
 		do_status
 		exit $?
 		;;
 	migrate)
+		validate_all || exit $OCF_ERR_ARGS
 		migrate $2 # Send VM to this node
 		exit $?
 		;;
@@ -557,6 +776,7 @@
 		exit 0
 		;;
 	reconfig)
+		validate_all || exit $OCF_ERR_ARGS
 		echo "$0 RECONFIGURING $OCF_RESKEY_memory"
 		reconfigure
 		exit $?
@@ -566,7 +786,7 @@
 		exit 0
 		;;
 	validate-all)
-		verify_all
+		validate_all
 		exit $?
 		;;
 	*)
diff -Naurd cluster-3.0.0.rc2/rgmanager/src/utils/Makefile cluster-3.0.0.rc3/rgmanager/src/utils/Makefile
--- cluster-3.0.0.rc2/rgmanager/src/utils/Makefile	2009-05-07 09:09:32.000000000 +0200
+++ cluster-3.0.0.rc3/rgmanager/src/utils/Makefile	2009-06-11 11:02:55.000000000 +0200
@@ -17,7 +17,7 @@
 
 DISABLEDTARGETS= cluarp
 
-CFLAGS += -Werror -Wstrict-prototypes -Wshadow -fPIC -D_GNU_SOURCE
+CFLAGS += -fPIC -D_GNU_SOURCE
 CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir}
 CFLAGS += -I${logtincdir} -I${ncursesincdir}
 CFLAGS += -I$(S)/../../include
