From patchwork Sat Sep 12 03:29:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 517066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id EC10B1401AD for ; Sat, 12 Sep 2015 13:29:44 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 1107B22C418; Fri, 11 Sep 2015 20:29:31 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 55EFC22C417 for ; Fri, 11 Sep 2015 20:29:29 -0700 (PDT) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id C7ACC420227 for ; Fri, 11 Sep 2015 21:29:28 -0600 (MDT) X-ASG-Debug-ID: 1442028567-09eadd2a414e150001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id sgde4LCzFtHL3fmg (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 11 Sep 2015 21:29:27 -0600 (MDT) X-Barracuda-Envelope-From: blp@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mail-pa0-f45.google.com) (209.85.220.45) by mx1-pf1.cudamail.com with ESMTPS (RC4-SHA encrypted); 12 Sep 2015 03:29:27 -0000 Received-SPF: unknown (mx1-pf1.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.45 Received: by padhk3 with SMTP id hk3so91056415pad.3 for ; Fri, 11 Sep 2015 20:29:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fZy0tZ1uNsXdD3+4+VPGn7qRDFTXKjtlObyhH57fC+4=; b=G+BG5gHgjzcjl+rF/SyZYsvrED4kUFIj6TFgNuqmJx44xBo+dCODv6o5aa8s5tfBbM G23deSYoTr8aoCsYQIZrzvWSAzk88RAh102kAiEtUIi1xF9B8mIhsJUbLlt5baaMWexo /V6ZEPLdmNS5PeH8vHigRtURue0RVtBmLAiT0ClN5D8G6e7c5gnddol4HfBiEDxyIeKP SD4hmrpcENuQi7067/ku9cx7j2Is2ceQZils1yRuQHs3YESE9UE7Hr0ln9PE5PTNK4qG VABJxC1DjuTi17DB7Svk7u7ezl00iBzuu8hYZcIWnVr5NqmLl9qCgtgW/3TvfKYhMg0l tqbg== X-Gm-Message-State: ALoCoQkDGIQyarVceRI6fHviJvKFaHHuR6GezFBgI92Ao9vTWJwyCfdY6Pvqae/RwLnKL8aag4YB X-Received: by 10.68.192.225 with SMTP id hj1mr4922607pbc.67.1442028566297; Fri, 11 Sep 2015 20:29:26 -0700 (PDT) Received: from sigabrt.benpfaff.org (173-228-112-165.dsl.dynamic.fusionbroadband.com. [173.228.112.165]) by smtp.gmail.com with ESMTPSA id oa5sm2989762pbb.41.2015.09.11.20.29.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Sep 2015 20:29:25 -0700 (PDT) X-CudaMail-Envelope-Sender: blp@nicira.com X-Barracuda-Apparent-Source-IP: 173.228.112.165 From: Ben Pfaff To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E1-910093729 X-CudaMail-DTE: 091115 X-CudaMail-Originating-IP: 209.85.220.45 Date: Fri, 11 Sep 2015 20:29:16 -0700 X-ASG-Orig-Subj: [##CM-E1-910093729##][PATCH 3/4] ovn-nbctl: Give handler functions more specific names. Message-Id: <1442028557-533-4-git-send-email-blp@nicira.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1442028557-533-1-git-send-email-blp@nicira.com> References: <1442028557-533-1-git-send-email-blp@nicira.com> X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1442028567 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 3/4] ovn-nbctl: Give handler functions more specific names. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" I find that it's nice to give functions for commands names specific to the utility, even though they're static, because occasionally it makes it easier to find them using "tags", "grep", etc. Signed-off-by: Ben Pfaff Acked-by: Alex Wang --- ovn/utilities/ovn-nbctl.c | 108 +++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index e684f73..6eae0e1 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -177,7 +177,7 @@ print_lswitch(const struct nbrec_logical_switch *lswitch) } static void -do_show(struct ovs_cmdl_context *ctx) +nbctl_show(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const struct nbrec_logical_switch *lswitch; @@ -195,7 +195,7 @@ do_show(struct ovs_cmdl_context *ctx) } static void -do_lswitch_add(struct ovs_cmdl_context *ctx) +nbctl_lswitch_add(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; struct nbrec_logical_switch *lswitch; @@ -207,7 +207,7 @@ do_lswitch_add(struct ovs_cmdl_context *ctx) } static void -do_lswitch_del(struct ovs_cmdl_context *ctx) +nbctl_lswitch_del(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -222,7 +222,7 @@ do_lswitch_del(struct ovs_cmdl_context *ctx) } static void -do_lswitch_list(struct ovs_cmdl_context *ctx) +nbctl_lswitch_list(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const struct nbrec_logical_switch *lswitch; @@ -243,7 +243,7 @@ do_lswitch_list(struct ovs_cmdl_context *ctx) } static void -do_lswitch_set_external_id(struct ovs_cmdl_context *ctx) +nbctl_lswitch_set_external_id(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -267,7 +267,7 @@ do_lswitch_set_external_id(struct ovs_cmdl_context *ctx) } static void -do_lswitch_get_external_id(struct ovs_cmdl_context *ctx) +nbctl_lswitch_get_external_id(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -328,7 +328,7 @@ lport_by_name_or_uuid(struct nbctl_context *nb_ctx, const char *id) } static void -do_lport_add(struct ovs_cmdl_context *ctx) +nbctl_lport_add(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; struct nbrec_logical_port *lport; @@ -395,7 +395,7 @@ remove_lport(const struct nbrec_logical_switch *lswitch, size_t idx) } static void -do_lport_del(struct ovs_cmdl_context *ctx) +nbctl_lport_del(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const struct nbrec_logical_port *lport; @@ -421,7 +421,7 @@ do_lport_del(struct ovs_cmdl_context *ctx) } static void -do_lport_list(struct ovs_cmdl_context *ctx) +nbctl_lport_list(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -450,7 +450,7 @@ do_lport_list(struct ovs_cmdl_context *ctx) } static void -do_lport_get_parent(struct ovs_cmdl_context *ctx) +nbctl_lport_get_parent(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const struct nbrec_logical_port *lport; @@ -466,7 +466,7 @@ do_lport_get_parent(struct ovs_cmdl_context *ctx) } static void -do_lport_get_tag(struct ovs_cmdl_context *ctx) +nbctl_lport_get_tag(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const struct nbrec_logical_port *lport; @@ -482,7 +482,7 @@ do_lport_get_tag(struct ovs_cmdl_context *ctx) } static void -do_lport_set_external_id(struct ovs_cmdl_context *ctx) +nbctl_lport_set_external_id(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -506,7 +506,7 @@ do_lport_set_external_id(struct ovs_cmdl_context *ctx) } static void -do_lport_get_external_id(struct ovs_cmdl_context *ctx) +nbctl_lport_get_external_id(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -539,7 +539,7 @@ do_lport_get_external_id(struct ovs_cmdl_context *ctx) } static void -do_lport_set_macs(struct ovs_cmdl_context *ctx) +nbctl_lport_set_macs(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -555,7 +555,7 @@ do_lport_set_macs(struct ovs_cmdl_context *ctx) } static void -do_lport_get_macs(struct ovs_cmdl_context *ctx) +nbctl_lport_get_macs(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -581,7 +581,7 @@ do_lport_get_macs(struct ovs_cmdl_context *ctx) } static void -do_lport_set_port_security(struct ovs_cmdl_context *ctx) +nbctl_lport_set_port_security(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -597,7 +597,7 @@ do_lport_set_port_security(struct ovs_cmdl_context *ctx) } static void -do_lport_get_port_security(struct ovs_cmdl_context *ctx) +nbctl_lport_get_port_security(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -623,7 +623,7 @@ do_lport_get_port_security(struct ovs_cmdl_context *ctx) } static void -do_lport_get_up(struct ovs_cmdl_context *ctx) +nbctl_lport_get_up(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -638,7 +638,7 @@ do_lport_get_up(struct ovs_cmdl_context *ctx) } static void -do_lport_set_enabled(struct ovs_cmdl_context *ctx) +nbctl_lport_set_enabled(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -662,7 +662,7 @@ do_lport_set_enabled(struct ovs_cmdl_context *ctx) } static void -do_lport_get_enabled(struct ovs_cmdl_context *ctx) +nbctl_lport_get_enabled(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -678,7 +678,7 @@ do_lport_get_enabled(struct ovs_cmdl_context *ctx) } static void -do_lport_set_type(struct ovs_cmdl_context *ctx) +nbctl_lport_set_type(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -694,7 +694,7 @@ do_lport_set_type(struct ovs_cmdl_context *ctx) } static void -do_lport_get_type(struct ovs_cmdl_context *ctx) +nbctl_lport_get_type(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -709,7 +709,7 @@ do_lport_get_type(struct ovs_cmdl_context *ctx) } static void -do_lport_set_options(struct ovs_cmdl_context *ctx) +nbctl_lport_set_options(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -738,7 +738,7 @@ do_lport_set_options(struct ovs_cmdl_context *ctx) } static void -do_lport_get_options(struct ovs_cmdl_context *ctx) +nbctl_lport_get_options(struct ovs_cmdl_context *ctx) { struct nbctl_context *nb_ctx = ctx->pvt; const char *id = ctx->argv[1]; @@ -793,7 +793,7 @@ acl_cmp(const void *acl1_, const void *acl2_) } static void -do_acl_list(struct ovs_cmdl_context *ctx) +nbctl_acl_list(struct ovs_cmdl_context *ctx) { const struct nbrec_logical_switch *lswitch; struct nbctl_context *nb_ctx = ctx->pvt; @@ -822,7 +822,7 @@ do_acl_list(struct ovs_cmdl_context *ctx) } static void -do_acl_add(struct ovs_cmdl_context *ctx) +nbctl_acl_add(struct ovs_cmdl_context *ctx) { const struct nbrec_logical_switch *lswitch; struct nbctl_context *nb_ctx = ctx->pvt; @@ -880,7 +880,7 @@ do_acl_add(struct ovs_cmdl_context *ctx) } static void -do_acl_del(struct ovs_cmdl_context *ctx) +nbctl_acl_del(struct ovs_cmdl_context *ctx) { const struct nbrec_logical_switch *lswitch; struct nbctl_context *nb_ctx = ctx->pvt; @@ -1022,112 +1022,112 @@ static const struct ovs_cmdl_command all_commands[] = { .usage = "[LSWITCH]", .min_args = 0, .max_args = 1, - .handler = do_show, + .handler = nbctl_show, }, { .name = "lswitch-add", .usage = "[LSWITCH]", .min_args = 0, .max_args = 1, - .handler = do_lswitch_add, + .handler = nbctl_lswitch_add, }, { .name = "lswitch-del", .usage = "LSWITCH", .min_args = 1, .max_args = 1, - .handler = do_lswitch_del, + .handler = nbctl_lswitch_del, }, { .name = "lswitch-list", .usage = "", .min_args = 0, .max_args = 0, - .handler = do_lswitch_list, + .handler = nbctl_lswitch_list, }, { .name = "lswitch-set-external-id", .usage = "LSWITCH KEY [VALUE]", .min_args = 2, .max_args = 3, - .handler = do_lswitch_set_external_id, + .handler = nbctl_lswitch_set_external_id, }, { .name = "lswitch-get-external-id", .usage = "LSWITCH [KEY]", .min_args = 1, .max_args = 2, - .handler = do_lswitch_get_external_id, + .handler = nbctl_lswitch_get_external_id, }, { .name = "acl-add", .usage = "LSWITCH DIRECTION PRIORITY MATCH ACTION [log]", .min_args = 5, .max_args = 6, - .handler = do_acl_add, + .handler = nbctl_acl_add, }, { .name = "acl-del", .usage = "LSWITCH [DIRECTION [PRIORITY MATCH]]", .min_args = 1, .max_args = 4, - .handler = do_acl_del, + .handler = nbctl_acl_del, }, { .name = "acl-list", .usage = "LSWITCH", .min_args = 1, .max_args = 1, - .handler = do_acl_list, + .handler = nbctl_acl_list, }, { .name = "lport-add", .usage = "LSWITCH LPORT [PARENT] [TAG]", .min_args = 2, .max_args = 4, - .handler = do_lport_add, + .handler = nbctl_lport_add, }, { .name = "lport-del", .usage = "LPORT", .min_args = 1, .max_args = 1, - .handler = do_lport_del, + .handler = nbctl_lport_del, }, { .name = "lport-list", .usage = "LSWITCH", .min_args = 1, .max_args = 1, - .handler = do_lport_list, + .handler = nbctl_lport_list, }, { .name = "lport-get-parent", .usage = "LPORT", .min_args = 1, .max_args = 1, - .handler = do_lport_get_parent, + .handler = nbctl_lport_get_parent, }, { .name = "lport-get-tag", .usage = "LPORT", .min_args = 1, .max_args = 1, - .handler = do_lport_get_tag, + .handler = nbctl_lport_get_tag, }, { .name = "lport-set-external-id", .usage = "LPORT KEY [VALUE]", .min_args = 2, .max_args = 3, - .handler = do_lport_set_external_id, + .handler = nbctl_lport_set_external_id, }, { .name = "lport-get-external-id", .usage = "LPORT [KEY]", .min_args = 1, .max_args = 2, - .handler = do_lport_get_external_id, + .handler = nbctl_lport_get_external_id, }, { .name = "lport-set-macs", @@ -1135,14 +1135,14 @@ static const struct ovs_cmdl_command all_commands[] = { .min_args = 1, /* Accept however many arguments the system will allow. */ .max_args = INT_MAX, - .handler = do_lport_set_macs, + .handler = nbctl_lport_set_macs, }, { .name = "lport-get-macs", .usage = "LPORT", .min_args = 1, .max_args = 1, - .handler = do_lport_get_macs, + .handler = nbctl_lport_get_macs, }, { .name = "lport-set-port-security", @@ -1150,63 +1150,63 @@ static const struct ovs_cmdl_command all_commands[] = { .min_args = 0, /* Accept however many arguments the system will allow. */ .max_args = INT_MAX, - .handler = do_lport_set_port_security, + .handler = nbctl_lport_set_port_security, }, { .name = "lport-get-port-security", .usage = "LPORT", .min_args = 1, .max_args = 1, - .handler = do_lport_get_port_security, + .handler = nbctl_lport_get_port_security, }, { .name = "lport-get-up", .usage = "LPORT", .min_args = 1, .max_args = 1, - .handler = do_lport_get_up, + .handler = nbctl_lport_get_up, }, { .name = "lport-set-enabled", .usage = "LPORT STATE", .min_args = 2, .max_args = 2, - .handler = do_lport_set_enabled, + .handler = nbctl_lport_set_enabled, }, { .name = "lport-get-enabled", .usage = "LPORT", .min_args = 1, .max_args = 1, - .handler = do_lport_get_enabled, + .handler = nbctl_lport_get_enabled, }, { .name = "lport-set-type", .usage = "LPORT TYPE", .min_args = 2, .max_args = 2, - .handler = do_lport_set_type, + .handler = nbctl_lport_set_type, }, { .name = "lport-get-type", .usage = "LPORT", .min_args = 1, .max_args = 1, - .handler = do_lport_get_type, + .handler = nbctl_lport_get_type, }, { .name = "lport-set-options", .usage = "LPORT KEY=VALUE [KEY=VALUE]...", .min_args = 1, .max_args = INT_MAX, - .handler = do_lport_set_options + .handler = nbctl_lport_set_options }, { .name = "lport-get-options", .usage = "LPORT", .min_args = 1, .max_args = 1, - .handler = do_lport_get_options, + .handler = nbctl_lport_get_options, }, {