From patchwork Sat Feb 4 08:02:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 139545 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C95D5104796 for ; Sat, 4 Feb 2012 19:39:56 +1100 (EST) Received: from localhost ([::1]:55329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtbA2-0003MB-Pt for incoming@patchwork.ozlabs.org; Sat, 04 Feb 2012 03:39:54 -0500 Received: from eggs.gnu.org ([140.186.70.92]:34951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rtaat-0002E3-TM for qemu-devel@nongnu.org; Sat, 04 Feb 2012 03:03:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rtaam-0005KK-Au for qemu-devel@nongnu.org; Sat, 04 Feb 2012 03:03:35 -0500 Received: from mail-we0-f173.google.com ([74.125.82.173]:55443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rtaaj-00057N-VE for qemu-devel@nongnu.org; Sat, 04 Feb 2012 03:03:26 -0500 Received: by mail-we0-f173.google.com with SMTP id h12so3839005wer.4 for ; Sat, 04 Feb 2012 00:03:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=H/+pnyRcOkhIfJMO08qLmyjPKjOxWxT517JgC75MuFo=; b=AIvG5g8Kkv9XVyMZiXOBqNo7D6NMmMC8qK3WrvHhFYydil1rqVdtycJaB4Kzq1EcvH wHjEZoY6P/7CDdn0GIY0tjTa6ngmfaXUwFjfzCVetb5PdIXSqZhpREDUpLDFCQjwqxiq +eQYW2/tO9ucX0ulwtG6/D0HPsoRoV5ZWrPDQ= Received: by 10.216.138.149 with SMTP id a21mr496213wej.0.1328342605363; Sat, 04 Feb 2012 00:03:25 -0800 (PST) Received: from yakj.usersys.redhat.com.ACCOR.COM (218.104-246-81.adsl-static.isp.belgacom.be. [81.246.104.218]) by mx.google.com with ESMTPS id m8sm24963019wia.11.2012.02.04.00.03.24 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 04 Feb 2012 00:03:24 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sat, 4 Feb 2012 09:02:55 +0100 Message-Id: <1328342577-25732-26-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1328342577-25732-1-git-send-email-pbonzini@redhat.com> References: <1328342577-25732-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.173 Subject: [Qemu-devel] [PATCH v2 25/27] qdev: remove unused fields from PropertyInfo X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Paolo Bonzini Reviewed-by: Anthony Liguori --- hw/qdev-addr.c | 2 -- hw/qdev-properties.c | 38 +------------------------------------- hw/qdev.h | 21 --------------------- 3 files changed, 1 insertions(+), 60 deletions(-) diff --git a/hw/qdev-addr.c b/hw/qdev-addr.c index 8daa733..0bb16c7 100644 --- a/hw/qdev-addr.c +++ b/hw/qdev-addr.c @@ -61,8 +61,6 @@ static void set_taddr(Object *obj, Visitor *v, void *opaque, PropertyInfo qdev_prop_taddr = { .name = "taddr", - .type = PROP_TYPE_TADDR, - .size = sizeof(target_phys_addr_t), .parse = parse_taddr, .print = print_taddr, .get = get_taddr, diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 49bed30..b6d6fcf 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -12,7 +12,7 @@ void *qdev_get_prop_ptr(DeviceState *dev, Property *prop) static uint32_t qdev_get_prop_mask(Property *prop) { - assert(prop->info->type == PROP_TYPE_BIT); + assert(prop->info == &qdev_prop_bit); return 0x1 << prop->bitnr; } @@ -79,8 +79,6 @@ static void set_bit(Object *obj, Visitor *v, void *opaque, PropertyInfo qdev_prop_bit = { .name = "boolean", .legacy_name = "on/off", - .type = PROP_TYPE_BIT, - .size = sizeof(uint32_t), .parse = parse_bit, .print = print_bit, .get = get_bit, @@ -151,8 +149,6 @@ static void set_int8(Object *obj, Visitor *v, void *opaque, PropertyInfo qdev_prop_uint8 = { .name = "uint8", - .type = PROP_TYPE_UINT8, - .size = sizeof(uint8_t), .parse = parse_uint8, .print = print_uint8, .get = get_int8, @@ -185,8 +181,6 @@ static int print_hex8(DeviceState *dev, Property *prop, char *dest, size_t len) PropertyInfo qdev_prop_hex8 = { .name = "uint8", .legacy_name = "hex8", - .type = PROP_TYPE_UINT8, - .size = sizeof(uint8_t), .parse = parse_hex8, .print = print_hex8, .get = get_int8, @@ -259,8 +253,6 @@ static void set_int16(Object *obj, Visitor *v, void *opaque, PropertyInfo qdev_prop_uint16 = { .name = "uint16", - .type = PROP_TYPE_UINT16, - .size = sizeof(uint16_t), .parse = parse_uint16, .print = print_uint16, .get = get_int16, @@ -333,8 +325,6 @@ static void set_int32(Object *obj, Visitor *v, void *opaque, PropertyInfo qdev_prop_uint32 = { .name = "uint32", - .type = PROP_TYPE_UINT32, - .size = sizeof(uint32_t), .parse = parse_uint32, .print = print_uint32, .get = get_int32, @@ -364,8 +354,6 @@ static int print_int32(DeviceState *dev, Property *prop, char *dest, size_t len) PropertyInfo qdev_prop_int32 = { .name = "int32", - .type = PROP_TYPE_INT32, - .size = sizeof(int32_t), .parse = parse_int32, .print = print_int32, .get = get_int32, @@ -398,8 +386,6 @@ static int print_hex32(DeviceState *dev, Property *prop, char *dest, size_t len) PropertyInfo qdev_prop_hex32 = { .name = "uint32", .legacy_name = "hex32", - .type = PROP_TYPE_UINT32, - .size = sizeof(uint32_t), .parse = parse_hex32, .print = print_hex32, .get = get_int32, @@ -457,8 +443,6 @@ static void set_int64(Object *obj, Visitor *v, void *opaque, PropertyInfo qdev_prop_uint64 = { .name = "uint64", - .type = PROP_TYPE_UINT64, - .size = sizeof(uint64_t), .parse = parse_uint64, .print = print_uint64, .get = get_int64, @@ -489,8 +473,6 @@ static int print_hex64(DeviceState *dev, Property *prop, char *dest, size_t len) PropertyInfo qdev_prop_hex64 = { .name = "uint64", .legacy_name = "hex64", - .type = PROP_TYPE_UINT64, - .size = sizeof(uint64_t), .parse = parse_hex64, .print = print_hex64, .get = get_int64, @@ -559,8 +541,6 @@ static void set_string(Object *obj, Visitor *v, void *opaque, PropertyInfo qdev_prop_string = { .name = "string", - .type = PROP_TYPE_STRING, - .size = sizeof(char*), .print = print_string, .release = release_string, .get = get_string, @@ -655,8 +635,6 @@ static void set_drive(Object *obj, Visitor *v, void *opaque, PropertyInfo qdev_prop_drive = { .name = "drive", - .type = PROP_TYPE_DRIVE, - .size = sizeof(BlockDriverState *), .get = get_drive, .set = set_drive, .release = release_drive, @@ -711,8 +689,6 @@ static void set_chr(Object *obj, Visitor *v, void *opaque, PropertyInfo qdev_prop_chr = { .name = "chr", - .type = PROP_TYPE_CHR, - .size = sizeof(CharDriverState*), .get = get_chr, .set = set_chr, .release = release_chr, @@ -755,8 +731,6 @@ static void set_netdev(Object *obj, Visitor *v, void *opaque, PropertyInfo qdev_prop_netdev = { .name = "netdev", - .type = PROP_TYPE_NETDEV, - .size = sizeof(VLANClientState*), .get = get_netdev, .set = set_netdev, }; @@ -834,8 +808,6 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque, PropertyInfo qdev_prop_vlan = { .name = "vlan", - .type = PROP_TYPE_VLAN, - .size = sizeof(VLANClientState*), .parse = parse_vlan, .print = print_vlan, .get = get_vlan, @@ -847,8 +819,6 @@ PropertyInfo qdev_prop_vlan = { /* Not a proper property, just for dirty hacks. TODO Remove it! */ PropertyInfo qdev_prop_ptr = { .name = "ptr", - .type = PROP_TYPE_PTR, - .size = sizeof(void*), }; /* --- mac address --- */ @@ -917,8 +887,6 @@ inval: PropertyInfo qdev_prop_macaddr = { .name = "macaddr", - .type = PROP_TYPE_MACADDR, - .size = sizeof(MACAddr), .get = get_mac, .set = set_mac, }; @@ -965,8 +933,6 @@ static void set_enum(Object *obj, Visitor *v, void *opaque, PropertyInfo qdev_prop_losttickpolicy = { .name = "LostTickPolicy", - .type = PROP_TYPE_LOSTTICKPOLICY, - .size = sizeof(LostTickPolicy), .enum_table = lost_tick_policy_table, .get = get_enum, .set = set_enum, @@ -1012,8 +978,6 @@ static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest, size_t PropertyInfo qdev_prop_pci_devfn = { .name = "int32", .legacy_name = "pci-devfn", - .type = PROP_TYPE_UINT32, - .size = sizeof(uint32_t), .parse = parse_pci_devfn, .print = print_pci_devfn, .get = get_int32, diff --git a/hw/qdev.h b/hw/qdev.h index a3bcf0b..9cc3f98 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -117,30 +117,9 @@ struct Property { int64_t defval; }; -enum PropertyType { - PROP_TYPE_UNSPEC = 0, - PROP_TYPE_UINT8, - PROP_TYPE_UINT16, - PROP_TYPE_UINT32, - PROP_TYPE_INT32, - PROP_TYPE_UINT64, - PROP_TYPE_TADDR, - PROP_TYPE_MACADDR, - PROP_TYPE_LOSTTICKPOLICY, - PROP_TYPE_DRIVE, - PROP_TYPE_CHR, - PROP_TYPE_STRING, - PROP_TYPE_NETDEV, - PROP_TYPE_VLAN, - PROP_TYPE_PTR, - PROP_TYPE_BIT, -}; - struct PropertyInfo { const char *name; const char *legacy_name; - size_t size; - enum PropertyType type; const char **enum_table; int64_t min; int64_t max;