1 #ifndef _LIBCTDB_PRIVATE_H
2 #define _LIBCTDB_PRIVATE_H
8 #include <ctdb_protocol.h>
14 #define offsetof(t,f) ((unsigned int)&((t *)0)->f)
17 #ifndef COLD_ATTRIBUTE
18 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
19 #define COLD_ATTRIBUTE __attribute__((cold))
21 #define COLD_ATTRIBUTE
23 #endif /* COLD_ATTRIBUTE */
25 #define DEBUG(ctdb, lvl, format, args...) do { if (lvl <= ctdb_log_level) { ctdb_do_debug(ctdb, lvl, format , ## args ); }} while(0)
27 struct message_handler_info
;
28 struct ctdb_reply_call
;
31 struct ctdb_connection
*ctdb
;
32 struct ctdb_request
*next
, *prev
;
37 struct ctdb_req_header
*hdr
;
38 struct ctdb_req_call
*call
;
39 struct ctdb_req_control
*control
;
40 struct ctdb_req_message
*message
;
43 struct io_elem
*reply
;
45 ctdb_callback_t callback
;
48 /* Extra per-request info. */
49 void (*extra_destructor
)(struct ctdb_connection
*,
50 struct ctdb_request
*);
54 struct ctdb_connection
{
55 /* Socket to ctdbd. */
57 /* Currently our failure mode is simple; return -1 from ctdb_service */
59 /* Linked list of pending outgoings. */
60 struct ctdb_request
*outq
;
61 /* Finished outgoings (awaiting response) */
62 struct ctdb_request
*doneq
;
64 /* Current incoming. */
66 /* Queue of received pdus */
67 struct io_elem
*inqueue
;
69 /* Guess at a good reqid to try next. */
71 /* List of messages */
72 struct message_handler_info
*message_handlers
;
73 /* PNN of this ctdb: valid by the time we do our first db connection. */
75 /* Chain of locks we hold. */
76 struct ctdb_lock
*locks
;
83 struct ctdb_request
*new_ctdb_request(struct ctdb_connection
*ctdb
, size_t len
,
84 ctdb_callback_t cb
, void *cbdata
);
85 struct ctdb_request
*new_ctdb_control_request(struct ctdb_connection
*ctdb
,
88 const void *extra_data
,
90 ctdb_callback_t
, void *);
91 uint32_t new_reqid(struct ctdb_connection
*ctdb
);
93 struct ctdb_reply_control
*unpack_reply_control(struct ctdb_request
*req
,
94 enum ctdb_controls control
);
95 void ctdb_cancel_callback(struct ctdb_connection
*ctdb
,
96 struct ctdb_request
*req
,
100 void ctdb_tdb_log_bridge(struct tdb_context
*tdb
,
101 enum tdb_debug_level level
,
102 const char *format
, ...) PRINTF_ATTRIBUTE(3, 4);
104 void ctdb_do_debug(struct ctdb_connection
*, int, const char *format
, ...)
105 PRINTF_ATTRIBUTE(3, 4) COLD_ATTRIBUTE
;
107 #endif /* _LIBCTDB_PRIVATE_H */