svn commit: r292428 - head/sys/dev/nand

Warner Losh imp at bsdimp.com
Fri Dec 18 06:52:28 UTC 2015


On Thu, Dec 17, 2015 at 11:36 PM, NGie Cooper <yaneurabeya at gmail.com> wrote:

>
> > On Dec 17, 2015, at 21:55, Warner Losh <imp at 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 — but we don’t
> use nandfs(4) today… 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


More information about the svn-src-head mailing list