Date: Sun, 05 Nov 2017 12:37:50 -0700 From: Ian Lepore <ian@freebsd.org> To: cem@freebsd.org, Andriy Gapon <avg@freebsd.org> Cc: Konstantin Belousov <kostikbel@gmail.com>, Warner Losh <imp@bsdimp.com>, src-committers <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r325386 - head/sys/kern Message-ID: <1509910670.99235.70.camel@freebsd.org> In-Reply-To: <CAG6CVpUuQ-LP9P0ckkkv4Y07aowEhT3qj8e45AK-Nnzhh_LnMA@mail.gmail.com> References: <201711041049.vA4AnZUE096709@repo.freebsd.org> <CAG6CVpUaXSX26Bc839kn96EXnUjtGyQ3_eNJPhsRB%2Bv6G6gH1Q@mail.gmail.com> <20171105130607.GA2566@kib.kiev.ua> <CAG6CVpV3SfV8VuNeMJEuN%2BMSu3424mK=HO_-YW9vRt9HEdcJZQ@mail.gmail.com> <20171105173032.GE2566@kib.kiev.ua> <CAG6CVpVQ4RSgz883ezsdExVDQ4RbSiR_y%2BZ5XWDNFeYBpMS-cQ@mail.gmail.com> <CANCZdfqApxd99G-HqVfe4x8EysYJVCAcHksqTeUuBAaYR1OjEA@mail.gmail.com> <20171105190214.GG2566@kib.kiev.ua> <20f694b3-c60c-1b6d-76a1-2ef14cbdd698@FreeBSD.org> <CAG6CVpUuQ-LP9P0ckkkv4Y07aowEhT3qj8e45AK-Nnzhh_LnMA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 2017-11-05 at 11:24 -0800, Conrad Meyer wrote: > On Sun, Nov 5, 2017 at 11:13 AM, Andriy Gapon <avg@freebsd.org> wrote: > > > > I guess (only guess) that Conrad is saying that it would be useful to have a > > macro like KASSERT but which would be always active regardless of INVARIANTS. > > E.g. in illumos they have ASSERT and VERIFY. > Yes, exactly. There are numerous places in the kernel where we have > essentially an unrolled version of that idea, with if + panic. > > Best, > Conrad > IMO, the only reason ASSERT-style macros exist is to hide the conditional-on-build-type part of the operation. That is, to avoid having #ifdef INVARIANTS scattered everywhere. Creating a macro to generate always-on error detection and reporting code just because there exists a macro to do so conditionally seems to turn the world on its head. Sure, there is a lot of 'if (condition) panic("msg")' in the source. There is also a lot of stuff like 'if (error != 0) return (ENXIO)", so should we have a macro for that too? Where does it end? Since I suspect my opinion will be a minority of 1-ish, I'd like to follow up with a suggestion that the new macro at least get a name that includes the word 'panic', such as PANIC_IF(). Something that can be found in the source with: grep -i panic.*message.I.saw -- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1509910670.99235.70.camel>