From: Ben Pfaff Date: Thu, 19 Apr 2012 21:27:40 +0000 (-0700) Subject: ovs-vsctl: Remove 'fail_mode' member from struct vsctl_bridge. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=753cb20f032998c664d32b1932fb922db3a8a77f;p=openvswitch ovs-vsctl: Remove 'fail_mode' member from struct vsctl_bridge. It's only used in cmd_get_fail_mode(), which can easily look it up for itself, so there's no benefit to storing it in every vsctl_bridge record. Signed-off-by: Ben Pfaff --- diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index 5b6aee42..8a914ca5 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -630,7 +630,6 @@ struct vsctl_bridge { struct ovsrec_bridge *br_cfg; char *name; struct ovsrec_controller **ctrl; - char *fail_mode; size_t n_ctrl; /* VLAN ("fake") bridge support. @@ -707,11 +706,9 @@ add_bridge(struct vsctl_context *ctx, if (parent) { br->ctrl = parent->br_cfg->controller; br->n_ctrl = parent->br_cfg->n_controller; - br->fail_mode = parent->br_cfg->fail_mode; } else { br->ctrl = br_cfg->controller; br->n_ctrl = br_cfg->n_controller; - br->fail_mode = br_cfg->fail_mode; } shash_add(&ctx->bridges, br->name, br); return br; @@ -2065,14 +2062,19 @@ static void cmd_get_fail_mode(struct vsctl_context *ctx) { struct vsctl_bridge *br; + const char *fail_mode; vsctl_context_populate_cache(ctx); br = find_bridge(ctx, ctx->argv[1], true); - ovsrec_bridge_verify_fail_mode(br->br_cfg - ? br->br_cfg : br->parent->br_cfg); - if (br->fail_mode && strlen(br->fail_mode)) { - ds_put_format(&ctx->output, "%s\n", br->fail_mode); + if (br->parent) { + br = br->parent; + } + ovsrec_bridge_verify_fail_mode(br->br_cfg); + + fail_mode = br->br_cfg->fail_mode; + if (fail_mode && strlen(fail_mode)) { + ds_put_format(&ctx->output, "%s\n", fail_mode); } } @@ -2086,7 +2088,6 @@ cmd_del_fail_mode(struct vsctl_context *ctx) br = find_real_bridge(ctx, ctx->argv[1], true); ovsrec_bridge_set_fail_mode(br->br_cfg, NULL); - vsctl_context_invalidate_cache(ctx); } static void @@ -2104,7 +2105,6 @@ cmd_set_fail_mode(struct vsctl_context *ctx) } ovsrec_bridge_set_fail_mode(br->br_cfg, fail_mode); - vsctl_context_invalidate_cache(ctx); } static void