qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 4/5] atapi: GESN: Add enums for commonly-used field


From: Amit Shah
Subject: [Qemu-devel] [PATCH 4/5] atapi: GESN: Add enums for commonly-used field types
Date: Fri, 8 Apr 2011 12:45:18 +0530

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,
+    };
     unsigned int max_len, used_len;
 
-    max_len = ube16_to_cpu(packet + 7);
+    max_len = ube16_to_cpu(packet + allocation_length_msb);
 
     /* It is fine by the MMC spec to not support async mode operations */
-    if (!(packet[1] & 0x01)) { /* asynchronous mode */
+    if (!(packet[polled] & 0x01)) { /* asynchronous mode */
         /* Only polling is supported, asynchronous mode is not. */
         ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST,
                             ASC_INV_FIELD_IN_CMD_PACKET);
-- 
1.7.4.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]