From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NAMd6-0004sL-3w for qemu-devel@nongnu.org; Tue, 17 Nov 2009 06:53:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NAMd1-0004p1-8T for qemu-devel@nongnu.org; Tue, 17 Nov 2009 06:53:51 -0500 Received: from [199.232.76.173] (port=53129 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAMd0-0004ok-Qx for qemu-devel@nongnu.org; Tue, 17 Nov 2009 06:53:46 -0500 Received: from verein.lst.de ([213.95.11.210]:45542) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1NAMd0-0005OK-9X for qemu-devel@nongnu.org; Tue, 17 Nov 2009 06:53:46 -0500 Date: Tue, 17 Nov 2009 12:53:44 +0100 From: Christoph Hellwig Subject: Re: [Qemu-devel] [PATCH 11/15] scsi: add xfer mode Message-ID: <20091117115344.GC1330@lst.de> References: <1258453071-3496-1-git-send-email-kraxel@redhat.com> <1258453071-3496-12-git-send-email-kraxel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1258453071-3496-12-git-send-email-kraxel@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org On Tue, Nov 17, 2009 at 11:17:47AM +0100, Gerd Hoffmann wrote: > +static void scsi_req_xfer_mode(SCSIRequest *req) > +{ > + switch (req->cmd.buf[0]) { Having this as a void seem a bit odd to me. I'd make it return the mode, and maybe just pass the cmd to it to make it more clear. > +static int is_write(SCSIGenericReq *r) > { > + switch (r->req.cmd.mode) { > + case SCSI_XFER_TO_DEV: > return 1; > + default: > + return 0; > } > } Does this helper relaly buy anything over a simple if (r->req.cmd.mode == SCSI_XFER_TO_DEV) { check?