From: Andrew Tridgell Date: Wed, 18 Apr 2007 23:14:25 +0000 (+1000) Subject: merged the db_dir changes from volker. Changed them slightly, X-Git-Tag: tevent-0.9.20~348^2~2876 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=36816ee12ac345c419d8b0fbca0858c6336f6ad9;p=thirdparty%2Fsamba.git merged the db_dir changes from volker. Changed them slightly, to make the --dbdir option available to all ctdb tools, not just the daemon (This used to be ctdb commit add63b0ae11d8727163bb6f0c94a617d9b88ef28) --- 36816ee12ac345c419d8b0fbca0858c6336f6ad9 diff --cc ctdb/common/cmdline.c index 4753d8286bc,4753d8286bc..4995cc8de13 --- a/ctdb/common/cmdline.c +++ b/ctdb/common/cmdline.c @@@ -31,11 -31,11 +31,13 @@@ static struct const char *transport; const char *myaddress; int self_connect; ++ const char *db_dir; } ctdb_cmdline = { .nlist = NULL, .transport = "tcp", .myaddress = NULL, .self_connect = 0, ++ .db_dir = "." }; @@@ -45,6 -45,6 +47,7 @@@ struct poptOption popt_ctdb_cmdline[] { "transport", 0, POPT_ARG_STRING, &ctdb_cmdline.transport, 0, "protocol transport", NULL }, { "self-connect", 0, POPT_ARG_NONE, &ctdb_cmdline.self_connect, 0, "enable self connect", "boolean" }, { "debug", 'd', POPT_ARG_INT, &LogLevel, 0, "debug level"}, ++ { "dbdir", 0, POPT_ARG_STRING, &ctdb_cmdline.db_dir, 0, "directory for the tdb files", NULL }, { NULL } }; @@@ -93,5 -93,5 +96,11 @@@ struct ctdb_context *ctdb_cmdline_init( exit(1); } ++ ret = ctdb_set_tdb_dir(ctdb, ctdb_cmdline.db_dir); ++ if (ret == -1) { ++ printf("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(ctdb)); ++ exit(1); ++ } ++ return ctdb; } diff --cc ctdb/common/ctdb.c index de7a36f0c47,835cf129970..691d0b30628 --- a/ctdb/common/ctdb.c +++ b/ctdb/common/ctdb.c @@@ -73,6 -73,14 +73,18 @@@ void ctdb_set_max_lacount(struct ctdb_c ctdb->max_lacount = count; } + /* + set the directory for the local databases + */ -void ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir) ++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; + } + /* add a node to the list of active nodes */ diff --cc ctdb/include/ctdb.h index a61b7518123,160a56d975e..7339a56b2b7 --- a/ctdb/include/ctdb.h +++ b/ctdb/include/ctdb.h @@@ -71,6 -71,11 +71,11 @@@ struct ctdb_context *ctdb_init(struct e */ int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport); + /* + set the directory for the local databases + */ -void ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir); ++int ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir); + /* set some flags */ diff --cc ctdb/include/ctdb_private.h index 72ee5dadd66,e5aef487b9d..36a6c8de5da --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@@ -460,4 -461,4 +461,6 @@@ struct ctdb_call_state *ctdb_daemon_cal struct ctdb_call *call, struct ctdb_ltdb_header *header); ++void ctdb_request_finished(struct ctdb_context *ctdb, struct ctdb_req_header *hdr); ++ #endif