ctdb-common: Remove unused function ctdb_parse_connections()
authorMartin Schwenke <martin@meltin.net>
Tue, 19 Sep 2017 13:12:15 +0000 (23:12 +1000)
committerMartin Schwenke <martins@samba.org>
Thu, 5 Oct 2017 03:19:21 +0000 (05:19 +0200)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/common/system.h
ctdb/common/system_util.c

index 2875760806a3a2f6be56023a08b7c378fc2920c7..1f479cef1066f3b3b285affa8184842536629f01 100644 (file)
@@ -62,7 +62,4 @@ void mkdir_p_or_die(const char *dir, int mode);
 
 void ctdb_wait_for_process_to_exit(pid_t pid);
 
-int ctdb_parse_connections(FILE *fp, TALLOC_CTX *mem_ctx,
-                          int *num_conn, struct ctdb_connection **out);
-
 #endif /* __CTDB_SYSTEM_H__ */
index 96ea71dafaf1a72b75dd86b703e435b20081b40f..ee48da74486fdaf3143f57f6d7711ab8879ae613 100644 (file)
@@ -378,60 +378,3 @@ void ctdb_wait_for_process_to_exit(pid_t pid)
                sleep(5);
        }
 }
-
-int ctdb_parse_connections(FILE *fp, TALLOC_CTX *mem_ctx,
-                          int *num_conn, struct ctdb_connection **out)
-{
-       struct ctdb_connection *conn = NULL;
-       char line[128], src[128], dst[128]; /* long enough for IPv6 */
-       int line_num, ret;
-       int num = 0, max = 0;
-
-       line_num = 0;
-       while (! feof(fp)) {
-               if (fgets(line, sizeof(line), fp) == NULL) {
-                       break;
-               }
-               line_num += 1;
-
-               /* Skip empty lines */
-               if (line[0] == '\n') {
-                       continue;
-               }
-
-               ret = sscanf(line, "%s %s\n", src, dst);
-               if (ret != 2) {
-                       DEBUG(DEBUG_ERR, ("Bad line [%d]: %s\n",
-                                         line_num, line));
-                       talloc_free(conn);
-                       return EINVAL;
-               }
-
-               if (num >= max) {
-                       max += 1024;
-                       conn = talloc_realloc(mem_ctx, conn,
-                                             struct ctdb_connection, max);
-                       if (conn == NULL) {
-                               return ENOMEM;
-                       }
-               }
-
-               if (! parse_ip_port(src, &conn[num].src)) {
-                       DEBUG(DEBUG_ERR, ("Invalid IP address %s\n", src));
-                       talloc_free(conn);
-                       return EINVAL;
-               }
-
-               if (! parse_ip_port(dst, &conn[num].dst)) {
-                       DEBUG(DEBUG_ERR, ("Invalid IP address %s\n", dst));
-                       talloc_free(conn);
-                       return EINVAL;
-               }
-
-               num += 1;
-       }
-
-       *num_conn = num;
-       *out = conn;
-       return 0;
-}