From f8d55af76b7a758a134bc816d9a34a7ca4325e32 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 6 Feb 2011 21:33:03 +0100 Subject: [PATCH] rename publish to add_object --- libubus.c | 14 +++++++------- libubus.h | 2 +- ubus-example.c | 8 ++++---- ubusd_proto.c | 4 ++-- ubusmsg.h | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libubus.c b/libubus.c index 8749d7c..d799c1d 100644 --- a/libubus.c +++ b/libubus.c @@ -533,7 +533,7 @@ int ubus_invoke(struct ubus_context *ctx, uint32_t obj, const char *method, return ubus_complete_request(ctx, &req); } -static void ubus_publish_cb(struct ubus_request *req, int type, struct blob_attr *msg) +static void ubus_add_object_cb(struct ubus_request *req, int type, struct blob_attr *msg) { struct ubus_object *obj = req->priv; @@ -609,7 +609,7 @@ static bool ubus_push_object_type(struct ubus_object_type *type) return true; } -static int __ubus_publish(struct ubus_context *ctx, struct ubus_object *obj) +static int __ubus_add_object(struct ubus_context *ctx, struct ubus_object *obj) { struct ubus_request req; int ret; @@ -625,8 +625,8 @@ static int __ubus_publish(struct ubus_context *ctx, struct ubus_object *obj) return UBUS_STATUS_INVALID_ARGUMENT; } - ubus_start_request(ctx, &req, b.head, UBUS_MSG_PUBLISH, 0); - req.raw_data_cb = ubus_publish_cb; + ubus_start_request(ctx, &req, b.head, UBUS_MSG_ADD_OBJECT, 0); + req.raw_data_cb = ubus_add_object_cb; req.priv = obj; ret = ubus_complete_request(ctx, &req); if (ret) @@ -638,12 +638,12 @@ static int __ubus_publish(struct ubus_context *ctx, struct ubus_object *obj) return 0; } -int ubus_publish(struct ubus_context *ctx, struct ubus_object *obj) +int ubus_add_object(struct ubus_context *ctx, struct ubus_object *obj) { if (!obj->name || !obj->type) return UBUS_STATUS_INVALID_ARGUMENT; - return __ubus_publish(ctx, obj); + return __ubus_add_object(ctx, obj); } static int ubus_event_cb(struct ubus_context *ctx, struct ubus_object *obj, @@ -677,7 +677,7 @@ int ubus_register_event_handler(struct ubus_context *ctx, if (!!obj->name ^ !!obj->type) return UBUS_STATUS_INVALID_ARGUMENT; - ret = __ubus_publish(ctx, obj); + ret = __ubus_add_object(ctx, obj); if (ret) return ret; } diff --git a/libubus.h b/libubus.h index 5fb565b..bab919f 100644 --- a/libubus.h +++ b/libubus.h @@ -175,7 +175,7 @@ void ubus_invoke_async(struct ubus_context *ctx, uint32_t obj, const char *metho struct blob_attr *msg, struct ubus_request *req); /* make an object visible to remote connections */ -int ubus_publish(struct ubus_context *ctx, struct ubus_object *obj); +int ubus_add_object(struct ubus_context *ctx, struct ubus_object *obj); /* send a reply to an incoming object method call */ int ubus_send_reply(struct ubus_context *ctx, struct ubus_request_data *req, diff --git a/ubus-example.c b/ubus-example.c index 298a7dd..9e1b1d9 100644 --- a/ubus-example.c +++ b/ubus-example.c @@ -98,18 +98,18 @@ int main(int argc, char **argv) fprintf(stderr, "Connected as ID 0x%08x\n", ctx->local_id); fprintf(stderr, "Publishing object\n"); - ret = ubus_publish(ctx, &test_object); + ret = ubus_add_object(ctx, &test_object); if (ret) - fprintf(stderr, "Failed to publish object: %s\n", ubus_strerror(ret)); + fprintf(stderr, "Failed to add_object object: %s\n", ubus_strerror(ret)); else { fprintf(stderr, "Object ID: %08x\n", test_object.id); fprintf(stderr, "Object Type ID: %08x\n", test_object.type->id); } fprintf(stderr, "Publishing object\n"); - ret = ubus_publish(ctx, &test_object2); + ret = ubus_add_object(ctx, &test_object2); if (ret) - fprintf(stderr, "Failed to publish object: %s\n", ubus_strerror(ret)); + fprintf(stderr, "Failed to add_object object: %s\n", ubus_strerror(ret)); else { fprintf(stderr, "Object ID: %08x\n", test_object2.id); fprintf(stderr, "Object Type ID: %08x\n", test_object2.type->id); diff --git a/ubusd_proto.c b/ubusd_proto.c index 3333330..550e116 100644 --- a/ubusd_proto.c +++ b/ubusd_proto.c @@ -69,7 +69,7 @@ static int ubusd_send_pong(struct ubus_client *cl, struct ubus_msg_buf *ub, stru return 0; } -static int ubusd_handle_publish(struct ubus_client *cl, struct ubus_msg_buf *ub, struct blob_attr **attr) +static int ubusd_handle_add_object(struct ubus_client *cl, struct ubus_msg_buf *ub, struct blob_attr **attr) { struct ubus_object *obj; @@ -231,7 +231,7 @@ error: static const ubus_cmd_cb handlers[__UBUS_MSG_LAST] = { [UBUS_MSG_PING] = ubusd_send_pong, - [UBUS_MSG_PUBLISH] = ubusd_handle_publish, + [UBUS_MSG_ADD_OBJECT] = ubusd_handle_add_object, [UBUS_MSG_LOOKUP] = ubusd_handle_lookup, [UBUS_MSG_INVOKE] = ubusd_handle_invoke, [UBUS_MSG_STATUS] = ubusd_handle_response, diff --git a/ubusmsg.h b/ubusmsg.h index 32cee6b..116351d 100644 --- a/ubusmsg.h +++ b/ubusmsg.h @@ -38,8 +38,8 @@ enum ubus_msg_type { /* invoke a method on a single object */ UBUS_MSG_INVOKE, - /* publish an object */ - UBUS_MSG_PUBLISH, + UBUS_MSG_ADD_OBJECT, + UBUS_MSG_REMOVE_OBJECT, /* must be last */ __UBUS_MSG_LAST, -- 2.25.1