From owner-svn-src-head@freebsd.org Fri Dec 18 06:52:28 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2952CA4BD6C for ; Fri, 18 Dec 2015 06:52:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qg0-x22f.google.com (mail-qg0-x22f.google.com [IPv6:2607:f8b0:400d:c04::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D70631CE6 for ; Fri, 18 Dec 2015 06:52:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qg0-x22f.google.com with SMTP id p88so11306566qge.1 for ; Thu, 17 Dec 2015 22:52:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=RgWA4qE4f61RC+K0r99mP4jNAtFCaamaj4mCTWBEKW4=; b=iOQqIE/TClTmP3G8YqzKAG+eRbfhvar1hePApmm/oVL+TiHDIIWw0s21j7ufmZVwiW qeH2TAx3WKjI7hyEykGHm7/8ClFFmLHNu4FWKZoLt3gUNlmVCtpMVGw/1uS6opYQ1X34 Ly+Z4WH6AuTagZjPNTarIjmVo+HQsIGPz4uGU9f+cUrLR+v3qX5qiPp1YQvVFaP6SuDE WEVAJm18LvUGwmiJhhn+QS034GF159qp8sa/5j3+a3cKl6w89x0BurXK54fnAWX+jNMf WbOv3ySYJ4GWSyatHqsE1ybUYBWvZoB1RAO+IuuSu6Llxy2OWF6tLL/VigwK9boMQrsY uSSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=RgWA4qE4f61RC+K0r99mP4jNAtFCaamaj4mCTWBEKW4=; b=EEMtfaWv7zirBmX+9Cd+FeTphLOU/Z0BJB6i73TwiuXY+xTXIS7zRo0wqYDZ5KHpIA ze7oGT2qLKj8QIIfWE394Igkedd7mD9rnIawvChvf6byHY1BbStiP8k5/KOVxwugn88h PgJQMfptjONe9DbcI62keqLMLdP8YFc9piVoaeeAZrwBVgTJwvApnzi4QQm4WXeb60Fe IOWovX2gOYRGfTOKFN/kbr6ZQOi433HjubRWs0M63Wae7NoVVLL1QPR1qvMEfkSH+Y9r ywjVXrk8kIdS7G9OPq1FBzLsFgaREQ0ZJZZf3tHutODIN9IZF9GUaHd5okQiPIG18LIE tMZw== X-Gm-Message-State: ALoCoQmDnzrUlWzlwSNaC2RCf671YslPN8DdUBBEfcpjx85QiCk4aF61QKI6306FsUeTy2SRDkMfiqE79Me6JgtIhShZddjy7w== MIME-Version: 1.0 X-Received: by 10.140.40.38 with SMTP id w35mr2680859qgw.52.1450421546814; Thu, 17 Dec 2015 22:52:26 -0800 (PST) Sender: wlosh@bsdimp.com Received: by 10.140.27.181 with HTTP; Thu, 17 Dec 2015 22:52:26 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201512180555.tBI5tOAv057347@repo.freebsd.org> Date: Thu, 17 Dec 2015 23:52:26 -0700 X-Google-Sender-Auth: Wbazq1sza1J8tEFWEM9dMdaxXBg Message-ID: Subject: Re: svn commit: r292428 - head/sys/dev/nand From: Warner Losh To: NGie Cooper Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2015 06:52:28 -0000 On Thu, Dec 17, 2015 at 11:36 PM, NGie Cooper wrote= : > > > On Dec 17, 2015, at 21:55, Warner Losh 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