From patchwork Tue Jul 7 09:00:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 6148 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 2F0EC5A63; Tue, 7 Jul 2015 11:00:54 +0200 (CEST) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by dpdk.org (Postfix) with ESMTP id 01C7F5A52 for ; Tue, 7 Jul 2015 11:00:51 +0200 (CEST) Received: by wiwl6 with SMTP id l6so307751638wiw.0 for ; Tue, 07 Jul 2015 02:00:50 -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:subject:date:message-id:in-reply-to :references; bh=SUpR7tHOsL5i1Ahx+09tZJ4TW+FIFIkveAvqgYTtC18=; b=SgI+t8S7aTFAgt+F2xd/H3QAs4o6+/tw1Wf7XHWCYxmOnI7SGDhTusLcR3l7AWNgNW etlMsGy0+Q43C7LBTcQY4MNpLu+heYbVinAVdS/1W0I2WVdPxpypcdiwSzm043ILay8o Jj/2ba0rnHvkeb0eoVbiOFT/gVq6zpevDo6VIYd4a+En0yjyHQBF3ThTamkyTsHB1c4h C9Tvg5osHL2NxO50/oQE+YNy3tKhJBshyDwtHtruTfofux7+nTFONlRuW0rSXfIiZitZ YqTj7D18h0ooJ0UFr4t6jukb07ZMDtKvqtxUMuxGWu846BhMMn/8Fflm8DhtvaGO5nkp krhg== X-Gm-Message-State: ALoCoQlE98XsDtOJ56QjV48DHrdThvi4BJEcX5AGx2DIIFq6akmxTJsKY12Rg+/T0e1+p3BnefaU X-Received: by 10.194.108.5 with SMTP id hg5mr6655906wjb.25.1436259650849; Tue, 07 Jul 2015 02:00:50 -0700 (PDT) Received: from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.151.210]) by mx.google.com with ESMTPSA id y19sm32737674wia.15.2015.07.07.02.00.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jul 2015 02:00:49 -0700 (PDT) From: David Marchand To: dev@dpdk.org Date: Tue, 7 Jul 2015 11:00:31 +0200 Message-Id: <1436259634-7077-4-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1436259634-7077-1-git-send-email-david.marchand@6wind.com> References: <1436259634-7077-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH 3/6] eal/linux: cosmetic change X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Prepare for checkpatch compliance. Signed-off-by: David Marchand --- lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 28 +++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c index 0b6ece7..b474159 100644 --- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c +++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c @@ -274,22 +274,26 @@ eal_hugepage_info_init(void) const char dirent_start_text[] = "hugepages-"; const size_t dirent_start_len = sizeof(dirent_start_text) - 1; unsigned i, num_sizes = 0; + DIR *dir; + struct dirent *dirent; - DIR *dir = opendir(sys_dir_path); + dir = opendir(sys_dir_path); if (dir == NULL) - rte_panic("Cannot open directory %s to read system hugepage info\n", - sys_dir_path); + rte_panic("Cannot open directory %s to read system hugepage " + "info\n", sys_dir_path); - struct dirent *dirent = readdir(dir); - while(dirent != NULL){ - if (strncmp(dirent->d_name, dirent_start_text, dirent_start_len) == 0){ - struct hugepage_info *hpi = \ - &internal_config.hugepage_info[num_sizes]; + dirent = readdir(dir); + while (dirent != NULL) { + struct hugepage_info *hpi; + + if (strncmp(dirent->d_name, dirent_start_text, + dirent_start_len) == 0) { + hpi = &internal_config.hugepage_info[num_sizes]; hpi->hugepage_sz = rte_str_to_size(&dirent->d_name[dirent_start_len]); hpi->hugedir = get_hugepage_dir(hpi->hugepage_sz); /* first, check if we have a mountpoint */ - if (hpi->hugedir == NULL){ + if (hpi->hugedir == NULL) { unsigned long num_pages; num_pages = get_num_hugepages(dirent->d_name); @@ -332,10 +336,10 @@ eal_hugepage_info_init(void) internal_config.num_hugepage_sizes = num_sizes; /* sort the page directory entries by size, largest to smallest */ - for (i = 0; i < num_sizes; i++){ + for (i = 0; i < num_sizes; i++) { unsigned j; for (j = i+1; j < num_sizes; j++) - if (internal_config.hugepage_info[j-1].hugepage_sz < \ + if (internal_config.hugepage_info[j-1].hugepage_sz < internal_config.hugepage_info[j].hugepage_sz) swap_hpi(&internal_config.hugepage_info[j-1], &internal_config.hugepage_info[j]); @@ -344,7 +348,7 @@ eal_hugepage_info_init(void) /* now we have all info, check we have at least one valid size */ for (i = 0; i < num_sizes; i++) if (internal_config.hugepage_info[i].hugedir != NULL && - internal_config.hugepage_info[i].num_pages[0] > 0) + internal_config.hugepage_info[i].num_pages[0] > 0) return 0; /* no valid hugepage mounts available, return error */