2 Misc control routines of libctdb
4 Copyright (C) Rusty Russell 2010
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include <ctdb_protocol.h>
21 #include "libctdb_private.h"
23 /* Remove type-safety macros. */
24 #undef ctdb_getrecmaster_send
25 #undef ctdb_getpnn_send
27 bool ctdb_getrecmaster_recv(struct ctdb_connection *ctdb,
28 struct ctdb_request *req, uint32_t *recmaster)
30 struct ctdb_reply_control *reply;
32 reply = unpack_reply_control(ctdb, req, CTDB_CONTROL_GET_RECMASTER);
36 if (reply->status == -1) {
37 DEBUG(ctdb, LOG_ERR, "ctdb_getrecmaster_recv: status -1");
40 *recmaster = reply->status;
44 struct ctdb_request *ctdb_getrecmaster_send(struct ctdb_connection *ctdb,
46 ctdb_callback_t callback,
49 return new_ctdb_control_request(ctdb, CTDB_CONTROL_GET_RECMASTER,
51 callback, private_data);
54 bool ctdb_getpnn_recv(struct ctdb_connection *ctdb,
55 struct ctdb_request *req, uint32_t *pnn)
57 struct ctdb_reply_control *reply;
59 reply = unpack_reply_control(ctdb, req, CTDB_CONTROL_GET_PNN);
63 if (reply->status == -1) {
64 DEBUG(ctdb, LOG_ERR, "ctdb_getpnn_recv: status -1");
71 struct ctdb_request *ctdb_getpnn_send(struct ctdb_connection *ctdb,
73 ctdb_callback_t callback,
76 return new_ctdb_control_request(ctdb, CTDB_CONTROL_GET_PNN, destnode,
77 NULL, 0, callback, private_data);