diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-11-07 00:58:15 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-11-07 00:58:15 +0300 |
commit | 3d45c47752a36e123895a8b4f7e6b30ac2d0b3a0 (patch) | |
tree | 3f95453dda232dc9d1cfa72e84983802d38a1410 /json_script.h | |
parent | 136a5196266d03d537f822c4e67d2fde2ed59505 (diff) |
json_script: add support for aborting script processing
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'json_script.h')
-rw-r--r-- | json_script.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/json_script.h b/json_script.h index 9475baa..66563e9 100644 --- a/json_script.h +++ b/json_script.h @@ -28,6 +28,7 @@ struct json_script_ctx { struct blob_buf buf; uint32_t run_seq; + bool abort; /* * handle_command: handle a command that was not recognized by the @@ -99,6 +100,18 @@ void json_script_run(struct json_script_ctx *ctx, const char *filename, void json_script_run_file(struct json_script_ctx *ctx, struct json_script_file *file, struct blob_attr *vars); + +/* + * json_script_abort - abort current json script run + * + * to be called from a script context callback + */ +static inline void +json_script_abort(struct json_script_ctx *ctx) +{ + ctx->abort = true; +} + /* * json_script_eval_string - evaluate a string and store the result * |