summaryrefslogtreecommitdiff
path: root/source4/cluster
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-01-10 11:16:11 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:37:24 -0500
commitf6274959ba381b6b5d025cb0cee78665107a72a6 (patch)
tree750d88afc3f88f833162dc7d9ae93d844b61a4e4 /source4/cluster
parent1cd4339b9a2786aa26691ca4f02fa93ab0958b88 (diff)
downloadsamba-f6274959ba381b6b5d025cb0cee78665107a72a6.tar.gz
samba-f6274959ba381b6b5d025cb0cee78665107a72a6.tar.bz2
samba-f6274959ba381b6b5d025cb0cee78665107a72a6.zip
r20647: add cluster code
(This used to be commit 5870830b99a8d76bda1ff5af3fcf8dda9aba50ec)
Diffstat (limited to 'source4/cluster')
-rw-r--r--source4/cluster/cluster.c45
-rw-r--r--source4/cluster/cluster.h35
-rw-r--r--source4/cluster/config.mk4
3 files changed, 84 insertions, 0 deletions
diff --git a/source4/cluster/cluster.c b/source4/cluster/cluster.c
new file mode 100644
index 0000000000..fef5bce0d1
--- /dev/null
+++ b/source4/cluster/cluster.c
@@ -0,0 +1,45 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ core clustering code
+
+ Copyright (C) Andrew Tridgell 2006
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "cluster/cluster.h"
+
+/*
+ server a server_id for the local node
+*/
+struct server_id cluster_id(uint32_t id)
+{
+ struct server_id server_id;
+ ZERO_STRUCT(server_id);
+ server_id.id = id;
+ return server_id;
+}
+
+
+/*
+ return a server_id as a string
+*/
+const char *cluster_id_string(TALLOC_CTX *mem_ctx, struct server_id id)
+{
+ return talloc_asprintf(mem_ctx, "%u.%u", id.node, id.id);
+}
+
diff --git a/source4/cluster/cluster.h b/source4/cluster/cluster.h
new file mode 100644
index 0000000000..3c7f83960e
--- /dev/null
+++ b/source4/cluster/cluster.h
@@ -0,0 +1,35 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ structures for clustering
+
+ Copyright (C) Andrew Tridgell 2006
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __CLUSTER_H__
+#define __CLUSTER_H__
+
+/*
+ test for same cluster id
+*/
+#define cluster_id_equal(id1, id2) ((id1)->id == (id2)->id && (id1)->node == (id2)->node)
+
+/* prototypes */
+struct server_id cluster_id(uint32_t id);
+const char *cluster_id_string(TALLOC_CTX *mem_ctx, struct server_id id);
+
+#endif
diff --git a/source4/cluster/config.mk b/source4/cluster/config.mk
new file mode 100644
index 0000000000..934bc55252
--- /dev/null
+++ b/source4/cluster/config.mk
@@ -0,0 +1,4 @@
+
+####################
+[SUBSYSTEM::CLUSTER]
+OBJ_FILES = cluster.o