From: Sukadev Bhattiprolu <sukadev@xxxxxxxxxxxxxxxxxx> Date: Sat, 6 Mar 2010 13:14:02 -0800 Subject: [PATCH 11/14][user-cr] restart: Define process_args() Move the code that validates/processes the arguments into a separate function. Signed-off-by: Sukadev Bhattiprolu <sukadev@xxxxxxxxxxxxxxxxxx> --- restart.c | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-) diff --git a/restart.c b/restart.c index b6ee23c..139f6db 100644 --- a/restart.c +++ b/restart.c @@ -379,14 +379,12 @@ static int freezer_register(struct ckpt_ctx *ctx, pid_t pid) return ret; } -int app_restart(struct app_restart_args *args) +/* + * Validate the specified arguments and initialize globals based on the + * arguments. Return 0 on success. + */ +int process_args(struct app_restart_args *args) { - struct ckpt_ctx ctx; - int ret; - - memset(&ctx, 0, sizeof(ctx)); - ctx.args = args; - global_debug = args->debug; global_verbose = args->verbose; global_ulogfd = args->ulogfd; @@ -406,6 +404,21 @@ int app_restart(struct app_restart_args *args) if (args->klogfd < 0) args->klogfd = CHECKPOINT_FD_NONE; + return 0; +} + +int app_restart(struct app_restart_args *args) +{ + struct ckpt_ctx ctx; + int ret; + + memset(&ctx, 0, sizeof(ctx)); + ctx.args = args; + + ret = process_args(args); + if (ret < 0) + return ret; + /* freezer preparation */ if (args->freezer && freezer_prepare(&ctx) < 0) exit(1); -- 1.6.0.4 _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers