Date: Fri, 10 Jul 2015 14:10:50 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Mateusz Guzik <mjg@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285356 - in head/sys: compat/cloudabi kern sys Message-ID: <20150710111050.GU2080@kib.kiev.ua> In-Reply-To: <201507101101.t6AB1VYe002159@repo.freebsd.org> References: <201507101101.t6AB1VYe002159@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jul 10, 2015 at 11:01:31AM +0000, Mateusz Guzik wrote: > Author: mjg > Date: Fri Jul 10 11:01:30 2015 > New Revision: 285356 > URL: https://svnweb.freebsd.org/changeset/base/285356 > > Log: > fd: split kern_dup flags argument into actual flags and a mode > > Tidy up the code inside to switch on the mode. > + MPASS(mode < FDDUP_LASTMODE); Since you started the FDDUP_ modes enum from 1, this assert does not fully validate the mode. Am I wrong ? > +/* Operation types for kern_dup(). */ > +enum { > + FDDUP_NORMAL = 0x01, /* dup() behavior. */ > + FDDUP_FCNTL, /* fcntl()-style errors. */ > + FDDUP_FIXED, /* Force fixed allocation. */ > + FDDUP_MUSTREPLACE, /* Target must exist. */ > + FDDUP_LASTMODE, > +}; > + > /* Flags for kern_dup(). */ > -#define FDDUP_FIXED 0x1 /* Force fixed allocation. */ > -#define FDDUP_FCNTL 0x2 /* fcntl()-style errors. */ > -#define FDDUP_CLOEXEC 0x4 /* Atomically set FD_CLOEXEC. */ > -#define FDDUP_MUSTREPLACE 0x8 /* Target must exist. */ > +#define FDDUP_CLOEXEC 0x1 /* Atomically set FD_CLOEXEC. */ Consider using different prefixes for mode/flags ?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150710111050.GU2080>