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 C7501A00C4; Wed, 3 Jun 2020 14:34:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A5B1B1D170; Wed, 3 Jun 2020 14:34:06 +0200 (CEST) Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by dpdk.org (Postfix) with ESMTP id 6C3E51C43E for ; Wed, 3 Jun 2020 14:34:05 +0200 (CEST) Received: by mail-lj1-f196.google.com with SMTP id n24so2456108lji.10 for ; Wed, 03 Jun 2020 05:34:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jPZjvWUk/ILKQ9I19rJwX5dakD0N5CTZdvVG7h+mGHc=; b=LK7PUKwfGSyBrtMMHccA3zlrV2l8K6bP1W2WCJ95AONsLykRj8Dt8pfVwDqsp4b7UG 0PUiENdjBxEMoYKv5Ik484jRWRkeHtveWgscLrH17GgbB7gdl+acJsRES3d0r4QKMPam DjNzWJAsJ7ez7nddSb0jLoRDjhLl71HzrkUNYvFy5IhJ1pcn2+Gx2iaz2LW7P6/wzGP5 jslfNKycSmg6a1rj3CJlIEw3rLxECWPar13UkQ6o3WiMZXIm43LeLGU7BrUN6FBLmznW C0rbwuM5H80BCXUSQDZNZHS9i7lMlfCg/m0QSR+xS+RS75P1dO8HBZn6DtHyt3xhA9I0 q7MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jPZjvWUk/ILKQ9I19rJwX5dakD0N5CTZdvVG7h+mGHc=; b=H8EmDTvnwclD2M6XpOaeMGYT7X3RSRUUxdVFp6rWlUf9YbiqdojyevW60LsMIx1wWX T/eUSQjTsAno2Y/Z9BS/5vWzC4l7wo0NycJ3rRPavPRGXNJca1xNroqHmzp5hUzvQkRE blScnLKK+CMyLgp+t7vxijKylv/w08VY3usZyQnbmsfS938jhQ1EC2SRw3XBB1QcFRze SJE10BXqV3Afo05SdAhJGYdqUkMqQHFJlI2KMMgveHn/dvcXoMHpQ74QS0Rw7W5/fWMN F5ER8vyYlPzv/69V0ig3WXGNiBxRNJDRbofeDMPUKkV/npYsNq0GwZyWLYniaTNfixZ6 3ONQ== X-Gm-Message-State: AOAM531EqO0ag0wxma3a9zicCYapI7LqxLtNLAr3VdZ6RLnU+veOgSg8 TCSrXShSSz3wTdQK83nz7jE= X-Google-Smtp-Source: ABdhPJwXvhLUTb3DnXroZcyaHw4hMJFqM1Yml1BxD/eSw42rbxpbRyrd22oIRC7DOAY2WuA1G6fBgQ== X-Received: by 2002:a2e:6f13:: with SMTP id k19mr2117017ljc.364.1591187644899; Wed, 03 Jun 2020 05:34:04 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id e21sm495406ljb.135.2020.06.03.05.34.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 05:34:04 -0700 (PDT) Date: Wed, 3 Jun 2020 15:34:03 +0300 From: Dmitry Kozlyuk To: Neil Horman Cc: dev@dpdk.org, Dmitry Malloy , Narcisa Ana Maria Vasile , Fady Bader , Tal Shnaiderman , Thomas Monjalon , Anatoly Burakov , Bruce Richardson Message-ID: <20200603153403.2e58ef90@sovereign> In-Reply-To: <20200603120759.GA426574@hmswarspite.think-freely.org> References: <20200525003720.6410-1-dmitry.kozliuk@gmail.com> <20200602230329.17838-1-dmitry.kozliuk@gmail.com> <20200602230329.17838-3-dmitry.kozliuk@gmail.com> <20200603120759.GA426574@hmswarspite.think-freely.org> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 02/11] 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 Wed, 3 Jun 2020 08:07:59 -0400 Neil Horman wrote: [snip] > > +int > > +eal_file_create(const char *path) > > +{ > > + int ret; > > + > > + ret = open(path, O_CREAT | O_RDWR, 0600); > > + if (ret < 0) > > + rte_errno = errno; > > + > > + return ret; > > +} > > + > You don't need this call if you support the oflags option in the open call > below. See below. > > +int > > +eal_file_open(const char *path, bool writable) > > +{ > > + int ret, flags; > > + > > + flags = writable ? O_RDWR : O_RDONLY; > > + ret = open(path, flags); > > + if (ret < 0) > > + rte_errno = errno; > > + > > + return ret; > > +} > > + > why are you changing this api from the posix file format (with oflags > specified). As far as I can see both unix and windows platforms support that There is a number of caveats, which IMO make this approach better: 1. Filesystem permissions on Windows are complicated. Supporting anything other than 0600 would add a lot of code, while EAL doesn't really need it. Microsoft's open() takes not permission bits, but a set of flags. 2. Restricted interface prevents EAL developers from accidentally using features not supported on all platforms via a seemingly rich API. 3. Microsoft CRT (the one Clang is using) deprecates open() in favor of _sopen_s() and issues a warning, and we're targeting -Werror. Disabling all such warnings (_CRT_SECURE_NO_DEPRECATE) doesn't seem right when CRT vendor encourages using alternatives. This is the primary reason for open() wrappers in v6. -- Dmitry Kozlyuk