From patchwork Mon Oct 14 18:10:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1176574 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46sRs949F2z9sP7 for ; Tue, 15 Oct 2019 05:28:45 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A8EB62CC5; Mon, 14 Oct 2019 18:28:42 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 0DE4C2CBC for ; Mon, 14 Oct 2019 18:28:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 161A46CE for ; Mon, 14 Oct 2019 18:28:39 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from localhost.localdomain (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 8CBC1C0008; Mon, 14 Oct 2019 18:28:37 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Mon, 14 Oct 2019 11:10:47 -0700 Message-Id: <20191014181047.9565-1-blp@ovn.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH] dpif-netlink: Fix some variable naming. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Usually a plural name refers to an array, but 'socks' and 'socksp' were only single objects, so this changes their names to 'sock' and 'sockp'. Usually a 'p' suffix means that a variable is an output argument, but that was only true in one place here, so this changes the names of the other variables to plain 'sock'. Signed-off-by: Ben Pfaff Reviewed-by: Yifeng Sun --- lib/dpif-netlink.c | 48 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index ebe22106e0fc..d1f9b81db84f 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -249,11 +249,11 @@ static int dpif_netlink_port_query__(const struct dpif_netlink *dpif, struct dpif_port *dpif_port); static int -create_nl_sock(struct dpif_netlink *dpif OVS_UNUSED, struct nl_sock **socksp) +create_nl_sock(struct dpif_netlink *dpif OVS_UNUSED, struct nl_sock **sockp) OVS_REQ_WRLOCK(dpif->upcall_lock) { #ifndef _WIN32 - return nl_sock_create(NETLINK_GENERIC, socksp); + return nl_sock_create(NETLINK_GENERIC, sockp); #else /* Pick netlink sockets to use in a round-robin fashion from each * handler's pool of sockets. */ @@ -263,13 +263,13 @@ create_nl_sock(struct dpif_netlink *dpif OVS_UNUSED, struct nl_sock **socksp) /* A pool of sockets is allocated when the handler is initialized. */ if (sock_pool == NULL) { - *socksp = NULL; + *sockp = NULL; return EINVAL; } ovs_assert(index < VPORT_SOCK_POOL_SIZE); - *socksp = sock_pool[index].nl_sock; - ovs_assert(*socksp); + *sockp = sock_pool[index].nl_sock; + ovs_assert(*sockp); index = (index == VPORT_SOCK_POOL_SIZE - 1) ? 0 : index + 1; handler->last_used_pool_idx = index; return 0; @@ -277,10 +277,10 @@ create_nl_sock(struct dpif_netlink *dpif OVS_UNUSED, struct nl_sock **socksp) } static void -close_nl_sock(struct nl_sock *socksp) +close_nl_sock(struct nl_sock *sock) { #ifndef _WIN32 - nl_sock_destroy(socksp); + nl_sock_destroy(sock); #endif } @@ -450,7 +450,7 @@ vport_get_pid(struct dpif_netlink *dpif, uint32_t port_idx, static int vport_add_channel(struct dpif_netlink *dpif, odp_port_t port_no, - struct nl_sock *socksp) + struct nl_sock *sock) { struct epoll_event event; uint32_t port_idx = odp_to_u32(port_no); @@ -458,7 +458,7 @@ vport_add_channel(struct dpif_netlink *dpif, odp_port_t port_no, int error; if (dpif->handlers == NULL) { - close_nl_sock(socksp); + close_nl_sock(sock); return 0; } @@ -499,14 +499,14 @@ vport_add_channel(struct dpif_netlink *dpif, odp_port_t port_no, struct dpif_handler *handler = &dpif->handlers[i]; #ifndef _WIN32 - if (epoll_ctl(handler->epoll_fd, EPOLL_CTL_ADD, nl_sock_fd(socksp), + if (epoll_ctl(handler->epoll_fd, EPOLL_CTL_ADD, nl_sock_fd(sock), &event) < 0) { error = errno; goto error; } #endif } - dpif->channels[port_idx].sock = socksp; + dpif->channels[port_idx].sock = sock; dpif->channels[port_idx].last_poll = LLONG_MIN; return 0; @@ -515,7 +515,7 @@ error: #ifndef _WIN32 while (i--) { epoll_ctl(dpif->handlers[i].epoll_fd, EPOLL_CTL_DEL, - nl_sock_fd(socksp), NULL); + nl_sock_fd(sock), NULL); } #endif dpif->channels[port_idx].sock = NULL; @@ -750,12 +750,12 @@ dpif_netlink_port_add__(struct dpif_netlink *dpif, const char *name, { struct dpif_netlink_vport request, reply; struct ofpbuf *buf; - struct nl_sock *socksp = NULL; + struct nl_sock *sock = NULL; uint32_t upcall_pids = 0; int error = 0; if (dpif->handlers) { - error = create_nl_sock(dpif, &socksp); + error = create_nl_sock(dpif, &sock); if (error) { return error; } @@ -768,8 +768,8 @@ dpif_netlink_port_add__(struct dpif_netlink *dpif, const char *name, request.name = name; request.port_no = *port_nop; - if (socksp) { - upcall_pids = nl_sock_pid(socksp); + if (sock) { + upcall_pids = nl_sock_pid(sock); } request.n_upcall_pids = 1; request.upcall_pids = &upcall_pids; @@ -788,11 +788,11 @@ dpif_netlink_port_add__(struct dpif_netlink *dpif, const char *name, dpif_name(&dpif->dpif), *port_nop); } - close_nl_sock(socksp); + close_nl_sock(sock); goto exit; } - error = vport_add_channel(dpif, *port_nop, socksp); + error = vport_add_channel(dpif, *port_nop, sock); if (error) { VLOG_INFO("%s: could not add channel for port %s", dpif_name(&dpif->dpif), name); @@ -803,7 +803,7 @@ dpif_netlink_port_add__(struct dpif_netlink *dpif, const char *name, request.dp_ifindex = dpif->dp_ifindex; request.port_no = *port_nop; dpif_netlink_vport_transact(&request, NULL, NULL); - close_nl_sock(socksp); + close_nl_sock(sock); goto exit; } @@ -2316,22 +2316,22 @@ dpif_netlink_refresh_channels(struct dpif_netlink *dpif, uint32_t n_handlers) if (port_no >= dpif->uc_array_size || !vport_get_pid(dpif, port_no, &upcall_pid)) { - struct nl_sock *socksp; - error = create_nl_sock(dpif, &socksp); + struct nl_sock *sock; + error = create_nl_sock(dpif, &sock); if (error) { goto error; } - error = vport_add_channel(dpif, vport.port_no, socksp); + error = vport_add_channel(dpif, vport.port_no, sock); if (error) { VLOG_INFO("%s: could not add channels for port %s", dpif_name(&dpif->dpif), vport.name); - nl_sock_destroy(socksp); + nl_sock_destroy(sock); retval = error; goto error; } - upcall_pid = nl_sock_pid(socksp); + upcall_pid = nl_sock_pid(sock); } /* Configure the vport to deliver misses to 'sock'. */