From 177de8ec3f6f62243f59501db921b54034be040d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 20 Mar 2020 13:46:13 +0100 Subject: [PATCH] lib: Add ctdbd_prep_hdr_next_reqid() Preparation for generic ctdb_req_send/recv: No need to expose ctdbd_next_reqid(), do basic preparations of a ctdb_req_header Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- source3/include/ctdbd_conn.h | 4 ++++ source3/lib/ctdbd_conn.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h index 123294ff782..7ae2ec40139 100644 --- a/source3/include/ctdbd_conn.h +++ b/source3/include/ctdbd_conn.h @@ -104,6 +104,10 @@ int register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid, void *private_data); int ctdbd_probe(const char *sockname, int timeout); +struct ctdb_req_header; +void ctdbd_prep_hdr_next_reqid( + struct ctdbd_connection *conn, struct ctdb_req_header *hdr); + struct tevent_req *ctdbd_parse_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct ctdbd_connection *conn, diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index 35e5e34f49c..20f47aae173 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -1839,6 +1839,17 @@ static int ctdbd_connection_destructor(struct ctdbd_connection *c) return 0; } +void ctdbd_prep_hdr_next_reqid( + struct ctdbd_connection *conn, struct ctdb_req_header *hdr) +{ + *hdr = (struct ctdb_req_header) { + .ctdb_magic = CTDB_MAGIC, + .ctdb_version = CTDB_PROTOCOL, + .reqid = ctdbd_next_reqid(conn), + .destnode = CTDB_CURRENT_NODE, + }; +} + struct ctdbd_parse_state { struct tevent_context *ev; struct ctdbd_connection *conn;