diff --git a/doc/man3/treduce.c b/doc/man3/treduce.c index 11f59c17e59c..cff0352d056c 100644 --- a/doc/man3/treduce.c +++ b/doc/man3/treduce.c @@ -40,7 +40,7 @@ void forward (flux_reduce_t *r, int batchnum, void *arg) flux_rpc_t *rpc; while ((item = flux_reduce_pop (r))) { - JSON out = Jnew (); + json_object *out = Jnew (); Jadd_int (out, "batchnum", batchnum); Jadd_str (out, "nodeset", item); rpc = flux_rpc (ctx->h, "treduce.forward", Jtostr (out), @@ -77,7 +77,7 @@ void forward_cb (flux_t h, flux_msg_handler_t *w, { struct context *ctx = arg; const char *json_str, *nodeset_str; - JSON in = NULL; + json_object *in = NULL; int batchnum; char *item; diff --git a/doc/man3/trpc.c b/doc/man3/trpc.c index b8721e64fba9..400b6ad79e33 100644 --- a/doc/man3/trpc.c +++ b/doc/man3/trpc.c @@ -5,7 +5,7 @@ void get_rank (flux_rpc_t *rpc) { const char *json_str; - JSON o; + json_object *o; const char *rank; if (flux_rpc_get (rpc, NULL, &json_str) < 0) @@ -20,7 +20,7 @@ int main (int argc, char **argv) { flux_t h; flux_rpc_t *rpc; - JSON o = Jnew(); + json_object *o = Jnew(); if (!(h = flux_open (NULL, 0))) log_err_exit ("flux_open"); diff --git a/doc/man3/trpc_then.c b/doc/man3/trpc_then.c index 49cc598bdcdc..35b1acbebb65 100644 --- a/doc/man3/trpc_then.c +++ b/doc/man3/trpc_then.c @@ -5,7 +5,7 @@ void get_rank (flux_rpc_t *rpc, void *arg) { const char *json_str; - JSON o; + json_object *o; const char *rank; if (flux_rpc_get (rpc, NULL, &json_str) < 0) @@ -21,7 +21,7 @@ int main (int argc, char **argv) { flux_t h; flux_rpc_t *rpc; - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_str (o, "name", "rank"); if (!(h = flux_open (NULL, 0))) diff --git a/doc/man3/trpc_then_multi.c b/doc/man3/trpc_then_multi.c index 2c6beca9c4a6..e00806713f77 100644 --- a/doc/man3/trpc_then_multi.c +++ b/doc/man3/trpc_then_multi.c @@ -5,7 +5,7 @@ void get_rank (flux_rpc_t *rpc, void *arg) { const char *json_str; - JSON o; + json_object *o; const char *rank; uint32_t nodeid; @@ -21,7 +21,7 @@ int main (int argc, char **argv) { flux_t h; flux_rpc_t *rpc; - JSON o = Jnew(); + json_object *o = Jnew(); Jadd_str (o, "name", "rank"); if (!(h = flux_open (NULL, 0))) diff --git a/src/broker/broker.c b/src/broker/broker.c index 0265d58da0db..65bd180f160d 100644 --- a/src/broker/broker.c +++ b/src/broker/broker.c @@ -1727,14 +1727,14 @@ static int terminate_subprocesses_by_uuid (ctx_t *ctx, char *id) return (0); } -static JSON subprocess_json_info (struct subprocess *p) +static json_object *subprocess_json_info (struct subprocess *p) { int i; char buf [MAXPATHLEN]; const char *cwd; char *sender = NULL; - JSON o = Jnew (); - JSON a = Jnew_ar (); + json_object *o = Jnew (); + json_object *a = Jnew_ar (); Jadd_int (o, "pid", subprocess_pid (p)); for (i = 0; i < subprocess_get_argc (p); i++) { @@ -1758,15 +1758,15 @@ static int cmb_ps_cb (zmsg_t **zmsg, void *arg) { struct subprocess *p; ctx_t *ctx = arg; - JSON out = Jnew (); - JSON procs = Jnew_ar (); + json_object *out = Jnew (); + json_object *procs = Jnew_ar (); int rc; Jadd_int (out, "rank", ctx->rank); p = subprocess_manager_first (ctx->sm); while (p) { - JSON o = subprocess_json_info (p); + json_object *o = subprocess_json_info (p); /* Avoid shortjson here so we don't take an unnecessary * reference to 'o'. */ @@ -1814,8 +1814,8 @@ static int cmb_attrget_cb (zmsg_t **zmsg, void *arg) ctx_t *ctx = arg; const char *json_str, *name, *val; int flags; - JSON in = NULL; - JSON out = Jnew (); + json_object *in = NULL; + json_object *out = Jnew (); int rc = -1; if (flux_request_decode (*zmsg, NULL, &json_str) < 0) @@ -1846,7 +1846,7 @@ static int cmb_attrset_cb (zmsg_t **zmsg, void *arg) { ctx_t *ctx = arg; const char *json_str, *name, *val = NULL; - JSON in = NULL; + json_object *in = NULL; int rc = -1; if (flux_request_decode (*zmsg, NULL, &json_str) < 0) @@ -1879,8 +1879,8 @@ static int cmb_attrlist_cb (zmsg_t **zmsg, void *arg) { ctx_t *ctx = arg; const char *name; - JSON out = Jnew (); - JSON array = Jnew_ar (); + json_object *out = Jnew (); + json_object *array = Jnew_ar (); int rc = -1; if (flux_request_decode (*zmsg, NULL, NULL) < 0) @@ -1904,7 +1904,7 @@ static int cmb_attrlist_cb (zmsg_t **zmsg, void *arg) static int cmb_rusage_cb (zmsg_t **zmsg, void *arg) { ctx_t *ctx = arg; - JSON out = NULL; + json_object *out = NULL; int rc = -1; if (getrusage_json (RUSAGE_THREAD, &out) < 0) @@ -2029,7 +2029,7 @@ static int cmb_lsmod_cb (zmsg_t **zmsg, void *arg) static int cmb_lspeer_cb (zmsg_t **zmsg, void *arg) { ctx_t *ctx = arg; - JSON out = overlay_lspeer_encode (ctx->overlay); + json_object *out = overlay_lspeer_encode (ctx->overlay); int rc = flux_respond (ctx->h, *zmsg, 0, Jtostr (out)); zmsg_destroy (zmsg); Jput (out); @@ -2039,7 +2039,7 @@ static int cmb_lspeer_cb (zmsg_t **zmsg, void *arg) static int cmb_ping_cb (zmsg_t **zmsg, void *arg) { ctx_t *ctx = arg; - JSON inout = NULL; + json_object *inout = NULL; const char *json_str; char *s = NULL; char *route = NULL; @@ -2068,7 +2068,7 @@ static int cmb_ping_cb (zmsg_t **zmsg, void *arg) static int cmb_reparent_cb (zmsg_t **zmsg, void *arg) { ctx_t *ctx = arg; - JSON in = NULL; + json_object *in = NULL; const char *uri; const char *json_str; bool recycled = false; @@ -2092,7 +2092,7 @@ static int cmb_reparent_cb (zmsg_t **zmsg, void *arg) static int cmb_panic_cb (zmsg_t **zmsg, void *arg) { - JSON in = NULL; + json_object *in = NULL; const char *s = NULL; const char *json_str; int rc = -1; @@ -2129,7 +2129,7 @@ static int cmb_dmesg_clear_cb (zmsg_t **zmsg, void *arg) ctx_t *ctx = arg; const char *json_str; int seq; - JSON in = NULL; + json_object *in = NULL; int rc = -1; if (flux_request_decode (*zmsg, NULL, &json_str) < 0) @@ -2154,8 +2154,8 @@ static void cmb_dmesg (const flux_msg_t *msg, void *arg) const char *buf; int len; int seq; - JSON in = NULL; - JSON out = NULL; + json_object *in = NULL; + json_object *out = NULL; bool follow; int rc = -1; @@ -2233,7 +2233,7 @@ static int cmb_sub_cb (zmsg_t **zmsg, void *arg) ctx_t *ctx = arg; const char *json_str; char *uuid = NULL; - JSON in = NULL; + json_object *in = NULL; const char *topic; int rc = -1; @@ -2266,7 +2266,7 @@ static int cmb_unsub_cb (zmsg_t **zmsg, void *arg) ctx_t *ctx = arg; const char *json_str; char *uuid = NULL; - JSON in = NULL; + json_object *in = NULL; const char *topic; int rc = -1; @@ -2297,7 +2297,7 @@ static int cmb_unsub_cb (zmsg_t **zmsg, void *arg) static int cmb_seq (zmsg_t **zmsg, void *arg) { ctx_t *ctx = arg; - JSON out = NULL; + json_object *out = NULL; int rc = sequence_request_handler (ctx->seq, (flux_msg_t *) *zmsg, &out); if (flux_respond (ctx->h, *zmsg, rc < 0 ? errno : 0, Jtostr (out)) < 0) @@ -2311,7 +2311,7 @@ static int cmb_seq (zmsg_t **zmsg, void *arg) static int cmb_heaptrace_start_cb (zmsg_t **zmsg, void *arg) { const char *json_str, *filename; - JSON in = NULL; + json_object *in = NULL; int rc = -1; if (flux_request_decode (*zmsg, NULL, &json_str) < 0) @@ -2338,7 +2338,7 @@ static int cmb_heaptrace_start_cb (zmsg_t **zmsg, void *arg) static int cmb_heaptrace_dump_cb (zmsg_t **zmsg, void *arg) { const char *json_str, *reason; - JSON in = NULL; + json_object *in = NULL; int rc = -1; if (flux_request_decode (*zmsg, NULL, &json_str) < 0) diff --git a/src/broker/content-cache.c b/src/broker/content-cache.c index 7b2efdf52445..24b9687c98df 100644 --- a/src/broker/content-cache.c +++ b/src/broker/content-cache.c @@ -648,7 +648,7 @@ static void content_backing_request (flux_t h, flux_msg_handler_t *w, content_cache_t *cache = arg; const char *json_str; const char *name; - JSON in = NULL; + json_object *in = NULL; int rc = -1; bool backing; @@ -735,7 +735,7 @@ static void content_stats_request (flux_t h, flux_msg_handler_t *w, const flux_msg_t *msg, void *arg) { content_cache_t *cache = arg; - JSON out = Jnew (); + json_object *out = Jnew (); int rc = -1; if (flux_request_decode (msg, NULL, NULL) < 0) diff --git a/src/broker/hello.c b/src/broker/hello.c index b29132509891..61f28542ca6f 100644 --- a/src/broker/hello.c +++ b/src/broker/hello.c @@ -219,7 +219,7 @@ static void join_request (flux_t h, flux_msg_handler_t *w, hello_t *hello = arg; const char *json_str; int count, batch; - JSON in = NULL; + json_object *in = NULL; if (flux_request_decode (msg, NULL, &json_str) < 0) log_err_exit ("hello: flux_request_decode"); @@ -281,7 +281,7 @@ static void r_forward (flux_reduce_t *r, int batch, void *arg) flux_rpc_t *rpc; hello_t *hello = arg; int count = (uintptr_t)flux_reduce_pop (r); - JSON in = Jnew (); + json_object *in = Jnew (); assert (batch == 0); assert (count > 0); diff --git a/src/broker/modservice.c b/src/broker/modservice.c index e3bd315eab8d..e563feb6963f 100644 --- a/src/broker/modservice.c +++ b/src/broker/modservice.c @@ -94,7 +94,7 @@ static void ping_cb (flux_t h, flux_msg_handler_t *w, { module_t *p = arg; const char *json_str; - JSON o = NULL; + json_object *o = NULL; char *route = NULL; char *route_plus_uuid = NULL; int rc = -1; @@ -125,7 +125,7 @@ static void stats_get_cb (flux_t h, flux_msg_handler_t *w, const flux_msg_t *msg, void *arg) { flux_msgcounters_t mcs; - JSON out = Jnew (); + json_object *out = Jnew (); flux_get_msgcounters (h, &mcs); Jadd_int (out, "#request (tx)", mcs.request_tx); @@ -159,7 +159,7 @@ static void stats_clear_request_cb (flux_t h, flux_msg_handler_t *w, static void rusage_cb (flux_t h, flux_msg_handler_t *w, const flux_msg_t *msg, void *arg) { - JSON out = NULL; + json_object *out = NULL; int rc = -1; if (getrusage_json (RUSAGE_THREAD, &out) < 0) diff --git a/src/broker/overlay.c b/src/broker/overlay.c index 395e60363543..7a2744a94aba 100644 --- a/src/broker/overlay.c +++ b/src/broker/overlay.c @@ -183,12 +183,12 @@ void overlay_set_idle_warning (overlay_t *ov, int heartbeats) json_object *overlay_lspeer_encode (overlay_t *ov) { - JSON out = Jnew (); + json_object *out = Jnew (); const char *uuid; child_t *child; FOREACH_ZHASH (ov->children, uuid, child) { - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_int (o, "idle", ov->epoch - child->lastseen); Jadd_obj (out, uuid, o); /* takes ref on 'o' */ Jput (o); diff --git a/src/broker/sequence.c b/src/broker/sequence.c index decb8b37ad96..6e37a2258675 100644 --- a/src/broker/sequence.c +++ b/src/broker/sequence.c @@ -132,7 +132,8 @@ static int seq_cmp_and_set (seqhash_t *s, const char *name, return (0); } -static int handle_seq_destroy (seqhash_t *s, JSON in, JSON *outp) +static int handle_seq_destroy (seqhash_t *s, json_object *in, + json_object **outp) { const char *name; if (!Jget_str (in, "name", &name)) { @@ -147,7 +148,7 @@ static int handle_seq_destroy (seqhash_t *s, JSON in, JSON *outp) return (0); } -static int handle_seq_set (seqhash_t *s, JSON in, JSON *outp) +static int handle_seq_set (seqhash_t *s, json_object *in, json_object **outp) { const char *name; int64_t old, v; @@ -168,7 +169,7 @@ static int handle_seq_set (seqhash_t *s, JSON in, JSON *outp) return (0); } -static int handle_seq_fetch (seqhash_t *s, JSON in, JSON *outp) +static int handle_seq_fetch (seqhash_t *s, json_object *in, json_object **outp) { const char *name; bool create = false; @@ -202,11 +203,12 @@ static int handle_seq_fetch (seqhash_t *s, JSON in, JSON *outp) return (0); } -int sequence_request_handler (seqhash_t *s, const flux_msg_t *msg, JSON *outp) +int sequence_request_handler (seqhash_t *s, const flux_msg_t *msg, + json_object **outp) { const char *json_str, *topic; const char *method; - JSON in = NULL; + json_object *in = NULL; int rc = -1; *outp = NULL; diff --git a/src/broker/sequence.h b/src/broker/sequence.h index c2c274c302e0..c6c52f0963c7 100644 --- a/src/broker/sequence.h +++ b/src/broker/sequence.h @@ -34,7 +34,8 @@ typedef struct seq_struct seqhash_t; seqhash_t *sequence_hash_create (void); void sequence_hash_destroy (seqhash_t *seq); -int sequence_request_handler (seqhash_t *seq, const flux_msg_t *msg, JSON *op); +int sequence_request_handler (seqhash_t *seq, const flux_msg_t *msg, + json_object **op); #endif /* BROKER_SEQUENCE_H */ diff --git a/src/broker/shutdown.c b/src/broker/shutdown.c index 8728ce510b27..0616158c7be4 100644 --- a/src/broker/shutdown.c +++ b/src/broker/shutdown.c @@ -153,7 +153,7 @@ flux_msg_t *shutdown_vencode (double grace, int exitcode, int rank, const char *fmt, va_list ap) { flux_msg_t *msg; - JSON out = Jnew (); + json_object *out = Jnew (); char reason[REASON_MAX]; vsnprintf (reason, sizeof (reason), fmt, ap); @@ -184,7 +184,7 @@ int shutdown_decode (const flux_msg_t *msg, double *grace, int *exitcode, int *rank, char *reason, int reason_len) { const char *json_str, *s; - JSON in = NULL; + json_object *in = NULL; int rc = -1; if (flux_event_decode (msg, NULL, &json_str) < 0 diff --git a/src/cmd/builtin/heaptrace.c b/src/cmd/builtin/heaptrace.c index 0c096a2c5b6a..8d6e43f047ba 100644 --- a/src/cmd/builtin/heaptrace.c +++ b/src/cmd/builtin/heaptrace.c @@ -29,7 +29,7 @@ static int internal_heaptrace_start (optparse_t *p, int ac, char *av[]) { flux_t h; flux_rpc_t *rpc; - JSON in = Jnew (); + json_object *in = Jnew (); if (optparse_optind (p) != ac - 1) { optparse_print_usage (p); @@ -70,7 +70,7 @@ static int internal_heaptrace_dump (optparse_t *p, int ac, char *av[]) { flux_t h; flux_rpc_t *rpc; - JSON in = Jnew (); + json_object *in = Jnew (); if (optparse_optind (p) != ac - 1) { optparse_print_usage (p); diff --git a/src/cmd/builtin/hwloc.c b/src/cmd/builtin/hwloc.c index ddae14180697..52ed3bf5fc3b 100644 --- a/src/cmd/builtin/hwloc.c +++ b/src/cmd/builtin/hwloc.c @@ -234,9 +234,9 @@ static void config_hwloc_paths (flux_t h, const char *dirpath) log_err_exit ("kvs_commit"); } -static JSON hwloc_reload_json_create (const char *walk_topology) +static json_object *hwloc_reload_json_create (const char *walk_topology) { - JSON o = Jnew (); + json_object *o = Jnew (); bool v = true; if (walk_topology == NULL) @@ -255,7 +255,7 @@ static void request_hwloc_reload (flux_t h, const char *nodeset, const char *walk_topology) { flux_rpc_t *rpc; - JSON o = NULL; + json_object *o = NULL; const char *json_str = NULL; if ((o = hwloc_reload_json_create (walk_topology))) diff --git a/src/cmd/builtin/proxy.c b/src/cmd/builtin/proxy.c index 91dd3fcdb42f..faa34c60d479 100644 --- a/src/cmd/builtin/proxy.c +++ b/src/cmd/builtin/proxy.c @@ -333,7 +333,7 @@ static int client_unsubscribe (client_t *c, const char *topic) int sub_request (client_t *c, const flux_msg_t *msg, bool subscribe) { const char *json_str, *topic; - JSON in = NULL; + json_object *in = NULL; int rc = -1; if (flux_request_decode (msg, NULL, &json_str) < 0) diff --git a/src/cmd/flux-jstat.c b/src/cmd/flux-jstat.c index b5cf17e1ff7e..a794b3c8e01b 100644 --- a/src/cmd/flux-jstat.c +++ b/src/cmd/flux-jstat.c @@ -112,14 +112,14 @@ static FILE *open_test_outfile (const char *fn) return fp; } -static inline void get_jobid (JSON jcb, int64_t *j) +static inline void get_jobid (json_object *jcb, int64_t *j) { Jget_int64 (jcb, JSC_JOBID, j); } -static inline void get_states (JSON jcb, int64_t *os, int64_t *ns) +static inline void get_states (json_object *jcb, int64_t *os, int64_t *ns) { - JSON o = NULL; + json_object *o = NULL; Jget_obj (jcb, JSC_STATE_PAIR, &o); Jget_int64 (o, JSC_STATE_PAIR_OSTATE, os); Jget_int64 (o, JSC_STATE_PAIR_NSTATE, ns); @@ -139,7 +139,7 @@ static int job_status_cb (const char *jcbstr, void *arg, int errnum) int64_t j = 0; jstatctx_t *ctx = NULL; flux_t h = (flux_t)arg; - JSON jcb = NULL; + json_object *jcb = NULL; ctx = getctx (h); if (errnum > 0) { @@ -193,7 +193,7 @@ static int handle_notify_req (flux_t h, const char *ofn) static int handle_query_req (flux_t h, int64_t j, const char *k, const char *n) { - JSON jcb = NULL; + json_object *jcb = NULL; jstatctx_t *ctx = NULL; char *jcbstr; diff --git a/src/cmd/flux-kvs.c b/src/cmd/flux-kvs.c index 2e44ac584397..a7b44c13d372 100644 --- a/src/cmd/flux-kvs.c +++ b/src/cmd/flux-kvs.c @@ -189,7 +189,7 @@ int main (int argc, char *argv[]) void cmd_type (flux_t h, int argc, char **argv) { char *json_str; - JSON o; + json_object *o; int i; if (argc == 0) @@ -232,7 +232,7 @@ void cmd_type (flux_t h, int argc, char **argv) void cmd_get (flux_t h, int argc, char **argv) { char *json_str; - JSON o; + json_object *o; int i; if (argc == 0) @@ -435,7 +435,7 @@ void cmd_copy_tokvs (flux_t h, int argc, char **argv) char *file, *key; int fd, len; uint8_t *buf; - JSON o; + json_object *o; if (argc != 2) log_msg_exit ("copy-tokvs: specify key and filename"); @@ -466,7 +466,7 @@ void cmd_copy_fromkvs (flux_t h, int argc, char **argv) char *file, *key; int fd, len; uint8_t *buf; - JSON o; + json_object *o; char *json_str; if (argc != 2) @@ -498,7 +498,7 @@ void cmd_copy_fromkvs (flux_t h, int argc, char **argv) static void dump_kvs_val (const char *key, const char *json_str) { - JSON o = Jfromstr (json_str); + json_object *o = Jfromstr (json_str); if (!o) { printf ("%s: invalid JSON", key); return; diff --git a/src/cmd/flux-ping.c b/src/cmd/flux-ping.c index fff345f7b0b9..0f180b95ea69 100644 --- a/src/cmd/flux-ping.c +++ b/src/cmd/flux-ping.c @@ -80,7 +80,7 @@ void ping_continuation (flux_rpc_t *rpc, void *arg) int64_t sec, nsec; struct timespec t0; int seq; - JSON out = NULL; + json_object *out = NULL; tstat_t *tstat = flux_rpc_aux_get (rpc); if (flux_rpc_get (rpc, NULL, &json_str) < 0) { @@ -128,7 +128,7 @@ void ping_continuation (flux_rpc_t *rpc, void *arg) void send_ping (struct ping_ctx *ctx) { struct timespec t0; - JSON in = Jnew (); + json_object *in = Jnew (); flux_rpc_t *rpc; tstat_t *tstat = xzmalloc (sizeof (*tstat)); diff --git a/src/cmd/flux-up.c b/src/cmd/flux-up.c index ebde8685fc96..2af6e8d82289 100644 --- a/src/cmd/flux-up.c +++ b/src/cmd/flux-up.c @@ -131,7 +131,7 @@ int main (int argc, char *argv[]) return 0; } -static bool Jget_nodeset (JSON o, const char *name, nodeset_t **np) +static bool Jget_nodeset (json_object *o, const char *name, nodeset_t **np) { nodeset_t *ns; const char *s; @@ -145,7 +145,7 @@ static bool Jget_nodeset (JSON o, const char *name, nodeset_t **np) static ns_t *ns_fromjson (const char *json_str) { ns_t *ns = xzmalloc (sizeof (*ns)); - JSON o = NULL; + json_object *o = NULL; if (!(o = Jfromstr (json_str)) || !Jget_nodeset (o, "ok", &ns->ok) diff --git a/src/common/libcompat/request.c b/src/common/libcompat/request.c index be42068ce67b..40ecdf889e74 100644 --- a/src/common/libcompat/request.c +++ b/src/common/libcompat/request.c @@ -36,7 +36,7 @@ #include "compat.h" int flux_json_request (flux_t h, uint32_t nodeid, uint32_t matchtag, - const char *topic, JSON in) + const char *topic, json_object *in) { zmsg_t *zmsg; int rc = -1; @@ -69,7 +69,7 @@ int flux_json_request (flux_t h, uint32_t nodeid, uint32_t matchtag, return rc; } -int flux_json_respond (flux_t h, JSON out, zmsg_t **zmsg) +int flux_json_respond (flux_t h, json_object *out, zmsg_t **zmsg) { int rc = -1; diff --git a/src/common/libcompat/rpc.c b/src/common/libcompat/rpc.c index 016290763f3c..27c3c52c3464 100644 --- a/src/common/libcompat/rpc.c +++ b/src/common/libcompat/rpc.c @@ -35,11 +35,11 @@ #include "compat.h" int flux_json_rpc (flux_t h, uint32_t nodeid, const char *topic, - JSON in, JSON *out) + json_object *in, json_object **out) { flux_rpc_t *rpc; const char *json_str; - JSON o = NULL; + json_object *o = NULL; int rc = -1; if (!(rpc = flux_rpc (h, topic, Jtostr (in), nodeid, 0))) diff --git a/src/common/libflux/attr.c b/src/common/libflux/attr.c index 5791dd58b5d6..ad0f1e282370 100644 --- a/src/common/libflux/attr.c +++ b/src/common/libflux/attr.c @@ -86,8 +86,8 @@ static attr_t *attr_create (const char *val, int flags) static int attr_get_rpc (ctx_t *ctx, const char *name, attr_t **attrp) { flux_rpc_t *r; - JSON in = Jnew (); - JSON out = NULL; + json_object *in = Jnew (); + json_object *out = NULL; const char *json_str, *val; int flags; attr_t *attr; @@ -119,7 +119,7 @@ static int attr_get_rpc (ctx_t *ctx, const char *name, attr_t **attrp) static int attr_set_rpc (ctx_t *ctx, const char *name, const char *val) { flux_rpc_t *r; - JSON in = Jnew (); + json_object *in = Jnew (); attr_t *attr; int rc = -1; @@ -162,7 +162,8 @@ static int attr_list_rpc (ctx_t *ctx) { flux_rpc_t *r; const char *json_str; - JSON array, out = NULL; + json_object *array; + json_object *out = NULL; int len, i, rc = -1; if (!(r = flux_rpc (ctx->h, "cmb.attrlist", NULL, FLUX_NODEID_ANY, 0))) diff --git a/src/common/libflux/flog.c b/src/common/libflux/flog.c index b22f7db965b0..5cd5e16d9236 100644 --- a/src/common/libflux/flog.c +++ b/src/common/libflux/flog.c @@ -173,7 +173,7 @@ void flux_log_error (flux_t h, const char *fmt, ...) static int dmesg_clear (flux_t h, int seq) { flux_rpc_t *rpc; - JSON o = Jnew (); + json_object *o = Jnew (); int rc = -1; Jadd_int (o, "seq", seq); @@ -192,7 +192,7 @@ static int dmesg_clear (flux_t h, int seq) static flux_rpc_t *dmesg_rpc (flux_t h, int seq, bool follow) { flux_rpc_t *rpc; - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_int (o, "seq", seq); Jadd_bool (o, "follow", follow); rpc = flux_rpc (h, "cmb.dmesg", Jtostr (o), FLUX_NODEID_ANY, 0); @@ -204,7 +204,7 @@ static int dmesg_rpc_get (flux_rpc_t *rpc, int *seq, flux_log_f fun, void *arg) { const char *json_str; const char *buf; - JSON o = NULL; + json_object *o = NULL; int rc = -1; if (flux_rpc_get (rpc, NULL, &json_str) < 0) diff --git a/src/common/libflux/heartbeat.c b/src/common/libflux/heartbeat.c index e042a61d68b7..951341961e54 100644 --- a/src/common/libflux/heartbeat.c +++ b/src/common/libflux/heartbeat.c @@ -36,7 +36,7 @@ flux_msg_t *flux_heartbeat_encode (int epoch) { flux_msg_t *msg; - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_int (o, "epoch", epoch); msg = flux_event_encode ("hb", Jtostr (o)); @@ -47,7 +47,7 @@ flux_msg_t *flux_heartbeat_encode (int epoch) int flux_heartbeat_decode (const flux_msg_t *msg, int *epoch) { const char *json_str, *topic_str; - JSON out = NULL; + json_object *out = NULL; int rc = -1; if (flux_event_decode (msg, &topic_str, &json_str) < 0) diff --git a/src/common/libflux/module.c b/src/common/libflux/module.c index 5f06d6e6f0cd..67d5a95cfda8 100644 --- a/src/common/libflux/module.c +++ b/src/common/libflux/module.c @@ -64,8 +64,8 @@ static char *mod_service (const char *modname) int flux_insmod_json_decode (const char *json_str, char **path, char **argz, size_t *argz_len) { - JSON o = NULL; - JSON args = NULL; + json_object *o = NULL; + json_object *args = NULL; const char *s; int i, ac; int rc = -1; @@ -94,8 +94,8 @@ int flux_insmod_json_decode (const char *json_str, char *flux_insmod_json_encode (const char *path, int argc, char **argv) { - JSON o = Jnew (); - JSON args = Jnew_ar (); + json_object *o = Jnew (); + json_object *args = Jnew_ar (); char *json_str; int i; @@ -110,7 +110,7 @@ char *flux_insmod_json_encode (const char *path, int argc, char **argv) int flux_rmmod_json_decode (const char *json_str, char **name) { - JSON o = NULL; + json_object *o = NULL; const char *s; int rc = -1; if (!(o = Jfromstr (json_str)) || !Jget_str (o, "name", &s)) { @@ -126,7 +126,7 @@ int flux_rmmod_json_decode (const char *json_str, char **name) char *flux_rmmod_json_encode (const char *name) { - JSON o = Jnew (); + json_object *o = Jnew (); char *json_str; Jadd_str (o, "name", name); json_str = xstrdup (Jtostr (o)); @@ -137,7 +137,8 @@ char *flux_rmmod_json_encode (const char *name) int flux_modlist_get (flux_modlist_t *mods, int n, const char **name, int *size, const char **digest, int *idle, int *status) { - JSON o, a; + json_object *o; + json_object *a; int rc = -1; if (!Jget_obj (mods->o, "mods", &a) || !Jget_ar_obj (a, n, &o) @@ -156,7 +157,7 @@ int flux_modlist_get (flux_modlist_t *mods, int n, const char **name, int *size, int flux_modlist_count (flux_modlist_t *mods) { - JSON a; + json_object *a; int len; if (!Jget_obj (mods->o, "mods", &a) || !Jget_ar_len (a, &len)) { @@ -169,7 +170,8 @@ int flux_modlist_count (flux_modlist_t *mods) int flux_modlist_append (flux_modlist_t *mods, const char *name, int size, const char *digest, int idle, int status) { - JSON a, o = Jnew (); + json_object *a; + json_object *o = Jnew (); int rc = -1; if (!Jget_obj (mods->o, "mods", &a)) { @@ -382,7 +384,7 @@ int flux_insmod (flux_t h, uint32_t nodeid, const char *path, int argc, char **argv) { flux_rpc_t *r = NULL; - JSON in = Jnew (); + json_object *in = Jnew (); char *name = NULL; char *service = NULL; char *topic = NULL; diff --git a/src/common/libflux/panic.c b/src/common/libflux/panic.c index f089f0c61b2c..94d720f9d44d 100644 --- a/src/common/libflux/panic.c +++ b/src/common/libflux/panic.c @@ -40,7 +40,7 @@ int flux_panic (flux_t h, int rank, const char *msg) { uint32_t nodeid = rank < 0 ? FLUX_NODEID_ANY : rank; - JSON in = Jnew (); + json_object *in = Jnew (); flux_rpc_t *r = NULL; int rc = -1; diff --git a/src/common/libflux/reparent.c b/src/common/libflux/reparent.c index 82109c1f4167..656be218b214 100644 --- a/src/common/libflux/reparent.c +++ b/src/common/libflux/reparent.c @@ -54,7 +54,7 @@ int flux_reparent (flux_t h, int rank, const char *uri) { flux_rpc_t *r = NULL; uint32_t nodeid = (rank == -1 ? FLUX_NODEID_ANY : rank); - JSON in = Jnew (); + json_object *in = Jnew (); int rc = -1; if (!uri) { diff --git a/src/common/libutil/shortjson.h b/src/common/libutil/shortjson.h index 8c399d258a34..a0490e5495fe 100644 --- a/src/common/libutil/shortjson.h +++ b/src/common/libutil/shortjson.h @@ -5,14 +5,12 @@ #include #include "oom.h" -typedef json_object *JSON; - /* Creates JSON object with refcount of 1. */ -static __inline__ JSON +static __inline__ json_object * Jnew (void) { - JSON n = json_object_new_object (); + json_object *n = json_object_new_object (); if (!n) oom (); return n; @@ -20,8 +18,8 @@ Jnew (void) /* Increment JSON object refcount. */ -static __inline__ JSON -Jget (JSON o) +static __inline__ json_object * +Jget (json_object *o) { return o ? json_object_get (o) : o; } @@ -29,7 +27,7 @@ Jget (JSON o) /* Decrement JSON object refcount and free if refcount == 0. */ static __inline__ void -Jput (JSON o) +Jput (json_object *o) { if (o) json_object_put (o); @@ -38,9 +36,9 @@ Jput (JSON o) /* Add bool to JSON. */ static __inline__ void -Jadd_bool (JSON o, const char *name, bool b) +Jadd_bool (json_object *o, const char *name, bool b) { - JSON n = json_object_new_boolean (b); + json_object *n = json_object_new_boolean (b); if (!n) oom (); json_object_object_add (o, (char *)name, n); @@ -49,9 +47,9 @@ Jadd_bool (JSON o, const char *name, bool b) /* Add integer to JSON. */ static __inline__ void -Jadd_int (JSON o, const char *name, int i) +Jadd_int (json_object *o, const char *name, int i) { - JSON n = json_object_new_int (i); + json_object *n = json_object_new_int (i); if (!n) oom (); json_object_object_add (o, (char *)name, n); @@ -60,9 +58,9 @@ Jadd_int (JSON o, const char *name, int i) /* Add 64bit integer to JSON. */ static __inline__ void -Jadd_int64 (JSON o, const char *name, int64_t i) +Jadd_int64 (json_object *o, const char *name, int64_t i) { - JSON n = json_object_new_int64 (i); + json_object *n = json_object_new_int64 (i); if (!n) oom (); json_object_object_add (o, (char *)name, n); @@ -71,9 +69,9 @@ Jadd_int64 (JSON o, const char *name, int64_t i) /* Add double to JSON. */ static __inline__ void -Jadd_double (JSON o, const char *name, double d) +Jadd_double (json_object *o, const char *name, double d) { - JSON n = json_object_new_double (d); + json_object *n = json_object_new_double (d); if (!n) oom (); json_object_object_add (o, (char *)name, n); @@ -82,18 +80,18 @@ Jadd_double (JSON o, const char *name, double d) /* Add string to JSON (caller retains ownership of original). */ static __inline__ void -Jadd_str (JSON o, const char *name, const char *s) +Jadd_str (json_object *o, const char *name, const char *s) { - JSON n = json_object_new_string (s); + json_object *n = json_object_new_string (s); if (!n) oom (); json_object_object_add (o, (char *)name, n); } static __inline__ void -Jadd_str_len (JSON o, const char *name, const char *s, int len) +Jadd_str_len (json_object *o, const char *name, const char *s, int len) { - JSON n = json_object_new_string_len (s, len); + json_object *n = json_object_new_string_len (s, len); if (!n) oom (); json_object_object_add (o, (char *)name, n); @@ -102,17 +100,17 @@ Jadd_str_len (JSON o, const char *name, const char *s, int len) /* Add object to JSON (caller retains ownership of original). */ static __inline__ void -Jadd_obj (JSON o, const char *name, JSON obj) +Jadd_obj (json_object *o, const char *name, json_object *obj) { json_object_object_add (o, (char *)name, Jget (obj)); } /* Wrapper for json_object_object_get_ex() */ -static __inline__ JSON -Jobj_get (JSON o, const char *name) +static __inline__ json_object * +Jobj_get (json_object *o, const char *name) { - JSON n = NULL; + json_object *n = NULL; json_object_object_get_ex (o, (char *)name, &n); return (n); } @@ -120,9 +118,9 @@ Jobj_get (JSON o, const char *name) /* Get integer from JSON. */ static __inline__ bool -Jget_int (JSON o, const char *name, int *ip) +Jget_int (json_object *o, const char *name, int *ip) { - JSON n = Jobj_get (o, name); + json_object *n = Jobj_get (o, name); if (n && ip) *ip = json_object_get_int (n); return (n != NULL); @@ -131,9 +129,9 @@ Jget_int (JSON o, const char *name, int *ip) /* Get double from JSON. */ static __inline__ bool -Jget_double (JSON o, const char *name, double *dp) +Jget_double (json_object *o, const char *name, double *dp) { - JSON n = Jobj_get (o, name); + json_object *n = Jobj_get (o, name); if (n && dp) *dp = json_object_get_double (n); return (n != NULL); @@ -142,9 +140,9 @@ Jget_double (JSON o, const char *name, double *dp) /* Get integer from JSON. */ static __inline__ bool -Jget_int64 (JSON o, const char *name, int64_t *ip) +Jget_int64 (json_object *o, const char *name, int64_t *ip) { - JSON n = Jobj_get (o, name); + json_object *n = Jobj_get (o, name); if (n && ip) *ip = json_object_get_int64 (n); return (n != NULL); @@ -153,9 +151,9 @@ Jget_int64 (JSON o, const char *name, int64_t *ip) /* Get string from JSON (still owned by JSON, do not free). */ static __inline__ bool -Jget_str (JSON o, const char *name, const char **sp) +Jget_str (json_object *o, const char *name, const char **sp) { - JSON n = Jobj_get (o, name); + json_object *n = Jobj_get (o, name); if (n && sp) *sp = json_object_get_string (n); return (n != NULL); @@ -164,9 +162,9 @@ Jget_str (JSON o, const char *name, const char **sp) /* Get object from JSON (still owned by JSON, do not free). */ static __inline__ bool -Jget_obj (JSON o, const char *name, JSON *op) +Jget_obj (json_object *o, const char *name, json_object **op) { - JSON n = Jobj_get (o, name); + json_object *n = Jobj_get (o, name); if (n && op) *op = n; return (n != NULL); @@ -175,9 +173,9 @@ Jget_obj (JSON o, const char *name, JSON *op) /* Get boolean from JSON. */ static __inline__ bool -Jget_bool (JSON o, const char *name, bool *bp) +Jget_bool (json_object *o, const char *name, bool *bp) { - JSON n = Jobj_get (o, name); + json_object *n = Jobj_get (o, name); if (n && bp) *bp = json_object_get_boolean (n); return (n != NULL); @@ -185,10 +183,10 @@ Jget_bool (JSON o, const char *name, bool *bp) /* Create new JSON array. */ -static __inline__ JSON +static __inline__ json_object * Jnew_ar (void) { - JSON a = json_object_new_array (); + json_object *a = json_object_new_array (); if (!a) oom (); return a; @@ -197,32 +195,32 @@ Jnew_ar (void) /* Add object to JSON array (caller retains ownership of original). */ static __inline__ void -Jadd_ar_obj (JSON o, JSON obj) +Jadd_ar_obj (json_object *o, json_object *obj) { //assert (json_object_get_type (o) == json_type_array) json_object_array_add (o, Jget (obj)); } static __inline__ void -Jput_ar_obj (JSON o, int n, JSON obj) +Jput_ar_obj (json_object *o, int n, json_object *obj) { //assert (json_object_get_type (o) == json_type_array) json_object_array_put_idx (o, n, Jget (obj)); } static __inline__ void -Jadd_ar_int (JSON o, int i) +Jadd_ar_int (json_object *o, int i) { - JSON p = json_object_new_int (i); + json_object *p = json_object_new_int (i); if (!p) oom (); json_object_array_add (o, p); } static __inline__ void -Jadd_ar_str (JSON o, const char *s) +Jadd_ar_str (json_object *o, const char *s) { - JSON p = json_object_new_string (s); + json_object *p = json_object_new_string (s); if (!p) oom (); json_object_array_add (o, p); @@ -231,7 +229,7 @@ Jadd_ar_str (JSON o, const char *s) /* Get JSON array length. */ static __inline__ bool -Jget_ar_len (JSON o, int *ip) +Jget_ar_len (json_object *o, int *ip) { if (json_object_get_type (o) != json_type_array) return false; @@ -243,7 +241,7 @@ Jget_ar_len (JSON o, int *ip) /* Get JSON object at index 'n' array. */ static __inline__ bool -Jget_ar_obj (JSON o, int n, JSON *op) +Jget_ar_obj (json_object *o, int n, json_object **op) { if (json_object_get_type (o) != json_type_array) return false; @@ -257,9 +255,9 @@ Jget_ar_obj (JSON o, int n, JSON *op) /* Get integer at index 'n' of array. */ static __inline__ bool -Jget_ar_int (JSON o, int n, int *ip) +Jget_ar_int (json_object *o, int n, int *ip) { - JSON m; + json_object *m; if (json_object_get_type (o) != json_type_array) return false; @@ -275,9 +273,9 @@ Jget_ar_int (JSON o, int n, int *ip) /* Get string at index 'n' of array. */ static __inline__ bool -Jget_ar_str (JSON o, int n, const char **sp) +Jget_ar_str (json_object *o, int n, const char **sp) { - JSON m; + json_object *m; if (json_object_get_type (o) != json_type_array) return false; @@ -293,21 +291,21 @@ Jget_ar_str (JSON o, int n, const char **sp) /* Encode JSON to string (owned by JSON, do not free) */ static __inline__ const char * -Jtostr (JSON o) +Jtostr (json_object *o) { return o ? json_object_to_json_string (o) : NULL; } /* Decode string to JSON (caller is given ownership). */ -static __inline__ JSON +static __inline__ json_object * Jfromstr (const char *s) { return json_tokener_parse (s); } static __inline__ void -Jmerge (JSON dst, JSON src) +Jmerge (json_object *dst, json_object *src) { json_object_iter iter; @@ -317,8 +315,8 @@ Jmerge (JSON dst, JSON src) } } -static __inline__ JSON -Jdup (JSON o) +static __inline__ json_object * +Jdup (json_object *o) { return o ? Jfromstr (Jtostr (o)) : NULL; } diff --git a/src/connectors/local/local.c b/src/connectors/local/local.c index ceef21687b88..4c7b0fc51250 100644 --- a/src/connectors/local/local.c +++ b/src/connectors/local/local.c @@ -127,7 +127,7 @@ static int op_event_subscribe (void *impl, const char *topic) ctx_t *c = impl; assert (c->magic == CTX_MAGIC); flux_rpc_t *rpc = NULL; - JSON in = Jnew (); + json_object *in = Jnew (); int rc = 0; Jadd_str (in, "topic", topic); @@ -146,7 +146,7 @@ static int op_event_unsubscribe (void *impl, const char *topic) ctx_t *c = impl; assert (c->magic == CTX_MAGIC); flux_rpc_t *rpc = NULL; - JSON in = Jnew (); + json_object *in = Jnew (); int rc = 0; Jadd_str (in, "topic", topic); diff --git a/src/connectors/shmem/shmem.c b/src/connectors/shmem/shmem.c index 50ee89e69506..ab2da4147d23 100644 --- a/src/connectors/shmem/shmem.c +++ b/src/connectors/shmem/shmem.c @@ -157,7 +157,7 @@ static int op_event_subscribe (void *impl, const char *topic) { ctx_t *ctx = impl; assert (ctx->magic == MODHANDLE_MAGIC); - JSON in = Jnew (); + json_object *in = Jnew (); flux_rpc_t *rpc = NULL; int rc = -1; @@ -178,7 +178,7 @@ static int op_event_unsubscribe (void *impl, const char *topic) { ctx_t *ctx = impl; assert (ctx->magic == MODHANDLE_MAGIC); - JSON in = Jnew (); + json_object *in = Jnew (); flux_rpc_t *rpc = NULL; int rc = -1; diff --git a/src/connectors/ssh/ssh.c b/src/connectors/ssh/ssh.c index 7e1adf5b02fb..3472f9f4eccc 100644 --- a/src/connectors/ssh/ssh.c +++ b/src/connectors/ssh/ssh.c @@ -137,7 +137,7 @@ static int op_event_subscribe (void *impl, const char *topic) ctx_t *c = impl; assert (c->magic == CTX_MAGIC); flux_rpc_t *rpc = NULL; - JSON in = Jnew (); + json_object *in = Jnew (); int rc = 0; Jadd_str (in, "topic", topic); @@ -156,7 +156,7 @@ static int op_event_unsubscribe (void *impl, const char *topic) ctx_t *c = impl; assert (c->magic == CTX_MAGIC); flux_rpc_t *rpc = NULL; - JSON in = Jnew (); + json_object *in = Jnew (); int rc = 0; Jadd_str (in, "topic", topic); diff --git a/src/modules/aggregator/aggregator.c b/src/modules/aggregator/aggregator.c index 6290bc2ef7cf..abe4334450f7 100644 --- a/src/modules/aggregator/aggregator.c +++ b/src/modules/aggregator/aggregator.c @@ -142,11 +142,11 @@ static int aggregate_push (struct aggregate *ag, int64_t value, const char *ids) /* Push JSON represenation of an aggregate onto existing aggregate `ag` */ -static int aggregate_push_json (struct aggregate *ag, JSON o) +static int aggregate_push_json (struct aggregate *ag, json_object *o) { json_object_iter i; int64_t n64; - JSON entries = NULL; + json_object *entries = NULL; if (ag->total == 0 && (Jget_int64 (o, "total", &n64))) ag->total = n64; @@ -167,10 +167,11 @@ static int aggregate_push_json (struct aggregate *ag, JSON o) return (0); } -static JSON aggregate_tojson (struct aggregate *ag) +static json_object *aggregate_tojson (struct aggregate *ag) { struct aggregate_entry *ae; - JSON entries, o = Jnew (); + json_object *entries; + json_object *o = Jnew (); Jadd_str (o, "key", ag->key); Jadd_int (o, "count", ag->count); Jadd_int (o, "total", ag->total); @@ -197,7 +198,7 @@ static int aggregate_forward (flux_t h, struct aggregate *ag) int rc = 0; flux_rpc_t *rpc; uint32_t nodeid = FLUX_NODEID_UPSTREAM; - JSON o = aggregate_tojson (ag); + json_object *o = aggregate_tojson (ag); flux_log (h, LOG_INFO, "forward: %s: count=%d total=%d\n", ag->key, ag->count, ag->total); if (!(rpc = flux_rpc (h, "aggregator.push", Jtostr (o), @@ -236,7 +237,7 @@ static void aggregate_sink_abort (flux_t h, struct aggregate *ag) static int aggregate_sink (flux_t h, struct aggregate *ag) { int rc = 0; - JSON o; + json_object *o; flux_log (h, LOG_INFO, "sink: %s: count=%d total=%d", ag->key, ag->count, ag->total); @@ -462,7 +463,7 @@ static void push_cb (flux_t h, flux_msg_handler_t *w, struct aggregator *ctx = arg; struct aggregate *ag = NULL; const char *json_str; - JSON in = NULL; + json_object *in = NULL; const char *key; double timeout = ctx->default_timeout; int64_t fwd_count = 0; diff --git a/src/modules/barrier/barrier.c b/src/modules/barrier/barrier.c index 7bdfa543f7eb..31901be0abda 100644 --- a/src/modules/barrier/barrier.c +++ b/src/modules/barrier/barrier.c @@ -280,7 +280,7 @@ static int send_enter_response (const char *key, void *item, void *arg) static int exit_event_send (flux_t h, const char *name, int errnum) { - JSON o = Jnew (); + json_object *o = Jnew (); flux_msg_t *msg = NULL; int rc = -1; diff --git a/src/modules/barrier/libbarrier.c b/src/modules/barrier/libbarrier.c index 961560798663..7eb39f84b888 100644 --- a/src/modules/barrier/libbarrier.c +++ b/src/modules/barrier/libbarrier.c @@ -57,7 +57,7 @@ static ctx_t *getctx (flux_t h) int flux_barrier (flux_t h, const char *name, int nprocs) { - JSON in = Jnew (); + json_object *in = Jnew (); char *s = NULL; flux_rpc_t *rpc = NULL; int ret = -1; diff --git a/src/modules/connector-local/local.c b/src/modules/connector-local/local.c index 957128eaf2e0..a47e19622441 100644 --- a/src/modules/connector-local/local.c +++ b/src/modules/connector-local/local.c @@ -331,7 +331,7 @@ static int client_unsubscribe (client_t *c, const char *topic) int sub_request (client_t *c, const flux_msg_t *msg, bool subscribe) { const char *json_str, *topic; - JSON in = NULL; + json_object *in = NULL; int rc = -1; if (flux_request_decode (msg, NULL, &json_str) < 0) diff --git a/src/modules/content-sqlite/content-sqlite.c b/src/modules/content-sqlite/content-sqlite.c index f09ca82f531c..20a1e41adc34 100644 --- a/src/modules/content-sqlite/content-sqlite.c +++ b/src/modules/content-sqlite/content-sqlite.c @@ -397,7 +397,7 @@ void store_cb (flux_t h, flux_msg_handler_t *w, int register_backing_store (flux_t h, bool value, const char *name) { flux_rpc_t *rpc; - JSON in = Jnew (); + json_object *in = Jnew (); int saved_errno = 0; int rc = -1; diff --git a/src/modules/cron/cron.c b/src/modules/cron/cron.c index fa21df045156..a6e5d0e72c23 100644 --- a/src/modules/cron/cron.c +++ b/src/modules/cron/cron.c @@ -342,7 +342,8 @@ static int64_t next_cronid (flux_t h) { int64_t ret = (int64_t) -1; const char *json_str; - JSON req, resp; + json_object *req; + json_object *resp; flux_rpc_t *rpc; req = Jnew (); @@ -420,7 +421,7 @@ static cron_entry_t *cron_entry_create (cron_ctx_t *ctx, const char *json) { flux_t h = ctx->h; cron_entry_t *e = NULL; - JSON in; + json_object *in; const char *name; const char *command; const char *type; @@ -589,9 +590,9 @@ static cron_ctx_t * cron_ctx_create (flux_t h) /**************************************************************************/ -static JSON cron_stats_to_json (struct cron_stats *stats) +static json_object *cron_stats_to_json (struct cron_stats *stats) { - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_double (o, "ctime", stats->ctime); Jadd_double (o, "starttime", stats->starttime); Jadd_double (o, "lastrun", stats->lastrun); @@ -604,12 +605,12 @@ static JSON cron_stats_to_json (struct cron_stats *stats) return (o); } -static JSON cron_entry_to_json (cron_entry_t *e) +static json_object *cron_entry_to_json (cron_entry_t *e) { cron_task_t *t; - JSON o = Jnew (); - JSON to = NULL; - JSON tasks = Jnew_ar (); + json_object *o = Jnew (); + json_object *to = NULL; + json_object *tasks = Jnew_ar (); /* * Common entry contents: @@ -663,7 +664,7 @@ static void cron_create_handler (flux_t h, flux_msg_handler_t *w, cron_entry_t *e; cron_ctx_t *ctx = arg; const char *json_str; - JSON out = NULL; + json_object *out = NULL; int saved_errno; int rc = -1; @@ -697,8 +698,8 @@ static void cron_sync_handler (flux_t h, flux_msg_handler_t *w, { cron_ctx_t *ctx = arg; const char *json_str; - JSON in = NULL; - JSON out = NULL; + json_object *in = NULL; + json_object *out = NULL; const char *topic; bool disable; double epsilon; @@ -753,11 +754,11 @@ static cron_entry_t *cron_ctx_find_entry (cron_ctx_t *ctx, int64_t id) * [service] is name of service for logging purposes. */ static cron_entry_t *entry_from_request (flux_t h, const flux_msg_t *msg, - cron_ctx_t *ctx, JSON *r, + cron_ctx_t *ctx, json_object **r, const char *service) { const char *json_str; - JSON in = NULL; + json_object *in = NULL; int64_t id; if ((flux_request_decode (msg, NULL, &json_str) < 0) @@ -785,8 +786,8 @@ static void cron_delete_handler (flux_t h, flux_msg_handler_t *w, { cron_entry_t *e; cron_ctx_t *ctx = arg; - JSON in = NULL; - JSON out = NULL; + json_object *in = NULL; + json_object *out = NULL; bool kill = false; int saved_errno; int rc = -1; @@ -818,7 +819,7 @@ static void cron_stop_handler (flux_t h, flux_msg_handler_t *w, { cron_entry_t *e; cron_ctx_t *ctx = arg; - JSON out = NULL; + json_object *out = NULL; int saved_errno = 0; int rc = -1; @@ -842,7 +843,7 @@ static void cron_start_handler (flux_t h, flux_msg_handler_t *w, { cron_entry_t *e; cron_ctx_t *ctx = arg; - JSON out = NULL; + json_object *out = NULL; int saved_errno = 0; int rc = -1; @@ -867,12 +868,12 @@ static void cron_ls_handler (flux_t h, flux_msg_handler_t *w, { cron_ctx_t *ctx = arg; cron_entry_t *e = NULL; - JSON out = Jnew (); - JSON entries = Jnew_ar (); + json_object *out = Jnew (); + json_object *entries = Jnew_ar (); e = zlist_first (ctx->entries); while (e) { - JSON entry = cron_entry_to_json (e); + json_object *entry = cron_entry_to_json (e); if (entry == NULL) flux_log_error (h, "cron_entry_to_json"); else diff --git a/src/modules/cron/datetime.c b/src/modules/cron/datetime.c index b17d9221abc0..a2467ee12065 100644 --- a/src/modules/cron/datetime.c +++ b/src/modules/cron/datetime.c @@ -61,7 +61,7 @@ struct datetime_entry * datetime_entry_create () return (dt); } -static struct datetime_entry * datetime_entry_from_json (JSON o) +static struct datetime_entry * datetime_entry_from_json (json_object *o) { int i; struct datetime_entry *dt = datetime_entry_create (); @@ -117,7 +117,7 @@ static double reschedule_cb (flux_watcher_t *w, double now, void *arg) return (next); } -static void *cron_datetime_create (flux_t h, cron_entry_t *e, JSON arg) +static void *cron_datetime_create (flux_t h, cron_entry_t *e, json_object *arg) { struct datetime_entry *dt = datetime_entry_from_json (arg); if (dt == NULL) @@ -135,11 +135,11 @@ static void *cron_datetime_create (flux_t h, cron_entry_t *e, JSON arg) return (dt); } -static JSON cron_datetime_to_json (void *arg) +static json_object *cron_datetime_to_json (void *arg) { int i; struct datetime_entry *dt = arg; - JSON o = Jnew (); + json_object *o = Jnew (); if (dt->w) Jadd_double (o, "next_wakeup", flux_watcher_next_wakeup (dt->w)); for (i = 0; i < TM_MAX_ITEM; i++) diff --git a/src/modules/cron/entry.h b/src/modules/cron/entry.h index 604f1072d019..356e0beb7bf3 100644 --- a/src/modules/cron/entry.h +++ b/src/modules/cron/entry.h @@ -37,7 +37,7 @@ typedef struct cron_entry cron_entry_t; */ struct cron_entry_ops { // type creator from JSON request "arguments". Returns ptr to type object - void *(*create) (flux_t h, cron_entry_t *e, JSON arg); + void *(*create) (flux_t h, cron_entry_t *e, json_object *arg); // destroy type object contained in data void (*destroy) (void *data); @@ -49,7 +49,7 @@ struct cron_entry_ops { void (*stop) (void *data); // return data for entry type as JSON - JSON (*tojson) (void *data); + json_object *(*tojson) (void *data); }; struct cron_stats { diff --git a/src/modules/cron/event.c b/src/modules/cron/event.c index 6b52da431a5c..bee5b906d47f 100644 --- a/src/modules/cron/event.c +++ b/src/modules/cron/event.c @@ -97,7 +97,7 @@ static void event_handler (flux_t h, flux_msg_handler_t *w, cron_entry_schedule_task (e); } -static void *cron_event_create (flux_t h, cron_entry_t *e, JSON arg) +static void *cron_event_create (flux_t h, cron_entry_t *e, json_object *arg) { struct cron_event *ev; int nth; @@ -167,10 +167,10 @@ static void cron_event_stop (void *arg) flux_msg_handler_stop (((struct cron_event *)arg)->mh); } -static JSON cron_event_to_json (void *arg) +static json_object *cron_event_to_json (void *arg) { struct cron_event *ev = arg; - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_str (o, "topic", ev->event); Jadd_int (o, "nth", ev->nth); Jadd_int (o, "after", ev->after); diff --git a/src/modules/cron/interval.c b/src/modules/cron/interval.c index 14779f49ee99..5e4681101599 100644 --- a/src/modules/cron/interval.c +++ b/src/modules/cron/interval.c @@ -46,7 +46,7 @@ static void interval_handler (flux_reactor_t *r, flux_watcher_t *w, cron_entry_schedule_task ((cron_entry_t *)arg); } -static void *cron_interval_create (flux_t h, cron_entry_t *e, JSON arg) +static void *cron_interval_create (flux_t h, cron_entry_t *e, json_object *arg) { struct cron_interval *iv; double i; @@ -89,10 +89,10 @@ static void cron_interval_stop (void *arg) flux_watcher_stop (((struct cron_interval *)arg)->w); } -static JSON cron_interval_to_json (void *arg) +static json_object *cron_interval_to_json (void *arg) { struct cron_interval *iv = arg; - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_double (o, "interval", iv->seconds); Jadd_double (o, "after", iv->after); Jadd_double (o, "next_wakeup", diff --git a/src/modules/cron/task.c b/src/modules/cron/task.c index ca4905dfc3b6..d0185a61cb53 100644 --- a/src/modules/cron/task.c +++ b/src/modules/cron/task.c @@ -131,7 +131,7 @@ static void cron_task_state_update (cron_task_t *t, const char *fmt, ...) } static int io_handler (flux_t h, cron_task_t *t, - const char *json_str, JSON resp) + const char *json_str, json_object *resp) { const char *stream = "stdout"; void *data = NULL; @@ -161,7 +161,7 @@ static int io_handler (flux_t h, cron_task_t *t, return (0); } -static int state_handler (flux_t h, cron_task_t *t, JSON resp) +static int state_handler (flux_t h, cron_task_t *t, json_object *resp) { const char *state; @@ -231,7 +231,7 @@ static void exec_handler (flux_t h, flux_msg_handler_t *w, const char *json_str; const char *topic; const char *type; - JSON resp = NULL; + json_object *resp = NULL; if ((flux_response_decode (msg, &topic, &json_str) < 0) || !(resp = Jfromstr (json_str))) { @@ -257,7 +257,7 @@ static flux_msg_t *kill_request_create (cron_task_t *t, int sig) { int e = 0; flux_msg_t *msg; - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_int (o, "pid", t->pid); Jadd_int (o, "signum", sig); if (!(msg = flux_request_encode ("cmb.exec.signal", Jtostr (o))) @@ -319,13 +319,13 @@ void cron_task_set_timeout (cron_task_t *t, double to, cron_task_state_f cb) cron_task_timeout_start (t); } -static JSON exec_request_create (struct cron_task *t, +static json_object *exec_request_create (struct cron_task *t, const char *command, const char *cwd, char *const env[]) { - JSON o = Jnew (); - JSON cmd = Jnew_ar (); + json_object *o = Jnew (); + json_object *cmd = Jnew_ar (); Jadd_ar_str (cmd, "sh"); Jadd_ar_str (cmd, "-c"); @@ -337,7 +337,7 @@ static JSON exec_request_create (struct cron_task *t, Jadd_str (o, "cwd", cwd); if (env) { - JSON enva = Jnew_ar (); + json_object *enva = Jnew_ar (); const char *e = env[0]; while (e != NULL) Jadd_ar_str (enva, e); @@ -351,7 +351,7 @@ int cron_task_run (cron_task_t *t, char *const env[]) { flux_t h = t->h; - JSON req = NULL; + json_object *req = NULL; flux_msg_t *msg = NULL; int rc = -1; @@ -431,9 +431,9 @@ static const char * cron_task_state_string (cron_task_t *t) return ("Exited"); } -JSON cron_task_to_json (struct cron_task *t) +json_object *cron_task_to_json (struct cron_task *t) { - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_int (o, "rank", t->rank); Jadd_int (o, "pid", t->pid); diff --git a/src/modules/cron/task.h b/src/modules/cron/task.h index 47e8057bcb2d..a3ef8f33929c 100644 --- a/src/modules/cron/task.h +++ b/src/modules/cron/task.h @@ -94,7 +94,7 @@ int cron_task_status (cron_task_t *t); /* return JSON representation of cron task `t` */ -JSON cron_task_to_json (cron_task_t *t); +json_object *cron_task_to_json (cron_task_t *t); #endif /* !HAVE_CRON_TASK_H */ diff --git a/src/modules/kvs/json_dirent.c b/src/modules/kvs/json_dirent.c index c0159ae83ab8..fadf754d3c96 100644 --- a/src/modules/kvs/json_dirent.c +++ b/src/modules/kvs/json_dirent.c @@ -84,7 +84,7 @@ void dirent_append (json_object **array, const char *key, json_object *dirent) int dirent_validate (json_object *dirent) { - JSON o; + json_object *o; if (!dirent) goto error; diff --git a/src/modules/kvs/kvs.c b/src/modules/kvs/kvs.c index 5eab1861805e..6268f742de6a 100644 --- a/src/modules/kvs/kvs.c +++ b/src/modules/kvs/kvs.c @@ -868,14 +868,14 @@ static void get_request_cb (flux_t h, flux_msg_handler_t *w, { ctx_t *ctx = arg; const char *json_str; - JSON in = NULL; - JSON out = NULL; + json_object *in = NULL; + json_object *out = NULL; int flags; const char *key; - JSON val; - JSON root = NULL; - JSON root_dirent = NULL; - JSON tmp_dirent = NULL; + json_object *val; + json_object *root = NULL; + json_object *root_dirent = NULL; + json_object *tmp_dirent = NULL; const char *root_ref = ctx->rootdir; wait_t *wait = NULL; int lookup_errnum = 0; @@ -941,11 +941,12 @@ static void watch_request_cb (flux_t h, flux_msg_handler_t *w, { ctx_t *ctx = arg; const char *json_str; - JSON in = NULL; - JSON in2 = NULL; - JSON out = NULL; - JSON oval, val = NULL; - JSON root = NULL; + json_object *in = NULL; + json_object *in2 = NULL; + json_object *out = NULL; + json_object *oval; + json_object *val = NULL; + json_object *root = NULL; flux_msg_t *cpy = NULL; const char *key; int flags; @@ -1019,7 +1020,8 @@ static bool unwatch_cmp (const flux_msg_t *msg, void *arg) { unwatch_param_t *p = arg; char *sender = NULL; - JSON o = NULL, val; + json_object *o = NULL; + json_object *val; const char *key, *topic, *json_str; int flags; bool match = false; @@ -1051,7 +1053,7 @@ static void unwatch_request_cb (flux_t h, flux_msg_handler_t *w, { ctx_t *ctx = arg; const char *json_str; - JSON in = NULL; + json_object *in = NULL; unwatch_param_t p = { NULL, NULL }; int rc = -1; @@ -1114,9 +1116,9 @@ static fence_t *fence_create (ctx_t *ctx, const char *name, int nprocs) return NULL; } -static int fence_append_ops (fence_t *f, JSON ops) +static int fence_append_ops (fence_t *f, json_object *ops) { - JSON op; + json_object *op; int i; if (ops) { @@ -1209,8 +1211,8 @@ static void relayfence_request_cb (flux_t h, flux_msg_handler_t *w, ctx_t *ctx = arg; const char *json_str, *name; int nprocs; - JSON in = NULL; - JSON ops = NULL; + json_object *in = NULL; + json_object *ops = NULL; fence_t *f; if (flux_request_decode (msg, NULL, &json_str) < 0) { @@ -1261,8 +1263,8 @@ static void fence_request_cb (flux_t h, flux_msg_handler_t *w, ctx_t *ctx = arg; const char *json_str, *name; int nprocs; - JSON in = NULL; - JSON ops = NULL; + json_object *in = NULL; + json_object *ops = NULL; fence_t *f; if (flux_request_decode (msg, NULL, &json_str) < 0) @@ -1320,8 +1322,8 @@ static void sync_request_cb (flux_t h, flux_msg_handler_t *w, { ctx_t *ctx = arg; const char *json_str; - JSON in = NULL; - JSON out = Jnew (); + json_object *in = NULL; + json_object *out = Jnew (); int rootseq; wait_t *wait = NULL; int rc = -1; @@ -1355,7 +1357,7 @@ static void getroot_request_cb (flux_t h, flux_msg_handler_t *w, const flux_msg_t *msg, void *arg) { ctx_t *ctx = arg; - JSON out = NULL; + json_object *out = NULL; int rc = -1; if (flux_request_decode (msg, NULL, NULL) < 0) @@ -1374,7 +1376,7 @@ static int getroot_rpc (ctx_t *ctx, int *rootseq, href_t rootdir) { flux_rpc_t *rpc; const char *json_str; - JSON out = NULL; + json_object *out = NULL; const char *ref; int rc = -1; @@ -1406,8 +1408,8 @@ static void error_event_cb (flux_t h, flux_msg_handler_t *w, { ctx_t *ctx = arg; const char *json_str; - JSON out = NULL; - JSON names = NULL; + json_object *out = NULL; + json_object *names = NULL; int errnum; if (flux_event_decode (msg, NULL, &json_str) < 0) { @@ -1430,7 +1432,7 @@ static void error_event_cb (flux_t h, flux_msg_handler_t *w, static int error_event_send (ctx_t *ctx, json_object *names, int errnum) { - JSON in = NULL; + json_object *in = NULL; flux_msg_t *msg = NULL; int rc = -1; @@ -1453,12 +1455,12 @@ static void setroot_event_cb (flux_t h, flux_msg_handler_t *w, const flux_msg_t *msg, void *arg) { ctx_t *ctx = arg; - JSON out = NULL; + json_object *out = NULL; int rootseq; const char *json_str; const char *rootdir; - JSON root = NULL; - JSON names = NULL; + json_object *root = NULL; + json_object *names = NULL; if (flux_event_decode (msg, NULL, &json_str) < 0) { flux_log_error (ctx->h, "%s: flux_event_decode", __FUNCTION__); @@ -1499,8 +1501,8 @@ static void setroot_event_cb (flux_t h, flux_msg_handler_t *w, static int setroot_event_send (ctx_t *ctx, json_object *names) { - JSON in = NULL; - JSON root = NULL; + json_object *in = NULL; + json_object *root = NULL; flux_msg_t *msg = NULL; int rc = -1; diff --git a/src/modules/kvs/libkvs.c b/src/modules/kvs/libkvs.c index e8ef7547dd4f..4efb4449871a 100644 --- a/src/modules/kvs/libkvs.c +++ b/src/modules/kvs/libkvs.c @@ -87,7 +87,7 @@ typedef struct { flux_msg_handler_t *w; json_object *ops; /* JSON array of put, unlink, etc operations */ zhash_t *fence_ops; - JSON fence_context; + json_object *fence_context; } kvsctx_t; static void watch_response_cb (flux_t h, flux_msg_handler_t *w, @@ -261,9 +261,9 @@ static int getobj (flux_t h, json_object *rootdir, const char *key, { flux_rpc_t *rpc = NULL; const char *json_str; - JSON in = NULL; - JSON out = NULL; - JSON v = NULL; + json_object *in = NULL; + json_object *out = NULL; + json_object *v = NULL; int saved_errno; int rc = -1; @@ -297,7 +297,7 @@ static int getobj (flux_t h, json_object *rootdir, const char *key, int kvs_get (flux_t h, const char *key, char **val) { - JSON v = NULL; + json_object *v = NULL; if (getobj (h, NULL, key, 0, &v) < 0) return -1; @@ -310,8 +310,8 @@ int kvs_get (flux_t h, const char *key, char **val) int kvs_getat (flux_t h, const char *treeobj, const char *key, char **val) { - JSON v = NULL; - JSON dirent = NULL; + json_object *v = NULL; + json_object *dirent = NULL; if (!treeobj || !key || !(dirent = Jfromstr (treeobj)) || dirent_validate (dirent) < 0) { @@ -333,8 +333,8 @@ int kvs_getat (flux_t h, const char *treeobj, int kvs_get_dirat (flux_t h, const char *treeobj, const char *key, kvsdir_t **dir) { - JSON v = NULL; - JSON rootref = NULL; + json_object *v = NULL; + json_object *rootref = NULL; int rc = -1; if (!treeobj || !key || !dir || !(rootref = Jfromstr (treeobj)) @@ -355,8 +355,8 @@ int kvs_get_dirat (flux_t h, const char *treeobj, int kvs_get_symlinkat (flux_t h, const char *treeobj, const char *key, char **val) { - JSON v = NULL; - JSON dirent = NULL; + json_object *v = NULL; + json_object *dirent = NULL; int rc = -1; if (!treeobj || !key || !(dirent = Jfromstr (treeobj)) @@ -380,7 +380,7 @@ int kvs_get_symlinkat (flux_t h, const char *treeobj, } /* deprecated */ -int kvs_get_obj (flux_t h, const char *key, JSON *val) +int kvs_get_obj (flux_t h, const char *key, json_object **val) { return getobj (h, NULL, key, 0, val); } @@ -389,7 +389,7 @@ int kvs_get_dir (flux_t h, kvsdir_t **dir, const char *fmt, ...) { va_list ap; char *key = NULL; - JSON v = NULL; + json_object *v = NULL; int rc = -1; if (!h || !dir || !fmt) { @@ -417,7 +417,7 @@ int kvs_get_dir (flux_t h, kvsdir_t **dir, const char *fmt, ...) int kvs_get_symlink (flux_t h, const char *key, char **val) { - JSON v = NULL; + json_object *v = NULL; int rc = -1; if (getobj (h, NULL, key, KVS_PROTO_READLINK, &v) < 0) @@ -436,7 +436,7 @@ int kvs_get_symlink (flux_t h, const char *key, char **val) int kvs_get_treeobj (flux_t h, const char *key, char **val) { - JSON v = NULL; + json_object *v = NULL; const char *s; int rc = -1; @@ -454,7 +454,7 @@ int kvs_get_treeobj (flux_t h, const char *key, char **val) int kvs_get_string (flux_t h, const char *key, char **val) { - JSON v = NULL; + json_object *v = NULL; int rc = -1; if (getobj (h, NULL, key, 0, &v) < 0) @@ -473,7 +473,7 @@ int kvs_get_string (flux_t h, const char *key, char **val) int kvs_get_int (flux_t h, const char *key, int *val) { - JSON v = NULL; + json_object *v = NULL; int rc = -1; if (getobj (h, NULL, key, 0, &v) < 0) @@ -492,7 +492,7 @@ int kvs_get_int (flux_t h, const char *key, int *val) int kvs_get_int64 (flux_t h, const char *key, int64_t *val) { - JSON v = NULL; + json_object *v = NULL; int rc = -1; if (getobj (h, NULL, key, 0, &v) < 0) @@ -511,7 +511,7 @@ int kvs_get_int64 (flux_t h, const char *key, int64_t *val) int kvs_get_double (flux_t h, const char *key, double *val) { - JSON v = NULL; + json_object *v = NULL; int rc = -1; if (getobj (h, NULL, key, 0, &v) < 0) @@ -530,7 +530,7 @@ int kvs_get_double (flux_t h, const char *key, double *val) int kvs_get_boolean (flux_t h, const char *key, bool *val) { - JSON v = NULL; + json_object *v = NULL; int rc = -1; if (getobj (h, NULL, key, 0, &v) < 0) @@ -597,7 +597,7 @@ int kvs_unwatch (flux_t h, const char *key) { kvsctx_t *ctx = getctx (h); flux_rpc_t *rpc = NULL; - JSON in = NULL; + json_object *in = NULL; int rc = -1; if (!(in = kp_tunwatch_enc (key))) @@ -688,8 +688,8 @@ static void watch_response_cb (flux_t h, flux_msg_handler_t *w, const flux_msg_t *msg, void *arg) { const char *json_str; - JSON out = NULL; - JSON val; + json_object *out = NULL; + json_object *val; uint32_t matchtag; kvs_watcher_t *wp; @@ -715,17 +715,17 @@ static void watch_response_cb (flux_t h, flux_msg_handler_t *w, * If 'matchtag' is non-NULL return the request's matchtag in it for * adding to the watcher state; else retire the matchtag. */ -static int watch_rpc (flux_t h, const char *key, JSON *val, +static int watch_rpc (flux_t h, const char *key, json_object **val, int flags, uint32_t *matchtag) { struct flux_match match = { .typemask = FLUX_MSGTYPE_RESPONSE, .topic_glob = NULL }; - JSON in = NULL; - JSON out = NULL; + json_object *in = NULL; + json_object *out = NULL; const char *json_str; flux_msg_t *request_msg = NULL; flux_msg_t *response_msg = NULL; - JSON v = NULL; + json_object *v = NULL; int ret = -1; /* Send the request. @@ -794,7 +794,7 @@ int kvs_watch_once_obj (flux_t h, const char *key, json_object **valp) int kvs_watch_once (flux_t h, const char *key, char **valp) { - JSON val = NULL; + json_object *val = NULL; int rc = -1; if (!h || !key || !valp) { @@ -1037,7 +1037,7 @@ static int kvs_put_dirent (flux_t h, const char *key, json_object *dirent) { kvsctx_t *ctx = getctx (h); int rc = -1; - JSON *ops = ctx->fence_context ? &ctx->fence_context : &ctx->ops; + json_object **ops = ctx->fence_context ? &ctx->fence_context : &ctx->ops; if (!h || !key) { errno = EINVAL; @@ -1051,7 +1051,7 @@ static int kvs_put_dirent (flux_t h, const char *key, json_object *dirent) int kvs_put_treeobj (flux_t h, const char *key, const char *treeobj) { - JSON dirent; + json_object *dirent; if (!treeobj || !(dirent = Jfromstr (treeobj)) || dirent_validate (dirent) < 0) { @@ -1067,7 +1067,7 @@ int kvs_put_treeobj (flux_t h, const char *key, const char *treeobj) int kvs_put (flux_t h, const char *key, const char *json_str) { int rc = -1; - JSON val = NULL; + json_object *val = NULL; if (!json_str) return kvs_unlink (h, key); @@ -1184,8 +1184,8 @@ int kvs_unlink (flux_t h, const char *key) int kvs_symlink (flux_t h, const char *key, const char *target) { kvsctx_t *ctx = getctx (h); - JSON val = NULL; - JSON *ops = ctx->fence_context ? &ctx->fence_context : &ctx->ops; + json_object *val = NULL; + json_object **ops = ctx->fence_context ? &ctx->fence_context : &ctx->ops; if (!h || !key || !target) { errno = EINVAL; @@ -1203,8 +1203,8 @@ int kvs_symlink (flux_t h, const char *key, const char *target) int kvs_mkdir (flux_t h, const char *key) { kvsctx_t *ctx = getctx (h); - JSON val = Jnew (); - JSON *ops = ctx->fence_context ? &ctx->fence_context : &ctx->ops; + json_object *val = Jnew (); + json_object **ops = ctx->fence_context ? &ctx->fence_context : &ctx->ops; if (!h || !key) { errno = EINVAL; @@ -1261,10 +1261,10 @@ int kvs_commit (flux_t h) flux_rpc_t *kvs_fence_begin (flux_t h, const char *name, int nprocs) { kvsctx_t *ctx = getctx (h); - JSON in = NULL; + json_object *in = NULL; flux_rpc_t *rpc = NULL; int saved_errno = errno; - JSON fence_ops = NULL; + json_object *fence_ops = NULL; if (ctx->fence_ops) fence_ops = zhash_lookup (ctx->fence_ops, name); @@ -1333,7 +1333,7 @@ int kvs_get_version (flux_t h, int *versionp) { flux_rpc_t *rpc; const char *json_str; - JSON out = NULL; + json_object *out = NULL; int version; int rc = -1; @@ -1358,7 +1358,7 @@ int kvs_wait_version (flux_t h, int version) { flux_rpc_t *rpc; const char *json_str; - JSON in = Jnew (); + json_object *in = Jnew (); int ret = -1; Jadd_int (in, "rootseq", version); @@ -1414,7 +1414,7 @@ int kvsdir_get_obj (kvsdir_t *dir, const char *name, json_object **valp) int kvsdir_get (kvsdir_t *dir, const char *name, char **valp) { - JSON v = NULL; + json_object *v = NULL; if (dirgetobj (dir, name, 0, &v) < 0) return -1; if (valp) @@ -1428,7 +1428,7 @@ int kvsdir_get_dir (kvsdir_t *dir, kvsdir_t **dirp, const char *fmt, ...) int rc = -1; char *name, *key; va_list ap; - JSON v = NULL; + json_object *v = NULL; va_start (ap, fmt); if (vasprintf (&name, fmt, ap) < 0) @@ -1450,7 +1450,7 @@ int kvsdir_get_dir (kvsdir_t *dir, kvsdir_t **dirp, const char *fmt, ...) int kvsdir_get_symlink (kvsdir_t *dir, const char *name, char **valp) { int rc = -1; - JSON v = NULL; + json_object *v = NULL; if (dirgetobj (dir, name, KVS_PROTO_READLINK, &v) < 0) goto done; @@ -1468,7 +1468,7 @@ int kvsdir_get_symlink (kvsdir_t *dir, const char *name, char **valp) int kvsdir_get_string (kvsdir_t *dir, const char *name, char **valp) { - JSON v = NULL; + json_object *v = NULL; int rc = -1; if (dirgetobj (dir, name, 0, &v) < 0) @@ -1487,7 +1487,7 @@ int kvsdir_get_string (kvsdir_t *dir, const char *name, char **valp) int kvsdir_get_int (kvsdir_t *dir, const char *name, int *valp) { - JSON v = NULL; + json_object *v = NULL; int rc = -1; if (dirgetobj (dir, name, 0, &v) < 0) @@ -1506,7 +1506,7 @@ int kvsdir_get_int (kvsdir_t *dir, const char *name, int *valp) int kvsdir_get_int64 (kvsdir_t *dir, const char *name, int64_t *valp) { - JSON v = NULL; + json_object *v = NULL; int rc = -1; if (dirgetobj (dir, name, 0, &v) < 0) @@ -1525,7 +1525,7 @@ int kvsdir_get_int64 (kvsdir_t *dir, const char *name, int64_t *valp) int kvsdir_get_double (kvsdir_t *dir, const char *name, double *valp) { - JSON v = NULL; + json_object *v = NULL; int rc = -1; if (dirgetobj (dir, name, 0, &v) < 0) @@ -1544,7 +1544,7 @@ int kvsdir_get_double (kvsdir_t *dir, const char *name, double *valp) int kvsdir_get_boolean (kvsdir_t *dir, const char *name, bool *valp) { - JSON v = NULL; + json_object *v = NULL; int rc = -1; if (dirgetobj (dir, name, 0, &v) < 0) @@ -1723,7 +1723,7 @@ int kvsdir_unlink (kvsdir_t *dir, const char *name) int kvs_copy (flux_t h, const char *from, const char *to) { - JSON dirent; + json_object *dirent; if (getobj (h, NULL, from, KVS_PROTO_TREEOBJ, &dirent) < 0) return -1; if (kvs_put_dirent (h, to, dirent) < 0) { diff --git a/src/modules/kvs/proto.c b/src/modules/kvs/proto.c index cd2ceb645078..0654863585f3 100644 --- a/src/modules/kvs/proto.c +++ b/src/modules/kvs/proto.c @@ -44,9 +44,9 @@ /* kvs.get */ -JSON kp_tget_enc (JSON rootdir, const char *key, int flags) +json_object *kp_tget_enc (json_object *rootdir, const char *key, int flags) { - JSON o = NULL; + json_object *o = NULL; if (!key) { errno = EINVAL; @@ -61,7 +61,8 @@ JSON kp_tget_enc (JSON rootdir, const char *key, int flags) return o; } -int kp_tget_dec (JSON o, JSON *rootdir, const char **key, int *flags) +int kp_tget_dec (json_object *o, json_object **rootdir, const char **key, + int *flags) { int rc = -1; @@ -80,9 +81,9 @@ int kp_tget_dec (JSON o, JSON *rootdir, const char **key, int *flags) return rc; } -JSON kp_rget_enc (JSON rootdir, JSON val) +json_object *kp_rget_enc (json_object *rootdir, json_object *val) { - JSON o = NULL; + json_object *o = NULL; o = Jnew (); json_object_object_add (o, "rootdir", rootdir); @@ -90,10 +91,10 @@ JSON kp_rget_enc (JSON rootdir, JSON val) return o; } -int kp_rget_dec (JSON o, JSON *rootdir, JSON *val) +int kp_rget_dec (json_object *o, json_object **rootdir, json_object **val) { int rc = -1; - JSON v; + json_object *v; if (!o || !(v = Jobj_get (o, "val"))) { errno = EINVAL; @@ -111,9 +112,9 @@ int kp_rget_dec (JSON o, JSON *rootdir, JSON *val) /* kvs.watch */ -JSON kp_twatch_enc (const char *key, JSON val, int flags) +json_object *kp_twatch_enc (const char *key, json_object *val, int flags) { - JSON o = NULL; + json_object *o = NULL; if (!key) { errno = EINVAL; @@ -127,7 +128,8 @@ JSON kp_twatch_enc (const char *key, JSON val, int flags) return o; } -int kp_twatch_dec (JSON o, const char **key, JSON *val, int *flags) +int kp_twatch_dec (json_object *o, const char **key, json_object **val, + int *flags) { int rc = -1; @@ -145,16 +147,16 @@ int kp_twatch_dec (JSON o, const char **key, JSON *val, int *flags) return rc; } -JSON kp_rwatch_enc (JSON val) +json_object *kp_rwatch_enc (json_object *val) { - JSON o = NULL; + json_object *o = NULL; o = Jnew (); json_object_object_add (o, "val", val); return o; } -int kp_rwatch_dec (JSON o, JSON *val) +int kp_rwatch_dec (json_object *o, json_object **val) { int rc = -1; @@ -171,9 +173,9 @@ int kp_rwatch_dec (JSON o, JSON *val) /* kvs.unwatch */ -JSON kp_tunwatch_enc (const char *key) +json_object *kp_tunwatch_enc (const char *key) { - JSON o = NULL; + json_object *o = NULL; if (!key) { errno = EINVAL; @@ -185,7 +187,7 @@ JSON kp_tunwatch_enc (const char *key) return o; } -int kp_tunwatch_dec (JSON o, const char **key) +int kp_tunwatch_dec (json_object *o, const char **key) { int rc = -1; @@ -204,10 +206,10 @@ int kp_tunwatch_dec (JSON o, const char **key) /* kvs.fence */ -JSON kp_tfence_enc (const char *name, int nprocs, JSON ops) +json_object *kp_tfence_enc (const char *name, int nprocs, json_object *ops) { - JSON o = Jnew (); - JSON empty_ops = NULL; + json_object *o = Jnew (); + json_object *empty_ops = NULL; Jadd_str (o, "name", name); Jadd_int (o, "nprocs", nprocs); @@ -218,7 +220,8 @@ JSON kp_tfence_enc (const char *name, int nprocs, JSON ops) return o; } -int kp_tfence_dec (JSON o, const char **name, int *nprocs, JSON *ops) +int kp_tfence_dec (json_object *o, const char **name, int *nprocs, + json_object **ops) { int rc = -1; @@ -239,9 +242,9 @@ int kp_tfence_dec (JSON o, const char **name, int *nprocs, JSON *ops) /* kvs.getroot */ -JSON kp_rgetroot_enc (int rootseq, const char *rootdir) +json_object *kp_rgetroot_enc (int rootseq, const char *rootdir) { - JSON o = NULL; + json_object *o = NULL; if (!rootdir) { errno = EINVAL; @@ -254,7 +257,7 @@ JSON kp_rgetroot_enc (int rootseq, const char *rootdir) return o; } -int kp_rgetroot_dec (JSON o, int *rootseq, const char **rootdir) +int kp_rgetroot_dec (json_object *o, int *rootseq, const char **rootdir) { int rc = -1; @@ -274,10 +277,10 @@ int kp_rgetroot_dec (JSON o, int *rootseq, const char **rootdir) /* kvs.setroot (event) */ -JSON kp_tsetroot_enc (int rootseq, const char *rootdir, JSON root, - JSON names) +json_object *kp_tsetroot_enc (int rootseq, const char *rootdir, + json_object *root, json_object *names) { - JSON o = NULL; + json_object *o = NULL; int n; if (!rootdir || !names || !Jget_ar_len (names, &n) || n < 1) { @@ -294,8 +297,8 @@ JSON kp_tsetroot_enc (int rootseq, const char *rootdir, JSON root, return o; } -int kp_tsetroot_dec (JSON o, int *rootseq, const char **rootdir, - JSON *root, JSON *names) +int kp_tsetroot_dec (json_object *o, int *rootseq, const char **rootdir, + json_object **root, json_object **names) { int rc = -1; @@ -320,7 +323,7 @@ int kp_tsetroot_dec (JSON o, int *rootseq, const char **rootdir, json_object *kp_terror_enc (json_object *names, int errnum) { - JSON o = NULL; + json_object *o = NULL; int n; if (!names || !Jget_ar_len (names, &n) || n < 1 || errnum == 0) { @@ -334,7 +337,7 @@ json_object *kp_terror_enc (json_object *names, int errnum) return o; } -int kp_terror_dec (JSON o, json_object **names, int *errnum) +int kp_terror_dec (json_object *o, json_object **names, int *errnum) { int rc = -1; if (!o || !names || !errnum) { diff --git a/src/modules/kvs/test/cache.c b/src/modules/kvs/test/cache.c index 1c4d22615a71..27a6b2827bb7 100644 --- a/src/modules/kvs/test/cache.c +++ b/src/modules/kvs/test/cache.c @@ -20,7 +20,8 @@ int main (int argc, char *argv[]) { struct cache *cache; struct cache_entry *e1, *e2; - JSON o1, o2; + json_object *o1; + json_object *o2; wait_t *w; int count, i; diff --git a/src/modules/kvs/test/dirent.c b/src/modules/kvs/test/dirent.c index 045296648e1d..adbdc01f0cef 100644 --- a/src/modules/kvs/test/dirent.c +++ b/src/modules/kvs/test/dirent.c @@ -6,9 +6,10 @@ int main (int argc, char *argv[]) { - JSON d1, d2; - JSON dir; - JSON array = NULL; + json_object *d1; + json_object *d2; + json_object *dir; + json_object *array = NULL; plan (NO_PLAN); diff --git a/src/modules/kvs/test/proto.c b/src/modules/kvs/test/proto.c index 7ba8d7840837..232b5cda01b6 100644 --- a/src/modules/kvs/test/proto.c +++ b/src/modules/kvs/test/proto.c @@ -11,11 +11,11 @@ void test_get (void) { - JSON o; + json_object *o; const char *key = NULL; - JSON val = NULL; - JSON dirent = NULL; - JSON dirent2 = NULL; + json_object *val = NULL; + json_object *dirent = NULL; + json_object *dirent2 = NULL; int i, flags; o = kp_tget_enc (NULL, "foo", 42); @@ -64,11 +64,11 @@ void test_get (void) void test_watch (void) { - JSON o; + json_object *o; int flags; const char *key = NULL; const char *s = NULL; - JSON val; + json_object *val; val = Jnew (); Jadd_str (val, "s", "blatz"); @@ -103,7 +103,7 @@ void test_watch (void) void test_unwatch (void) { - JSON o; + json_object *o; const char *key; o = kp_tunwatch_enc ("foo"); @@ -117,8 +117,9 @@ void test_unwatch (void) void test_fence (void) { - JSON o, out; - JSON ops = Jnew_ar(); + json_object *o; + json_object *out; + json_object *ops = Jnew_ar(); int nprocs; const char *name; @@ -140,7 +141,7 @@ void test_fence (void) void test_getroot (void) { - JSON o; + json_object *o; const char *rootdir; int rootseq; @@ -156,10 +157,11 @@ void test_getroot (void) void test_setroot (void) { - JSON o; + json_object *o; const char *rootdir, *name; int rootseq; - JSON root, names; + json_object *root; + json_object *names; names = Jnew_ar (); Jadd_ar_str (names, "foo"); @@ -179,8 +181,8 @@ void test_setroot (void) void test_error (void) { - JSON o; - JSON names; + json_object *o; + json_object *names; const char *name[3]; int errnum; diff --git a/src/modules/libjsc/jstatctl.c b/src/modules/libjsc/jstatctl.c index 0e988467ad6a..037cce23c2e9 100644 --- a/src/modules/libjsc/jstatctl.c +++ b/src/modules/libjsc/jstatctl.c @@ -205,7 +205,8 @@ static int jobid_exist (flux_t h, int64_t j) return 0; } -static bool fetch_rank_pdesc (JSON src, int64_t *p, int64_t *n, const char **c) +static bool fetch_rank_pdesc (json_object *src, int64_t *p, int64_t *n, + const char **c) { if (!src) return false; if (!Jget_str (src, "command", c)) return false; @@ -214,7 +215,7 @@ static bool fetch_rank_pdesc (JSON src, int64_t *p, int64_t *n, const char **c) return true; } -static int build_name_array (zhash_t *ha, const char *k, JSON ns) +static int build_name_array (zhash_t *ha, const char *k, json_object *ns) { int i = (intptr_t) zhash_lookup (ha, k); if ((void *)((intptr_t)i) == NULL) { @@ -302,7 +303,7 @@ static int extract_raw_state (flux_t h, int64_t j, int64_t *s) return rc; } -static int extract_raw_pdesc (flux_t h, int64_t j, int64_t i, JSON *o) +static int extract_raw_pdesc (flux_t h, int64_t j, int64_t i, json_object **o) { int rc = 0; char *json_str = NULL; @@ -320,16 +321,17 @@ static int extract_raw_pdesc (flux_t h, int64_t j, int64_t i, JSON *o) return rc; } -static JSON build_parray_elem (int64_t pid, int64_t eix, int64_t hix) +static json_object *build_parray_elem (int64_t pid, int64_t eix, int64_t hix) { - JSON po = Jnew (); + json_object *po = Jnew (); Jadd_int64 (po, JSC_PDESC_RANK_PDARRAY_PID, pid); Jadd_int64 (po, JSC_PDESC_RANK_PDARRAY_EINDX, eix); Jadd_int64 (po, JSC_PDESC_RANK_PDARRAY_HINDX, hix); return po; } -static void add_pdescs_to_jcb (JSON *hns, JSON *ens, JSON *pa, JSON jcb) +static void add_pdescs_to_jcb (json_object **hns, json_object **ens, + json_object **pa, json_object *jcb) { json_object_object_add (jcb, JSC_PDESC_HOSTNAMES, *hns); json_object_object_add (jcb, JSC_PDESC_EXECS, *ens); @@ -340,7 +342,7 @@ static void add_pdescs_to_jcb (JSON *hns, JSON *ens, JSON *pa, JSON jcb) *pa = NULL; } -static int extract_raw_pdescs (flux_t h, int64_t j, int64_t n, JSON jcb) +static int extract_raw_pdescs (flux_t h, int64_t j, int64_t n, json_object *jcb) { int rc = -1; int64_t i = 0; @@ -348,10 +350,11 @@ static int extract_raw_pdescs (flux_t h, int64_t j, int64_t n, JSON jcb) const char *cmd = NULL; zhash_t *eh = NULL; /* hash holding a set of unique exec_names */ zhash_t *hh = NULL; /* hash holding a set of unique host_names */ - JSON o = NULL, po = NULL; - JSON pa = Jnew_ar (); - JSON hns = Jnew_ar (); - JSON ens = Jnew_ar (); + json_object *o = NULL; + json_object *po = NULL; + json_object *pa = Jnew_ar (); + json_object *hns = Jnew_ar (); + json_object *ens = Jnew_ar (); if (!(eh = zhash_new ()) || !(hh = zhash_new ())) oom (); @@ -389,12 +392,12 @@ static int extract_raw_pdescs (flux_t h, int64_t j, int64_t n, JSON jcb) return rc; } -static int extract_raw_rdl_alloc (flux_t h, int64_t j, JSON jcb) +static int extract_raw_rdl_alloc (flux_t h, int64_t j, json_object *jcb) { int i = 0; char *key; int64_t cores = 0; - JSON ra = Jnew_ar (); + json_object *ra = Jnew_ar (); bool processing = true; for (i=0; processing; ++i) { @@ -404,8 +407,8 @@ static int extract_raw_rdl_alloc (flux_t h, int64_t j, JSON jcb) flux_log_error (h, "extract %s", key); processing = false; } else { - JSON elem = Jnew (); - JSON o = Jnew (); + json_object *elem = Jnew (); + json_object *o = Jnew (); Jadd_int64 (o, JSC_RDL_ALLOC_CONTAINED_NCORES, cores); json_object_object_add (elem, JSC_RDL_ALLOC_CONTAINED, o); json_object_array_add (ra, elem); @@ -416,7 +419,7 @@ static int extract_raw_rdl_alloc (flux_t h, int64_t j, JSON jcb) return 0; } -static int query_jobid (flux_t h, int64_t j, JSON *jcb) +static int query_jobid (flux_t h, int64_t j, json_object **jcb) { int rc = 0; if ( ( rc = jobid_exist (h, j)) != 0) @@ -428,9 +431,9 @@ static int query_jobid (flux_t h, int64_t j, JSON *jcb) return rc; } -static int query_state_pair (flux_t h, int64_t j, JSON *jcb) +static int query_state_pair (flux_t h, int64_t j, json_object **jcb) { - JSON o = NULL; + json_object *o = NULL; int64_t st = (int64_t)J_FOR_RENT;; if (extract_raw_state (h, j, &st) < 0) return -1; @@ -446,9 +449,9 @@ static int query_state_pair (flux_t h, int64_t j, JSON *jcb) return 0; } -static int query_rdesc (flux_t h, int64_t j, JSON *jcb) +static int query_rdesc (flux_t h, int64_t j, json_object **jcb) { - JSON o = NULL; + json_object *o = NULL; int64_t nnodes = -1; int64_t ntasks = -1; int64_t walltime = -1; @@ -466,7 +469,7 @@ static int query_rdesc (flux_t h, int64_t j, JSON *jcb) return 0; } -static int query_rdl (flux_t h, int64_t j, JSON *jcb) +static int query_rdl (flux_t h, int64_t j, json_object **jcb) { char *rdlstr = NULL; @@ -481,13 +484,13 @@ static int query_rdl (flux_t h, int64_t j, JSON *jcb) return 0; } -static int query_rdl_alloc (flux_t h, int64_t j, JSON *jcb) +static int query_rdl_alloc (flux_t h, int64_t j, json_object **jcb) { *jcb = Jnew (); return extract_raw_rdl_alloc (h, j, *jcb); } -static int query_pdesc (flux_t h, int64_t j, JSON *jcb) +static int query_pdesc (flux_t h, int64_t j, json_object **jcb) { int64_t ntasks = 0; if (extract_raw_ntasks (h, j, &ntasks) < 0) return -1; @@ -524,7 +527,7 @@ static int send_state_event (flux_t h, job_state_t st, int64_t j) return rc; } -static int update_state (flux_t h, int64_t j, JSON o) +static int update_state (flux_t h, int64_t j, json_object *o) { int rc = -1; int64_t st = 0; @@ -551,7 +554,7 @@ static int update_state (flux_t h, int64_t j, JSON o) return rc; } -static int update_rdesc (flux_t h, int64_t j, JSON o) +static int update_rdesc (flux_t h, int64_t j, json_object *o) { int rc = -1; int64_t nnodes = 0; @@ -605,14 +608,14 @@ static int update_rdl (flux_t h, int64_t j, const char *rs) return rc; } -static int update_hash_1ra (flux_t h, int64_t j, JSON o, zhash_t *rtab) +static int update_hash_1ra (flux_t h, int64_t j, json_object *o, zhash_t *rtab) { int rc = 0; int64_t ncores = 0; int64_t rank = 0; int64_t *curcnt; char *key; - JSON c = NULL; + json_object *c = NULL; if (!Jget_obj (o, JSC_RDL_ALLOC_CONTAINED, &c)) return -1; if (!Jget_int64 (c, JSC_RDL_ALLOC_CONTAINING_RANK, &rank)) return -1; @@ -630,12 +633,12 @@ static int update_hash_1ra (flux_t h, int64_t j, JSON o, zhash_t *rtab) return rc; } -static int update_rdl_alloc (flux_t h, int64_t j, JSON o) +static int update_rdl_alloc (flux_t h, int64_t j, json_object *o) { int i = 0; int rc = -1; int size = 0; - JSON ra_e = NULL; + json_object *ra_e = NULL; const char *key = NULL; zhash_t *rtab = NULL; int64_t *ncores = NULL; @@ -674,10 +677,11 @@ static int update_rdl_alloc (flux_t h, int64_t j, JSON o) return rc; } -static int update_1pdesc (flux_t h, int r, int64_t j, JSON o, JSON ha, JSON ea) +static int update_1pdesc (flux_t h, int r, int64_t j, json_object *o, + json_object *ha, json_object *ea) { int rc = -1; - JSON d = NULL; + json_object *d = NULL; char *key; char *json_str = NULL; const char *hn = NULL, *en = NULL; @@ -719,12 +723,15 @@ static int update_1pdesc (flux_t h, int r, int64_t j, JSON o, JSON ha, JSON ea) return rc; } -static int update_pdesc (flux_t h, int64_t j, JSON o) +static int update_pdesc (flux_t h, int64_t j, json_object *o) { int i = 0; int rc = -1; int64_t size = 0; - JSON h_arr = NULL, e_arr = NULL, pd_arr = NULL, pde = NULL; + json_object *h_arr = NULL; + json_object *e_arr = NULL; + json_object *pd_arr = NULL; + json_object *pde = NULL; if (!Jget_int64 (o, JSC_PDESC_SIZE, &size)) return -1; if (!Jget_obj (o, JSC_PDESC_PDARRAY, &pd_arr)) return -1; @@ -747,10 +754,10 @@ static int update_pdesc (flux_t h, int64_t j, JSON o) return rc; } -static JSON get_update_jcb (flux_t h, int64_t j, const char *val) +static json_object *get_update_jcb (flux_t h, int64_t j, const char *val) { - JSON o = NULL; - JSON ss = NULL; + json_object *o = NULL; + json_object *ss = NULL; jscctx_t *ctx = getctx (h); int64_t ostate = (int64_t) J_FOR_RENT; int64_t nstate = (int64_t) J_FOR_RENT; @@ -776,7 +783,7 @@ static JSON get_update_jcb (flux_t h, int64_t j, const char *val) * * ******************************************************************************/ -static int invoke_cbs (flux_t h, int64_t j, JSON jcb, int errnum) +static int invoke_cbs (flux_t h, int64_t j, json_object *jcb, int errnum) { int rc = 0; cb_pair_t *c = NULL; @@ -792,8 +799,8 @@ static int invoke_cbs (flux_t h, int64_t j, JSON jcb, int errnum) static void fixup_newjob_event (flux_t h, int64_t nj) { - JSON ss = NULL; - JSON jcb = NULL; + json_object *ss = NULL; + json_object *jcb = NULL; int64_t js = J_NULL; char *key = xasprintf ("%"PRId64"", nj); jscctx_t *ctx = getctx (h); @@ -947,7 +954,8 @@ int jsc_notify_status (flux_t h, jsc_handler_f func, void *d) return rc; } -int jsc_query_jcb_obj (flux_t h, int64_t jobid, const char *key, JSON *jcb) +int jsc_query_jcb_obj (flux_t h, int64_t jobid, const char *key, + json_object **jcb) { int rc = -1; @@ -981,7 +989,7 @@ int jsc_query_jcb_obj (flux_t h, int64_t jobid, const char *key, JSON *jcb) int jsc_query_jcb (flux_t h, int64_t jobid, const char *key, char **jcb) { int rc; - JSON o = NULL; + json_object *o = NULL; rc = jsc_query_jcb_obj (h, jobid, key, &o); if (rc < 0) @@ -992,10 +1000,11 @@ int jsc_query_jcb (flux_t h, int64_t jobid, const char *key, char **jcb) return rc; } -int jsc_update_jcb_obj (flux_t h, int64_t jobid, const char *key, JSON jcb) +int jsc_update_jcb_obj (flux_t h, int64_t jobid, const char *key, + json_object *jcb) { int rc = -1; - JSON o = NULL; + json_object *o = NULL; if (!jcb) return -1; if (jobid_exist (h, jobid) != 0) return -1; @@ -1028,7 +1037,7 @@ int jsc_update_jcb_obj (flux_t h, int64_t jobid, const char *key, JSON jcb) int jsc_update_jcb (flux_t h, int64_t jobid, const char *key, const char *jcb) { int rc = -1; - JSON o = NULL; + json_object *o = NULL; if (!jcb || !(o = Jfromstr (jcb))) { errno = EINVAL; diff --git a/src/modules/live/live.c b/src/modules/live/live.c index e863424a67d4..00faf5608907 100644 --- a/src/modules/live/live.c +++ b/src/modules/live/live.c @@ -125,7 +125,7 @@ typedef struct { bool hb_subscribed; flux_reduce_t *r; ns_t *ns; /* master only */ - JSON topo; /* master only */ + json_object *topo; /* master only */ flux_t h; optparse_t *opts; } ctx_t; @@ -259,7 +259,7 @@ static parent_t *parent_create (int rank, const char *uri) return p; } -static parent_t *parent_fromjson (JSON o) +static parent_t *parent_fromjson (json_object *o) { int rank; const char *uri = NULL; @@ -269,9 +269,9 @@ static parent_t *parent_fromjson (JSON o) return parent_create (rank, uri); } -static JSON parent_tojson (parent_t *p) +static json_object *parent_tojson (parent_t *p) { - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_int (o, "rank", p->rank); if (p->uri) @@ -279,11 +279,11 @@ static JSON parent_tojson (parent_t *p) return o; } -static JSON parents_tojson (ctx_t *ctx) +static json_object *parents_tojson (ctx_t *ctx) { parent_t *p; - JSON el; - JSON ar = Jnew_ar (); + json_object *el; + json_object *ar = Jnew_ar (); p = zlist_first (ctx->parents); while (p) { @@ -301,10 +301,10 @@ static JSON parents_tojson (ctx_t *ctx) * zmq_connect(), as opposed to the parent which has a zmq_bind() URI * that could be a wildcard. */ -static void parents_fromjson (ctx_t *ctx, JSON ar) +static void parents_fromjson (ctx_t *ctx, json_object *ar) { int i, len; - JSON el; + json_object *el; parent_t *p; if (Jget_ar_len (ar, &len)) { @@ -396,7 +396,7 @@ static void cstate_cb (flux_t h, flux_msg_handler_t *w, { ctx_t *ctx = arg; const char *json_str; - JSON event = NULL; + json_object *event = NULL; int epoch, parent, rank; cstate_t ostate, nstate; @@ -441,7 +441,7 @@ static void cstate_cb (flux_t h, flux_msg_handler_t *w, static void cstate_change (ctx_t *ctx, child_t *c, cstate_t newstate) { - JSON event = Jnew (); + json_object *event = Jnew (); flux_msg_t *msg; flux_log (ctx->h, LOG_CRIT, "transitioning %d from %s to %s", c->rank, @@ -476,7 +476,7 @@ static void hb_cb (flux_t h, flux_msg_handler_t *w, { ctx_t *ctx = arg; char *peers_str = NULL; - JSON peers = NULL; + json_object *peers = NULL; zlist_t *keys = NULL; char *key; @@ -492,7 +492,7 @@ static void hb_cb (flux_t h, flux_msg_handler_t *w, oom (); key = zlist_first (keys); while (key) { - JSON co; + json_object *co; int idle = ctx->epoch; child_t *c = zhash_lookup (ctx->children, key); assert (c != NULL); @@ -579,7 +579,7 @@ static void goodbye_request_cb (flux_t h, flux_msg_handler_t *w, { ctx_t *ctx = arg; const char *json_str; - JSON in = NULL; + json_object *in = NULL; int n, rank, prank; char rankstr[16]; @@ -608,7 +608,7 @@ static void goodbye_request_cb (flux_t h, flux_msg_handler_t *w, static void goodbye (ctx_t *ctx, int parent_rank) { - JSON in = Jnew (); + json_object *in = Jnew (); flux_rpc_t *rpc; Jadd_int (in, "rank", ctx->rank); @@ -648,9 +648,9 @@ static ns_t *ns_create (const char *ok, const char *fail, } -static JSON ns_tojson (ns_t *ns) +static json_object *ns_tojson (ns_t *ns) { - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_str (o, "ok", nodeset_string (ns->ok)); Jadd_str (o, "fail", nodeset_string (ns->fail)); Jadd_str (o, "slow", nodeset_string (ns->slow)); @@ -658,7 +658,7 @@ static JSON ns_tojson (ns_t *ns) return o; } -static ns_t *ns_fromjson (JSON o) +static ns_t *ns_fromjson (json_object *o) { ns_t *ns = xzmalloc (sizeof (*ns)); const char *s; @@ -675,7 +675,7 @@ static ns_t *ns_fromjson (JSON o) static int ns_tokvs (ctx_t *ctx) { - JSON o = ns_tojson (ctx->ns); + json_object *o = ns_tojson (ctx->ns); int rc = -1; if (kvs_put (ctx->h, "conf.live.status", Jtostr (o)) < 0) @@ -691,7 +691,7 @@ static int ns_tokvs (ctx_t *ctx) static int ns_fromkvs (ctx_t *ctx) { char *json_str = NULL; - JSON o = NULL; + json_object *o = NULL; int rc = -1; if (kvs_get (ctx->h, "conf.live.status", &json_str) < 0 @@ -771,7 +771,7 @@ static void ns_chg_one (ctx_t *ctx, uint32_t r, cstate_t from, cstate_t to) * FIXME: should we generate a live.cstate event if state is * transitioning from CS_SLOW or CS_FAIL e.g. after reparenting? */ -static void ns_chg_hello (ctx_t *ctx, JSON a) +static void ns_chg_hello (ctx_t *ctx, json_object *a) { json_object_iter iter; int i, len, crank; @@ -792,7 +792,9 @@ static void ns_chg_hello (ctx_t *ctx, JSON a) static int topo_fromkvs (ctx_t *ctx) { char *json_str = NULL; - JSON car, ar = NULL, topo = NULL; + json_object *car; + json_object *ar = NULL; + json_object *topo = NULL; int rc = -1; int n, len, i; char prank[16]; @@ -822,7 +824,7 @@ static int topo_fromkvs (ctx_t *ctx) static int topo_tokvs (ctx_t *ctx) { json_object_iter iter; - JSON ar = Jnew_ar (); + json_object *ar = Jnew_ar (); int rc = -1; json_object_object_foreachC (ctx->topo, iter) { @@ -862,7 +864,7 @@ static int topo_sync (ctx_t *ctx) return rc; } -static bool inarray (JSON ar, int n) +static bool inarray (json_object *ar, int n) { int i, len, val; @@ -876,9 +878,9 @@ static bool inarray (JSON ar, int n) /* Reduce b into a, where a and b look like: * { "p1":[c1,c2,...], "p2":[c1,c2,...], ... } */ -static void hello_merge (JSON a, JSON b) +static void hello_merge (json_object *a, json_object *b) { - JSON ar; + json_object *ar; json_object_iter iter; int i, len, crank; @@ -900,7 +902,7 @@ static void hello_merge (JSON a, JSON b) static void hello_destroy (void *arg) { - JSON o = arg; + json_object *o = arg; Jput (o); } @@ -908,7 +910,7 @@ static void hello_forward (flux_reduce_t *r, int batchnum, void *arg) { ctx_t *ctx = arg; flux_rpc_t *rpc; - JSON o; + json_object *o; while ((o = flux_reduce_pop (r))) { if (!(rpc = flux_rpc (ctx->h, "live.push", Jtostr (o), @@ -923,7 +925,7 @@ static void hello_forward (flux_reduce_t *r, int batchnum, void *arg) static void hello_sink (flux_reduce_t *r, int batchnum, void *arg) { ctx_t *ctx = arg; - JSON o; + json_object *o; while ((o = flux_reduce_pop (r))) { ns_chg_hello (ctx, o); @@ -938,7 +940,8 @@ static void hello_sink (flux_reduce_t *r, int batchnum, void *arg) static void hello_reduce (flux_reduce_t *r, int batchnum, void *arg) { - JSON a, b; + json_object *a; + json_object *b; if ((a = flux_reduce_pop (r))) { while ((b = flux_reduce_pop (r))) { @@ -954,8 +957,8 @@ static void hello_reduce (flux_reduce_t *r, int batchnum, void *arg) */ static void hello_source (ctx_t *ctx, const char *prank, int crank) { - JSON a = Jnew (); - JSON c = Jnew_ar (); + json_object *a = Jnew (); + json_object *c = Jnew_ar (); Jadd_ar_int (c, crank); Jadd_obj (a, prank, c); @@ -971,7 +974,7 @@ static void push_request_cb (flux_t h, flux_msg_handler_t *w, { ctx_t *ctx = arg; const char *json_str; - JSON in = NULL; + json_object *in = NULL; if (flux_request_decode (msg, NULL, &json_str) < 0) { flux_log_error (ctx->h, "%s: reuqest decode", __FUNCTION__); @@ -995,8 +998,8 @@ static void hello_request_cb (flux_t h, flux_msg_handler_t *w, { ctx_t *ctx = arg; const char *json_str; - JSON in = NULL; - JSON out = NULL; + json_object *in = NULL; + json_object *out = NULL; int saved_errno; int rank, rc = -1; child_t *c; @@ -1045,8 +1048,9 @@ static void hello_request_cb (flux_t h, flux_msg_handler_t *w, static int hello (ctx_t *ctx) { const char *json_str; - JSON in = Jnew (); - JSON a, out = NULL; + json_object *in = Jnew (); + json_object *a; + json_object *out = NULL; flux_rpc_t *rpc; int rc = -1; diff --git a/src/modules/resource-hwloc/resource.c b/src/modules/resource-hwloc/resource.c index 78863daefab1..e107e0925e52 100644 --- a/src/modules/resource-hwloc/resource.c +++ b/src/modules/resource-hwloc/resource.c @@ -351,7 +351,7 @@ static int decode_reload_request (flux_t h, ctx_t *ctx, const flux_msg_t *msg) { const char *json_str; - JSON in = NULL; + json_object *in = NULL; bool walk_topology = ctx->walk_topology; if ((flux_request_decode (msg, NULL, &json_str) < 0) diff --git a/src/modules/wreck/wrexecd.c b/src/modules/wreck/wrexecd.c index 2e026f0f1fff..01df0782dcf1 100644 --- a/src/modules/wreck/wrexecd.c +++ b/src/modules/wreck/wrexecd.c @@ -1256,7 +1256,7 @@ exitstatus_watcher (const char *key, const char *str, void *arg, int err) struct prog_ctx *ctx = arg; flux_t h = ctx->flux; int count; - JSON o; + json_object *o; if (err || !(o = Jfromstr (str))) { if (err != ENOENT) @@ -1277,12 +1277,13 @@ exitstatus_watcher (const char *key, const char *str, void *arg, int err) return (0); } -static JSON task_exit_tojson (struct task_info *t) +static json_object *task_exit_tojson (struct task_info *t) { char *key = NULL; char *taskid = NULL; struct prog_ctx *ctx = t->ctx; - JSON o, e; + json_object *o; + json_object *e; if (asprintf (&key, "lwj.%ju.exit_status", ctx->id) < 0) return (NULL); @@ -1333,7 +1334,7 @@ static int aggregator_push_task_exit (struct task_info *t) int rc = 0; flux_t h = t->ctx->flux; flux_rpc_t *rpc; - JSON o = task_exit_tojson (t); + json_object *o = task_exit_tojson (t); if (o == NULL) { flux_log_error (h, "task_exit_tojson"); diff --git a/t/build/hello_flux_internal.c b/t/build/hello_flux_internal.c index 57396f666777..e8c48c9ce785 100644 --- a/t/build/hello_flux_internal.c +++ b/t/build/hello_flux_internal.c @@ -2,7 +2,7 @@ int main (int argc, char **argv) { - JSON o = Jnew(); + json_object *o = Jnew(); Jput (o); return 0; diff --git a/t/kvs/watch.c b/t/kvs/watch.c index c0f385e39b01..f97f8e56a1ea 100644 --- a/t/kvs/watch.c +++ b/t/kvs/watch.c @@ -419,7 +419,7 @@ int get_watch_stats (flux_t h, int *count) { flux_rpc_t *rpc; const char *json_str; - JSON o = NULL; + json_object *o = NULL; int rc = -1; if (!(rpc = flux_rpc (h, "kvs.stats.get", NULL, FLUX_NODEID_ANY, 0))) diff --git a/t/kvs/watch_disconnect.c b/t/kvs/watch_disconnect.c index 75e5357a09f3..dc3a11cc9a18 100644 --- a/t/kvs/watch_disconnect.c +++ b/t/kvs/watch_disconnect.c @@ -17,7 +17,7 @@ */ void send_watch_requests (flux_t h, const char *key) { - JSON in; + json_object *in; flux_rpc_t *r; const char *json_str; @@ -37,7 +37,7 @@ void send_watch_requests (flux_t h, const char *key) */ int count_watchers (flux_t h) { - JSON out; + json_object *out; const char *json_str; int n, count = 0; flux_rpc_t *r; diff --git a/t/loop/multrpc.c b/t/loop/multrpc.c index 62ab2cff40f4..99150d5f6592 100644 --- a/t/loop/multrpc.c +++ b/t/loop/multrpc.c @@ -14,7 +14,7 @@ void rpctest_nodeid_cb (flux_t h, flux_msg_handler_t *w, { int errnum = 0; uint32_t nodeid; - JSON o = NULL; + json_object *o = NULL; int flags; if (flux_request_decode (msg, NULL, NULL) < 0 diff --git a/t/loop/rpc.c b/t/loop/rpc.c index a2ec5f91e54d..23032048dc1b 100644 --- a/t/loop/rpc.c +++ b/t/loop/rpc.c @@ -10,7 +10,7 @@ void rpctest_nodeid_cb (flux_t h, flux_msg_handler_t *w, { int errnum = 0; uint32_t nodeid; - JSON o = NULL; + json_object *o = NULL; int flags; if (flux_request_decode (msg, NULL, NULL) < 0 diff --git a/t/request/req.c b/t/request/req.c index 8244a2d1fbdb..316e5861858e 100644 --- a/t/request/req.c +++ b/t/request/req.c @@ -65,7 +65,7 @@ void count_request_cb (flux_t h, flux_msg_handler_t *w, const flux_msg_t *msg, void *arg) { ctx_t *ctx = getctx (h); - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_int (o, "count", zlist_size (ctx->clog_requests)); if (flux_respond (h, msg, 0, Jtostr (o)) < 0) @@ -111,7 +111,7 @@ void sink_request_cb (flux_t h, flux_msg_handler_t *w, { const char *json_str; int saved_errno; - JSON o = NULL; + json_object *o = NULL; double d; int rc = -1; @@ -136,7 +136,7 @@ void sink_request_cb (flux_t h, flux_msg_handler_t *w, void src_request_cb (flux_t h, flux_msg_handler_t *w, const flux_msg_t *msg, void *arg) { - JSON o = Jnew (); + json_object *o = Jnew (); Jadd_int (o, "wormz", 42); if (flux_respond (h, msg, 0, Jtostr (o)) < 0) @@ -151,7 +151,7 @@ void nsrc_request_cb (flux_t h, flux_msg_handler_t *w, { const char *json_str; int saved_errno; - JSON o = Jnew (); + json_object *o = Jnew (); int i, count; int rc = -1; @@ -220,8 +220,8 @@ void xping_request_cb (flux_t h, flux_msg_handler_t *w, int rank, seq = ctx->ping_seq++; const char *service; char *hashkey = NULL; - JSON in = Jnew (); - JSON o = NULL; + json_object *in = Jnew (); + json_object *o = NULL; flux_msg_t *cpy; if (flux_request_decode (msg, NULL, &json_str) < 0) { @@ -272,8 +272,8 @@ void ping_response_cb (flux_t h, flux_msg_handler_t *w, { ctx_t *ctx = arg; const char *json_str; - JSON o = NULL; - JSON out = Jnew ();; + json_object *o = NULL; + json_object *out = Jnew ();; int seq; const char *route; flux_msg_t *req = NULL; diff --git a/t/request/treq.c b/t/request/treq.c index 3cf23a6234eb..b222132b7d32 100644 --- a/t/request/treq.c +++ b/t/request/treq.c @@ -148,8 +148,8 @@ void test_null (flux_t h, uint32_t nodeid) void test_echo (flux_t h, uint32_t nodeid) { - JSON in = Jnew (); - JSON out = NULL; + json_object *in = Jnew (); + json_object *out = NULL; const char *json_str; const char *s; flux_rpc_t *rpc; @@ -183,7 +183,7 @@ void test_src (flux_t h, uint32_t nodeid) { flux_rpc_t *rpc; const char *json_str; - JSON out = NULL; + json_object *out = NULL; int i; if (!(rpc = flux_rpc (h, "req.src", NULL, nodeid, 0)) @@ -198,7 +198,7 @@ void test_src (flux_t h, uint32_t nodeid) void test_sink (flux_t h, uint32_t nodeid) { flux_rpc_t *rpc; - JSON in = Jnew(); + json_object *in = Jnew(); Jadd_double (in, "pi", 3.14); if (!(rpc = flux_rpc (h, "req.sink", Jtostr (in), nodeid, 0)) @@ -212,9 +212,9 @@ void test_nsrc (flux_t h, uint32_t nodeid) { flux_rpc_t *rpc; const int count = 10000; - JSON in = Jnew (); + json_object *in = Jnew (); const char *json_str; - JSON out = NULL; + json_object *out = NULL; int i, seq; Jadd_int (in, "count", count); @@ -249,8 +249,8 @@ void test_putmsg (flux_t h, uint32_t nodeid) const int count = 10000; const int defer_start = 5000; const int defer_count = 500; - JSON in = Jnew (); - JSON out = NULL; + json_object *in = Jnew (); + json_object *out = NULL; int seq, myseq = 0; zlist_t *defer = zlist_new (); bool popped = false; @@ -311,8 +311,8 @@ static void xping (flux_t h, uint32_t nodeid, uint32_t xnodeid, const char *svc) { flux_rpc_t *rpc; const char *json_str; - JSON in = Jnew (); - JSON out = NULL; + json_object *in = Jnew (); + json_object *out = NULL; const char *route; Jadd_int (in, "rank", xnodeid); @@ -391,7 +391,7 @@ int req_count (flux_t h, uint32_t nodeid) { flux_rpc_t *rpc; const char *json_str; - JSON out = NULL; + json_object *out = NULL; int rc = -1; int count;