diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-05-02 14:26:21 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-06-12 18:42:22 +0200 |
commit | 309a747fa6cfeac0a0165543f23a924866727c9b (patch) | |
tree | a51242aa3ac87243c0614bf93d27e9083182e485 /src/shared/varlink-io.systemd.service.c | |
parent | json: merge json_dispatch_path() + json_dispatch_absolute_path() (diff) | |
download | systemd-309a747fa6cfeac0a0165543f23a924866727c9b.tar.xz systemd-309a747fa6cfeac0a0165543f23a924866727c9b.zip |
libsystemd: turn json.[ch] into a public API
This is preparation for making our Varlink API a public API. Since our
Varlink API is built on top of our JSON API we need to make that public
first (it's a nice API, but JSON APIs there are already enough, this is
purely about the Varlink angle).
I made most of the json.h APIs public, and just placed them in
sd-json.h. Sometimes I wasn't so sure however, since the underlying data
structures would have to be made public too. If in doubt I didn#t risk
it, and moved the relevant API to src/libsystemd/sd-json/json-util.h
instead (without any sd_* symbol prefixes).
This is mostly a giant search/replace patch.
Diffstat (limited to 'src/shared/varlink-io.systemd.service.c')
-rw-r--r-- | src/shared/varlink-io.systemd.service.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/shared/varlink-io.systemd.service.c b/src/shared/varlink-io.systemd.service.c index e9df5de814..7c22c33ea8 100644 --- a/src/shared/varlink-io.systemd.service.c +++ b/src/shared/varlink-io.systemd.service.c @@ -19,10 +19,10 @@ VARLINK_DEFINE_INTERFACE( &vl_method_Reload, &vl_method_SetLogLevel); -int varlink_method_ping(Varlink *link, JsonVariant *parameters, VarlinkMethodFlags flags, void *userdata) { +int varlink_method_ping(Varlink *link, sd_json_variant *parameters, VarlinkMethodFlags flags, void *userdata) { assert(link); - if (json_variant_elements(parameters) > 0) + if (sd_json_variant_elements(parameters) > 0) return varlink_error_invalid_parameter(link, parameters); log_debug("Received io.systemd.service.Ping"); @@ -30,9 +30,9 @@ int varlink_method_ping(Varlink *link, JsonVariant *parameters, VarlinkMethodFla return varlink_reply(link, NULL); } -int varlink_method_set_log_level(Varlink *link, JsonVariant *parameters, VarlinkMethodFlags flags, void *userdata) { - static const JsonDispatch dispatch_table[] = { - { "level", _JSON_VARIANT_TYPE_INVALID, json_dispatch_int64, 0, JSON_MANDATORY }, +int varlink_method_set_log_level(Varlink *link, sd_json_variant *parameters, VarlinkMethodFlags flags, void *userdata) { + static const sd_json_dispatch_field dispatch_table[] = { + { "level", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_int64, 0, SD_JSON_MANDATORY }, {} }; @@ -44,8 +44,8 @@ int varlink_method_set_log_level(Varlink *link, JsonVariant *parameters, Varlink assert(parameters); /* NOTE: The method does have 1 parameter, but we must compare to 2 here, because - * json_variant_elements() breaks abstraction and exposes internal structure of JsonObject. */ - if (json_variant_elements(parameters) != 2) + * sd_json_variant_elements() breaks abstraction and exposes internal structure of JsonObject. */ + if (sd_json_variant_elements(parameters) != 2) return varlink_error_invalid_parameter(link, parameters); r = varlink_dispatch(link, parameters, dispatch_table, &level); |