From patchwork Sun Mar 23 20:18:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hefty, Sean" X-Patchwork-Id: 3880621 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2C3959F38E for ; Sun, 23 Mar 2014 20:18:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F45420220 for ; Sun, 23 Mar 2014 20:18:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6DBC82020F for ; Sun, 23 Mar 2014 20:18:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751192AbaCWUSd (ORCPT ); Sun, 23 Mar 2014 16:18:33 -0400 Received: from mga11.intel.com ([192.55.52.93]:10324 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750979AbaCWUSc (ORCPT ); Sun, 23 Mar 2014 16:18:32 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 23 Mar 2014 13:18:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,715,1389772800"; d="scan'208";a="505038278" Received: from cst-linux.jf.intel.com ([10.23.221.72]) by fmsmga002.fm.intel.com with ESMTP; 23 Mar 2014 13:18:31 -0700 From: sean.hefty@intel.com To: sean.hefty@intel.com, ira.weiny@intel.com, kaike.wan@intel.com, john.fleck@intel.com, linux-rdma@vger.kernel.org Subject: [PATCH 2/9] ibacm: Rename client array Date: Sun, 23 Mar 2014 13:18:14 -0700 Message-Id: <1395605901-9080-3-git-send-email-sean.hefty@intel.com> X-Mailer: git-send-email 1.7.3 In-Reply-To: <1395605901-9080-1-git-send-email-sean.hefty@intel.com> References: <1395605901-9080-1-git-send-email-sean.hefty@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Hefty Rename the client array to client_array, to make it easier to distinguish between the array and local variables, which are also named client. And, hey, this found the bug in the previous patch. Signed-off-by: Sean Hefty --- src/acm.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/acm.c b/src/acm.c index c403aa8..57d34dc 100644 --- a/src/acm.c +++ b/src/acm.c @@ -210,7 +210,7 @@ static event_t timeout_event; static atomic_t wait_cnt; static SOCKET listen_socket; -static struct acm_client client[FD_SETSIZE - 1]; +static struct acm_client client_array[FD_SETSIZE - 1]; static FILE *flog; static lock_t log_lock; @@ -1690,10 +1690,10 @@ static void acm_init_server(void) int i; for (i = 0; i < FD_SETSIZE - 1; i++) { - lock_init(&client[i].lock); - client[i].index = i; - client[i].sock = INVALID_SOCKET; - atomic_init(&client[i].refcnt); + lock_init(&client_array[i].lock); + client_array[i].index = i; + client_array[i].sock = INVALID_SOCKET; + atomic_init(&client_array[i].refcnt); } if (!(f = fopen("/var/run/ibacm.port", "w"))) { @@ -1758,7 +1758,7 @@ static void acm_svr_accept(void) } for (i = 0; i < FD_SETSIZE - 1; i++) { - if (!atomic_get(&client[i].refcnt)) + if (!atomic_get(&client_array[i].refcnt)) break; } @@ -1768,8 +1768,8 @@ static void acm_svr_accept(void) return; } - client[i].sock = s; - atomic_set(&client[i].refcnt, 1); + client_array[i].sock = s; + atomic_set(&client_array[i].refcnt, 1); acm_log(2, "assigned client %d\n", i); } @@ -2407,9 +2407,9 @@ static void acm_server(void) FD_SET(listen_socket, &readfds); for (i = 0; i < FD_SETSIZE - 1; i++) { - if (client[i].sock != INVALID_SOCKET) { - FD_SET(client[i].sock, &readfds); - n = max(n, (int) client[i].sock); + if (client_array[i].sock != INVALID_SOCKET) { + FD_SET(client_array[i].sock, &readfds); + n = max(n, (int) client_array[i].sock); } } @@ -2423,10 +2423,10 @@ static void acm_server(void) acm_svr_accept(); for (i = 0; i < FD_SETSIZE - 1; i++) { - if (client[i].sock != INVALID_SOCKET && - FD_ISSET(client[i].sock, &readfds)) { + if (client_array[i].sock != INVALID_SOCKET && + FD_ISSET(client_array[i].sock, &readfds)) { acm_log(2, "receiving from client %d\n", i); - acm_svr_receive(&client[i]); + acm_svr_receive(&client_array[i]); } } }