qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com, afaerber@suse.de
Subject: [Qemu-devel] [PATCH 03/12] qdev: remove legacy parsers for hex8/32/64
Date: Thu, 30 Jan 2014 14:09:45 +0100	[thread overview]
Message-ID: <1391087394-17914-4-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1391087394-17914-1-git-send-email-pbonzini@redhat.com>

The hexNN property types have not been accepting values not prefixed
by "0x" since QEMU 1.2.  Parse those values as decimals now.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/qdev-properties.c | 54 -----------------------------------------------
 1 file changed, 54 deletions(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index da37710..e223ce1 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -189,23 +189,6 @@ PropertyInfo qdev_prop_uint8 = {
 
 /* --- 8bit hex value --- */
 
-static int parse_hex8(DeviceState *dev, Property *prop, const char *str)
-{
-    uint8_t *ptr = qdev_get_prop_ptr(dev, prop);
-    char *end;
-
-    if (str[0] != '0' || str[1] != 'x') {
-        return -EINVAL;
-    }
-
-    *ptr = strtoul(str, &end, 16);
-    if ((*end != '\0') || (end == str)) {
-        return -EINVAL;
-    }
-
-    return 0;
-}
-
 static int print_hex8(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
     uint8_t *ptr = qdev_get_prop_ptr(dev, prop);
@@ -215,7 +198,6 @@ static int print_hex8(DeviceState *dev, Property *prop, char *dest, size_t len)
 PropertyInfo qdev_prop_hex8 = {
     .name  = "uint8",
     .legacy_name  = "hex8",
-    .parse = parse_hex8,
     .print = print_hex8,
     .get   = get_uint8,
     .set   = set_uint8,
@@ -320,23 +302,6 @@ PropertyInfo qdev_prop_int32 = {
 
 /* --- 32bit hex value --- */
 
-static int parse_hex32(DeviceState *dev, Property *prop, const char *str)
-{
-    uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
-    char *end;
-
-    if (str[0] != '0' || str[1] != 'x') {
-        return -EINVAL;
-    }
-
-    *ptr = strtoul(str, &end, 16);
-    if ((*end != '\0') || (end == str)) {
-        return -EINVAL;
-    }
-
-    return 0;
-}
-
 static int print_hex32(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
     uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
@@ -346,7 +311,6 @@ static int print_hex32(DeviceState *dev, Property *prop, char *dest, size_t len)
 PropertyInfo qdev_prop_hex32 = {
     .name  = "uint32",
     .legacy_name  = "hex32",
-    .parse = parse_hex32,
     .print = print_hex32,
     .get   = get_uint32,
     .set   = set_uint32,
@@ -387,23 +351,6 @@ PropertyInfo qdev_prop_uint64 = {
 
 /* --- 64bit hex value --- */
 
-static int parse_hex64(DeviceState *dev, Property *prop, const char *str)
-{
-    uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
-    char *end;
-
-    if (str[0] != '0' || str[1] != 'x') {
-        return -EINVAL;
-    }
-
-    *ptr = strtoull(str, &end, 16);
-    if ((*end != '\0') || (end == str)) {
-        return -EINVAL;
-    }
-
-    return 0;
-}
-
 static int print_hex64(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
     uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
@@ -413,7 +360,6 @@ static int print_hex64(DeviceState *dev, Property *prop, char *dest, size_t len)
 PropertyInfo qdev_prop_hex64 = {
     .name  = "uint64",
     .legacy_name  = "hex64",
-    .parse = parse_hex64,
     .print = print_hex64,
     .get   = get_uint64,
     .set   = set_uint64,
-- 
1.8.4.2

  parent reply	other threads:[~2014-01-30 13:10 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-30 13:09 [Qemu-devel] [PATCH 00/12] qdev: cleanup legacy properties Paolo Bonzini
2014-01-30 13:09 ` [Qemu-devel] [PATCH 01/12] qapi: add size parser to StringInputVisitor Paolo Bonzini
2014-01-30 13:45   ` Eric Blake
2014-02-05 17:13   ` Andreas Färber
2014-02-05 17:18     ` Paolo Bonzini
2014-02-05 17:30       ` Eric Blake
2014-01-30 13:09 ` [Qemu-devel] [PATCH 02/12] qdev: sizes are now parsed by StringInputVisitor Paolo Bonzini
2014-01-30 13:46   ` Eric Blake
2014-01-30 13:09 ` Paolo Bonzini [this message]
2014-01-30 13:46   ` [Qemu-devel] [PATCH 03/12] qdev: remove legacy parsers for hex8/32/64 Eric Blake
2014-01-30 13:09 ` [Qemu-devel] [PATCH 04/12] qdev: legacy properties are now read-only Paolo Bonzini
2014-01-30 13:49   ` Eric Blake
2014-01-30 13:09 ` [Qemu-devel] [PATCH 05/12] qdev: legacy properties are just strings Paolo Bonzini
2014-01-30 13:52   ` Eric Blake
2014-01-30 13:09 ` [Qemu-devel] [PATCH 06/12] qdev: inline qdev_prop_parse Paolo Bonzini
2014-01-30 13:53   ` Eric Blake
2014-01-30 13:09 ` [Qemu-devel] [PATCH 07/12] qapi: add human mode to StringOutputVisitor Paolo Bonzini
2014-01-30 14:09   ` Eric Blake
2014-01-30 14:12     ` Paolo Bonzini
2014-01-30 14:20       ` Eric Blake
2014-02-10 17:57   ` Andreas Färber
2014-01-30 13:09 ` [Qemu-devel] [PATCH 08/12] qdev: use human mode in "info qtree" Paolo Bonzini
2014-01-30 15:01   ` Eric Blake
2014-01-30 13:09 ` [Qemu-devel] [PATCH 09/12] qdev: remove most legacy printers Paolo Bonzini
2014-01-30 15:03   ` Eric Blake
2014-01-30 13:09 ` [Qemu-devel] [PATCH 10/12] qdev: remove hex8/32/64 property types Paolo Bonzini
2014-01-30 15:17   ` Eric Blake
2014-01-30 13:09 ` [Qemu-devel] [PATCH 11/12] qdev: add enum property types to QAPI schema Paolo Bonzini
2014-01-30 15:22   ` Eric Blake
2014-01-31  8:05   ` Markus Armbruster
2014-01-31 11:26     ` Paolo Bonzini
2014-01-30 13:09 ` [Qemu-devel] [PATCH 12/12] qdev: use QAPI type names for properties Paolo Bonzini
2014-01-30 15:26   ` Eric Blake
2014-01-30 16:42 ` [Qemu-devel] [PATCH 13/12] qapi: refine human printing of sizes Paolo Bonzini
2014-01-30 20:16   ` Eric Blake
2014-02-05 11:10   ` Igor Mammedov
2014-02-05 11:12 ` [Qemu-devel] [PATCH 00/12] qdev: cleanup legacy properties Igor Mammedov
2014-02-05 16:36   ` Paolo Bonzini
2014-02-05 16:39     ` Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391087394-17914-4-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).