]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Add ctdbd_prep_hdr_next_reqid()
authorVolker Lendecke <vl@samba.org>
Fri, 20 Mar 2020 12:46:13 +0000 (13:46 +0100)
committerRalph Boehme <slow@samba.org>
Tue, 28 Apr 2020 09:08:40 +0000 (09:08 +0000)
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 <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/include/ctdbd_conn.h
source3/lib/ctdbd_conn.c

index 123294ff78262e42ce7950965d2eb33c3ab2bbdb..7ae2ec40139409f11937d051b4ee49d28cf30a59 100644 (file)
@@ -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,
index 35e5e34f49c65d1b2553462dc6b46964aac88869..20f47aae17364eb315a4755e80f346a2d223abeb 100644 (file)
@@ -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;