diff options
author | Jiri Pirko <jiri@resnulli.us> | 2014-04-09 15:35:04 +0200 |
---|---|---|
committer | Jiri Pirko <jiri@resnulli.us> | 2014-04-10 09:07:25 +0200 |
commit | 0ae6174f06c3044346bc944f7210d29c32b7c74a (patch) | |
tree | 075254dca11051f3c873be1e2758eb2d0e2b397e | |
parent | 6c8d2e8102ea5613acdf5f01d37346d3d059ff53 (diff) | |
download | libteam-0ae6174f06c3044346bc944f7210d29c32b7c74a.tar.gz |
teamd: split --take-over option into --no-quit-destroy
It is quite confusing that take_over mode also causes that during the
quit, the team dev stays on the system. So introduce no-quit-destroy to
take care of the quit part separately.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
-rw-r--r-- | man/teamd.8 | 5 | ||||
-rw-r--r-- | teamd/teamd.c | 11 | ||||
-rw-r--r-- | teamd/teamd.h | 1 |
3 files changed, 13 insertions, 4 deletions
diff --git a/man/teamd.8 b/man/teamd.8 index 53a18a2..03b525c 100644 --- a/man/teamd.8 +++ b/man/teamd.8 @@ -73,7 +73,10 @@ Turns on debugging messages. Repeating the option increases verbosity. Force team device recreation in case it already exists. .TP .B "\-o, \-\-take-over" -Take over the device if it already exists. This option also ensures that the team device is not removed after teamd finishes. +Take over the device if it already exists. +.TP +.B "\-N, \-\-no-quit-destroy" +This option also ensures that the team device is not removed after teamd finishes. .TP .BI "\-t " devicename ", \-\-team-dev " devicename Use the specified team device name (overrides "device" key in the configuration). diff --git a/teamd/teamd.c b/teamd/teamd.c index d937852..b7daa51 100644 --- a/teamd/teamd.c +++ b/teamd/teamd.c @@ -104,6 +104,7 @@ static void print_help(const struct teamd_context *ctx) { " -r --force-recreate Force team device recreation in case it\n" " already exists\n" " -o --take-over Take over the device if it already exists\n" + " -N --no-quit-destroy Do not destroy the device on quit\n" " -t --team-dev=DEVNAME Use the specified team device\n" " -n --no-ports Start without ports\n" " -D --dbus-enable Enable D-Bus interface\n" @@ -135,6 +136,7 @@ static int parse_command_line(struct teamd_context *ctx, { "debug", no_argument, NULL, 'g' }, { "force-recreate", no_argument, NULL, 'r' }, { "take-over", no_argument, NULL, 'o' }, + { "no-quit-destroy", no_argument, NULL, 'N' }, { "team-dev", required_argument, NULL, 't' }, { "no-ports", no_argument, NULL, 'n' }, { "dbus-enable", no_argument, NULL, 'D' }, @@ -144,7 +146,7 @@ static int parse_command_line(struct teamd_context *ctx, { NULL, 0, NULL, 0 } }; - while ((opt = getopt_long(argc, argv, "hdkevf:c:p:grot:nDZ:Uu", + while ((opt = getopt_long(argc, argv, "hdkevf:c:p:groNt:nDZ:Uu", long_options, NULL)) >= 0) { switch(opt) { @@ -189,6 +191,9 @@ static int parse_command_line(struct teamd_context *ctx, case 'o': ctx->take_over = true; break; + case 'N': + ctx->no_quit_destroy = true; + break; case 't': free(ctx->team_devname); ctx->team_devname = strdup(optarg); @@ -325,7 +330,7 @@ static int teamd_run_loop_do_callbacks(struct list_item *lcb_list, fd_set *fds, static int teamd_flush_ports(struct teamd_context *ctx) { - if (!ctx->take_over) + if (!ctx->no_quit_destroy) return teamd_port_remove_all(ctx); else teamd_port_obj_remove_all(ctx); @@ -1393,7 +1398,7 @@ static void teamd_fini(struct teamd_context *ctx) teamd_unregister_default_handlers(ctx); teamd_workq_fini(ctx); teamd_run_loop_fini(ctx); - if (!ctx->take_over) + if (!ctx->no_quit_destroy) team_destroy(ctx->th); team_free(ctx->th); } diff --git a/teamd/teamd.h b/teamd/teamd.h index 72bd76c..46dbafc 100644 --- a/teamd/teamd.h +++ b/teamd/teamd.h @@ -99,6 +99,7 @@ struct teamd_context { unsigned int debug; bool force_recreate; bool take_over; + bool no_quit_destroy; bool init_no_ports; bool pre_add_ports; char * config_file; |