From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=58867 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8CY2-00032d-Ef for qemu-devel@nongnu.org; Fri, 08 Apr 2011 10:20:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q8CWw-0007EW-MX for qemu-devel@nongnu.org; Fri, 08 Apr 2011 10:19:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q8CWw-0007De-Dt for qemu-devel@nongnu.org; Fri, 08 Apr 2011 10:19:22 -0400 Message-ID: <4D9F19F2.3060705@redhat.com> Date: Fri, 08 Apr 2011 16:21:38 +0200 From: Kevin Wolf MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 4/5] atapi: GESN: Add enums for commonly-used field types List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: Juan Quintela , Stefan Hajnoczi , Markus Armbruster , qemu list , Paolo Bonzini Am 08.04.2011 09:15, schrieb Amit Shah: > Instead of using magic numbers, use enums that are more descriptive of > the fields being used. > > Signed-off-by: Amit Shah > --- > hw/ide/core.c | 11 +++++++++-- > 1 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/hw/ide/core.c b/hw/ide/core.c > index 730587e..cdc2c56 100644 > --- a/hw/ide/core.c > +++ b/hw/ide/core.c > @@ -1118,12 +1118,19 @@ static void handle_get_event_status_notification(IDEState *s, > uint8_t *buf, > const uint8_t *packet) > { > + enum cdb { > + polled = 1, > + request = 4, > + allocation_length_msb = 7, > + allocation_length_lsb = 8, > + control = 9, > + }; Wouldn't it be nicer to make this a struct and just cast packet to a pointer to this struct? At first I didn't realize that this should be field offsets and I find something like packet + allocation_length_msb rather confusing. Kevin