From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtOyU-00059R-1L for qemu-devel@nongnu.org; Sun, 21 Mar 2010 13:30:06 -0400 Received: from [199.232.76.173] (port=44850 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtOyT-000596-F4 for qemu-devel@nongnu.org; Sun, 21 Mar 2010 13:30:05 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NtOyS-0001YS-N2 for qemu-devel@nongnu.org; Sun, 21 Mar 2010 13:30:05 -0400 Received: from mail-yw0-f198.google.com ([209.85.211.198]:55333) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NtOyS-0001YI-G6 for qemu-devel@nongnu.org; Sun, 21 Mar 2010 13:30:04 -0400 Received: by ywh36 with SMTP id 36so1399160ywh.4 for ; Sun, 21 Mar 2010 10:30:02 -0700 (PDT) Sender: Richard Henderson Message-ID: <4BA65791.8070207@twiddle.net> Date: Sun, 21 Mar 2010 10:29:53 -0700 From: Richard Henderson MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] read-only: allow read-only CDROM with any interface References: <1269185633-31750-1-git-send-email-nsprei@redhat.com> In-Reply-To: <1269185633-31750-1-git-send-email-nsprei@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Naphtali Sprei Cc: qemu-devel@nongnu.org On 03/21/2010 08:33 AM, Naphtali Sprei wrote: > - if (ro == 1) { > + if (media == MEDIA_CDROM) { > + ro = 1; > + } > + if (ro == 1&& > + media != MEDIA_CDROM) { /* CDROM is fine for any interface, don't check */ > if (type != IF_SCSI&& type != IF_VIRTIO&& type != IF_FLOPPY) { Ug. How about formatting this as if (media == MEDIA_CDROM) { /* CDROM is fine for any interface, don't check. */ ro = 1; } else if (ro == 1) { if (type != IF_SCSI ...) } duplicating the MEDIA_CDROM test makes the logic harder to follow. r~