Date: Thu, 17 Dec 2015 23:52:26 -0700 From: Warner Losh <imp@bsdimp.com> To: NGie Cooper <yaneurabeya@gmail.com> Cc: Warner Losh <imp@freebsd.org>, 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: r292428 - head/sys/dev/nand Message-ID: <CANCZdfq7FEw0orhGtKVb3wUHNvuwW2ymFkAoms3tmXwL7c-1bg@mail.gmail.com> In-Reply-To: <CE75EF46-751E-4024-ADB1-660A0A812E52@gmail.com> References: <201512180555.tBI5tOAv057347@repo.freebsd.org> <CE75EF46-751E-4024-ADB1-660A0A812E52@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 17, 2015 at 11:36 PM, NGie Cooper <yaneurabeya@gmail.com> wrote= : > > > On Dec 17, 2015, at 21:55, Warner Losh <imp@FreeBSD.org> wrote: > > > > Author: imp > > Date: Fri Dec 18 05:55:24 2015 > > New Revision: 292428 > > URL: https://svnweb.freebsd.org/changeset/base/292428 > > > > Log: > > No need to test command values this way. There can be only one, even > > though the encoding is bit-wise today... > > What if a third party has defined other BIOs in addition to these and are > doing bitwise ORs? I know $work specialized the buf layer =E2=80=94 but w= e don=E2=80=99t > use nandfs(4) today=E2=80=A6 not sure about others... > Those applications would fail. But they would fail hard in FreeBSD's default stack due to the pervasive use of switch statements and direct tests for equality. Only one bit can ever be set in the stack today and have things actually work as intended. The only reason they are assigned as bits was so that drivers could pass whole classes of commands up / down the stack by looking at a bitmask, rather than a series of if statements. This consideration isn't relevant to the changes I made, which merely obfuscated the tests for no benefit. Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfq7FEw0orhGtKVb3wUHNvuwW2ymFkAoms3tmXwL7c-1bg>