[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] Cluster Project branch, STABLE2, updated. cluster-2.03.04-26-g47cf8d5



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=47cf8d572161f188b60e56625cd6fc150879dc03

The branch, STABLE2 has been updated
       via  47cf8d572161f188b60e56625cd6fc150879dc03 (commit)
      from  7ea2a4dce8d413d6d0f0c86833cf71ca8082b7ef (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 47cf8d572161f188b60e56625cd6fc150879dc03
Author: Fabio M. Di Nitto <fdinitto redhat com>
Date:   Fri Jun 20 16:19:54 2008 +0200

    [QDISK] Major clean up
    
    Kill lots of dead and unused code around.
    
    Switch whatever possible into static functions.
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>

-----------------------------------------------------------------------

Summary of changes:
 cman/qdisk/crc32.c       |    8 -----
 cman/qdisk/daemon_init.c |    3 +-
 cman/qdisk/disk.h        |    1 -
 cman/qdisk/disk_util.c   |   69 +------------------------------------------
 cman/qdisk/main.c        |   73 +++++++++++++--------------------------------
 cman/qdisk/proc.c        |    8 ++--
 cman/qdisk/score.c       |   56 ++---------------------------------
 cman/qdisk/score.h       |    5 ---
 8 files changed, 31 insertions(+), 192 deletions(-)

diff --git a/cman/qdisk/crc32.c b/cman/qdisk/crc32.c
index 796fac9..597d0b7 100644
--- a/cman/qdisk/crc32.c
+++ b/cman/qdisk/crc32.c
@@ -95,11 +95,3 @@ uint32_t clu_crc32(const char *data, size_t count)
 	       return 0;
        	return ~crc;
 }
-
-#if 0
-int
-main(int argc, const char **argv)
-{
-	printf("%08x\n",crc32(argv[1],strlen(argv[1])));
-}
-#endif
diff --git a/cman/qdisk/daemon_init.c b/cman/qdisk/daemon_init.c
index 460bef3..e0b5374 100644
--- a/cman/qdisk/daemon_init.c
+++ b/cman/qdisk/daemon_init.c
@@ -28,7 +28,6 @@
  * This should ultimately go in a header file.
  */
 void daemon_init(char *prog);
-int check_pid_valid(pid_t pid, char *prog);
 int check_process_running(char *prog, pid_t * pid);
 
 /*
@@ -38,7 +37,7 @@ static void update_pidfile(char *prog);
 static int setup_sigmask(void);
 
 
-int
+static int
 check_pid_valid(pid_t pid, char *prog)
 {
 	FILE *fp;
diff --git a/cman/qdisk/disk.h b/cman/qdisk/disk.h
index d56ffc7..0062c86 100644
--- a/cman/qdisk/disk.h
+++ b/cman/qdisk/disk.h
@@ -268,7 +268,6 @@ typedef struct {
 
 int qd_write_status(qd_ctx *ctx, int nid, disk_node_state_t state,
 		    disk_msg_t *msg, memb_mask_t mask, memb_mask_t master);
-int qd_read_print_status(target_info_t *disk, int nid);
 int qd_init(qd_ctx *ctx, cman_handle_t ch, int me);
 void qd_destroy(qd_ctx *ctx);
 
diff --git a/cman/qdisk/disk_util.c b/cman/qdisk/disk_util.c
index 5360dbb..c1b01b6 100644
--- a/cman/qdisk/disk_util.c
+++ b/cman/qdisk/disk_util.c
@@ -84,7 +84,7 @@ get_time(struct timeval *tv, int use_uptime)
 /**
   Update write times and calculate a new average time
  */
-void
+static void
 qd_update_wtime(qd_ctx *ctx, struct timeval *newtime)
 {
 	int x;
@@ -203,75 +203,10 @@ qd_write_status(qd_ctx *ctx, int nid, disk_node_state_t state,
 }
 
 
-int
-qd_print_status(target_info_t *disk, status_block_t *ps)
-{
-	int x;
-
-	printf("Data @ offset %d:\n",
-	       (int)qdisk_nodeid_offset(ps->ps_nodeid, disk->d_blksz));
-	printf("status_block_t {\n");
-	printf("\t.ps_magic = %08x;\n", (int)ps->ps_magic);
-	printf("\t.ps_nodeid = %d;\n", (int)ps->ps_nodeid);
-	printf("\t.ps_updatenode = %d;\n", (int)ps->ps_updatenode);
-	printf("\t.pad0 = %d;\n", (int)ps->pad0);
-	printf("\t.ps_timestamp = %llu;\n", (long long unsigned)
-		ps->ps_timestamp);
-	printf("\t.ps_state = %d;\n", ps->ps_state);
-	printf("\t.pad1[0] = %d;\n", ps->pad1[0]);
-	printf("\t.ps_flags = %d;\n", ps->ps_flags);
-	printf("\t.ps_score = %d;\n", ps->ps_score);
-	printf("\t.ps_scoremax = %d;\n", ps->ps_scoremax);
-	printf("\t.ps_ca_sec = %d;\n", ps->ps_ca_sec);
-	printf("\t.ps_ca_usec = %d;\n", ps->ps_ca_usec);
-	printf("\t.ps_lc_sec = %d;\n", ps->ps_lc_sec);
-	printf("\t.ps_lc_usec = %d;\n", ps->ps_lc_usec);
-	printf("\t.ps_mask = 0x");
-	for (x = (sizeof(memb_mask_t)-1); x >= 0; x--)
-		printf("%02x", ps->ps_mask[x]);
-	printf("\n");
-	printf("\t.ps_master_mask = 0x");
-	for (x = (sizeof(memb_mask_t)-1); x >= 0; x--)
-		printf("%02x", ps->ps_mask[x]);
-	printf("\n");
-
-	printf("}\n");
-
-	return 0;
-}
-
-
-int
-qd_read_print_status(target_info_t *disk, int nid)
-{
-	status_block_t ps;
-
-	if (!disk || disk->d_fd < 0) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (nid <= 0) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (qdisk_read(disk, qdisk_nodeid_offset(nid, disk->d_blksz), &ps,
-			sizeof(ps)) < 0) {
-		printf("Error reading node ID block %d\n", nid);
-		return -1;
-	}
-	swab_status_block_t(&ps);
-	qd_print_status(disk, &ps);
-
-	return 0;
-}
-
-
 /**
   Generate a token based on the current system time.
  */
-uint64_t
+static uint64_t
 generate_token(void)
 {
 	uint64_t my_token = 0;
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index ed4aba5..e9ef495 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -28,9 +28,13 @@
 #include <cluster/cnxman-socket.h>
 #endif
 
+/* from daemon_init.c */
 int daemon_init(char *);
 int check_process_running(char *, pid_t *);
 
+/* from proc.c */
+char *state_str(disk_node_state_t s);
+
 /*
   TODO:
   1) Take into account timings to gracefully extend node timeouts during 
@@ -48,7 +52,7 @@ inline void _diff_tv(struct timeval *dest, struct timeval *start,
 		     struct timeval *end);
 
 static int _running = 1;
-void update_local_status(qd_ctx *ctx, node_info_t *ni, int max, int score,
+static void update_local_status(qd_ctx *ctx, node_info_t *ni, int max, int score,
 		    	 int score_req, int score_max);
 
 
@@ -62,7 +66,7 @@ int_handler(int sig)
 /**
   Simple thing to see if a node is running.
  */
-inline int
+static inline int
 state_run(disk_node_state_t state)
 {
 	return (state >= S_INIT ? state : 0);
@@ -72,7 +76,7 @@ state_run(disk_node_state_t state)
 /**
   Clear out / initialize node info block.
  */
-void
+static void
 node_info_init(node_info_t *ni, int max)
 {
 	int x;
@@ -93,7 +97,7 @@ node_info_init(node_info_t *ni, int max)
   Rare case; usually other nodes would put up the 'Undead' message and
   re-evict us.
  */
-void
+static void
 check_self(qd_ctx *ctx, status_block_t *sb)
 {
 	if (!sb->ps_updatenode ||
@@ -118,7 +122,7 @@ check_self(qd_ctx *ctx, status_block_t *sb)
   or has not updated their timestamp recently.  See check_transitions as
   well.
  */
-void
+static void
 read_node_blocks(qd_ctx *ctx, node_info_t *ni, int max)
 {
 	int x;
@@ -174,7 +178,7 @@ read_node_blocks(qd_ctx *ctx, node_info_t *ni, int max)
 /**
   Check for node transitions.
  */
-void
+static void
 check_transitions(qd_ctx *ctx, node_info_t *ni, int max, memb_mask_t mask)
 {
 	int x;
@@ -362,7 +366,7 @@ check_transitions(qd_ctx *ctx, node_info_t *ni, int max, memb_mask_t mask)
   Checks for presence of an online master.  If there is no
   Returns
  */
-int
+static int
 master_exists(qd_ctx *ctx, node_info_t *ni, int max, int *low_id, int *count)
 {
 	int x;
@@ -430,7 +434,7 @@ master_exists(qd_ctx *ctx, node_info_t *ni, int max, int *low_id, int *count)
   a cluster running using this QD.  Note that this will delay master
   election if multiple nodes start with a second or two of each other.
  */
-int
+static int
 quorum_init(qd_ctx *ctx, node_info_t *ni, int max, struct h_data *h, int maxh)
 {
 	int x = 0, score, maxscore, score_req;
@@ -498,7 +502,7 @@ quorum_init(qd_ctx *ctx, node_info_t *ni, int max, struct h_data *h, int maxh)
 /**
   Vote for a master if it puts a bid in.
  */
-void
+static void
 do_vote(qd_ctx *ctx, node_info_t *ni, int max, disk_msg_t *msg)
 {
 	int x;
@@ -526,7 +530,7 @@ do_vote(qd_ctx *ctx, node_info_t *ni, int max, disk_msg_t *msg)
   Check to match nodes in mask with nodes online according to CMAN.
   Only the master needs to do this.
  */
-void
+static void
 check_cman(qd_ctx *ctx, memb_mask_t mask, memb_mask_t master_mask)
 {
 	cman_node_t nodes[MAX_NODES_DISK];
@@ -562,7 +566,7 @@ check_cman(qd_ctx *ctx, memb_mask_t mask, memb_mask_t master_mask)
 	*msg - it will store the vote for the lowest bid if we should
 	clear our bid.
  */ 
-int
+static int
 check_votes(qd_ctx *ctx, node_info_t *ni, int max, disk_msg_t *msg)
 {
 	int x, running = 0, acks = 0, nacks = 0, low_id = ctx->qc_my_id;
@@ -604,12 +608,7 @@ check_votes(qd_ctx *ctx, node_info_t *ni, int max, disk_msg_t *msg)
 	return 0;
 }
 
-
-char *
-state_str(disk_node_state_t s);
-
-
-void
+static void
 print_node_info(FILE *fp, node_info_t *ni)
 {
 	fprintf(fp, "node_info_t [node %d] {\n", ni->ni_status.ps_nodeid);
@@ -638,7 +637,7 @@ print_node_info(FILE *fp, node_info_t *ni)
 }
 
 
-void
+static void
 update_local_status(qd_ctx *ctx, node_info_t *ni, int max, int score,
 		    int score_req, int score_max)
 {
@@ -718,36 +717,6 @@ out:
 		fclose(fp);
 }
 
-
-/* Timeval functions from clumanager */
-/**
- * Scale a (struct timeval).
- *
- * @param tv		The timeval to scale.
- * @param scale		Positive multiplier.
- * @return		tv
- */
-struct timeval *
-_scale_tv(struct timeval *tv, int scale)
-{
-	tv->tv_sec *= scale;
-	tv->tv_usec *= scale;
-
-	if (tv->tv_usec > 1000000) {
-		tv->tv_sec += (tv->tv_usec / 1000000);
-		tv->tv_usec = (tv->tv_usec % 1000000);
-	}
-
-	return tv;
-}
-
-
-
-#define _print_tv(val) \
-	printf("%s: %d.%06d\n", #val, (int)((val)->tv_sec), \
-			(int)((val)->tv_usec))
-
-
 static inline int
 _cmp_tv(struct timeval *left, struct timeval *right)
 {
@@ -793,7 +762,7 @@ set_priority(int queue, int prio)
 }
 
 
-int
+static int
 cman_alive(cman_handle_t ch)
 {
 	fd_set rfds;
@@ -813,7 +782,7 @@ cman_alive(cman_handle_t ch)
 }
 
 
-int
+static int
 quorum_loop(qd_ctx *ctx, node_info_t *ni, int max)
 {
 	disk_msg_t msg = {0, 0, 0};
@@ -1067,7 +1036,7 @@ quorum_loop(qd_ctx *ctx, node_info_t *ni, int max)
 /**
   Tell the other nodes we're done (safely!).
  */
-int
+static int
 quorum_logout(qd_ctx *ctx)
 {
 	/* Write out our status */
@@ -1341,7 +1310,7 @@ get_config_data(qd_ctx *ctx, struct h_data *h, int maxh,
 }
 
 
-void
+static void
 check_stop_cman(qd_ctx *ctx)
 {
 	if (!(ctx->qc_flags & RF_STOP_CMAN))
diff --git a/cman/qdisk/proc.c b/cman/qdisk/proc.c
index 09a53ef..2f0b6b0 100644
--- a/cman/qdisk/proc.c
+++ b/cman/qdisk/proc.c
@@ -69,7 +69,7 @@ check_device(char *device, char *label, quorum_header_t *qh,
 }
 
 
-void
+static void
 filter_devs(struct devnode *node, void *v_args)
 {
 	struct device_args *args = (struct device_args *)v_args;
@@ -123,7 +123,7 @@ state_str(disk_node_state_t s)
 }
 
 
-void
+static void
 print_status_block(status_block_t *sb)
 {
 	time_t timestamp = (time_t)sb->ps_timestamp;
@@ -147,7 +147,7 @@ print_status_block(status_block_t *sb)
 }
 
 
-void
+static void
 read_info(char *dev)
 {
 	target_info_t ti;
@@ -177,7 +177,7 @@ read_info(char *dev)
 }
 
 
-void
+static void
 print_qdisk_info(struct devnode *dn)
 {
 	quorum_header_t *qh = (quorum_header_t *)dn->filter;
diff --git a/cman/qdisk/score.c b/cman/qdisk/score.c
index 2650c8a..d223c36 100644
--- a/cman/qdisk/score.c
+++ b/cman/qdisk/score.c
@@ -33,7 +33,7 @@ struct h_arg {
 /*
   XXX Messy, but works for now... 
  */
-void
+static void
 nullify(void)
 {
 	int fd[3];
@@ -58,7 +58,7 @@ nullify(void)
   Set all signal handlers to default for exec of a script.
   ONLY do this after a fork().
  */
-void
+static void
 restore_signals(void)
 {
 	sigset_t set;
@@ -348,7 +348,7 @@ fudge_scoring(void)
 /**
   Loop for the scoring thread.
  */
-void *
+static void *
 score_thread_main(void *arg)
 {
 	struct h_arg *args = (struct h_arg *)arg;
@@ -378,24 +378,6 @@ score_thread_main(void *arg)
 
 
 /**
-  Stop the score thread for shutdown / reconfiguration
- */
-int
-stop_score_thread(void)
-{
-	void *ret;
-
-	if (!_score_thread_running)
-		return 0;
-
-	_score_thread_running = 0;
-	pthread_join(score_thread, &ret);
-
-	return 0;
-}
-
-
-/**
   Start the score thread.  h is copied into an argument which is
   passed in as the arg parameter in the score thread, so it is safe
   to pass in h if it was allocated on the stack.
@@ -436,35 +418,3 @@ start_score_thread(qd_ctx *ctx, struct h_data *h, int count)
 	_score_thread_running = 0;
 	return -1;	
 }
-
-
-#if 0
-int
-main(int argc, char **argv)
-{
-	struct h_data h[10];
-	int max = 0, score, maxscore, ccsfd;
-
-	ccsfd = ccs_force_connect("test", 1);
-	if (ccsfd < 0) 
-		return -1;
-	max = configure_heuristics(ccsfd, h, 10);
-	ccs_disconnect(ccsfd);
-	
-	start_score_thread(h, max);
-	max = 0;
-	while (max < 10) {
-		get_my_score(&score,&maxscore);
-		printf("current %d/%d\n", score, maxscore);
-		sleep(1);
-		++max;
-	}
-	stop_score_thread();
-
-	get_my_score(&score,&maxscore);
-	printf("final! %d/%d\n", score, maxscore);
-
-	return 0;
-}
-#endif
-
diff --git a/cman/qdisk/score.h b/cman/qdisk/score.h
index 368a9fc..77e155b 100644
--- a/cman/qdisk/score.h
+++ b/cman/qdisk/score.h
@@ -24,11 +24,6 @@ struct h_data {
  */
 int configure_heuristics(int ccsfd, struct h_data *hp, int max);
 
-/* 
-   Stop the thread which runs the scoring applets.
- */
-int stop_score_thread(void);
-
 /*
    Start the thread which runs the scoring applets
  */


hooks/post-receive
--
Cluster Project


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]