From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C22F7A0524; Fri, 31 Jan 2020 01:04:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 22FC51C0B5; Fri, 31 Jan 2020 01:04:10 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 5F77B1BFB6 for ; Fri, 31 Jan 2020 01:04:01 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jan 2020 16:04:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,383,1574150400"; d="scan'208";a="262364529" Received: from win-dpdk-pallavi.jf.intel.com (HELO localhost.localdomain) ([10.166.188.75]) by fmsmga002.fm.intel.com with ESMTP; 30 Jan 2020 16:03:59 -0800 From: Pallavi Kadam To: dev@dpdk.org, thomas@monjalon.net Cc: Harini.Ramakrishnan@microsoft.com, keith.wiles@intel.com, bruce.richardson@intel.com, david.marchand@redhat.com, jerinjacobk@gmail.com, ranjit.menon@intel.com, antara.ganesh.kolar@intel.com, pallavi.kadam@intel.com Date: Thu, 30 Jan 2020 16:03:00 -0800 Message-Id: <20200131000307.10608-4-pallavi.kadam@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 In-Reply-To: <20200131000307.10608-1-pallavi.kadam@intel.com> References: <20200113215534.10084-1-pallavi.kadam@intel.com> <20200131000307.10608-1-pallavi.kadam@intel.com> Subject: [dpdk-dev] [PATCH v6 03/10] eal: include filesystem implementation for windows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Adding eal_filesystem.h to support functions and path defines for files and directories on Windows. Signed-off-by: Antara Ganesh Kolar Signed-off-by: Pallavi Kadam Reviewed-by: Ranjit Menon Reviewed-by: Keith Wiles --- .../windows/eal/include/eal_filesystem.h | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 lib/librte_eal/windows/eal/include/eal_filesystem.h diff --git a/lib/librte_eal/windows/eal/include/eal_filesystem.h b/lib/librte_eal/windows/eal/include/eal_filesystem.h new file mode 100644 index 000000000..0350b0f13 --- /dev/null +++ b/lib/librte_eal/windows/eal/include/eal_filesystem.h @@ -0,0 +1,94 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2019 Intel Corporation + */ + +/** + * @file + * Stores functions and path defines for files and directories + * on the filesystem for Windows, that are used by the Windows EAL. + */ + +#ifndef EAL_FILESYSTEM_H +#define EAL_FILESYSTEM_H + +#include "eal_internal_cfg.h" + +/* sets up platform-specific runtime data dir */ +int +eal_create_runtime_dir(void); + +/* returns runtime dir */ +const char * +eal_get_runtime_dir(void); + +/* define the default filename prefix for the %s values below */ +#define HUGEFILE_PREFIX_DEFAULT "rte" + +/** Path of rte config file */ +#define RUNTIME_CONFIG_FMT "%s\\%s.config" + +static inline const char * +eal_runtime_config_path(void) +{ + static char buffer[PATH_MAX]; /* static so auto-zeroed */ + char Directory[PATH_MAX]; + + GetTempPathA(sizeof(Directory), Directory); + snprintf(buffer, sizeof(buffer)-1, RUNTIME_CONFIG_FMT, Directory, + internal_config.hugefile_prefix); + + return buffer; +} + +/* Path of file backed array */ +#define FBARRAY_NAME_FMT "%s\\fbarray_%s" + +static inline const char * +eal_get_fbarray_path(char *buffer, size_t buflen, const char *name) { + snprintf(buffer, buflen, FBARRAY_NAME_FMT, eal_get_runtime_dir(), name); + return buffer; +} + +/* Path of primary/secondary communication unix socket file. */ +#define MP_SOCKET_FNAME "mp_socket" + +static inline const char * +eal_mp_socket_path(void) +{ + static char buffer[PATH_MAX]; /* static so auto-zeroed */ + + snprintf(buffer, sizeof(buffer) - 1, "%s/%s", eal_get_runtime_dir(), + MP_SOCKET_FNAME); + return buffer; +} + +/** Path of hugepage info file */ +#define HUGEPAGE_INFO_FMT "%s\\.%s_hugepage_info" + +static inline const char * +eal_hugepage_info_path(void) +{ + static char buffer[PATH_MAX]; /* static so auto-zeroed */ + TCHAR Directory[PATH_MAX]; + + GetSystemDirectory(Directory, sizeof(Directory)); + snprintf(buffer, sizeof(buffer)-1, HUGEPAGE_INFO_FMT, Directory, + internal_config.hugefile_prefix); + return buffer; +} + +/** String format for hugepage map files */ +#define HUGEFILE_FMT "%s/%smap_%d" +#define TEMP_HUGEFILE_FMT "%s/%smap_temp_%d" + +static inline const char * +eal_get_hugefile_path(char *buffer, size_t buflen, const char *hugedir, + int f_id) +{ + snprintf(buffer, buflen, HUGEFILE_FMT, hugedir, + internal_config.hugefile_prefix, f_id); + buffer[buflen - 1] = '\0'; + return buffer; +} + +#endif /* EAL_FILESYSTEM_H */ -- 2.18.0.windows.1