2015-04-14 10:20:05 +03:00
/*
CTDB protocol marshalling
Copyright ( C ) Amitay Isaacs 2015
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 3 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 , see < http : //www.gnu.org/licenses/>.
*/
# include "replace.h"
# include "system/network.h"
# include <talloc.h>
# include <tdb.h>
# include "protocol.h"
# include "protocol_api.h"
# include "protocol_private.h"
/*
void ctdb_req_call_fill ( struct ctdb_req_call * c ,
uint32_t db_id , uint32_t flags ,
uint32_t call_id , TDB_DATA key )
{
request - > flags = flags ;
c - > db_id = db_id ;
c - > call_id = call_id ;
c - > key = key ;
c - > calldata = tdb_null ;
}
*/
2016-04-21 07:19:44 +03:00
static int ctdb_reply_control_generic ( struct ctdb_reply_control * reply ,
uint32_t opcode )
2015-04-14 10:20:05 +03:00
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = opcode ) {
return EPROTO ;
}
2015-04-14 10:20:05 +03:00
return reply - > status ;
}
/* CTDB_CONTROL_PROCESS_EXISTS */
void ctdb_req_control_process_exists ( struct ctdb_req_control * request ,
pid_t pid )
{
request - > opcode = CTDB_CONTROL_PROCESS_EXISTS ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_PROCESS_EXISTS ;
request - > rdata . data . pid = pid ;
}
int ctdb_reply_control_process_exists ( struct ctdb_reply_control * reply ,
int * status )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_PROCESS_EXISTS ) {
return EPROTO ;
2015-04-14 10:20:05 +03:00
}
2016-04-21 07:19:44 +03:00
* status = reply - > status ;
reply - > status = 0 ;
2015-04-14 10:20:05 +03:00
return reply - > status ;
}
/* CTDB_CONTROL_STATISTICS */
void ctdb_req_control_statistics ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_STATISTICS ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_STATISTICS ;
}
int ctdb_reply_control_statistics ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_statistics * * stats )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_STATISTICS ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* stats = talloc_steal ( mem_ctx , reply - > rdata . data . stats ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_PING */
void ctdb_req_control_ping ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_PING ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_PING ;
}
int ctdb_reply_control_ping ( struct ctdb_reply_control * reply ,
int * num_clients )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_PING ) {
return EPROTO ;
}
2015-04-14 10:20:05 +03:00
if ( reply - > status > = 0 ) {
* num_clients = reply - > status ;
reply - > status = 0 ;
}
return reply - > status ;
}
/* CTDB_CONTROL_GETDBPATH */
void ctdb_req_control_getdbpath ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_GETDBPATH ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GETDBPATH ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_getdbpath ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx , const char * * db_path )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GETDBPATH ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* db_path = talloc_steal ( mem_ctx , reply - > rdata . data . db_path ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_GETVNNMAP */
void ctdb_req_control_getvnnmap ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GETVNNMAP ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GETVNNMAP ;
}
int ctdb_reply_control_getvnnmap ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_vnn_map * * vnnmap )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GETVNNMAP ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* vnnmap = talloc_steal ( mem_ctx , reply - > rdata . data . vnnmap ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_SETVNNMAP */
void ctdb_req_control_setvnnmap ( struct ctdb_req_control * request ,
struct ctdb_vnn_map * vnnmap )
{
request - > opcode = CTDB_CONTROL_SETVNNMAP ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SETVNNMAP ;
request - > rdata . data . vnnmap = vnnmap ;
}
int ctdb_reply_control_setvnnmap ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_SETVNNMAP ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_DEBUG */
void ctdb_req_control_get_debug ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_DEBUG ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_DEBUG ;
}
int ctdb_reply_control_get_debug ( struct ctdb_reply_control * reply ,
2016-11-25 05:23:11 +03:00
int * loglevel )
2015-04-14 10:20:05 +03:00
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_DEBUG ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2016-11-25 05:23:11 +03:00
* loglevel = ( int ) reply - > rdata . data . loglevel ;
2015-04-14 10:20:05 +03:00
}
return reply - > status ;
}
/* CTDB_CONTROL_SET_DEBUG */
void ctdb_req_control_set_debug ( struct ctdb_req_control * request ,
2016-11-25 05:23:11 +03:00
int loglevel )
2015-04-14 10:20:05 +03:00
{
request - > opcode = CTDB_CONTROL_SET_DEBUG ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SET_DEBUG ;
2016-11-25 05:23:11 +03:00
request - > rdata . data . loglevel = ( uint32_t ) loglevel ;
2015-04-14 10:20:05 +03:00
}
int ctdb_reply_control_set_debug ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_SET_DEBUG ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_DBMAP */
void ctdb_req_control_get_dbmap ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_DBMAP ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_DBMAP ;
}
int ctdb_reply_control_get_dbmap ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_dbid_map * * dbmap )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_DBMAP ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* dbmap = talloc_steal ( mem_ctx , reply - > rdata . data . dbmap ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_PULL_DB */
void ctdb_req_control_pull_db ( struct ctdb_req_control * request ,
struct ctdb_pulldb * pulldb )
{
request - > opcode = CTDB_CONTROL_PULL_DB ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_PULL_DB ;
request - > rdata . data . pulldb = pulldb ;
}
int ctdb_reply_control_pull_db ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_rec_buffer * * recbuf )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_PULL_DB ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* recbuf = talloc_steal ( mem_ctx , reply - > rdata . data . recbuf ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_PUSH_DB */
void ctdb_req_control_push_db ( struct ctdb_req_control * request ,
struct ctdb_rec_buffer * recbuf )
{
request - > opcode = CTDB_CONTROL_PUSH_DB ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_PUSH_DB ;
request - > rdata . data . recbuf = recbuf ;
}
int ctdb_reply_control_push_db ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_PUSH_DB ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_RECMODE */
void ctdb_req_control_get_recmode ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_RECMODE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_RECMODE ;
}
int ctdb_reply_control_get_recmode ( struct ctdb_reply_control * reply ,
int * recmode )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_RECMODE ) {
return EPROTO ;
}
2015-04-14 10:20:05 +03:00
if ( reply - > status > = 0 ) {
* recmode = reply - > status ;
reply - > status = 0 ;
}
return reply - > status ;
}
/* CTDB_CONTROL_SET_RECMODE */
void ctdb_req_control_set_recmode ( struct ctdb_req_control * request ,
int recmode )
{
request - > opcode = CTDB_CONTROL_SET_RECMODE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SET_RECMODE ;
request - > rdata . data . recmode = recmode ;
}
int ctdb_reply_control_set_recmode ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_SET_RECMODE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_STATISTICS_RESET */
void ctdb_req_control_statistics_reset ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_STATISTICS_RESET ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_STATISTICS_RESET ;
}
int ctdb_reply_control_statistics_reset ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_STATISTICS_RESET ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_DB_ATTACH */
void ctdb_req_control_db_attach ( struct ctdb_req_control * request ,
2017-03-21 07:02:56 +03:00
const char * db_name )
2015-04-14 10:20:05 +03:00
{
request - > opcode = CTDB_CONTROL_DB_ATTACH ;
request - > pad = 0 ;
2017-03-21 07:02:56 +03:00
request - > srvid = 0 ;
2015-04-14 10:20:05 +03:00
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_ATTACH ;
request - > rdata . data . db_name = db_name ;
}
int ctdb_reply_control_db_attach ( struct ctdb_reply_control * reply ,
uint32_t * db_id )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_DB_ATTACH ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* db_id = reply - > rdata . data . db_id ;
}
return reply - > status ;
}
/* CTDB_CONTROL_SET_CALL */
/* CTDB_CONTROL_TRAVERSE_START */
void ctdb_req_control_traverse_start ( struct ctdb_req_control * request ,
struct ctdb_traverse_start * traverse )
{
request - > opcode = CTDB_CONTROL_TRAVERSE_START ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_TRAVERSE_START ;
request - > rdata . data . traverse_start = traverse ;
}
int ctdb_reply_control_traverse_start ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_TRAVERSE_START ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_TRAVERSE_ALL */
/* CTDB_CONTROL_TRAVERSE_DATA */
/* CTDB_CONTROL_REGISTER_SRVID */
void ctdb_req_control_register_srvid ( struct ctdb_req_control * request ,
uint64_t srvid )
{
request - > opcode = CTDB_CONTROL_REGISTER_SRVID ;
request - > pad = 0 ;
request - > srvid = srvid ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_REGISTER_SRVID ;
}
int ctdb_reply_control_register_srvid ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_REGISTER_SRVID ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_DEREGISTER_SRVID */
void ctdb_req_control_deregister_srvid ( struct ctdb_req_control * request ,
uint64_t srvid )
{
request - > opcode = CTDB_CONTROL_DEREGISTER_SRVID ;
request - > pad = 0 ;
request - > srvid = srvid ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DEREGISTER_SRVID ;
}
int ctdb_reply_control_deregister_srvid ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_DEREGISTER_SRVID ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_DBNAME */
void ctdb_req_control_get_dbname ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_GET_DBNAME ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_DBNAME ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_get_dbname ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx , const char * * db_name )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_DBNAME ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* db_name = talloc_steal ( mem_ctx , reply - > rdata . data . db_name ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_ENABLE_SEQNUM */
void ctdb_req_control_enable_seqnum ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_ENABLE_SEQNUM ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_ENABLE_SEQNUM ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_enable_seqnum ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_ENABLE_SEQNUM ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_UPDATE_SEQNUM */
void ctdb_req_control_update_seqnum ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_UPDATE_SEQNUM ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_UPDATE_SEQNUM ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_update_seqnum ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_UPDATE_SEQNUM ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_DUMP_MEMORY */
void ctdb_req_control_dump_memory ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_DUMP_MEMORY ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DUMP_MEMORY ;
}
int ctdb_reply_control_dump_memory ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx , const char * * mem_str )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_DUMP_MEMORY ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* mem_str = talloc_steal ( mem_ctx , reply - > rdata . data . mem_str ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_GET_PID */
void ctdb_req_control_get_pid ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_PID ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_PID ;
}
int ctdb_reply_control_get_pid ( struct ctdb_reply_control * reply ,
pid_t * pid )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_PID ) {
return EPROTO ;
2015-04-14 10:20:05 +03:00
}
2016-04-21 07:19:44 +03:00
* pid = reply - > status ;
reply - > status = 0 ;
2015-04-14 10:20:05 +03:00
return reply - > status ;
}
/* CTDB_CONTROL_GET_RECMASTER */
void ctdb_req_control_get_recmaster ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_RECMASTER ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_RECMASTER ;
}
int ctdb_reply_control_get_recmaster ( struct ctdb_reply_control * reply ,
uint32_t * recmaster )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_RECMASTER ) {
return EPROTO ;
2015-04-14 10:20:05 +03:00
}
2016-04-21 07:19:44 +03:00
* recmaster = reply - > status ;
reply - > status = 0 ;
2015-04-14 10:20:05 +03:00
return reply - > status ;
}
/* CTDB_CONTROL_SET_RECMASTER */
void ctdb_req_control_set_recmaster ( struct ctdb_req_control * request ,
int recmaster )
{
request - > opcode = CTDB_CONTROL_SET_RECMASTER ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SET_RECMASTER ;
request - > rdata . data . recmaster = recmaster ;
}
int ctdb_reply_control_set_recmaster ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_SET_RECMASTER ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_FREEZE */
void ctdb_req_control_freeze ( struct ctdb_req_control * request ,
uint32_t priority )
{
request - > opcode = CTDB_CONTROL_FREEZE ;
request - > pad = 0 ;
request - > srvid = priority ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_FREEZE ;
}
int ctdb_reply_control_freeze ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_FREEZE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_PNN */
void ctdb_req_control_get_pnn ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_PNN ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_PNN ;
}
int ctdb_reply_control_get_pnn ( struct ctdb_reply_control * reply ,
uint32_t * pnn )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_PNN ) {
return EPROTO ;
}
2015-04-14 10:20:05 +03:00
if ( reply - > status > = 0 ) {
* pnn = reply - > status ;
reply - > status = 0 ;
}
return reply - > status ;
}
/* CTDB_CONTROL_SHUTDOWN */
void ctdb_req_control_shutdown ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_SHUTDOWN ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
2015-11-05 09:08:46 +03:00
request - > flags = CTDB_CTRL_FLAG_NOREPLY ;
2015-04-14 10:20:05 +03:00
request - > rdata . opcode = CTDB_CONTROL_SHUTDOWN ;
}
int ctdb_reply_control_shutdown ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_SHUTDOWN ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_MONMODE */
/* CTDB_CONTROL_TCP_CLIENT */
void ctdb_req_control_tcp_client ( struct ctdb_req_control * request ,
struct ctdb_connection * conn )
{
request - > opcode = CTDB_CONTROL_TCP_CLIENT ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_TCP_CLIENT ;
request - > rdata . data . conn = conn ;
}
int ctdb_reply_control_tcp_client ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_TCP_CLIENT ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_TCP_ADD */
void ctdb_req_control_tcp_add ( struct ctdb_req_control * request ,
struct ctdb_connection * conn )
{
request - > opcode = CTDB_CONTROL_TCP_ADD ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_TCP_ADD ;
request - > rdata . data . conn = conn ;
}
int ctdb_reply_control_tcp_add ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_TCP_ADD ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_TCP_REMOVE */
void ctdb_req_control_tcp_remove ( struct ctdb_req_control * request ,
struct ctdb_connection * conn )
{
request - > opcode = CTDB_CONTROL_TCP_REMOVE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_TCP_REMOVE ;
request - > rdata . data . conn = conn ;
}
int ctdb_reply_control_tcp_remove ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_TCP_REMOVE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_STARTUP */
void ctdb_req_control_startup ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_STARTUP ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_STARTUP ;
}
int ctdb_reply_control_startup ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_STARTUP ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_SET_TUNABLE */
void ctdb_req_control_set_tunable ( struct ctdb_req_control * request ,
struct ctdb_tunable * tunable )
{
request - > opcode = CTDB_CONTROL_SET_TUNABLE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SET_TUNABLE ;
request - > rdata . data . tunable = tunable ;
}
int ctdb_reply_control_set_tunable ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_SET_TUNABLE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_TUNABLE */
void ctdb_req_control_get_tunable ( struct ctdb_req_control * request ,
const char * name )
{
request - > opcode = CTDB_CONTROL_GET_TUNABLE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_TUNABLE ;
request - > rdata . data . tun_var = discard_const ( name ) ;
}
int ctdb_reply_control_get_tunable ( struct ctdb_reply_control * reply ,
uint32_t * value )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_TUNABLE ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* value = reply - > rdata . data . tun_value ;
}
return reply - > status ;
}
/* CTDB_CONTROL_LIST_TUNABLES */
void ctdb_req_control_list_tunables ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_LIST_TUNABLES ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_LIST_TUNABLES ;
}
int ctdb_reply_control_list_tunables ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_var_list * * tun_var_list )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_LIST_TUNABLES ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* tun_var_list = talloc_steal ( mem_ctx ,
reply - > rdata . data . tun_var_list ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_MODIFY_FLAGS */
void ctdb_req_control_modify_flags ( struct ctdb_req_control * request ,
struct ctdb_node_flag_change * flag_change )
{
request - > opcode = CTDB_CONTROL_MODIFY_FLAGS ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_MODIFY_FLAGS ;
request - > rdata . data . flag_change = flag_change ;
}
int ctdb_reply_control_modify_flags ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_MODIFY_FLAGS ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_ALL_TUNABLES */
void ctdb_req_control_get_all_tunables ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_ALL_TUNABLES ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_ALL_TUNABLES ;
}
int ctdb_reply_control_get_all_tunables ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_tunable_list * * tun_list )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_ALL_TUNABLES ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* tun_list = talloc_steal ( mem_ctx , reply - > rdata . data . tun_list ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_GET_TCP_TICKLE_LIST */
void ctdb_req_control_get_tcp_tickle_list ( struct ctdb_req_control * request ,
ctdb_sock_addr * addr )
{
request - > opcode = CTDB_CONTROL_GET_TCP_TICKLE_LIST ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_TCP_TICKLE_LIST ;
request - > rdata . data . addr = addr ;
}
int ctdb_reply_control_get_tcp_tickle_list ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_tickle_list * * tickles )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_TCP_TICKLE_LIST ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* tickles = talloc_steal ( mem_ctx , reply - > rdata . data . tickles ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_SET_TCP_TICKLE_LIST */
void ctdb_req_control_set_tcp_tickle_list ( struct ctdb_req_control * request ,
struct ctdb_tickle_list * tickles )
{
request - > opcode = CTDB_CONTROL_SET_TCP_TICKLE_LIST ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SET_TCP_TICKLE_LIST ;
request - > rdata . data . tickles = tickles ;
}
int ctdb_reply_control_set_tcp_tickle_list ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_SET_TCP_TICKLE_LIST ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_DB_ATTACH_PERSISTENT */
void ctdb_req_control_db_attach_persistent ( struct ctdb_req_control * request ,
2017-03-21 07:02:56 +03:00
const char * db_name )
2015-04-14 10:20:05 +03:00
{
request - > opcode = CTDB_CONTROL_DB_ATTACH_PERSISTENT ;
request - > pad = 0 ;
2017-03-21 07:02:56 +03:00
request - > srvid = 0 ;
2015-04-14 10:20:05 +03:00
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_ATTACH_PERSISTENT ;
request - > rdata . data . db_name = db_name ;
}
int ctdb_reply_control_db_attach_persistent ( struct ctdb_reply_control * reply ,
uint32_t * db_id )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_DB_ATTACH_PERSISTENT ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* db_id = reply - > rdata . data . db_id ;
}
return reply - > status ;
}
/* CTDB_CONTROL_UPDATE_RECORD */
void ctdb_req_control_update_record ( struct ctdb_req_control * request ,
struct ctdb_rec_buffer * recbuf )
{
request - > opcode = CTDB_CONTROL_UPDATE_RECORD ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_UPDATE_RECORD ;
request - > rdata . data . recbuf = recbuf ;
}
int ctdb_reply_control_update_record ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_UPDATE_RECORD ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_SEND_GRATUITOUS_ARP */
void ctdb_req_control_send_gratuitous_arp ( struct ctdb_req_control * request ,
struct ctdb_addr_info * addr_info )
{
request - > opcode = CTDB_CONTROL_SEND_GRATUITOUS_ARP ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SEND_GRATUITOUS_ARP ;
request - > rdata . data . addr_info = addr_info ;
}
int ctdb_reply_control_send_gratuitous_arp ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_SEND_GRATUITOUS_ARP ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_WIPE_DATABASE */
void ctdb_req_control_wipe_database ( struct ctdb_req_control * request ,
struct ctdb_transdb * transdb )
{
request - > opcode = CTDB_CONTROL_WIPE_DATABASE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_WIPE_DATABASE ;
request - > rdata . data . transdb = transdb ;
}
int ctdb_reply_control_wipe_database ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_WIPE_DATABASE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_UPTIME */
void ctdb_req_control_uptime ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_UPTIME ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_UPTIME ;
}
int ctdb_reply_control_uptime ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx , struct ctdb_uptime * * uptime )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_UPTIME ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* uptime = talloc_steal ( mem_ctx , reply - > rdata . data . uptime ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_START_RECOVERY */
void ctdb_req_control_start_recovery ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_START_RECOVERY ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_START_RECOVERY ;
}
int ctdb_reply_control_start_recovery ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_START_RECOVERY ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_END_RECOVERY */
void ctdb_req_control_end_recovery ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_END_RECOVERY ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_END_RECOVERY ;
}
int ctdb_reply_control_end_recovery ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_END_RECOVERY ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_RELOAD_NODES_FILE */
void ctdb_req_control_reload_nodes_file ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_RELOAD_NODES_FILE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_RELOAD_NODES_FILE ;
}
int ctdb_reply_control_reload_nodes_file ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_RELOAD_NODES_FILE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_TRY_DELETE_RECORDS */
void ctdb_req_control_try_delete_records ( struct ctdb_req_control * request ,
struct ctdb_rec_buffer * recbuf )
{
request - > opcode = CTDB_CONTROL_TRY_DELETE_RECORDS ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_TRY_DELETE_RECORDS ;
request - > rdata . data . recbuf = recbuf ;
}
int ctdb_reply_control_try_delete_records ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_rec_buffer * * recbuf )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_TRY_DELETE_RECORDS ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* recbuf = talloc_steal ( mem_ctx , reply - > rdata . data . recbuf ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_ENABLE_MONITOR */
/* CTDB_CONTROL_DISABLE_MONITOR */
/* CTDB_CONTROL_ADD_PUBLIC_IP */
void ctdb_req_control_add_public_ip ( struct ctdb_req_control * request ,
struct ctdb_addr_info * addr_info )
{
request - > opcode = CTDB_CONTROL_ADD_PUBLIC_IP ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_ADD_PUBLIC_IP ;
request - > rdata . data . addr_info = addr_info ;
}
int ctdb_reply_control_add_public_ip ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_ADD_PUBLIC_IP ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_DEL_PUBLIC_IP */
void ctdb_req_control_del_public_ip ( struct ctdb_req_control * request ,
struct ctdb_addr_info * addr_info )
{
request - > opcode = CTDB_CONTROL_DEL_PUBLIC_IP ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DEL_PUBLIC_IP ;
request - > rdata . data . addr_info = addr_info ;
}
int ctdb_reply_control_del_public_ip ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_DEL_PUBLIC_IP ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_CAPABILITIES */
void ctdb_req_control_get_capabilities ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_CAPABILITIES ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_CAPABILITIES ;
}
int ctdb_reply_control_get_capabilities ( struct ctdb_reply_control * reply ,
uint32_t * caps )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_CAPABILITIES ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* caps = reply - > rdata . data . caps ;
}
return reply - > status ;
}
/* CTDB_CONTROL_RECD_PING */
void ctdb_req_control_recd_ping ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_RECD_PING ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_RECD_PING ;
}
int ctdb_reply_control_recd_ping ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_RECD_PING ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_RELEASE_IP */
void ctdb_req_control_release_ip ( struct ctdb_req_control * request ,
struct ctdb_public_ip * pubip )
{
request - > opcode = CTDB_CONTROL_RELEASE_IP ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_RELEASE_IP ;
request - > rdata . data . pubip = pubip ;
}
int ctdb_reply_control_release_ip ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_RELEASE_IP ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_TAKEOVER_IP */
void ctdb_req_control_takeover_ip ( struct ctdb_req_control * request ,
struct ctdb_public_ip * pubip )
{
request - > opcode = CTDB_CONTROL_TAKEOVER_IP ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_TAKEOVER_IP ;
request - > rdata . data . pubip = pubip ;
}
int ctdb_reply_control_takeover_ip ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_TAKEOVER_IP ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_PUBLIC_IPS */
2016-11-10 08:11:12 +03:00
void ctdb_req_control_get_public_ips ( struct ctdb_req_control * request ,
bool available_only )
2015-04-14 10:20:05 +03:00
{
request - > opcode = CTDB_CONTROL_GET_PUBLIC_IPS ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_PUBLIC_IPS ;
2016-11-10 08:11:12 +03:00
if ( available_only ) {
request - > flags = CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE ;
}
2015-04-14 10:20:05 +03:00
}
int ctdb_reply_control_get_public_ips ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_public_ip_list * * pubip_list )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_PUBLIC_IPS ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
* pubip_list = talloc_steal ( mem_ctx ,
reply - > rdata . data . pubip_list ) ;
2015-04-14 10:20:05 +03:00
}
return reply - > status ;
}
/* CTDB_CONTROL_GET_NODEMAP */
void ctdb_req_control_get_nodemap ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_NODEMAP ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_NODEMAP ;
}
int ctdb_reply_control_get_nodemap ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_node_map * * nodemap )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_NODEMAP ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* nodemap = talloc_steal ( mem_ctx , reply - > rdata . data . nodemap ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_TRAVERSE_KILL */
void ctdb_req_control_traverse_kill ( struct ctdb_req_control * request ,
struct ctdb_traverse_start * traverse )
{
request - > opcode = CTDB_CONTROL_TRAVERSE_KILL ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_TRAVERSE_KILL ;
request - > rdata . data . traverse_start = traverse ;
}
int ctdb_reply_control_traverse_kill ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_TRAVERSE_KILL ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_RECD_RECLOCK_LATENCY */
void ctdb_req_control_recd_reclock_latency ( struct ctdb_req_control * request ,
double reclock_latency )
{
request - > opcode = CTDB_CONTROL_RECD_RECLOCK_LATENCY ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_RECD_RECLOCK_LATENCY ;
request - > rdata . data . reclock_latency = reclock_latency ;
}
int ctdb_reply_control_recd_reclock_latency ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_RECD_RECLOCK_LATENCY ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_RECLOCK_FILE */
void ctdb_req_control_get_reclock_file ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_RECLOCK_FILE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_RECLOCK_FILE ;
}
int ctdb_reply_control_get_reclock_file ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
const char * * reclock_file )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_RECLOCK_FILE ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* reclock_file = talloc_steal ( mem_ctx ,
reply - > rdata . data . reclock_file ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_STOP_NODE */
void ctdb_req_control_stop_node ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_STOP_NODE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_STOP_NODE ;
}
int ctdb_reply_control_stop_node ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_STOP_NODE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_CONTINUE_NODE */
void ctdb_req_control_continue_node ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_CONTINUE_NODE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_CONTINUE_NODE ;
}
int ctdb_reply_control_continue_node ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_CONTINUE_NODE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_SET_LMASTERROLE */
void ctdb_req_control_set_lmasterrole ( struct ctdb_req_control * request ,
uint32_t lmaster_role )
{
request - > opcode = CTDB_CONTROL_SET_LMASTERROLE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SET_LMASTERROLE ;
request - > rdata . data . role = lmaster_role ;
}
int ctdb_reply_control_set_lmasterrole ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_SET_LMASTERROLE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_SET_RECMASTERROLE */
void ctdb_req_control_set_recmasterrole ( struct ctdb_req_control * request ,
uint32_t recmaster_role )
{
request - > opcode = CTDB_CONTROL_SET_RECMASTERROLE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SET_RECMASTERROLE ;
request - > rdata . data . role = recmaster_role ;
}
int ctdb_reply_control_set_recmasterrole ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_SET_RECMASTERROLE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_SET_BAN_STATE */
void ctdb_req_control_set_ban_state ( struct ctdb_req_control * request ,
struct ctdb_ban_state * ban_state )
{
request - > opcode = CTDB_CONTROL_SET_BAN_STATE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SET_BAN_STATE ;
request - > rdata . data . ban_state = ban_state ;
}
int ctdb_reply_control_set_ban_state ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_SET_BAN_STATE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_BAN_STATE */
void ctdb_req_control_get_ban_state ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_BAN_STATE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_BAN_STATE ;
}
int ctdb_reply_control_get_ban_state ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_ban_state * * ban_state )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_BAN_STATE ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* ban_state = talloc_steal ( mem_ctx ,
reply - > rdata . data . ban_state ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_REGISTER_NOTIFY */
void ctdb_req_control_register_notify ( struct ctdb_req_control * request ,
struct ctdb_notify_data * notify )
{
request - > opcode = CTDB_CONTROL_REGISTER_NOTIFY ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_REGISTER_NOTIFY ;
request - > rdata . data . notify = notify ;
}
int ctdb_reply_control_register_notify ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_REGISTER_NOTIFY ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_DEREGISTER_NOTIFY */
void ctdb_req_control_deregister_notify ( struct ctdb_req_control * request ,
uint64_t srvid )
{
request - > opcode = CTDB_CONTROL_DEREGISTER_NOTIFY ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DEREGISTER_NOTIFY ;
request - > rdata . data . srvid = srvid ;
}
int ctdb_reply_control_deregister_notify ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_DEREGISTER_NOTIFY ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_TRANS3_COMMIT */
void ctdb_req_control_trans3_commit ( struct ctdb_req_control * request ,
struct ctdb_rec_buffer * recbuf )
{
request - > opcode = CTDB_CONTROL_TRANS3_COMMIT ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_TRANS3_COMMIT ;
request - > rdata . data . recbuf = recbuf ;
}
int ctdb_reply_control_trans3_commit ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_TRANS3_COMMIT ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_DB_SEQNUM */
void ctdb_req_control_get_db_seqnum ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_GET_DB_SEQNUM ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_DB_SEQNUM ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_get_db_seqnum ( struct ctdb_reply_control * reply ,
uint64_t * seqnum )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_DB_SEQNUM ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* seqnum = reply - > rdata . data . seqnum ;
}
return reply - > status ;
}
/* CTDB_CONTROL_DB_SET_HEALTHY */
void ctdb_req_control_db_set_healthy ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_DB_SET_HEALTHY ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_SET_HEALTHY ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_db_set_healthy ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_DB_SET_HEALTHY ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_DB_GET_HEALTH */
void ctdb_req_control_db_get_health ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_DB_GET_HEALTH ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_GET_HEALTH ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_db_get_health ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx , const char * * reason )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_DB_GET_HEALTH ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* reason = talloc_steal ( mem_ctx , reply - > rdata . data . reason ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_GET_PUBLIC_IP_INFO */
void ctdb_req_control_get_public_ip_info ( struct ctdb_req_control * request ,
ctdb_sock_addr * addr )
{
request - > opcode = CTDB_CONTROL_GET_PUBLIC_IP_INFO ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_PUBLIC_IP_INFO ;
request - > rdata . data . addr = addr ;
}
int ctdb_reply_control_get_public_ip_info ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_public_ip_info * * ipinfo )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_PUBLIC_IP_INFO ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* ipinfo = talloc_steal ( mem_ctx , reply - > rdata . data . ipinfo ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_GET_IFACES */
void ctdb_req_control_get_ifaces ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_IFACES ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_IFACES ;
}
int ctdb_reply_control_get_ifaces ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_iface_list * * iface_list )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_IFACES ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* iface_list = talloc_steal ( mem_ctx ,
reply - > rdata . data . iface_list ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_SET_IFACE_LINK_STATE */
void ctdb_req_control_set_iface_link_state ( struct ctdb_req_control * request ,
struct ctdb_iface * iface )
{
request - > opcode = CTDB_CONTROL_SET_IFACE_LINK_STATE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SET_IFACE_LINK_STATE ;
request - > rdata . data . iface = iface ;
}
int ctdb_reply_control_set_iface_link_state ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_SET_IFACE_LINK_STATE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE */
void ctdb_req_control_tcp_add_delayed_update ( struct ctdb_req_control * request ,
struct ctdb_connection * conn )
{
request - > opcode = CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE ;
request - > rdata . data . conn = conn ;
}
int ctdb_reply_control_tcp_add_delayed_update ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_STAT_HISTORY */
void ctdb_req_control_get_stat_history ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_STAT_HISTORY ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_STAT_HISTORY ;
}
int ctdb_reply_control_get_stat_history ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_statistics_list * * stats_list )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_STAT_HISTORY ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* stats_list = talloc_steal ( mem_ctx ,
reply - > rdata . data . stats_list ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_SCHEDULE_FOR_DELETION */
void ctdb_req_control_schedule_for_deletion ( struct ctdb_req_control * request ,
struct ctdb_key_data * key )
{
request - > opcode = CTDB_CONTROL_SCHEDULE_FOR_DELETION ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SCHEDULE_FOR_DELETION ;
request - > rdata . data . key = key ;
}
int ctdb_reply_control_schedule_for_deletion ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_SCHEDULE_FOR_DELETION ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_SET_DB_READONLY */
void ctdb_req_control_set_db_readonly ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_SET_DB_READONLY ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SET_DB_READONLY ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_set_db_readonly ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_SET_DB_READONLY ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_CHECK_SRVIDS */
/* CTDB_CONTROL_TRAVERSE_START_EXT */
void ctdb_req_control_traverse_start_ext ( struct ctdb_req_control * request ,
struct ctdb_traverse_start_ext * traverse )
{
request - > opcode = CTDB_CONTROL_TRAVERSE_START_EXT ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_TRAVERSE_START_EXT ;
request - > rdata . data . traverse_start_ext = traverse ;
}
int ctdb_reply_control_traverse_start_ext ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_TRAVERSE_START_EXT ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_DB_STATISTICS */
void ctdb_req_control_get_db_statistics ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_GET_DB_STATISTICS ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_DB_STATISTICS ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_get_db_statistics ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_db_statistics * * dbstats )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_DB_STATISTICS ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* dbstats = talloc_steal ( mem_ctx , reply - > rdata . data . dbstats ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_SET_DB_STICKY */
void ctdb_req_control_set_db_sticky ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_SET_DB_STICKY ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_SET_DB_STICKY ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_set_db_sticky ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_SET_DB_STICKY ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_RELOAD_PUBLIC_IPS */
void ctdb_req_control_reload_public_ips ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_RELOAD_PUBLIC_IPS ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_RELOAD_PUBLIC_IPS ;
}
int ctdb_reply_control_reload_public_ips ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_RELOAD_PUBLIC_IPS ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_TRAVERSE_ALL_EXT */
/* CTDB_CONTROL_RECEIVE_RECORDS */
void ctdb_req_control_receive_records ( struct ctdb_req_control * request ,
struct ctdb_rec_buffer * recbuf )
{
request - > opcode = CTDB_CONTROL_RECEIVE_RECORDS ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_RECEIVE_RECORDS ;
request - > rdata . data . recbuf = recbuf ;
}
int ctdb_reply_control_receive_records ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_rec_buffer * * recbuf )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_RECEIVE_RECORDS ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* recbuf = talloc_steal ( mem_ctx , reply - > rdata . data . recbuf ) ;
}
return reply - > status ;
}
/* CTDB_CONTROL_IPREALLOCATED */
void ctdb_req_control_ipreallocated ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_IPREALLOCATED ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_IPREALLOCATED ;
}
int ctdb_reply_control_ipreallocated ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_IPREALLOCATED ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_RUNSTATE */
void ctdb_req_control_get_runstate ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_RUNSTATE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_RUNSTATE ;
}
int ctdb_reply_control_get_runstate ( struct ctdb_reply_control * reply ,
enum ctdb_runstate * runstate )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_RUNSTATE ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* runstate = reply - > rdata . data . runstate ;
}
return reply - > status ;
}
/* CTDB_CONTROL_DB_DETACH */
void ctdb_req_control_db_detach ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_DB_DETACH ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_DETACH ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_db_detach ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_DB_DETACH ) ;
2015-04-14 10:20:05 +03:00
}
/* CTDB_CONTROL_GET_NODES_FILE */
void ctdb_req_control_get_nodes_file ( struct ctdb_req_control * request )
{
request - > opcode = CTDB_CONTROL_GET_NODES_FILE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_GET_NODES_FILE ;
}
int ctdb_reply_control_get_nodes_file ( struct ctdb_reply_control * reply ,
TALLOC_CTX * mem_ctx ,
struct ctdb_node_map * * nodemap )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_GET_NODES_FILE ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2015-04-14 10:20:05 +03:00
* nodemap = talloc_steal ( mem_ctx , reply - > rdata . data . nodemap ) ;
}
return reply - > status ;
}
2015-07-31 18:47:22 +03:00
/* CTDB_CONTROL_DB_FREEZE */
void ctdb_req_control_db_freeze ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_DB_FREEZE ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_FREEZE ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_db_freeze ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_DB_FREEZE ) ;
2015-07-31 18:47:22 +03:00
}
/* CTDB_CONTROL_DB_THAW */
void ctdb_req_control_db_thaw ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_DB_THAW ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_THAW ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_db_thaw ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_DB_THAW ) ;
2015-07-31 18:47:22 +03:00
}
/* CTDB_CONTROL_DB_TRANSACTION_START */
void ctdb_req_control_db_transaction_start ( struct ctdb_req_control * request ,
struct ctdb_transdb * transdb )
{
request - > opcode = CTDB_CONTROL_DB_TRANSACTION_START ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_TRANSACTION_START ;
request - > rdata . data . transdb = transdb ;
}
int ctdb_reply_control_db_transaction_start ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_DB_TRANSACTION_START ) ;
2015-07-31 18:47:22 +03:00
}
/* CTDB_CONTROL_DB_TRANSACTION_COMMIT */
void ctdb_req_control_db_transaction_commit ( struct ctdb_req_control * request ,
struct ctdb_transdb * transdb )
{
request - > opcode = CTDB_CONTROL_DB_TRANSACTION_COMMIT ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_TRANSACTION_COMMIT ;
request - > rdata . data . transdb = transdb ;
}
int ctdb_reply_control_db_transaction_commit ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_DB_TRANSACTION_COMMIT ) ;
2015-07-31 18:47:22 +03:00
}
/* CTDB_CONTROL_DB_TRANSACTION_CANCEL */
void ctdb_req_control_db_transaction_cancel ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_DB_TRANSACTION_CANCEL ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_TRANSACTION_CANCEL ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_db_transaction_cancel ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply ,
CTDB_CONTROL_DB_TRANSACTION_CANCEL ) ;
2015-07-31 18:47:22 +03:00
}
2016-02-19 02:54:15 +03:00
/* CTDB_CONTROL_DB_PULL */
void ctdb_req_control_db_pull ( struct ctdb_req_control * request ,
struct ctdb_pulldb_ext * pulldb_ext )
{
request - > opcode = CTDB_CONTROL_DB_PULL ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_PULL ;
request - > rdata . data . pulldb_ext = pulldb_ext ;
}
int ctdb_reply_control_db_pull ( struct ctdb_reply_control * reply ,
uint32_t * num_records )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_DB_PULL ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2016-02-19 02:54:15 +03:00
* num_records = reply - > rdata . data . num_records ;
}
return reply - > status ;
}
/* CTDB_CONTROL_DB_PUSH_START */
void ctdb_req_control_db_push_start ( struct ctdb_req_control * request ,
struct ctdb_pulldb_ext * pulldb_ext )
{
request - > opcode = CTDB_CONTROL_DB_PUSH_START ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_PUSH_START ;
request - > rdata . data . pulldb_ext = pulldb_ext ;
}
int ctdb_reply_control_db_push_start ( struct ctdb_reply_control * reply )
{
2016-04-21 07:19:44 +03:00
return ctdb_reply_control_generic ( reply , CTDB_CONTROL_DB_PUSH_START ) ;
2016-02-19 02:54:15 +03:00
}
/* CTDB_CONTROL_DB_PUSH_CONFIRM */
void ctdb_req_control_db_push_confirm ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_DB_PUSH_CONFIRM ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_PUSH_CONFIRM ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_db_push_confirm ( struct ctdb_reply_control * reply ,
uint32_t * num_records )
{
2016-04-21 07:19:44 +03:00
if ( reply - > rdata . opcode ! = CTDB_CONTROL_DB_PUSH_CONFIRM ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
2016-02-19 02:54:15 +03:00
* num_records = reply - > rdata . data . num_records ;
}
return reply - > status ;
}
2017-06-14 09:24:02 +03:00
/* CTDB_CONTROL_DB_OPEN_FLAGS */
void ctdb_req_control_db_open_flags ( struct ctdb_req_control * request ,
uint32_t db_id )
{
request - > opcode = CTDB_CONTROL_DB_OPEN_FLAGS ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_OPEN_FLAGS ;
request - > rdata . data . db_id = db_id ;
}
int ctdb_reply_control_db_open_flags ( struct ctdb_reply_control * reply ,
int * tdb_flags )
{
if ( reply - > rdata . opcode ! = CTDB_CONTROL_DB_OPEN_FLAGS ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
* tdb_flags = reply - > rdata . data . tdb_flags ;
}
return reply - > status ;
}
2017-03-02 09:07:13 +03:00
/* CTDB_CONTROL_DB_ATTACH_REPLICATED */
void ctdb_req_control_db_attach_replicated ( struct ctdb_req_control * request ,
const char * db_name )
{
request - > opcode = CTDB_CONTROL_DB_ATTACH_REPLICATED ;
request - > pad = 0 ;
request - > srvid = 0 ;
request - > client_id = 0 ;
request - > flags = 0 ;
request - > rdata . opcode = CTDB_CONTROL_DB_ATTACH_REPLICATED ;
request - > rdata . data . db_name = db_name ;
}
int ctdb_reply_control_db_attach_replicated ( struct ctdb_reply_control * reply ,
uint32_t * db_id )
{
if ( reply - > rdata . opcode ! = CTDB_CONTROL_DB_ATTACH_REPLICATED ) {
return EPROTO ;
}
if ( reply - > status = = 0 ) {
* db_id = reply - > rdata . data . db_id ;
}
return reply - > status ;
}