From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCAqx-0006Lm-GM for qemu-devel@nongnu.org; Tue, 19 Apr 2011 09:20:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QCAqw-0008Of-Ca for qemu-devel@nongnu.org; Tue, 19 Apr 2011 09:20:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20154) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCAqv-0008OL-Vr for qemu-devel@nongnu.org; Tue, 19 Apr 2011 09:20:26 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3JDKP85029121 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 19 Apr 2011 09:20:25 -0400 Date: Tue, 19 Apr 2011 18:50:20 +0530 From: Amit Shah Message-ID: <20110419132019.GH16567@amit-x200.redhat.com> References: <1303216603-11658-1-git-send-email-kwolf@redhat.com> <1303216603-11658-4-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1303216603-11658-4-git-send-email-kwolf@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/5] ide/atapi: Use table instead of switch for commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On (Tue) 19 Apr 2011 [14:36:41], Kevin Wolf wrote: > +struct { > + void (*handler)(IDEState *s, uint8_t *buf); > + int flags; > +} atapi_cmd_table[0x100] = { > + [ 0x00 ] = { cmd_test_unit_ready, 0 }, > + [ 0x03 ] = { cmd_request_sense, ALLOW_UA }, > + [ 0x12 ] = { cmd_inquiry, ALLOW_UA }, > + [ 0x1a ] = { cmd_mode_sense, /* (6) */ 0 }, > + [ 0x1b ] = { cmd_start_stop_unit, 0 }, > + [ 0x1e ] = { cmd_prevent_allow_medium_removal, 0 }, > + [ 0x25 ] = { cmd_read_cdvd_capacity, 0 }, > + [ 0x28 ] = { cmd_read, /* (10) */ 0 }, > + [ 0x2b ] = { cmd_seek, 0 }, > + [ 0x43 ] = { cmd_read_toc_pma_atip, 0 }, > + [ 0x46 ] = { cmd_get_configuration, ALLOW_UA }, > + [ 0x4a ] = { cmd_get_event_status_notification, ALLOW_UA }, > + [ 0x5a ] = { cmd_mode_sense, /* (10) */ 0 }, > + [ 0xa8 ] = { cmd_read, /* (12) */ 0 }, > + [ 0xad ] = { cmd_read_dvd_structure, 0 }, > + [ 0xbb ] = { cmd_set_speed, 0 }, > + [ 0xbd ] = { cmd_mechanism_status, 0 }, > + [ 0xbe ] = { cmd_read_cd, 0 }, > +}; I'd prefer to use the GPCMD_TEST_UNIT_READY, etc., defines we already have in internal.h instead of using the command numbers here. Amit