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

[Cluster-devel] [PATCH] ccs_tool: remove big chunck of unused code.



Similar clean up as I did for ccs daemon. Pretty self explanatory.

Please apply or acknowledge and I will apply.

Thanks
Fabio

-- 
I'm going to make him an offer he can't refuse.
#! /bin/sh /usr/share/dpatch/dpatch-run
## 002_ccs_more_dead_code.dpatch by  <fabbione gordian int fabbione net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad redhat-cluster-suite-2.20070502~/ccs/ccs_tool/update.c redhat-cluster-suite-2.20070502/ccs/ccs_tool/update.c
--- redhat-cluster-suite-2.20070502~/ccs/ccs_tool/update.c	2007-05-03 07:53:18.000000000 +0200
+++ redhat-cluster-suite-2.20070502/ccs/ccs_tool/update.c	2007-05-03 07:54:34.000000000 +0200
@@ -38,16 +38,10 @@
 
 static member_list_t *get_member_list(cman_handle_t handle);
 static void free_member_list(member_list_t *list);
-static char *member_id_to_name(member_list_t *list, int node);
-static int member_name_to_id(member_list_t *list, char *name);
-static int member_addr_to_id(member_list_t *list, struct sockaddr *addr);
-static int member_online_node(member_list_t *list, int node);
-static int member_online_name(member_list_t *list, char *name);
 
 static int select_retry(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *xfds,
 			struct timeval *timeout);
 
-static ssize_t write_retry(int fd, void *buf, int count, struct timeval *timeout);
 static ssize_t read_retry(int fd, void *buf, int count, struct timeval *timeout);
 
 static int ccs_open(cman_node_t node, uint16_t baseport, int timeout);
@@ -448,78 +442,6 @@
 }
 
 
-static char *member_id_to_name(member_list_t *list, int node)
-{
-  int i;
-
-  for (i = 0; i < list->count; i++) {
-    if (list->nodes[i].cn_nodeid == node) {
-      return list->nodes[i].cn_name;
-    }
-  }
-
-  return NULL;
-}
-
-
-static int member_name_to_id(member_list_t *list, char *name)
-{
-  int i;
-
-  for (i = 0; i < list->count; i++) {
-    if (!strcasecmp(list->nodes[i].cn_name, name)) {
-      return list->nodes[i].cn_nodeid;
-    }
-  }
-
-  return 0;
-}
-
-
-static int member_addr_to_id(member_list_t *list, struct sockaddr *addr)
-{
-  int i;
-
-  for (i = 0; i < list->count; i++) {
-	  if (memcmp(&list->nodes[i].cn_address.cna_address, addr,
-		sizeof(struct sockaddr))) {
-
-		return list->nodes[i].cn_nodeid;
-	  }
-  }
-
-  return -1;
-}
-
-
-static int member_online_node(member_list_t *list, int node)
-{
-  int i;
-
-  for (i = 0; i < list->count; i++) {
-    if (list->nodes[i].cn_nodeid == node) {
-      return list->nodes[i].cn_member;
-    }
-  }
-
-  return 0;
-}
-
-
-static int member_online_name(member_list_t *list, char *name)
-{
-  int i;
-
-  for (i = 0; i < list->count; i++) {
-    if (!strcasecmp(list->nodes[i].cn_name, name)) {
-      return list->nodes[i].cn_member;
-    }
-  }
-
-  return 0;
-}
-
-
 static int select_retry(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *xfds,
 			struct timeval *timeout)
 {
@@ -536,68 +458,6 @@
 }
 
 
-static ssize_t write_retry(int fd, void *buf, int count, struct timeval *timeout)
-{
-  int n, total = 0, remain = count, rv = 0;
-  fd_set wfds, xfds;
-
-  while (total < count)
-  {
-    /* Create the write FD set of 1... */
-    FD_ZERO(&wfds);
-    FD_SET(fd, &wfds);
-    FD_ZERO(&xfds);
-    FD_SET(fd, &xfds);
-
-    /* wait for the fd to be available for writing */
-    rv = select_retry(fd + 1, NULL, &wfds, &xfds, timeout);
-    if (rv == -1) {
-      return -1;
-    }
-    else if (rv == 0) {
-      errno = ETIMEDOUT;
-      return -1;
-    }
-
-    if (FD_ISSET(fd, &xfds)) {
-      errno = EPIPE;
-      return -1;
-    }
-
-    /* 
-     * Attempt to write to fd
-     */
-    n = write(fd, buf + (off_t) total, remain);
-
-    /*
-     * When we know our fd was select()ed and we receive 0 bytes
-     * when we write, the fd was closed.
-     */
-    if ((n == 0) && (rv == 1)) {
-      errno = EPIPE;
-      return -1;
-    }
-
-    if (n == -1) {
-      if ((errno == EAGAIN) || (errno == EINTR)) {
-	/* 
-	 * Not ready?
-	 */
-	continue;
-      }
-
-      /* Other errors: EIO, EINVAL, etc */
-      return -1;
-    }
-
-    total += n;
-    remain -= n;
-  }
-
-  return total;
-}
-
-
 static ssize_t read_retry(int fd, void *buf, int count, struct timeval *timeout)
 {
   int n, total = 0, remain = count, rv = 0;

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