From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH] Separate out common fstatat code Date: Wed, 8 Apr 2009 09:27:28 -0400 Message-ID: <20090408132727.GB5957@infradead.org> References: <20090408055411.GA1615245@fiona.linuxhacker.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Oleg Drokin Return-path: Content-Disposition: inline In-Reply-To: <20090408055411.GA1615245@fiona.linuxhacker.ru> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, Apr 08, 2009 at 09:54:11AM +0400, Oleg Drokin wrote: > Hello! > > It seems we have way too many copy&pasted fstatat code elsewhere which > might not have been a problem until now, but with all the changes > with "stat light" now and who knows what other additions in there in > the future, it really helps if we have only one copy of the code. > > Hence this patch adds fstatat_common() that fills struct kstat with > proper values and does all the AT flags parsing that's needed and > then calls all the proper underlying functions, what's left to the > caller now is to only copy filled out kstat buffer to the final > destination. Looks good and like a merge candidate even without any statlite-like syscall. But I would call it vfs_fstatat, not fstatat_common. > --- linux-2.6.29.orig/arch/arm/kernel/sys_oabi-compat.c 2009-04-08 01:31:41.000000000 -0400 > +++ linux-2.6.29/arch/arm/kernel/sys_oabi-compat.c 2009-04-08 01:41:59.000000000 -0400 > @@ -176,20 +176,12 @@ > int flag) > { > struct kstat stat; > + int error; > > + error = fstatat_common(dfd, filename, &stat, flag); > if (!error) > + error = cp_oldabi_stat64(&stat, statbuf); > > return error; Also a error = vfs_fstatat(dfd, filename, &stat, flag); if (error) return error; return cp_oldabi_stat64(&stat, statbuf); would looks slightly cleaner than that. (Same for the various other duplicates)