2 Unix SMB/CIFS implementation.
4 local (dummy) clustering operations
6 Copyright (C) Andrew Tridgell 2006
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "cluster/cluster.h"
25 #include "cluster/cluster_private.h"
26 #include "lib/tdb/include/tdb.h"
28 #include "system/filesys.h"
31 server a server_id for the local node
33 static struct server_id local_id(struct cluster_ops *ops, uint32_t id)
35 struct server_id server_id;
36 ZERO_STRUCT(server_id);
43 return a server_id as a string
45 static const char *local_id_string(struct cluster_ops *ops,
46 TALLOC_CTX *mem_ctx, struct server_id id)
48 return talloc_asprintf(mem_ctx, "%u.%u", id.node, id.id);
53 open a tmp tdb for the local node. By using smbd_tmp_path() we don't need
54 TDB_CLEAR_IF_FIRST as the tmp path is wiped at startup
56 static struct tdb_wrap *local_tdb_tmp_open(struct cluster_ops *ops,
57 TALLOC_CTX *mem_ctx, const char *dbname,
60 char *path = smbd_tmp_path(mem_ctx, dbname);
62 w = tdb_wrap_open(mem_ctx, path, 0, flags,
63 O_RDWR|O_CREAT, 0600);
69 dummy backend handle function
71 static void *local_backend_handle(struct cluster_ops *ops)
77 dummy message init function - not needed as all messages are local
79 static NTSTATUS local_message_init(struct cluster_ops *ops,
80 struct messaging_context *msg,
81 struct server_id server,
82 cluster_message_fn_t handler)
90 static NTSTATUS local_message_send(struct cluster_ops *ops,
91 struct server_id server, uint32_t msg_type,
94 return NT_STATUS_INVALID_DEVICE_REQUEST;
97 static struct cluster_ops cluster_local_ops = {
98 .cluster_id = local_id,
99 .cluster_id_string = local_id_string,
100 .cluster_tdb_tmp_open = local_tdb_tmp_open,
101 .backend_handle = local_backend_handle,
102 .message_init = local_message_init,
103 .message_send = local_message_send,
107 void cluster_local_init(void)
109 cluster_set_ops(&cluster_local_ops);