From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Drokin Subject: Re: [PATCH 1/3] VFS "stat light" out of fstatat, and fine grained flags Date: Sun, 12 Apr 2009 17:46:32 -0400 Message-ID: References: <20090407231524.GA1569655@fiona.linuxhacker.ru> <20090412205048.GI4394@shareable.org> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org To: Jamie Lokier Return-path: Received: from linuxhacker.ru ([217.76.32.60]:39648 "EHLO fiona.linuxhacker.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750734AbZDLVrO (ORCPT ); Sun, 12 Apr 2009 17:47:14 -0400 In-Reply-To: <20090412205048.GI4394@shareable.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hello! On Apr 12, 2009, at 4:50 PM, Jamie Lokier wrote: >> Also it adds AT_STAT_SELF flag to mean that the stat should be >> executed not >> on a path, but on the passed filedecriptor itself. > Do you think this is more attractive? > > ret = fstatat(fd, 0, &stat, AT_STAT_SELF|AT_STAT_TYPE| > AT_STAT_SIZE); > > Or this? > ret = fstatat(fd, 0, &stat, AT_STAT_TYPE|AT_STAT_SIZE); > Where 0 in the path automatically means AT_STAT_SELF. > Or this? > ret = fstatat(fd, AT_STAT_SELF, &stat, AT_STAT_TYPE|AT_STAT_SIZE); > Where AT_STAT_SELF is defined as (const char *)-1 in system headers, > to better catch null pointer application bugs. While I think the last one might be attractive, we also need to think about compatibility, unaware kernels would return -EFAULT if you pass some nonsense as a path, which is much less useful than say nice EINVAL. Bye, Oleg