2 CTDB protocol marshalling
4 Copyright (C) Amitay Isaacs 2015
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/>.
21 #include "system/network.h"
27 #include "protocol_api.h"
28 #include "protocol_private.h"
31 void ctdb_req_call_fill(struct ctdb_req_call *c,
32 uint32_t db_id, uint32_t flags,
33 uint32_t call_id, TDB_DATA key)
35 request->flags = flags;
39 c->calldata = tdb_null;
43 static int ctdb_reply_control_generic(struct ctdb_reply_control
*reply
,
46 if (reply
->rdata
.opcode
!= opcode
) {
53 /* CTDB_CONTROL_PROCESS_EXISTS */
55 void ctdb_req_control_process_exists(struct ctdb_req_control
*request
,
58 request
->opcode
= CTDB_CONTROL_PROCESS_EXISTS
;
61 request
->client_id
= 0;
64 request
->rdata
.opcode
= CTDB_CONTROL_PROCESS_EXISTS
;
65 request
->rdata
.data
.pid
= pid
;
69 int ctdb_reply_control_process_exists(struct ctdb_reply_control
*reply
,
72 if (reply
->rdata
.opcode
!= CTDB_CONTROL_PROCESS_EXISTS
) {
76 *status
= reply
->status
;
82 /* CTDB_CONTROL_STATISTICS */
84 void ctdb_req_control_statistics(struct ctdb_req_control
*request
)
86 request
->opcode
= CTDB_CONTROL_STATISTICS
;
89 request
->client_id
= 0;
92 request
->rdata
.opcode
= CTDB_CONTROL_STATISTICS
;
95 int ctdb_reply_control_statistics(struct ctdb_reply_control
*reply
,
97 struct ctdb_statistics
**stats
)
99 if (reply
->rdata
.opcode
!= CTDB_CONTROL_STATISTICS
) {
103 if (reply
->status
== 0) {
104 *stats
= talloc_steal(mem_ctx
, reply
->rdata
.data
.stats
);
106 return reply
->status
;
109 /* CTDB_CONTROL_PING */
111 void ctdb_req_control_ping(struct ctdb_req_control
*request
)
113 request
->opcode
= CTDB_CONTROL_PING
;
116 request
->client_id
= 0;
119 request
->rdata
.opcode
= CTDB_CONTROL_PING
;
122 int ctdb_reply_control_ping(struct ctdb_reply_control
*reply
,
125 if (reply
->rdata
.opcode
!= CTDB_CONTROL_PING
) {
129 if (reply
->status
>= 0) {
130 *num_clients
= reply
->status
;
133 return reply
->status
;
136 /* CTDB_CONTROL_GETDBPATH */
138 void ctdb_req_control_getdbpath(struct ctdb_req_control
*request
,
141 request
->opcode
= CTDB_CONTROL_GETDBPATH
;
144 request
->client_id
= 0;
147 request
->rdata
.opcode
= CTDB_CONTROL_GETDBPATH
;
148 request
->rdata
.data
.db_id
= db_id
;
151 int ctdb_reply_control_getdbpath(struct ctdb_reply_control
*reply
,
152 TALLOC_CTX
*mem_ctx
, const char **db_path
)
154 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GETDBPATH
) {
158 if (reply
->status
== 0) {
159 *db_path
= talloc_steal(mem_ctx
, reply
->rdata
.data
.db_path
);
161 return reply
->status
;
164 /* CTDB_CONTROL_GETVNNMAP */
166 void ctdb_req_control_getvnnmap(struct ctdb_req_control
*request
)
168 request
->opcode
= CTDB_CONTROL_GETVNNMAP
;
171 request
->client_id
= 0;
174 request
->rdata
.opcode
= CTDB_CONTROL_GETVNNMAP
;
177 int ctdb_reply_control_getvnnmap(struct ctdb_reply_control
*reply
,
179 struct ctdb_vnn_map
**vnnmap
)
181 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GETVNNMAP
) {
185 if (reply
->status
== 0) {
186 *vnnmap
= talloc_steal(mem_ctx
, reply
->rdata
.data
.vnnmap
);
188 return reply
->status
;
191 /* CTDB_CONTROL_SETVNNMAP */
193 void ctdb_req_control_setvnnmap(struct ctdb_req_control
*request
,
194 struct ctdb_vnn_map
*vnnmap
)
196 request
->opcode
= CTDB_CONTROL_SETVNNMAP
;
199 request
->client_id
= 0;
202 request
->rdata
.opcode
= CTDB_CONTROL_SETVNNMAP
;
203 request
->rdata
.data
.vnnmap
= vnnmap
;
206 int ctdb_reply_control_setvnnmap(struct ctdb_reply_control
*reply
)
208 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SETVNNMAP
);
211 /* CTDB_CONTROL_GET_DEBUG */
213 void ctdb_req_control_get_debug(struct ctdb_req_control
*request
)
215 request
->opcode
= CTDB_CONTROL_GET_DEBUG
;
218 request
->client_id
= 0;
221 request
->rdata
.opcode
= CTDB_CONTROL_GET_DEBUG
;
224 int ctdb_reply_control_get_debug(struct ctdb_reply_control
*reply
,
227 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_DEBUG
) {
231 if (reply
->status
== 0) {
232 *loglevel
= (int)reply
->rdata
.data
.loglevel
;
234 return reply
->status
;
237 /* CTDB_CONTROL_SET_DEBUG */
239 void ctdb_req_control_set_debug(struct ctdb_req_control
*request
,
242 request
->opcode
= CTDB_CONTROL_SET_DEBUG
;
245 request
->client_id
= 0;
248 request
->rdata
.opcode
= CTDB_CONTROL_SET_DEBUG
;
249 request
->rdata
.data
.loglevel
= (uint32_t)loglevel
;
252 int ctdb_reply_control_set_debug(struct ctdb_reply_control
*reply
)
254 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_DEBUG
);
257 /* CTDB_CONTROL_GET_DBMAP */
259 void ctdb_req_control_get_dbmap(struct ctdb_req_control
*request
)
261 request
->opcode
= CTDB_CONTROL_GET_DBMAP
;
264 request
->client_id
= 0;
267 request
->rdata
.opcode
= CTDB_CONTROL_GET_DBMAP
;
270 int ctdb_reply_control_get_dbmap(struct ctdb_reply_control
*reply
,
272 struct ctdb_dbid_map
**dbmap
)
274 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_DBMAP
) {
278 if (reply
->status
== 0) {
279 *dbmap
= talloc_steal(mem_ctx
, reply
->rdata
.data
.dbmap
);
281 return reply
->status
;
284 /* CTDB_CONTROL_PULL_DB */
286 void ctdb_req_control_pull_db(struct ctdb_req_control
*request
,
287 struct ctdb_pulldb
*pulldb
)
289 request
->opcode
= CTDB_CONTROL_PULL_DB
;
292 request
->client_id
= 0;
295 request
->rdata
.opcode
= CTDB_CONTROL_PULL_DB
;
296 request
->rdata
.data
.pulldb
= pulldb
;
299 int ctdb_reply_control_pull_db(struct ctdb_reply_control
*reply
,
301 struct ctdb_rec_buffer
**recbuf
)
303 if (reply
->rdata
.opcode
!= CTDB_CONTROL_PULL_DB
) {
307 if (reply
->status
== 0) {
308 *recbuf
= talloc_steal(mem_ctx
, reply
->rdata
.data
.recbuf
);
310 return reply
->status
;
313 /* CTDB_CONTROL_PUSH_DB */
315 void ctdb_req_control_push_db(struct ctdb_req_control
*request
,
316 struct ctdb_rec_buffer
*recbuf
)
318 request
->opcode
= CTDB_CONTROL_PUSH_DB
;
321 request
->client_id
= 0;
324 request
->rdata
.opcode
= CTDB_CONTROL_PUSH_DB
;
325 request
->rdata
.data
.recbuf
= recbuf
;
328 int ctdb_reply_control_push_db(struct ctdb_reply_control
*reply
)
330 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_PUSH_DB
);
333 /* CTDB_CONTROL_GET_RECMODE */
335 void ctdb_req_control_get_recmode(struct ctdb_req_control
*request
)
337 request
->opcode
= CTDB_CONTROL_GET_RECMODE
;
340 request
->client_id
= 0;
343 request
->rdata
.opcode
= CTDB_CONTROL_GET_RECMODE
;
346 int ctdb_reply_control_get_recmode(struct ctdb_reply_control
*reply
,
349 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_RECMODE
) {
353 if (reply
->status
>= 0) {
354 *recmode
= reply
->status
;
357 return reply
->status
;
360 /* CTDB_CONTROL_SET_RECMODE */
362 void ctdb_req_control_set_recmode(struct ctdb_req_control
*request
,
365 request
->opcode
= CTDB_CONTROL_SET_RECMODE
;
368 request
->client_id
= 0;
371 request
->rdata
.opcode
= CTDB_CONTROL_SET_RECMODE
;
372 request
->rdata
.data
.recmode
= recmode
;
375 int ctdb_reply_control_set_recmode(struct ctdb_reply_control
*reply
)
377 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_RECMODE
);
380 /* CTDB_CONTROL_STATISTICS_RESET */
382 void ctdb_req_control_statistics_reset(struct ctdb_req_control
*request
)
384 request
->opcode
= CTDB_CONTROL_STATISTICS_RESET
;
387 request
->client_id
= 0;
390 request
->rdata
.opcode
= CTDB_CONTROL_STATISTICS_RESET
;
393 int ctdb_reply_control_statistics_reset(struct ctdb_reply_control
*reply
)
395 return ctdb_reply_control_generic(reply
,
396 CTDB_CONTROL_STATISTICS_RESET
);
399 /* CTDB_CONTROL_DB_ATTACH */
401 void ctdb_req_control_db_attach(struct ctdb_req_control
*request
,
402 const char *db_name
, uint32_t tdb_flags
)
404 request
->opcode
= CTDB_CONTROL_DB_ATTACH
;
406 request
->srvid
= tdb_flags
;
407 request
->client_id
= 0;
410 request
->rdata
.opcode
= CTDB_CONTROL_DB_ATTACH
;
411 request
->rdata
.data
.db_name
= db_name
;
414 int ctdb_reply_control_db_attach(struct ctdb_reply_control
*reply
,
417 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_ATTACH
) {
421 if (reply
->status
== 0) {
422 *db_id
= reply
->rdata
.data
.db_id
;
424 return reply
->status
;
427 /* CTDB_CONTROL_SET_CALL */
429 /* CTDB_CONTROL_TRAVERSE_START */
431 void ctdb_req_control_traverse_start(struct ctdb_req_control
*request
,
432 struct ctdb_traverse_start
*traverse
)
434 request
->opcode
= CTDB_CONTROL_TRAVERSE_START
;
437 request
->client_id
= 0;
440 request
->rdata
.opcode
= CTDB_CONTROL_TRAVERSE_START
;
441 request
->rdata
.data
.traverse_start
= traverse
;
444 int ctdb_reply_control_traverse_start(struct ctdb_reply_control
*reply
)
446 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TRAVERSE_START
);
449 /* CTDB_CONTROL_TRAVERSE_ALL */
450 /* CTDB_CONTROL_TRAVERSE_DATA */
452 /* CTDB_CONTROL_REGISTER_SRVID */
454 void ctdb_req_control_register_srvid(struct ctdb_req_control
*request
,
457 request
->opcode
= CTDB_CONTROL_REGISTER_SRVID
;
459 request
->srvid
= srvid
;
460 request
->client_id
= 0;
463 request
->rdata
.opcode
= CTDB_CONTROL_REGISTER_SRVID
;
466 int ctdb_reply_control_register_srvid(struct ctdb_reply_control
*reply
)
468 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_REGISTER_SRVID
);
471 /* CTDB_CONTROL_DEREGISTER_SRVID */
473 void ctdb_req_control_deregister_srvid(struct ctdb_req_control
*request
,
476 request
->opcode
= CTDB_CONTROL_DEREGISTER_SRVID
;
478 request
->srvid
= srvid
;
479 request
->client_id
= 0;
482 request
->rdata
.opcode
= CTDB_CONTROL_DEREGISTER_SRVID
;
485 int ctdb_reply_control_deregister_srvid(struct ctdb_reply_control
*reply
)
487 return ctdb_reply_control_generic(reply
,
488 CTDB_CONTROL_DEREGISTER_SRVID
);
491 /* CTDB_CONTROL_GET_DBNAME */
493 void ctdb_req_control_get_dbname(struct ctdb_req_control
*request
,
496 request
->opcode
= CTDB_CONTROL_GET_DBNAME
;
499 request
->client_id
= 0;
502 request
->rdata
.opcode
= CTDB_CONTROL_GET_DBNAME
;
503 request
->rdata
.data
.db_id
= db_id
;
506 int ctdb_reply_control_get_dbname(struct ctdb_reply_control
*reply
,
507 TALLOC_CTX
*mem_ctx
, const char **db_name
)
509 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_DBNAME
) {
513 if (reply
->status
== 0) {
514 *db_name
= talloc_steal(mem_ctx
, reply
->rdata
.data
.db_name
);
516 return reply
->status
;
519 /* CTDB_CONTROL_ENABLE_SEQNUM */
521 void ctdb_req_control_enable_seqnum(struct ctdb_req_control
*request
,
524 request
->opcode
= CTDB_CONTROL_ENABLE_SEQNUM
;
527 request
->client_id
= 0;
530 request
->rdata
.opcode
= CTDB_CONTROL_ENABLE_SEQNUM
;
531 request
->rdata
.data
.db_id
= db_id
;
534 int ctdb_reply_control_enable_seqnum(struct ctdb_reply_control
*reply
)
536 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_ENABLE_SEQNUM
);
539 /* CTDB_CONTROL_UPDATE_SEQNUM */
541 void ctdb_req_control_update_seqnum(struct ctdb_req_control
*request
,
544 request
->opcode
= CTDB_CONTROL_UPDATE_SEQNUM
;
547 request
->client_id
= 0;
550 request
->rdata
.opcode
= CTDB_CONTROL_UPDATE_SEQNUM
;
551 request
->rdata
.data
.db_id
= db_id
;
554 int ctdb_reply_control_update_seqnum(struct ctdb_reply_control
*reply
)
556 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_UPDATE_SEQNUM
);
559 /* CTDB_CONTROL_DUMP_MEMORY */
561 void ctdb_req_control_dump_memory(struct ctdb_req_control
*request
)
563 request
->opcode
= CTDB_CONTROL_DUMP_MEMORY
;
566 request
->client_id
= 0;
569 request
->rdata
.opcode
= CTDB_CONTROL_DUMP_MEMORY
;
572 int ctdb_reply_control_dump_memory(struct ctdb_reply_control
*reply
,
573 TALLOC_CTX
*mem_ctx
, const char **mem_str
)
575 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DUMP_MEMORY
) {
579 if (reply
->status
== 0) {
580 *mem_str
= talloc_steal(mem_ctx
, reply
->rdata
.data
.mem_str
);
582 return reply
->status
;
585 /* CTDB_CONTROL_GET_PID */
587 void ctdb_req_control_get_pid(struct ctdb_req_control
*request
)
589 request
->opcode
= CTDB_CONTROL_GET_PID
;
592 request
->client_id
= 0;
595 request
->rdata
.opcode
= CTDB_CONTROL_GET_PID
;
598 int ctdb_reply_control_get_pid(struct ctdb_reply_control
*reply
,
601 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_PID
) {
605 *pid
= reply
->status
;
608 return reply
->status
;
611 /* CTDB_CONTROL_GET_RECMASTER */
613 void ctdb_req_control_get_recmaster(struct ctdb_req_control
*request
)
615 request
->opcode
= CTDB_CONTROL_GET_RECMASTER
;
618 request
->client_id
= 0;
621 request
->rdata
.opcode
= CTDB_CONTROL_GET_RECMASTER
;
624 int ctdb_reply_control_get_recmaster(struct ctdb_reply_control
*reply
,
627 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_RECMASTER
) {
631 *recmaster
= reply
->status
;
634 return reply
->status
;
637 /* CTDB_CONTROL_SET_RECMASTER */
639 void ctdb_req_control_set_recmaster(struct ctdb_req_control
*request
,
642 request
->opcode
= CTDB_CONTROL_SET_RECMASTER
;
645 request
->client_id
= 0;
648 request
->rdata
.opcode
= CTDB_CONTROL_SET_RECMASTER
;
649 request
->rdata
.data
.recmaster
= recmaster
;
652 int ctdb_reply_control_set_recmaster(struct ctdb_reply_control
*reply
)
654 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_RECMASTER
);
657 /* CTDB_CONTROL_FREEZE */
659 void ctdb_req_control_freeze(struct ctdb_req_control
*request
,
662 request
->opcode
= CTDB_CONTROL_FREEZE
;
664 request
->srvid
= priority
;
665 request
->client_id
= 0;
668 request
->rdata
.opcode
= CTDB_CONTROL_FREEZE
;
671 int ctdb_reply_control_freeze(struct ctdb_reply_control
*reply
)
673 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_FREEZE
);
676 /* CTDB_CONTROL_GET_PNN */
678 void ctdb_req_control_get_pnn(struct ctdb_req_control
*request
)
680 request
->opcode
= CTDB_CONTROL_GET_PNN
;
683 request
->client_id
= 0;
686 request
->rdata
.opcode
= CTDB_CONTROL_GET_PNN
;
689 int ctdb_reply_control_get_pnn(struct ctdb_reply_control
*reply
,
692 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_PNN
) {
696 if (reply
->status
>= 0) {
697 *pnn
= reply
->status
;
700 return reply
->status
;
703 /* CTDB_CONTROL_SHUTDOWN */
705 void ctdb_req_control_shutdown(struct ctdb_req_control
*request
)
707 request
->opcode
= CTDB_CONTROL_SHUTDOWN
;
710 request
->client_id
= 0;
711 request
->flags
= CTDB_CTRL_FLAG_NOREPLY
;
713 request
->rdata
.opcode
= CTDB_CONTROL_SHUTDOWN
;
716 int ctdb_reply_control_shutdown(struct ctdb_reply_control
*reply
)
718 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SHUTDOWN
);
721 /* CTDB_CONTROL_GET_MONMODE */
723 void ctdb_req_control_get_monmode(struct ctdb_req_control
*request
)
725 request
->opcode
= CTDB_CONTROL_GET_MONMODE
;
728 request
->client_id
= 0;
731 request
->rdata
.opcode
= CTDB_CONTROL_GET_MONMODE
;
734 int ctdb_reply_control_get_monmode(struct ctdb_reply_control
*reply
,
737 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_MONMODE
) {
741 if (reply
->status
>= 0) {
742 *mon_mode
= reply
->status
;
745 return reply
->status
;
748 /* CTDB_CONTROL_TCP_CLIENT */
750 void ctdb_req_control_tcp_client(struct ctdb_req_control
*request
,
751 struct ctdb_connection
*conn
)
753 request
->opcode
= CTDB_CONTROL_TCP_CLIENT
;
756 request
->client_id
= 0;
759 request
->rdata
.opcode
= CTDB_CONTROL_TCP_CLIENT
;
760 request
->rdata
.data
.conn
= conn
;
763 int ctdb_reply_control_tcp_client(struct ctdb_reply_control
*reply
)
765 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TCP_CLIENT
);
768 /* CTDB_CONTROL_TCP_ADD */
770 void ctdb_req_control_tcp_add(struct ctdb_req_control
*request
,
771 struct ctdb_connection
*conn
)
773 request
->opcode
= CTDB_CONTROL_TCP_ADD
;
776 request
->client_id
= 0;
779 request
->rdata
.opcode
= CTDB_CONTROL_TCP_ADD
;
780 request
->rdata
.data
.conn
= conn
;
783 int ctdb_reply_control_tcp_add(struct ctdb_reply_control
*reply
)
785 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TCP_ADD
);
788 /* CTDB_CONTROL_TCP_REMOVE */
790 void ctdb_req_control_tcp_remove(struct ctdb_req_control
*request
,
791 struct ctdb_connection
*conn
)
793 request
->opcode
= CTDB_CONTROL_TCP_REMOVE
;
796 request
->client_id
= 0;
799 request
->rdata
.opcode
= CTDB_CONTROL_TCP_REMOVE
;
800 request
->rdata
.data
.conn
= conn
;
803 int ctdb_reply_control_tcp_remove(struct ctdb_reply_control
*reply
)
805 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TCP_REMOVE
);
808 /* CTDB_CONTROL_STARTUP */
810 void ctdb_req_control_startup(struct ctdb_req_control
*request
)
812 request
->opcode
= CTDB_CONTROL_STARTUP
;
815 request
->client_id
= 0;
818 request
->rdata
.opcode
= CTDB_CONTROL_STARTUP
;
821 int ctdb_reply_control_startup(struct ctdb_reply_control
*reply
)
823 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_STARTUP
);
826 /* CTDB_CONTROL_SET_TUNABLE */
828 void ctdb_req_control_set_tunable(struct ctdb_req_control
*request
,
829 struct ctdb_tunable
*tunable
)
831 request
->opcode
= CTDB_CONTROL_SET_TUNABLE
;
834 request
->client_id
= 0;
837 request
->rdata
.opcode
= CTDB_CONTROL_SET_TUNABLE
;
838 request
->rdata
.data
.tunable
= tunable
;
841 int ctdb_reply_control_set_tunable(struct ctdb_reply_control
*reply
)
843 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_TUNABLE
);
846 /* CTDB_CONTROL_GET_TUNABLE */
848 void ctdb_req_control_get_tunable(struct ctdb_req_control
*request
,
851 request
->opcode
= CTDB_CONTROL_GET_TUNABLE
;
854 request
->client_id
= 0;
857 request
->rdata
.opcode
= CTDB_CONTROL_GET_TUNABLE
;
858 request
->rdata
.data
.tun_var
= discard_const(name
);
861 int ctdb_reply_control_get_tunable(struct ctdb_reply_control
*reply
,
864 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_TUNABLE
) {
868 if (reply
->status
== 0) {
869 *value
= reply
->rdata
.data
.tun_value
;
871 return reply
->status
;
874 /* CTDB_CONTROL_LIST_TUNABLES */
876 void ctdb_req_control_list_tunables(struct ctdb_req_control
*request
)
878 request
->opcode
= CTDB_CONTROL_LIST_TUNABLES
;
881 request
->client_id
= 0;
884 request
->rdata
.opcode
= CTDB_CONTROL_LIST_TUNABLES
;
887 int ctdb_reply_control_list_tunables(struct ctdb_reply_control
*reply
,
889 struct ctdb_var_list
**tun_var_list
)
891 if (reply
->rdata
.opcode
!= CTDB_CONTROL_LIST_TUNABLES
) {
895 if (reply
->status
== 0) {
896 *tun_var_list
= talloc_steal(mem_ctx
,
897 reply
->rdata
.data
.tun_var_list
);
899 return reply
->status
;
902 /* CTDB_CONTROL_MODIFY_FLAGS */
904 void ctdb_req_control_modify_flags(struct ctdb_req_control
*request
,
905 struct ctdb_node_flag_change
*flag_change
)
907 request
->opcode
= CTDB_CONTROL_MODIFY_FLAGS
;
910 request
->client_id
= 0;
913 request
->rdata
.opcode
= CTDB_CONTROL_MODIFY_FLAGS
;
914 request
->rdata
.data
.flag_change
= flag_change
;
917 int ctdb_reply_control_modify_flags(struct ctdb_reply_control
*reply
)
919 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_MODIFY_FLAGS
);
922 /* CTDB_CONTROL_GET_ALL_TUNABLES */
924 void ctdb_req_control_get_all_tunables(struct ctdb_req_control
*request
)
926 request
->opcode
= CTDB_CONTROL_GET_ALL_TUNABLES
;
929 request
->client_id
= 0;
932 request
->rdata
.opcode
= CTDB_CONTROL_GET_ALL_TUNABLES
;
935 int ctdb_reply_control_get_all_tunables(struct ctdb_reply_control
*reply
,
937 struct ctdb_tunable_list
**tun_list
)
939 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_ALL_TUNABLES
) {
943 if (reply
->status
== 0) {
944 *tun_list
= talloc_steal(mem_ctx
, reply
->rdata
.data
.tun_list
);
946 return reply
->status
;
949 /* CTDB_CONTROL_GET_TCP_TICKLE_LIST */
951 void ctdb_req_control_get_tcp_tickle_list(struct ctdb_req_control
*request
,
952 ctdb_sock_addr
*addr
)
954 request
->opcode
= CTDB_CONTROL_GET_TCP_TICKLE_LIST
;
957 request
->client_id
= 0;
960 request
->rdata
.opcode
= CTDB_CONTROL_GET_TCP_TICKLE_LIST
;
961 request
->rdata
.data
.addr
= addr
;
964 int ctdb_reply_control_get_tcp_tickle_list(struct ctdb_reply_control
*reply
,
966 struct ctdb_tickle_list
**tickles
)
968 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_TCP_TICKLE_LIST
) {
972 if (reply
->status
== 0) {
973 *tickles
= talloc_steal(mem_ctx
, reply
->rdata
.data
.tickles
);
975 return reply
->status
;
978 /* CTDB_CONTROL_SET_TCP_TICKLE_LIST */
980 void ctdb_req_control_set_tcp_tickle_list(struct ctdb_req_control
*request
,
981 struct ctdb_tickle_list
*tickles
)
983 request
->opcode
= CTDB_CONTROL_SET_TCP_TICKLE_LIST
;
986 request
->client_id
= 0;
989 request
->rdata
.opcode
= CTDB_CONTROL_SET_TCP_TICKLE_LIST
;
990 request
->rdata
.data
.tickles
= tickles
;
993 int ctdb_reply_control_set_tcp_tickle_list(struct ctdb_reply_control
*reply
)
995 return ctdb_reply_control_generic(reply
,
996 CTDB_CONTROL_SET_TCP_TICKLE_LIST
);
999 /* CTDB_CONTROL_DB_ATTACH_PERSISTENT */
1001 void ctdb_req_control_db_attach_persistent(struct ctdb_req_control
*request
,
1002 const char *db_name
,
1005 request
->opcode
= CTDB_CONTROL_DB_ATTACH_PERSISTENT
;
1007 request
->srvid
= tdb_flags
;
1008 request
->client_id
= 0;
1011 request
->rdata
.opcode
= CTDB_CONTROL_DB_ATTACH_PERSISTENT
;
1012 request
->rdata
.data
.db_name
= db_name
;
1015 int ctdb_reply_control_db_attach_persistent(struct ctdb_reply_control
*reply
,
1018 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_ATTACH_PERSISTENT
) {
1022 if (reply
->status
== 0) {
1023 *db_id
= reply
->rdata
.data
.db_id
;
1025 return reply
->status
;
1028 /* CTDB_CONTROL_UPDATE_RECORD */
1030 void ctdb_req_control_update_record(struct ctdb_req_control
*request
,
1031 struct ctdb_rec_buffer
*recbuf
)
1033 request
->opcode
= CTDB_CONTROL_UPDATE_RECORD
;
1036 request
->client_id
= 0;
1039 request
->rdata
.opcode
= CTDB_CONTROL_UPDATE_RECORD
;
1040 request
->rdata
.data
.recbuf
= recbuf
;
1043 int ctdb_reply_control_update_record(struct ctdb_reply_control
*reply
)
1045 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_UPDATE_RECORD
);
1048 /* CTDB_CONTROL_SEND_GRATUITOUS_ARP */
1050 void ctdb_req_control_send_gratuitous_arp(struct ctdb_req_control
*request
,
1051 struct ctdb_addr_info
*addr_info
)
1053 request
->opcode
= CTDB_CONTROL_SEND_GRATUITOUS_ARP
;
1056 request
->client_id
= 0;
1059 request
->rdata
.opcode
= CTDB_CONTROL_SEND_GRATUITOUS_ARP
;
1060 request
->rdata
.data
.addr_info
= addr_info
;
1063 int ctdb_reply_control_send_gratuitous_arp(struct ctdb_reply_control
*reply
)
1065 return ctdb_reply_control_generic(reply
,
1066 CTDB_CONTROL_SEND_GRATUITOUS_ARP
);
1069 /* CTDB_CONTROL_WIPE_DATABASE */
1071 void ctdb_req_control_wipe_database(struct ctdb_req_control
*request
,
1072 struct ctdb_transdb
*transdb
)
1074 request
->opcode
= CTDB_CONTROL_WIPE_DATABASE
;
1077 request
->client_id
= 0;
1080 request
->rdata
.opcode
= CTDB_CONTROL_WIPE_DATABASE
;
1081 request
->rdata
.data
.transdb
= transdb
;
1084 int ctdb_reply_control_wipe_database(struct ctdb_reply_control
*reply
)
1086 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_WIPE_DATABASE
);
1089 /* CTDB_CONTROL_UPTIME */
1091 void ctdb_req_control_uptime(struct ctdb_req_control
*request
)
1093 request
->opcode
= CTDB_CONTROL_UPTIME
;
1096 request
->client_id
= 0;
1099 request
->rdata
.opcode
= CTDB_CONTROL_UPTIME
;
1102 int ctdb_reply_control_uptime(struct ctdb_reply_control
*reply
,
1103 TALLOC_CTX
*mem_ctx
, struct ctdb_uptime
**uptime
)
1105 if (reply
->rdata
.opcode
!= CTDB_CONTROL_UPTIME
) {
1109 if (reply
->status
== 0) {
1110 *uptime
= talloc_steal(mem_ctx
, reply
->rdata
.data
.uptime
);
1112 return reply
->status
;
1115 /* CTDB_CONTROL_START_RECOVERY */
1117 void ctdb_req_control_start_recovery(struct ctdb_req_control
*request
)
1119 request
->opcode
= CTDB_CONTROL_START_RECOVERY
;
1122 request
->client_id
= 0;
1125 request
->rdata
.opcode
= CTDB_CONTROL_START_RECOVERY
;
1128 int ctdb_reply_control_start_recovery(struct ctdb_reply_control
*reply
)
1130 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_START_RECOVERY
);
1133 /* CTDB_CONTROL_END_RECOVERY */
1135 void ctdb_req_control_end_recovery(struct ctdb_req_control
*request
)
1137 request
->opcode
= CTDB_CONTROL_END_RECOVERY
;
1140 request
->client_id
= 0;
1143 request
->rdata
.opcode
= CTDB_CONTROL_END_RECOVERY
;
1146 int ctdb_reply_control_end_recovery(struct ctdb_reply_control
*reply
)
1148 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_END_RECOVERY
);
1151 /* CTDB_CONTROL_RELOAD_NODES_FILE */
1153 void ctdb_req_control_reload_nodes_file(struct ctdb_req_control
*request
)
1155 request
->opcode
= CTDB_CONTROL_RELOAD_NODES_FILE
;
1158 request
->client_id
= 0;
1161 request
->rdata
.opcode
= CTDB_CONTROL_RELOAD_NODES_FILE
;
1164 int ctdb_reply_control_reload_nodes_file(struct ctdb_reply_control
*reply
)
1166 return ctdb_reply_control_generic(reply
,
1167 CTDB_CONTROL_RELOAD_NODES_FILE
);
1170 /* CTDB_CONTROL_TRY_DELETE_RECORDS */
1172 void ctdb_req_control_try_delete_records(struct ctdb_req_control
*request
,
1173 struct ctdb_rec_buffer
*recbuf
)
1175 request
->opcode
= CTDB_CONTROL_TRY_DELETE_RECORDS
;
1178 request
->client_id
= 0;
1181 request
->rdata
.opcode
= CTDB_CONTROL_TRY_DELETE_RECORDS
;
1182 request
->rdata
.data
.recbuf
= recbuf
;
1185 int ctdb_reply_control_try_delete_records(struct ctdb_reply_control
*reply
,
1186 TALLOC_CTX
*mem_ctx
,
1187 struct ctdb_rec_buffer
**recbuf
)
1189 if (reply
->rdata
.opcode
!= CTDB_CONTROL_TRY_DELETE_RECORDS
) {
1193 if (reply
->status
== 0) {
1194 *recbuf
= talloc_steal(mem_ctx
, reply
->rdata
.data
.recbuf
);
1196 return reply
->status
;
1199 /* CTDB_CONTROL_ENABLE_MONITOR */
1201 void ctdb_req_control_enable_monitor(struct ctdb_req_control
*request
)
1203 request
->opcode
= CTDB_CONTROL_ENABLE_MONITOR
;
1206 request
->client_id
= 0;
1209 request
->rdata
.opcode
= CTDB_CONTROL_ENABLE_MONITOR
;
1212 int ctdb_reply_control_enable_monitor(struct ctdb_reply_control
*reply
)
1214 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_ENABLE_MONITOR
);
1217 /* CTDB_CONTROL_DISABLE_MONITOR */
1219 void ctdb_req_control_disable_monitor(struct ctdb_req_control
*request
)
1221 request
->opcode
= CTDB_CONTROL_DISABLE_MONITOR
;
1224 request
->client_id
= 0;
1227 request
->rdata
.opcode
= CTDB_CONTROL_DISABLE_MONITOR
;
1230 int ctdb_reply_control_disable_monitor(struct ctdb_reply_control
*reply
)
1232 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DISABLE_MONITOR
);
1235 /* CTDB_CONTROL_ADD_PUBLIC_IP */
1237 void ctdb_req_control_add_public_ip(struct ctdb_req_control
*request
,
1238 struct ctdb_addr_info
*addr_info
)
1240 request
->opcode
= CTDB_CONTROL_ADD_PUBLIC_IP
;
1243 request
->client_id
= 0;
1246 request
->rdata
.opcode
= CTDB_CONTROL_ADD_PUBLIC_IP
;
1247 request
->rdata
.data
.addr_info
= addr_info
;
1250 int ctdb_reply_control_add_public_ip(struct ctdb_reply_control
*reply
)
1252 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_ADD_PUBLIC_IP
);
1255 /* CTDB_CONTROL_DEL_PUBLIC_IP */
1257 void ctdb_req_control_del_public_ip(struct ctdb_req_control
*request
,
1258 struct ctdb_addr_info
*addr_info
)
1260 request
->opcode
= CTDB_CONTROL_DEL_PUBLIC_IP
;
1263 request
->client_id
= 0;
1266 request
->rdata
.opcode
= CTDB_CONTROL_DEL_PUBLIC_IP
;
1267 request
->rdata
.data
.addr_info
= addr_info
;
1270 int ctdb_reply_control_del_public_ip(struct ctdb_reply_control
*reply
)
1272 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DEL_PUBLIC_IP
);
1275 /* CTDB_CONTROL_RUN_EVENTSCRIPTS */
1277 void ctdb_req_control_run_eventscripts(struct ctdb_req_control
*request
,
1278 const char *event_str
)
1280 request
->opcode
= CTDB_CONTROL_RUN_EVENTSCRIPTS
;
1283 request
->client_id
= 0;
1286 request
->rdata
.opcode
= CTDB_CONTROL_RUN_EVENTSCRIPTS
;
1287 request
->rdata
.data
.event_str
= event_str
;
1290 int ctdb_reply_control_run_eventscripts(struct ctdb_reply_control
*reply
)
1292 return ctdb_reply_control_generic(reply
,
1293 CTDB_CONTROL_RUN_EVENTSCRIPTS
);
1296 /* CTDB_CONTROL_GET_CAPABILITIES */
1298 void ctdb_req_control_get_capabilities(struct ctdb_req_control
*request
)
1300 request
->opcode
= CTDB_CONTROL_GET_CAPABILITIES
;
1303 request
->client_id
= 0;
1306 request
->rdata
.opcode
= CTDB_CONTROL_GET_CAPABILITIES
;
1309 int ctdb_reply_control_get_capabilities(struct ctdb_reply_control
*reply
,
1312 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_CAPABILITIES
) {
1316 if (reply
->status
== 0) {
1317 *caps
= reply
->rdata
.data
.caps
;
1319 return reply
->status
;
1322 /* CTDB_CONTROL_RECD_PING */
1324 void ctdb_req_control_recd_ping(struct ctdb_req_control
*request
)
1326 request
->opcode
= CTDB_CONTROL_RECD_PING
;
1329 request
->client_id
= 0;
1332 request
->rdata
.opcode
= CTDB_CONTROL_RECD_PING
;
1335 int ctdb_reply_control_recd_ping(struct ctdb_reply_control
*reply
)
1337 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_RECD_PING
);
1340 /* CTDB_CONTROL_RELEASE_IP */
1342 void ctdb_req_control_release_ip(struct ctdb_req_control
*request
,
1343 struct ctdb_public_ip
*pubip
)
1345 request
->opcode
= CTDB_CONTROL_RELEASE_IP
;
1348 request
->client_id
= 0;
1351 request
->rdata
.opcode
= CTDB_CONTROL_RELEASE_IP
;
1352 request
->rdata
.data
.pubip
= pubip
;
1355 int ctdb_reply_control_release_ip(struct ctdb_reply_control
*reply
)
1357 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_RELEASE_IP
);
1360 /* CTDB_CONTROL_TAKEOVER_IP */
1362 void ctdb_req_control_takeover_ip(struct ctdb_req_control
*request
,
1363 struct ctdb_public_ip
*pubip
)
1365 request
->opcode
= CTDB_CONTROL_TAKEOVER_IP
;
1368 request
->client_id
= 0;
1371 request
->rdata
.opcode
= CTDB_CONTROL_TAKEOVER_IP
;
1372 request
->rdata
.data
.pubip
= pubip
;
1375 int ctdb_reply_control_takeover_ip(struct ctdb_reply_control
*reply
)
1377 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TAKEOVER_IP
);
1380 /* CTDB_CONTROL_GET_PUBLIC_IPS */
1382 void ctdb_req_control_get_public_ips(struct ctdb_req_control
*request
)
1384 request
->opcode
= CTDB_CONTROL_GET_PUBLIC_IPS
;
1387 request
->client_id
= 0;
1390 request
->rdata
.opcode
= CTDB_CONTROL_GET_PUBLIC_IPS
;
1393 int ctdb_reply_control_get_public_ips(struct ctdb_reply_control
*reply
,
1394 TALLOC_CTX
*mem_ctx
,
1395 struct ctdb_public_ip_list
**pubip_list
)
1397 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_PUBLIC_IPS
) {
1401 if (reply
->status
== 0) {
1402 *pubip_list
= talloc_steal(mem_ctx
,
1403 reply
->rdata
.data
.pubip_list
);
1405 return reply
->status
;
1408 /* CTDB_CONTROL_GET_NODEMAP */
1410 void ctdb_req_control_get_nodemap(struct ctdb_req_control
*request
)
1412 request
->opcode
= CTDB_CONTROL_GET_NODEMAP
;
1415 request
->client_id
= 0;
1418 request
->rdata
.opcode
= CTDB_CONTROL_GET_NODEMAP
;
1421 int ctdb_reply_control_get_nodemap(struct ctdb_reply_control
*reply
,
1422 TALLOC_CTX
*mem_ctx
,
1423 struct ctdb_node_map
**nodemap
)
1425 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_NODEMAP
) {
1429 if (reply
->status
== 0) {
1430 *nodemap
= talloc_steal(mem_ctx
, reply
->rdata
.data
.nodemap
);
1432 return reply
->status
;
1435 /* CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS */
1437 void ctdb_req_control_get_event_script_status(struct ctdb_req_control
*request
,
1440 request
->opcode
= CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS
;
1443 request
->client_id
= 0;
1446 request
->rdata
.opcode
= CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS
;
1447 request
->rdata
.data
.event
= event
;
1450 int ctdb_reply_control_get_event_script_status(struct ctdb_reply_control
*reply
,
1451 TALLOC_CTX
*mem_ctx
,
1452 struct ctdb_script_list
**slist
)
1454 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS
) {
1458 if (reply
->status
== 0) {
1459 *slist
= talloc_steal(mem_ctx
, reply
->rdata
.data
.script_list
);
1461 return reply
->status
;
1464 /* CTDB_CONTROL_TRAVERSE_KILL */
1466 void ctdb_req_control_traverse_kill(struct ctdb_req_control
*request
,
1467 struct ctdb_traverse_start
*traverse
)
1469 request
->opcode
= CTDB_CONTROL_TRAVERSE_KILL
;
1472 request
->client_id
= 0;
1475 request
->rdata
.opcode
= CTDB_CONTROL_TRAVERSE_KILL
;
1476 request
->rdata
.data
.traverse_start
= traverse
;
1479 int ctdb_reply_control_traverse_kill(struct ctdb_reply_control
*reply
)
1481 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TRAVERSE_KILL
);
1484 /* CTDB_CONTROL_RECD_RECLOCK_LATENCY */
1486 void ctdb_req_control_recd_reclock_latency(struct ctdb_req_control
*request
,
1487 double reclock_latency
)
1489 request
->opcode
= CTDB_CONTROL_RECD_RECLOCK_LATENCY
;
1492 request
->client_id
= 0;
1495 request
->rdata
.opcode
= CTDB_CONTROL_RECD_RECLOCK_LATENCY
;
1496 request
->rdata
.data
.reclock_latency
= reclock_latency
;
1499 int ctdb_reply_control_recd_reclock_latency(struct ctdb_reply_control
*reply
)
1501 return ctdb_reply_control_generic(reply
,
1502 CTDB_CONTROL_RECD_RECLOCK_LATENCY
);
1505 /* CTDB_CONTROL_GET_RECLOCK_FILE */
1507 void ctdb_req_control_get_reclock_file(struct ctdb_req_control
*request
)
1509 request
->opcode
= CTDB_CONTROL_GET_RECLOCK_FILE
;
1512 request
->client_id
= 0;
1515 request
->rdata
.opcode
= CTDB_CONTROL_GET_RECLOCK_FILE
;
1518 int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control
*reply
,
1519 TALLOC_CTX
*mem_ctx
,
1520 const char **reclock_file
)
1522 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_RECLOCK_FILE
) {
1526 if (reply
->status
== 0) {
1527 *reclock_file
= talloc_steal(mem_ctx
,
1528 reply
->rdata
.data
.reclock_file
);
1530 return reply
->status
;
1533 /* CTDB_CONTROL_STOP_NODE */
1535 void ctdb_req_control_stop_node(struct ctdb_req_control
*request
)
1537 request
->opcode
= CTDB_CONTROL_STOP_NODE
;
1540 request
->client_id
= 0;
1543 request
->rdata
.opcode
= CTDB_CONTROL_STOP_NODE
;
1546 int ctdb_reply_control_stop_node(struct ctdb_reply_control
*reply
)
1548 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_STOP_NODE
);
1551 /* CTDB_CONTROL_CONTINUE_NODE */
1553 void ctdb_req_control_continue_node(struct ctdb_req_control
*request
)
1555 request
->opcode
= CTDB_CONTROL_CONTINUE_NODE
;
1558 request
->client_id
= 0;
1561 request
->rdata
.opcode
= CTDB_CONTROL_CONTINUE_NODE
;
1564 int ctdb_reply_control_continue_node(struct ctdb_reply_control
*reply
)
1566 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_CONTINUE_NODE
);
1569 /* CTDB_CONTROL_SET_LMASTERROLE */
1571 void ctdb_req_control_set_lmasterrole(struct ctdb_req_control
*request
,
1572 uint32_t lmaster_role
)
1574 request
->opcode
= CTDB_CONTROL_SET_LMASTERROLE
;
1577 request
->client_id
= 0;
1580 request
->rdata
.opcode
= CTDB_CONTROL_SET_LMASTERROLE
;
1581 request
->rdata
.data
.role
= lmaster_role
;
1584 int ctdb_reply_control_set_lmasterrole(struct ctdb_reply_control
*reply
)
1586 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_LMASTERROLE
);
1589 /* CTDB_CONTROL_SET_RECMASTERROLE */
1591 void ctdb_req_control_set_recmasterrole(struct ctdb_req_control
*request
,
1592 uint32_t recmaster_role
)
1594 request
->opcode
= CTDB_CONTROL_SET_RECMASTERROLE
;
1597 request
->client_id
= 0;
1600 request
->rdata
.opcode
= CTDB_CONTROL_SET_RECMASTERROLE
;
1601 request
->rdata
.data
.role
= recmaster_role
;
1604 int ctdb_reply_control_set_recmasterrole(struct ctdb_reply_control
*reply
)
1606 return ctdb_reply_control_generic(reply
,
1607 CTDB_CONTROL_SET_RECMASTERROLE
);
1610 /* CTDB_CONTROL_ENABLE_SCRIPT */
1612 void ctdb_req_control_enable_script(struct ctdb_req_control
*request
,
1615 request
->opcode
= CTDB_CONTROL_ENABLE_SCRIPT
;
1618 request
->client_id
= 0;
1621 request
->rdata
.opcode
= CTDB_CONTROL_ENABLE_SCRIPT
;
1622 request
->rdata
.data
.script
= script
;
1625 int ctdb_reply_control_enable_script(struct ctdb_reply_control
*reply
)
1627 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_ENABLE_SCRIPT
);
1630 /* CTDB_CONTROL_DISABLE_SCRIPT */
1632 void ctdb_req_control_disable_script(struct ctdb_req_control
*request
,
1635 request
->opcode
= CTDB_CONTROL_DISABLE_SCRIPT
;
1638 request
->client_id
= 0;
1641 request
->rdata
.opcode
= CTDB_CONTROL_DISABLE_SCRIPT
;
1642 request
->rdata
.data
.script
= script
;
1645 int ctdb_reply_control_disable_script(struct ctdb_reply_control
*reply
)
1647 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DISABLE_SCRIPT
);
1650 /* CTDB_CONTROL_SET_BAN_STATE */
1652 void ctdb_req_control_set_ban_state(struct ctdb_req_control
*request
,
1653 struct ctdb_ban_state
*ban_state
)
1655 request
->opcode
= CTDB_CONTROL_SET_BAN_STATE
;
1658 request
->client_id
= 0;
1661 request
->rdata
.opcode
= CTDB_CONTROL_SET_BAN_STATE
;
1662 request
->rdata
.data
.ban_state
= ban_state
;
1665 int ctdb_reply_control_set_ban_state(struct ctdb_reply_control
*reply
)
1667 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_BAN_STATE
);
1670 /* CTDB_CONTROL_GET_BAN_STATE */
1672 void ctdb_req_control_get_ban_state(struct ctdb_req_control
*request
)
1674 request
->opcode
= CTDB_CONTROL_GET_BAN_STATE
;
1677 request
->client_id
= 0;
1680 request
->rdata
.opcode
= CTDB_CONTROL_GET_BAN_STATE
;
1683 int ctdb_reply_control_get_ban_state(struct ctdb_reply_control
*reply
,
1684 TALLOC_CTX
*mem_ctx
,
1685 struct ctdb_ban_state
**ban_state
)
1687 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_BAN_STATE
) {
1691 if (reply
->status
== 0) {
1692 *ban_state
= talloc_steal(mem_ctx
,
1693 reply
->rdata
.data
.ban_state
);
1695 return reply
->status
;
1698 /* CTDB_CONTROL_REGISTER_NOTIFY */
1700 void ctdb_req_control_register_notify(struct ctdb_req_control
*request
,
1701 struct ctdb_notify_data
*notify
)
1703 request
->opcode
= CTDB_CONTROL_REGISTER_NOTIFY
;
1706 request
->client_id
= 0;
1709 request
->rdata
.opcode
= CTDB_CONTROL_REGISTER_NOTIFY
;
1710 request
->rdata
.data
.notify
= notify
;
1713 int ctdb_reply_control_register_notify(struct ctdb_reply_control
*reply
)
1715 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_REGISTER_NOTIFY
);
1718 /* CTDB_CONTROL_DEREGISTER_NOTIFY */
1720 void ctdb_req_control_deregister_notify(struct ctdb_req_control
*request
,
1723 request
->opcode
= CTDB_CONTROL_DEREGISTER_NOTIFY
;
1726 request
->client_id
= 0;
1729 request
->rdata
.opcode
= CTDB_CONTROL_DEREGISTER_NOTIFY
;
1730 request
->rdata
.data
.srvid
= srvid
;
1733 int ctdb_reply_control_deregister_notify(struct ctdb_reply_control
*reply
)
1735 return ctdb_reply_control_generic(reply
,
1736 CTDB_CONTROL_DEREGISTER_NOTIFY
);
1739 /* CTDB_CONTROL_TRANS3_COMMIT */
1741 void ctdb_req_control_trans3_commit(struct ctdb_req_control
*request
,
1742 struct ctdb_rec_buffer
*recbuf
)
1744 request
->opcode
= CTDB_CONTROL_TRANS3_COMMIT
;
1747 request
->client_id
= 0;
1750 request
->rdata
.opcode
= CTDB_CONTROL_TRANS3_COMMIT
;
1751 request
->rdata
.data
.recbuf
= recbuf
;
1754 int ctdb_reply_control_trans3_commit(struct ctdb_reply_control
*reply
)
1756 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_TRANS3_COMMIT
);
1759 /* CTDB_CONTROL_GET_DB_SEQNUM */
1761 void ctdb_req_control_get_db_seqnum(struct ctdb_req_control
*request
,
1764 request
->opcode
= CTDB_CONTROL_GET_DB_SEQNUM
;
1767 request
->client_id
= 0;
1770 request
->rdata
.opcode
= CTDB_CONTROL_GET_DB_SEQNUM
;
1771 request
->rdata
.data
.db_id
= db_id
;
1774 int ctdb_reply_control_get_db_seqnum(struct ctdb_reply_control
*reply
,
1777 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_DB_SEQNUM
) {
1781 if (reply
->status
== 0) {
1782 *seqnum
= reply
->rdata
.data
.seqnum
;
1784 return reply
->status
;
1787 /* CTDB_CONTROL_DB_SET_HEALTHY */
1789 void ctdb_req_control_db_set_healthy(struct ctdb_req_control
*request
,
1792 request
->opcode
= CTDB_CONTROL_DB_SET_HEALTHY
;
1795 request
->client_id
= 0;
1798 request
->rdata
.opcode
= CTDB_CONTROL_DB_SET_HEALTHY
;
1799 request
->rdata
.data
.db_id
= db_id
;
1802 int ctdb_reply_control_db_set_healthy(struct ctdb_reply_control
*reply
)
1804 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_SET_HEALTHY
);
1807 /* CTDB_CONTROL_DB_GET_HEALTH */
1809 void ctdb_req_control_db_get_health(struct ctdb_req_control
*request
,
1812 request
->opcode
= CTDB_CONTROL_DB_GET_HEALTH
;
1815 request
->client_id
= 0;
1818 request
->rdata
.opcode
= CTDB_CONTROL_DB_GET_HEALTH
;
1819 request
->rdata
.data
.db_id
= db_id
;
1822 int ctdb_reply_control_db_get_health(struct ctdb_reply_control
*reply
,
1823 TALLOC_CTX
*mem_ctx
, const char **reason
)
1825 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_GET_HEALTH
) {
1829 if (reply
->status
== 0) {
1830 *reason
= talloc_steal(mem_ctx
, reply
->rdata
.data
.reason
);
1832 return reply
->status
;
1835 /* CTDB_CONTROL_GET_PUBLIC_IP_INFO */
1837 void ctdb_req_control_get_public_ip_info(struct ctdb_req_control
*request
,
1838 ctdb_sock_addr
*addr
)
1840 request
->opcode
= CTDB_CONTROL_GET_PUBLIC_IP_INFO
;
1843 request
->client_id
= 0;
1846 request
->rdata
.opcode
= CTDB_CONTROL_GET_PUBLIC_IP_INFO
;
1847 request
->rdata
.data
.addr
= addr
;
1850 int ctdb_reply_control_get_public_ip_info(struct ctdb_reply_control
*reply
,
1851 TALLOC_CTX
*mem_ctx
,
1852 struct ctdb_public_ip_info
**ipinfo
)
1854 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_PUBLIC_IP_INFO
) {
1858 if (reply
->status
== 0) {
1859 *ipinfo
= talloc_steal(mem_ctx
, reply
->rdata
.data
.ipinfo
);
1861 return reply
->status
;
1864 /* CTDB_CONTROL_GET_IFACES */
1866 void ctdb_req_control_get_ifaces(struct ctdb_req_control
*request
)
1868 request
->opcode
= CTDB_CONTROL_GET_IFACES
;
1871 request
->client_id
= 0;
1874 request
->rdata
.opcode
= CTDB_CONTROL_GET_IFACES
;
1877 int ctdb_reply_control_get_ifaces(struct ctdb_reply_control
*reply
,
1878 TALLOC_CTX
*mem_ctx
,
1879 struct ctdb_iface_list
**iface_list
)
1881 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_IFACES
) {
1885 if (reply
->status
== 0) {
1886 *iface_list
= talloc_steal(mem_ctx
,
1887 reply
->rdata
.data
.iface_list
);
1889 return reply
->status
;
1892 /* CTDB_CONTROL_SET_IFACE_LINK_STATE */
1894 void ctdb_req_control_set_iface_link_state(struct ctdb_req_control
*request
,
1895 struct ctdb_iface
*iface
)
1897 request
->opcode
= CTDB_CONTROL_SET_IFACE_LINK_STATE
;
1900 request
->client_id
= 0;
1903 request
->rdata
.opcode
= CTDB_CONTROL_SET_IFACE_LINK_STATE
;
1904 request
->rdata
.data
.iface
= iface
;
1907 int ctdb_reply_control_set_iface_link_state(struct ctdb_reply_control
*reply
)
1909 return ctdb_reply_control_generic(reply
,
1910 CTDB_CONTROL_SET_IFACE_LINK_STATE
);
1913 /* CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE */
1915 void ctdb_req_control_tcp_add_delayed_update(struct ctdb_req_control
*request
,
1916 struct ctdb_connection
*conn
)
1918 request
->opcode
= CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE
;
1921 request
->client_id
= 0;
1924 request
->rdata
.opcode
= CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE
;
1925 request
->rdata
.data
.conn
= conn
;
1928 int ctdb_reply_control_tcp_add_delayed_update(struct ctdb_reply_control
*reply
)
1930 return ctdb_reply_control_generic(reply
,
1931 CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE
);
1934 /* CTDB_CONTROL_GET_STAT_HISTORY */
1936 void ctdb_req_control_get_stat_history(struct ctdb_req_control
*request
)
1938 request
->opcode
= CTDB_CONTROL_GET_STAT_HISTORY
;
1941 request
->client_id
= 0;
1944 request
->rdata
.opcode
= CTDB_CONTROL_GET_STAT_HISTORY
;
1947 int ctdb_reply_control_get_stat_history(struct ctdb_reply_control
*reply
,
1948 TALLOC_CTX
*mem_ctx
,
1949 struct ctdb_statistics_list
**stats_list
)
1951 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_STAT_HISTORY
) {
1955 if (reply
->status
== 0) {
1956 *stats_list
= talloc_steal(mem_ctx
,
1957 reply
->rdata
.data
.stats_list
);
1959 return reply
->status
;
1962 /* CTDB_CONTROL_SCHEDULE_FOR_DELETION */
1964 void ctdb_req_control_schedule_for_deletion(struct ctdb_req_control
*request
,
1965 struct ctdb_key_data
*key
)
1967 request
->opcode
= CTDB_CONTROL_SCHEDULE_FOR_DELETION
;
1970 request
->client_id
= 0;
1973 request
->rdata
.opcode
= CTDB_CONTROL_SCHEDULE_FOR_DELETION
;
1974 request
->rdata
.data
.key
= key
;
1977 int ctdb_reply_control_schedule_for_deletion(struct ctdb_reply_control
*reply
)
1979 return ctdb_reply_control_generic(reply
,
1980 CTDB_CONTROL_SCHEDULE_FOR_DELETION
);
1983 /* CTDB_CONTROL_SET_DB_READONLY */
1985 void ctdb_req_control_set_db_readonly(struct ctdb_req_control
*request
,
1988 request
->opcode
= CTDB_CONTROL_SET_DB_READONLY
;
1991 request
->client_id
= 0;
1994 request
->rdata
.opcode
= CTDB_CONTROL_SET_DB_READONLY
;
1995 request
->rdata
.data
.db_id
= db_id
;
1998 int ctdb_reply_control_set_db_readonly(struct ctdb_reply_control
*reply
)
2000 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_DB_READONLY
);
2003 /* CTDB_CONTROL_CHECK_SRVIDS */
2005 void ctdb_req_control_check_srvids(struct ctdb_req_control
*request
,
2006 struct ctdb_uint64_array
*u64_array
)
2008 request
->opcode
= CTDB_CONTROL_CHECK_SRVIDS
;
2011 request
->client_id
= 0;
2014 request
->rdata
.opcode
= CTDB_CONTROL_CHECK_SRVIDS
;
2015 request
->rdata
.data
.u64_array
= u64_array
;
2018 int ctdb_reply_control_check_srvids(struct ctdb_reply_control
*reply
,
2019 TALLOC_CTX
*mem_ctx
,
2020 struct ctdb_uint8_array
**u8_array
)
2022 if (reply
->rdata
.opcode
!= CTDB_CONTROL_CHECK_SRVIDS
) {
2026 if (reply
->status
== 0) {
2027 *u8_array
= talloc_steal(mem_ctx
, reply
->rdata
.data
.u8_array
);
2029 return reply
->status
;
2032 /* CTDB_CONTROL_TRAVERSE_START_EXT */
2034 void ctdb_req_control_traverse_start_ext(struct ctdb_req_control
*request
,
2035 struct ctdb_traverse_start_ext
*traverse
)
2037 request
->opcode
= CTDB_CONTROL_TRAVERSE_START_EXT
;
2040 request
->client_id
= 0;
2043 request
->rdata
.opcode
= CTDB_CONTROL_TRAVERSE_START_EXT
;
2044 request
->rdata
.data
.traverse_start_ext
= traverse
;
2047 int ctdb_reply_control_traverse_start_ext(struct ctdb_reply_control
*reply
)
2049 return ctdb_reply_control_generic(reply
,
2050 CTDB_CONTROL_TRAVERSE_START_EXT
);
2053 /* CTDB_CONTROL_GET_DB_STATISTICS */
2055 void ctdb_req_control_get_db_statistics(struct ctdb_req_control
*request
,
2058 request
->opcode
= CTDB_CONTROL_GET_DB_STATISTICS
;
2061 request
->client_id
= 0;
2064 request
->rdata
.opcode
= CTDB_CONTROL_GET_DB_STATISTICS
;
2065 request
->rdata
.data
.db_id
= db_id
;
2068 int ctdb_reply_control_get_db_statistics(struct ctdb_reply_control
*reply
,
2069 TALLOC_CTX
*mem_ctx
,
2070 struct ctdb_db_statistics
**dbstats
)
2072 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_DB_STATISTICS
) {
2076 if (reply
->status
== 0) {
2077 *dbstats
= talloc_steal(mem_ctx
, reply
->rdata
.data
.dbstats
);
2079 return reply
->status
;
2082 /* CTDB_CONTROL_SET_DB_STICKY */
2084 void ctdb_req_control_set_db_sticky(struct ctdb_req_control
*request
,
2087 request
->opcode
= CTDB_CONTROL_SET_DB_STICKY
;
2090 request
->client_id
= 0;
2093 request
->rdata
.opcode
= CTDB_CONTROL_SET_DB_STICKY
;
2094 request
->rdata
.data
.db_id
= db_id
;
2097 int ctdb_reply_control_set_db_sticky(struct ctdb_reply_control
*reply
)
2099 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_SET_DB_STICKY
);
2102 /* CTDB_CONTROL_RELOAD_PUBLIC_IPS */
2104 void ctdb_req_control_reload_public_ips(struct ctdb_req_control
*request
)
2106 request
->opcode
= CTDB_CONTROL_RELOAD_PUBLIC_IPS
;
2109 request
->client_id
= 0;
2112 request
->rdata
.opcode
= CTDB_CONTROL_RELOAD_PUBLIC_IPS
;
2115 int ctdb_reply_control_reload_public_ips(struct ctdb_reply_control
*reply
)
2117 return ctdb_reply_control_generic(reply
,
2118 CTDB_CONTROL_RELOAD_PUBLIC_IPS
);
2121 /* CTDB_CONTROL_TRAVERSE_ALL_EXT */
2123 /* CTDB_CONTROL_RECEIVE_RECORDS */
2125 void ctdb_req_control_receive_records(struct ctdb_req_control
*request
,
2126 struct ctdb_rec_buffer
*recbuf
)
2128 request
->opcode
= CTDB_CONTROL_RECEIVE_RECORDS
;
2131 request
->client_id
= 0;
2134 request
->rdata
.opcode
= CTDB_CONTROL_RECEIVE_RECORDS
;
2135 request
->rdata
.data
.recbuf
= recbuf
;
2138 int ctdb_reply_control_receive_records(struct ctdb_reply_control
*reply
,
2139 TALLOC_CTX
*mem_ctx
,
2140 struct ctdb_rec_buffer
**recbuf
)
2142 if (reply
->rdata
.opcode
!= CTDB_CONTROL_RECEIVE_RECORDS
) {
2146 if (reply
->status
== 0) {
2147 *recbuf
= talloc_steal(mem_ctx
, reply
->rdata
.data
.recbuf
);
2149 return reply
->status
;
2152 /* CTDB_CONTROL_IPREALLOCATED */
2154 void ctdb_req_control_ipreallocated(struct ctdb_req_control
*request
)
2156 request
->opcode
= CTDB_CONTROL_IPREALLOCATED
;
2159 request
->client_id
= 0;
2162 request
->rdata
.opcode
= CTDB_CONTROL_IPREALLOCATED
;
2165 int ctdb_reply_control_ipreallocated(struct ctdb_reply_control
*reply
)
2167 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_IPREALLOCATED
);
2170 /* CTDB_CONTROL_GET_RUNSTATE */
2172 void ctdb_req_control_get_runstate(struct ctdb_req_control
*request
)
2174 request
->opcode
= CTDB_CONTROL_GET_RUNSTATE
;
2177 request
->client_id
= 0;
2180 request
->rdata
.opcode
= CTDB_CONTROL_GET_RUNSTATE
;
2183 int ctdb_reply_control_get_runstate(struct ctdb_reply_control
*reply
,
2184 enum ctdb_runstate
*runstate
)
2186 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_RUNSTATE
) {
2190 if (reply
->status
== 0) {
2191 *runstate
= reply
->rdata
.data
.runstate
;
2193 return reply
->status
;
2196 /* CTDB_CONTROL_DB_DETACH */
2198 void ctdb_req_control_db_detach(struct ctdb_req_control
*request
,
2201 request
->opcode
= CTDB_CONTROL_DB_DETACH
;
2204 request
->client_id
= 0;
2207 request
->rdata
.opcode
= CTDB_CONTROL_DB_DETACH
;
2208 request
->rdata
.data
.db_id
= db_id
;
2211 int ctdb_reply_control_db_detach(struct ctdb_reply_control
*reply
)
2213 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_DETACH
);
2216 /* CTDB_CONTROL_GET_NODES_FILE */
2218 void ctdb_req_control_get_nodes_file(struct ctdb_req_control
*request
)
2220 request
->opcode
= CTDB_CONTROL_GET_NODES_FILE
;
2223 request
->client_id
= 0;
2226 request
->rdata
.opcode
= CTDB_CONTROL_GET_NODES_FILE
;
2229 int ctdb_reply_control_get_nodes_file(struct ctdb_reply_control
*reply
,
2230 TALLOC_CTX
*mem_ctx
,
2231 struct ctdb_node_map
**nodemap
)
2233 if (reply
->rdata
.opcode
!= CTDB_CONTROL_GET_NODES_FILE
) {
2237 if (reply
->status
== 0) {
2238 *nodemap
= talloc_steal(mem_ctx
, reply
->rdata
.data
.nodemap
);
2240 return reply
->status
;
2243 /* CTDB_CONTROL_DB_FREEZE */
2245 void ctdb_req_control_db_freeze(struct ctdb_req_control
*request
,
2248 request
->opcode
= CTDB_CONTROL_DB_FREEZE
;
2251 request
->client_id
= 0;
2254 request
->rdata
.opcode
= CTDB_CONTROL_DB_FREEZE
;
2255 request
->rdata
.data
.db_id
= db_id
;
2258 int ctdb_reply_control_db_freeze(struct ctdb_reply_control
*reply
)
2260 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_FREEZE
);
2263 /* CTDB_CONTROL_DB_THAW */
2265 void ctdb_req_control_db_thaw(struct ctdb_req_control
*request
,
2268 request
->opcode
= CTDB_CONTROL_DB_THAW
;
2271 request
->client_id
= 0;
2274 request
->rdata
.opcode
= CTDB_CONTROL_DB_THAW
;
2275 request
->rdata
.data
.db_id
= db_id
;
2278 int ctdb_reply_control_db_thaw(struct ctdb_reply_control
*reply
)
2280 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_THAW
);
2283 /* CTDB_CONTROL_DB_TRANSACTION_START */
2285 void ctdb_req_control_db_transaction_start(struct ctdb_req_control
*request
,
2286 struct ctdb_transdb
*transdb
)
2288 request
->opcode
= CTDB_CONTROL_DB_TRANSACTION_START
;
2291 request
->client_id
= 0;
2294 request
->rdata
.opcode
= CTDB_CONTROL_DB_TRANSACTION_START
;
2295 request
->rdata
.data
.transdb
= transdb
;
2298 int ctdb_reply_control_db_transaction_start(struct ctdb_reply_control
*reply
)
2300 return ctdb_reply_control_generic(reply
,
2301 CTDB_CONTROL_DB_TRANSACTION_START
);
2304 /* CTDB_CONTROL_DB_TRANSACTION_COMMIT */
2306 void ctdb_req_control_db_transaction_commit(struct ctdb_req_control
*request
,
2307 struct ctdb_transdb
*transdb
)
2309 request
->opcode
= CTDB_CONTROL_DB_TRANSACTION_COMMIT
;
2312 request
->client_id
= 0;
2315 request
->rdata
.opcode
= CTDB_CONTROL_DB_TRANSACTION_COMMIT
;
2316 request
->rdata
.data
.transdb
= transdb
;
2319 int ctdb_reply_control_db_transaction_commit(struct ctdb_reply_control
*reply
)
2321 return ctdb_reply_control_generic(reply
,
2322 CTDB_CONTROL_DB_TRANSACTION_COMMIT
);
2325 /* CTDB_CONTROL_DB_TRANSACTION_CANCEL */
2327 void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control
*request
,
2330 request
->opcode
= CTDB_CONTROL_DB_TRANSACTION_CANCEL
;
2333 request
->client_id
= 0;
2336 request
->rdata
.opcode
= CTDB_CONTROL_DB_TRANSACTION_CANCEL
;
2337 request
->rdata
.data
.db_id
= db_id
;
2340 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control
*reply
)
2342 return ctdb_reply_control_generic(reply
,
2343 CTDB_CONTROL_DB_TRANSACTION_CANCEL
);
2346 /* CTDB_CONTROL_DB_PULL */
2348 void ctdb_req_control_db_pull(struct ctdb_req_control
*request
,
2349 struct ctdb_pulldb_ext
*pulldb_ext
)
2351 request
->opcode
= CTDB_CONTROL_DB_PULL
;
2354 request
->client_id
= 0;
2357 request
->rdata
.opcode
= CTDB_CONTROL_DB_PULL
;
2358 request
->rdata
.data
.pulldb_ext
= pulldb_ext
;
2361 int ctdb_reply_control_db_pull(struct ctdb_reply_control
*reply
,
2362 uint32_t *num_records
)
2364 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_PULL
) {
2368 if (reply
->status
== 0) {
2369 *num_records
= reply
->rdata
.data
.num_records
;
2371 return reply
->status
;
2374 /* CTDB_CONTROL_DB_PUSH_START */
2376 void ctdb_req_control_db_push_start(struct ctdb_req_control
*request
,
2377 struct ctdb_pulldb_ext
*pulldb_ext
)
2379 request
->opcode
= CTDB_CONTROL_DB_PUSH_START
;
2382 request
->client_id
= 0;
2385 request
->rdata
.opcode
= CTDB_CONTROL_DB_PUSH_START
;
2386 request
->rdata
.data
.pulldb_ext
= pulldb_ext
;
2389 int ctdb_reply_control_db_push_start(struct ctdb_reply_control
*reply
)
2391 return ctdb_reply_control_generic(reply
, CTDB_CONTROL_DB_PUSH_START
);
2394 /* CTDB_CONTROL_DB_PUSH_CONFIRM */
2396 void ctdb_req_control_db_push_confirm(struct ctdb_req_control
*request
,
2399 request
->opcode
= CTDB_CONTROL_DB_PUSH_CONFIRM
;
2402 request
->client_id
= 0;
2405 request
->rdata
.opcode
= CTDB_CONTROL_DB_PUSH_CONFIRM
;
2406 request
->rdata
.data
.db_id
= db_id
;
2409 int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control
*reply
,
2410 uint32_t *num_records
)
2412 if (reply
->rdata
.opcode
!= CTDB_CONTROL_DB_PUSH_CONFIRM
) {
2416 if (reply
->status
== 0) {
2417 *num_records
= reply
->rdata
.data
.num_records
;
2419 return reply
->status
;