From e0a6c75cb4c7be2ad0124cd85fd41d2a59582513 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 16 May 2023 15:09:47 +1000 Subject: [PATCH] protocol: widen the callback_data arg for ping/sync to 64bit The only invocations we have right now of these callbacks ignore the argument or force it to zero. But in the future we may have an interface that requires a callback and that interface may need to store a timestamp or object ID in this argument - so let's make sure we have enough space for that. --- proto/protocol.xml | 4 ++-- src/libei-callback.c | 2 +- src/libei-callback.h | 4 +++- src/libei-connection.c | 2 +- src/libeis-connection.c | 3 ++- src/libeis-pingpong.c | 2 +- src/libeis-pingpong.h | 4 +++- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/proto/protocol.xml b/proto/protocol.xml index 9deb324..c6144b6 100644 --- a/proto/protocol.xml +++ b/proto/protocol.xml @@ -396,7 +396,7 @@ the ei_callback object is destroyed by the EIS implementation and as such the client must not attempt to use it after that point. - + @@ -418,7 +418,7 @@ the ei_pingpong object is destroyed by the client and as such must not be used any further. - + diff --git a/src/libei-callback.c b/src/libei-callback.c index 6acec2f..df699f2 100644 --- a/src/libei-callback.c +++ b/src/libei-callback.c @@ -69,7 +69,7 @@ ei_callback_get_id(struct ei_callback *callback) } static struct brei_result * -handle_msg_done(struct ei_callback *callback, uint32_t callback_data) +handle_msg_done(struct ei_callback *callback, uint64_t callback_data) { callback->func(callback, callback->callback_data, callback_data); return NULL; diff --git a/src/libei-callback.h b/src/libei-callback.h index e2744f4..585e6c3 100644 --- a/src/libei-callback.h +++ b/src/libei-callback.h @@ -32,7 +32,9 @@ struct ei; struct ei_callback; -typedef void (*ei_callback_func)(struct ei_callback *callback, void *callback_data, uint32_t proto_data); +typedef void (*ei_callback_func)(struct ei_callback *callback, + void *callback_data, + uint64_t proto_data); /* This is a protocol-only object, not exposed in the API */ struct ei_callback { diff --git a/src/libei-connection.c b/src/libei-connection.c index f342089..61c8d7a 100644 --- a/src/libei-connection.c +++ b/src/libei-connection.c @@ -107,7 +107,7 @@ struct callback_user_data { }; static void -sync_callback(struct ei_callback *callback, void *callback_data, uint32_t proto_data) +sync_callback(struct ei_callback *callback, void *callback_data, uint64_t proto_data) { struct ei_connection *connection = callback_data; diff --git a/src/libeis-connection.c b/src/libeis-connection.c index 167701c..f470578 100644 --- a/src/libeis-connection.c +++ b/src/libeis-connection.c @@ -114,7 +114,8 @@ struct pingpong_user_data { }; static void -ping_pingpong(struct eis_pingpong *pingpong, void *pingpong_data, uint32_t proto_data) +ping_pingpong(struct eis_pingpong *pingpong, void *pingpong_data, + uint64_t proto_data) { struct eis_connection *connection = pingpong_data; diff --git a/src/libeis-pingpong.c b/src/libeis-pingpong.c index 3c02fb9..b35101d 100644 --- a/src/libeis-pingpong.c +++ b/src/libeis-pingpong.c @@ -81,7 +81,7 @@ eis_pingpong_get_version(struct eis_pingpong *pingpong) } static struct brei_result * -client_msg_done(struct eis_pingpong *pingpong, uint32_t pingpong_data) +client_msg_done(struct eis_pingpong *pingpong, uint64_t pingpong_data) { pingpong->func(pingpong, pingpong->pingpong_data, pingpong_data); return NULL; diff --git a/src/libeis-pingpong.h b/src/libeis-pingpong.h index 551296a..7ea26d7 100644 --- a/src/libeis-pingpong.h +++ b/src/libeis-pingpong.h @@ -32,7 +32,9 @@ struct eis; struct eis_client; struct eis_pingpong; -typedef void (*eis_pingpong_func)(struct eis_pingpong *pingpong, void *pingpong_data, uint32_t proto_data); +typedef void (*eis_pingpong_func)(struct eis_pingpong *pingpong, + void *pingpong_data, + uint64_t proto_data); /* This is a protocol-only object, not exposed in the API */ struct eis_pingpong {