Changeset 988 for vendor/current/source4/cluster/local.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/cluster/local.c
r740 r988 23 23 #include "cluster/cluster.h" 24 24 #include "cluster/cluster_private.h" 25 #include <tdb.h> 26 #include "lib/util/tdb_wrap.h" 25 #include "dbwrap/dbwrap.h" 27 26 #include "system/filesys.h" 28 27 #include "param/param.h" 29 #include "librpc/gen_ndr/server_id 4.h"28 #include "librpc/gen_ndr/server_id.h" 30 29 31 30 /* 32 31 server a server_id for the local node 33 32 */ 34 static struct server_id local_id(struct cluster_ops *ops, uint64_t id, uint32_t id2)33 static struct server_id local_id(struct cluster_ops *ops, uint64_t pid, uint32_t task_id) 35 34 { 36 35 struct server_id server_id; 37 36 ZERO_STRUCT(server_id); 38 server_id.id = id; 39 server_id.id2 = id2; 37 server_id.pid = pid; 38 server_id.task_id = task_id; 39 server_id.vnn = NONCLUSTER_VNN; 40 /* This is because we are not in the s3 serverid database */ 41 server_id.unique_id = SERVERID_UNIQUE_ID_NOT_TO_VERIFY; 40 42 return server_id; 41 }42 43 44 /*45 return a server_id as a string46 */47 static const char *local_id_string(struct cluster_ops *ops,48 TALLOC_CTX *mem_ctx, struct server_id id)49 {50 return talloc_asprintf(mem_ctx, "%u.%llu.%u", id.node, (unsigned long long)id.id, id.id2);51 43 } 52 44 … … 56 48 TDB_CLEAR_IF_FIRST as the tmp path is wiped at startup 57 49 */ 58 static struct tdb_wrap *local_tdb_tmp_open(struct cluster_ops *ops,59 TALLOC_CTX *mem_ctx,60 struct loadparm_context *lp_ctx,61 const char *dbname, int flags)50 static struct db_context *local_db_tmp_open(struct cluster_ops *ops, 51 TALLOC_CTX *mem_ctx, 52 struct loadparm_context *lp_ctx, 53 const char *dbbase, int flags) 62 54 { 63 char *path = smbd_tmp_path(mem_ctx, lp_ctx, dbname); 64 struct tdb_wrap *w; 65 w = tdb_wrap_open(mem_ctx, path, 0, flags, 66 O_RDWR|O_CREAT, 0600); 67 talloc_free(path); 68 return w; 55 TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); 56 char *path, *dbname; 57 struct db_context *db; 58 59 dbname = talloc_asprintf(mem_ctx, "%s.tdb", dbbase); 60 61 path = smbd_tmp_path(tmp_ctx, lp_ctx, dbname); 62 db = dbwrap_local_open(mem_ctx, lp_ctx, path, 0, flags, O_RDWR|O_CREAT, 63 0600, DBWRAP_LOCK_ORDER_NONE, DBWRAP_FLAG_NONE); 64 talloc_free(tmp_ctx); 65 return db; 69 66 } 70 67 … … 81 78 */ 82 79 static NTSTATUS local_message_init(struct cluster_ops *ops, 83 struct messaging_context *msg,80 struct imessaging_context *msg, 84 81 struct server_id server, 85 82 cluster_message_fn_t handler) … … 99 96 static struct cluster_ops cluster_local_ops = { 100 97 .cluster_id = local_id, 101 .cluster_id_string = local_id_string, 102 .cluster_tdb_tmp_open = local_tdb_tmp_open, 98 .cluster_db_tmp_open = local_db_tmp_open, 103 99 .backend_handle = local_backend_handle, 104 100 .message_init = local_message_init,
Note:
See TracChangeset
for help on using the changeset viewer.