[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 4/5] atapi: GESN: Add enums for commonly-used fi
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] Re: [PATCH 4/5] atapi: GESN: Add enums for commonly-used field types |
Date: |
Fri, 08 Apr 2011 16:21:38 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10 |
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 <address@hidden>
> ---
> 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
- [Qemu-devel] [PATCH 1/5] atapi: Allow GET_EVENT_STATUS_NOTIFICATION after media change, (continued)
- [Qemu-devel] [PATCH 4/5] atapi: GESN: Add enums for commonly-used field types, Amit Shah, 2011/04/08
- [Qemu-devel] Re: [PATCH 4/5] atapi: GESN: Add enums for commonly-used field types,
Kevin Wolf <=
- [Qemu-devel] [PATCH 5/5] atapi: Implement 'media' subcommand of GET_EVENT_STATUS_NOTIFICATION command, Amit Shah, 2011/04/08
- [Qemu-devel] Re: [PATCH 0/5] atapi: Implement 'media' subcommand for GESN, Paolo Bonzini, 2011/04/08
- Re: [Qemu-devel] [PATCH 0/5] atapi: Implement 'media' subcommand for GESN, Markus Armbruster, 2011/04/08