diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-01-20 00:48:31 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:43:52 -0500 |
commit | efc68d8bf6d5acc009285e8f34b30a3a5b252884 (patch) | |
tree | d84cca0cf2946c054f3f19ee8b50b77713952af4 /source4/cluster/local.c | |
parent | d1b61b09aa542d64bf43abb3ad04611f46b57376 (diff) | |
download | samba-efc68d8bf6d5acc009285e8f34b30a3a5b252884.tar.gz samba-efc68d8bf6d5acc009285e8f34b30a3a5b252884.tar.bz2 samba-efc68d8bf6d5acc009285e8f34b30a3a5b252884.zip |
r20919: add a function cluster_tdb_tmp_open() which can be used in a cluster
environment for subsystems that have not yet been converted to use
ctdb to get a shared temporary tdb
(This used to be commit 0ed91384497aed6817b2220c31344bfcd45fd033)
Diffstat (limited to 'source4/cluster/local.c')
-rw-r--r-- | source4/cluster/local.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/source4/cluster/local.c b/source4/cluster/local.c index 2e1ac2035f..28a0576acc 100644 --- a/source4/cluster/local.c +++ b/source4/cluster/local.c @@ -23,6 +23,9 @@ #include "includes.h" #include "cluster/cluster.h" #include "cluster/cluster_private.h" +#include "lib/tdb/include/tdb.h" +#include "db_wrap.h" +#include "system/filesys.h" /* server a server_id for the local node @@ -45,10 +48,28 @@ static const char *local_id_string(struct cluster_ops *ops, return talloc_asprintf(mem_ctx, "%u.%u", id.node, id.id); } + +/* + open a tmp tdb for the local node. By using smbd_tmp_path() we don't need + TDB_CLEAR_IF_FIRST as the tmp path is wiped at startup +*/ +static struct tdb_wrap *local_tdb_tmp_open(struct cluster_ops *ops, + TALLOC_CTX *mem_ctx, const char *dbname, + int flags) +{ + char *path = smbd_tmp_path(mem_ctx, dbname); + struct tdb_wrap *w; + w = tdb_wrap_open(mem_ctx, path, 0, flags, + O_RDWR|O_CREAT, 0600); + talloc_free(path); + return w; +} + static struct cluster_ops cluster_local_ops = { - .cluster_id = local_id, - .cluster_id_string = local_id_string, - .private = NULL + .cluster_id = local_id, + .cluster_id_string = local_id_string, + .cluster_tdb_tmp_open = local_tdb_tmp_open, + .private = NULL }; void cluster_local_init(void) |