diff options
author | Martin Schwenke <martin@meltin.net> | 2013-10-21 19:36:36 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2013-10-25 12:06:06 +1100 |
commit | b595712f254d249e02cf4bbbc933063725286f78 (patch) | |
tree | a5e51bf482a38c10270e765ef761f0acb4fcddf7 | |
parent | a604c3d945303d58ce12f20de6a3a6fad1493f49 (diff) | |
download | samba-b595712f254d249e02cf4bbbc933063725286f78.tar.gz samba-b595712f254d249e02cf4bbbc933063725286f78.tar.xz samba-b595712f254d249e02cf4bbbc933063725286f78.zip |
ctdbd: Simplify database directory setting logic
No need to check if the options are set. The options are always set
via static defaults.
No need to talloc_strdup() the values via wrapper functions. The
options aren't going away. Remove now unused ctdb_set_tdb_dir() and
similar functions.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit 1fe82f3d7b610547ff4945887f15dd6c5798a49b)
-rw-r--r-- | ctdb/include/ctdb_client.h | 7 | ||||
-rw-r--r-- | ctdb/server/ctdb_server.c | 36 | ||||
-rw-r--r-- | ctdb/server/ctdbd.c | 24 |
3 files changed, 3 insertions, 64 deletions
diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h index c270783e6ad..53b082978ca 100644 --- a/ctdb/include/ctdb_client.h +++ b/ctdb/include/ctdb_client.h @@ -65,13 +65,6 @@ struct ctdb_context *ctdb_init(struct tevent_context *ev); int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport); /* - set the directory for the local databases -*/ -int ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir); -int ctdb_set_tdb_dir_persistent(struct ctdb_context *ctdb, const char *dir); -int ctdb_set_tdb_dir_state(struct ctdb_context *ctdb, const char *dir); - -/* set some flags */ void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags); diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c index 1c0fa4ca9e7..41cc8819a57 100644 --- a/ctdb/server/ctdb_server.c +++ b/ctdb/server/ctdb_server.c @@ -78,42 +78,6 @@ int ctdb_set_recovery_lock_file(struct ctdb_context *ctdb, const char *file) } /* - set the directory for the local databases -*/ -int ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir) -{ - ctdb->db_directory = talloc_strdup(ctdb, dir); - if (ctdb->db_directory == NULL) { - return -1; - } - return 0; -} - -/* - set the directory for the persistent databases -*/ -int ctdb_set_tdb_dir_persistent(struct ctdb_context *ctdb, const char *dir) -{ - ctdb->db_directory_persistent = talloc_strdup(ctdb, dir); - if (ctdb->db_directory_persistent == NULL) { - return -1; - } - return 0; -} - -/* - set the directory for internal state databases -*/ -int ctdb_set_tdb_dir_state(struct ctdb_context *ctdb, const char *dir) -{ - ctdb->db_directory_state = talloc_strdup(ctdb, dir); - if (ctdb->db_directory_state == NULL) { - return -1; - } - return 0; -} - -/* add a node to the list of nodes */ static int ctdb_add_node(struct ctdb_context *ctdb, char *nstr) diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index f9e83f8c3f8..7fe99ba3118 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -256,31 +256,13 @@ int main(int argc, const char *argv[]) } ctdb_load_nodes_file(ctdb); - if (options.db_dir) { - ret = ctdb_set_tdb_dir(ctdb, options.db_dir); - if (ret == -1) { - DEBUG(DEBUG_ALERT,("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(ctdb))); - exit(1); - } - } + ctdb->db_directory = options.db_dir; ctdb_mkdir_p_or_die(ctdb, ctdb->db_directory, 0700); - if (options.db_dir_persistent) { - ret = ctdb_set_tdb_dir_persistent(ctdb, options.db_dir_persistent); - if (ret == -1) { - DEBUG(DEBUG_ALERT,("ctdb_set_tdb_dir_persistent failed - %s\n", ctdb_errstr(ctdb))); - exit(1); - } - } + ctdb->db_directory_persistent = options.db_dir_persistent; ctdb_mkdir_p_or_die(ctdb, ctdb->db_directory_persistent, 0700); - if (options.db_dir_state) { - ret = ctdb_set_tdb_dir_state(ctdb, options.db_dir_state); - if (ret == -1) { - DEBUG(DEBUG_ALERT,("ctdb_set_tdb_dir_state failed - %s\n", ctdb_errstr(ctdb))); - exit(1); - } - } + ctdb->db_directory_state = options.db_dir_state; ctdb_mkdir_p_or_die(ctdb, ctdb->db_directory_state, 0700); if (options.public_interface) { |