struct ctdb_request *req;
struct ctdb_req_control *pkt;
- req = new_ctdb_request(sizeof(*pkt) + extra, callback, cbdata);
+ req = new_ctdb_request(offsetof(struct ctdb_req_control, data) + extra, callback, cbdata);
if (!req)
return NULL;
lock->held = false;
/* Get ready in case we need to send a migrate request. */
- req = new_ctdb_request(sizeof(*req->hdr.call)
+ req = new_ctdb_request(offsetof(struct ctdb_req_call, data)
+ key.dsize, callback, cbdata);
if (!req) {
ctdb_release_lock(lock);
#include <ctdb.h>
#include <ctdb_protocol.h>
+#ifndef offsetof
+#define offsetof(t,f) ((unsigned int)&((t *)0)->f)
+#endif
+
struct message_handler_info;
struct ctdb_reply_call;
struct ctdb_req_message *pkt;
/* We just discard it once it's finished: no reply. */
- req = new_ctdb_request(sizeof(*pkt) + data.dsize,
+ req = new_ctdb_request(offsetof(struct ctdb_req_message, data) + data.dsize,
ctdb_cancel_callback, NULL);
if (!req) {
return -1;