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 7DC2DA00C5; Wed, 29 Apr 2020 18:41:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BCF2E1DADB; Wed, 29 Apr 2020 18:41:44 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id BEBDC1DAD8 for ; Wed, 29 Apr 2020 18:41:42 +0200 (CEST) IronPort-SDR: HwzMrM9ytUfFBIouKkcUdyFLKgNkZ+F4Sv93c2ZFadXiOdsGQGw83scQBxs/5z2ExFBDT7ysRB uCR2fPHSPYvQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 09:41:41 -0700 IronPort-SDR: Tl+8rMDJN9xLdfcy3dE1fVRiiuLUrFGMGiFMU4lWE3Q1PJkGIGu+Vvp6sSRbHSf7h5vDW7mtti T0pWkZMMgaVA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,332,1583222400"; d="scan'208";a="246900730" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.243.43]) ([10.213.243.43]) by orsmga007.jf.intel.com with ESMTP; 29 Apr 2020 09:41:39 -0700 To: Dmitry Kozlyuk , dev@dpdk.org Cc: "Dmitry Malloy (MESHCHANINOV)" , Narcisa Ana Maria Vasile , Fady Bader , Tal Shnaiderman , Bruce Richardson References: <20200410164342.1194634-1-dmitry.kozliuk@gmail.com> <20200428235015.2820677-1-dmitry.kozliuk@gmail.com> <20200428235015.2820677-3-dmitry.kozliuk@gmail.com> From: "Burakov, Anatoly" Message-ID: Date: Wed, 29 Apr 2020 17:41:38 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200428235015.2820677-3-dmitry.kozliuk@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v4 2/8] eal: introduce internal wrappers for file operations 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" On 29-Apr-20 12:50 AM, Dmitry Kozlyuk wrote: > EAL common code uses file locking and truncation. Introduce > OS-independent wrappers in order to support both Linux/FreeBSD > and Windows: > > * eal_file_lock: lock or unlock an open file. > * eal_file_truncate: enforce a given size for an open file. > > Wrappers follow POSIX semantics, but interface is not POSIX, > so that it can be made more clean, e.g. by not mixing locking > operation and behaviour on conflict. > > Implementation for Linux and FreeBSD is placed in "unix" subdirectory, > which is intended for common code between the two. Files should be named > after the ones from which the code is factored in OS subdirectory. > > Signed-off-by: Dmitry Kozlyuk > --- > > #include > #include > @@ -85,7 +85,7 @@ resize_and_map(int fd, void *addr, size_t len) > char path[PATH_MAX]; > void *map_addr; > > - if (ftruncate(fd, len)) { > + if (eal_file_truncate(fd, len)) { > RTE_LOG(ERR, EAL, "Cannot truncate %s\n", path); > /* pass errno up the chain */ > rte_errno = errno; eal_file_truncate sets rte_errno, so no need to pass it up the chain any more. Otherwise, Acked-by: Anatoly Burakov -- Thanks, Anatoly