1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

Add --dbdir to ctdbd. Necessary for shared operation between ctdbd and smbd.

(This used to be ctdb commit bce40105e2ccbca5e364793bbf1a6357e6dd69b2)
This commit is contained in:
Volker Lendecke 2007-04-18 16:36:22 +02:00
parent 31e2331608
commit 9135024fc7
5 changed files with 19 additions and 1 deletions

View File

@ -73,6 +73,14 @@ void ctdb_set_max_lacount(struct ctdb_context *ctdb, unsigned count)
ctdb->max_lacount = count;
}
/*
set the directory for the local databases
*/
void ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir)
{
ctdb->db_directory = talloc_strdup(ctdb, dir);
}
/*
add a node to the list of active nodes
*/

View File

@ -84,7 +84,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name,
/* add the node id to the database name, so when we run on loopback
we don't conflict in the local filesystem */
name = talloc_asprintf(ctdb_db, "%s.%u", name, ctdb_get_vnn(ctdb));
name = talloc_asprintf(ctdb_db, "%s/%s", ctdb->db_directory, name);
/* when we have a separate daemon this will need to be a real
file, not a TDB_INTERNAL, so the parent can access it to

View File

@ -45,12 +45,14 @@ int main(int argc, const char *argv[])
{
struct ctdb_context *ctdb;
const char *db_list = "test.tdb";
const char *db_dir = ".";
char *s, *tok;
struct poptOption popt_options[] = {
POPT_AUTOHELP
POPT_CTDB_CMDLINE
{ "dblist", 0, POPT_ARG_STRING, &db_list, 0, "list of databases", NULL },
{ "dbdir", 0, POPT_ARG_STRING, &db_dir, 0, "directory for the tdb files", NULL },
POPT_TABLEEND
};
int opt;
@ -84,6 +86,8 @@ int main(int argc, const char *argv[])
ctdb = ctdb_cmdline_init(ev);
ctdb_set_tdb_dir(ctdb, db_dir);
/* attach to the list of databases */
s = talloc_strdup(ctdb, db_list);
for (tok=strtok(s, ", "); tok; tok=strtok(NULL, ", ")) {

View File

@ -71,6 +71,11 @@ struct ctdb_context *ctdb_init(struct event_context *ev);
*/
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);
/*
set some flags
*/

View File

@ -119,6 +119,7 @@ struct ctdb_context {
struct event_context *ev;
struct ctdb_address address;
const char *name;
const char *db_directory;
uint32_t vnn; /* our own vnn */
uint32_t num_nodes;
uint32_t num_connected;