From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH v2 2/4] Add fchmodat4(), a new syscall Date: Wed, 17 Jul 2019 02:48:02 +0100 Message-ID: <20190717014802.GS17978@ZenIV.linux.org.uk> References: <20190717012719.5524-1-palmer@sifive.com> <20190717012719.5524-3-palmer@sifive.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190717012719.5524-3-palmer@sifive.com> Sender: linux-kernel-owner@vger.kernel.org To: Palmer Dabbelt Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , rth@twiddle.net, ink@jurassic.park.msu.ru, mattst88@gmail.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org, tony.luck@intel.com, fenghua.yu@intel.com, geert@linux-m68k.org, monstr@monstr.eu, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, James.Bottomley@hansenpartnership.com, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, heiko.carstens@de.ibm.com, gor@linux.ibm.com, borntraeger@de.ibm.com, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, peterz@infradead.org, acme@kernel.org, alexand List-Id: linux-api@vger.kernel.org On Tue, Jul 16, 2019 at 06:27:17PM -0700, Palmer Dabbelt wrote: > -int do_fchmodat(int dfd, const char __user *filename, umode_t mode) > +int do_fchmodat4(int dfd, const char __user *filename, umode_t mode, int flags) > { > struct path path; > int error; > - unsigned int lookup_flags = LOOKUP_FOLLOW; > + unsigned int lookup_flags; > + > + if (unlikely(flags & ~AT_SYMLINK_NOFOLLOW)) > + return -EINVAL; > + > + lookup_flags = flags & AT_SYMLINK_NOFOLLOW ? 0 : LOOKUP_FOLLOW; > + Why not do that in sys_fchmodat4() itself, passing lookup_flags to do_fchmodat() and updating old callers to pass it 0 as extra argument?