ctdb-daemon: Do not allow database detach if AllowClientDBAttach=1
[Samba.git] / source3 / lib / cluster_support.c
blobd6605fd3e21dc9fb9a186324b828079786559deb
1 /*
2 Unix SMB/CIFS implementation.
3 Copyright (C) 2014 Stefan Metzmacher
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "includes.h"
20 #include <tdb.h>
21 #include "cluster_support.h"
23 #ifdef HAVE_CTDB_H
24 #include <ctdb.h>
25 #define CLUSTER_SUPPORT 1
26 #endif
28 #ifdef HAVE_CTDB_PROTOCOL_H
29 #include <ctdb_protocol.h>
30 #else
31 #ifdef HAVE_CTDB_PRIVATE_H
32 #include <ctdb_private.h>
33 #endif
34 #endif
36 bool cluster_support_available(void)
38 #ifdef CLUSTER_SUPPORT
39 return true;
40 #else
41 return false;
42 #endif
45 const char *cluster_support_features(void)
47 #define _LINE_DEF(x) " " #x "\n"
48 #define _LINE_STR(x) " " #x ": " x "\n"
49 #define _LINE_INT(x) " " #x ": " __STRINGSTRING(x) "\n"
50 static const char *v = "Cluster support features:\n"
51 #ifdef CLUSTER_SUPPORT
52 _LINE_DEF(CLUSTER_SUPPORT)
53 #else
54 " NONE\n"
55 #endif
56 #ifdef HAVE_CTDB_H
57 _LINE_DEF(HAVE_CTDB_H)
58 #endif
59 #ifdef HAVE_CTDB_PRIVATE_H
60 _LINE_DEF(HAVE_CTDB_PRIVATE_H)
61 #endif
62 #ifdef HAVE_CTDB_PROTOCOL_H
63 _LINE_DEF(HAVE_CTDB_PROTOCOL_H)
64 #endif
65 #ifdef HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL
66 _LINE_DEF(HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL)
67 #endif
68 #ifdef HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL
69 _LINE_DEF(HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL)
70 #endif
71 #ifdef HAVE_CTDB_WANT_READONLY_DECL
72 _LINE_DEF(HAVE_CTDB_WANT_READONLY_DECL)
73 #endif
74 #ifdef HAVE_STRUCT_CTDB_CONTROL_TCP
75 _LINE_DEF(HAVE_STRUCT_CTDB_CONTROL_TCP)
76 #endif
77 #ifdef HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR
78 _LINE_DEF(HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR)
79 #endif
80 #ifdef HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL
81 _LINE_DEF(HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL)
82 #endif
83 #ifdef CTDB_PATH
84 _LINE_STR(CTDB_PATH)
85 #endif
86 #ifdef CTDB_VERSION
87 _LINE_INT(CTDB_VERSION)
88 #endif
89 "";
91 return v;