qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 3/6] qdev/prop: unstatic and rename prop_ptr()
Date: Mon, 13 Jul 2009 11:36:02 +0200	[thread overview]
Message-ID: <1247477765-17026-4-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1247477765-17026-1-git-send-email-kraxel@redhat.com>


Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/qdev-properties.c |   24 ++++++++++++------------
 hw/qdev.h            |    1 +
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index abd4b57..3c31e31 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -1,6 +1,6 @@
 #include "qdev.h"
 
-static void *prop_ptr(DeviceState *dev, Property *prop)
+void *qdev_get_prop_ptr(DeviceState *dev, Property *prop)
 {
     void *ptr = dev;
     ptr += prop->offset;
@@ -11,7 +11,7 @@ static void *prop_ptr(DeviceState *dev, Property *prop)
 
 static int parse_uint16(DeviceState *dev, Property *prop, const char *str)
 {
-    uint16_t *ptr = prop_ptr(dev, prop);
+    uint16_t *ptr = qdev_get_prop_ptr(dev, prop);
     const char *fmt;
 
     /* accept both hex and decimal */
@@ -23,7 +23,7 @@ static int parse_uint16(DeviceState *dev, Property *prop, const char *str)
 
 static int print_uint16(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
-    uint16_t *ptr = prop_ptr(dev, prop);
+    uint16_t *ptr = qdev_get_prop_ptr(dev, prop);
     return snprintf(dest, len, "%" PRIu16, *ptr);
 }
 
@@ -38,7 +38,7 @@ PropertyInfo qdev_prop_uint16 = {
 
 static int parse_uint32(DeviceState *dev, Property *prop, const char *str)
 {
-    uint32_t *ptr = prop_ptr(dev, prop);
+    uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
     const char *fmt;
 
     /* accept both hex and decimal */
@@ -50,7 +50,7 @@ static int parse_uint32(DeviceState *dev, Property *prop, const char *str)
 
 static int print_uint32(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
-    uint32_t *ptr = prop_ptr(dev, prop);
+    uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
     return snprintf(dest, len, "%" PRIu32, *ptr);
 }
 
@@ -65,7 +65,7 @@ PropertyInfo qdev_prop_uint32 = {
 
 static int parse_hex32(DeviceState *dev, Property *prop, const char *str)
 {
-    uint32_t *ptr = prop_ptr(dev, prop);
+    uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
 
     if (sscanf(str, "%" PRIx32, ptr) != 1)
         return -1;
@@ -74,7 +74,7 @@ static int parse_hex32(DeviceState *dev, Property *prop, const char *str)
 
 static int print_hex32(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
-    uint32_t *ptr = prop_ptr(dev, prop);
+    uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
     return snprintf(dest, len, "0x%" PRIx32, *ptr);
 }
 
@@ -89,7 +89,7 @@ PropertyInfo qdev_prop_hex32 = {
 
 static int print_ptr(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
-    void **ptr = prop_ptr(dev, prop);
+    void **ptr = qdev_get_prop_ptr(dev, prop);
     return snprintf(dest, len, "<%p>", *ptr);
 }
 
@@ -108,7 +108,7 @@ PropertyInfo qdev_prop_ptr = {
  */
 static int parse_mac(DeviceState *dev, Property *prop, const char *str)
 {
-    uint8_t *mac = prop_ptr(dev, prop);
+    uint8_t *mac = qdev_get_prop_ptr(dev, prop);
     int i, pos;
     char *p;
 
@@ -128,7 +128,7 @@ static int parse_mac(DeviceState *dev, Property *prop, const char *str)
 
 static int print_mac(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
-    uint8_t *mac = prop_ptr(dev, prop);
+    uint8_t *mac = qdev_get_prop_ptr(dev, prop);
     return snprintf(dest, len, "%02x:%02x:%02x:%02x:%02x:%02x",
                     mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
 }
@@ -205,7 +205,7 @@ int qdev_prop_set(DeviceState *dev, const char *name, void *src, size_t size)
                 dev->info->name, name, prop->info->size, size);
         return -1;
     }
-    dst = prop_ptr(dev, prop);
+    dst = qdev_get_prop_ptr(dev, prop);
     memcpy(dst, src, size);
     return 0;
 }
@@ -233,7 +233,7 @@ void qdev_prop_set_defaults(DeviceState *dev, Property *props)
         return;
     while (props->name) {
         if (props->defval) {
-            dst = prop_ptr(dev, props);
+            dst = qdev_get_prop_ptr(dev, props);
             memcpy(dst, props->defval, props->info->size);
         }
         props++;
diff --git a/hw/qdev.h b/hw/qdev.h
index d7f51fb..6b35961 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -135,6 +135,7 @@ extern PropertyInfo qdev_prop_ptr;
 extern PropertyInfo qdev_prop_mac;
 
 /* Set properties between creation and init.  */
+void *qdev_get_prop_ptr(DeviceState *dev, Property *prop);
 int qdev_prop_parse(DeviceState *dev, const char *name, const char *value);
 int qdev_prop_set(DeviceState *dev, const char *name, void *src, size_t size);
 int qdev_prop_set_uint16(DeviceState *dev, const char *name, uint16_t value);
-- 
1.6.2.5

  parent reply	other threads:[~2009-07-13  9:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-13  9:35 [Qemu-devel] [PATCH 0/6] qdev: property fixups Gerd Hoffmann
2009-07-13  9:36 ` [Qemu-devel] [PATCH 1/6] qdev/prop: make uint32 accept both hex and decimal Gerd Hoffmann
2009-07-13  9:36 ` [Qemu-devel] [PATCH 2/6] qdev/prop: add 16bit integer type Gerd Hoffmann
2009-07-13  9:36 ` Gerd Hoffmann [this message]
2009-07-13  9:36 ` [Qemu-devel] [PATCH 4/6] qdev/prop: add property for target_phys_addr_t Gerd Hoffmann
2009-07-13  9:36 ` [Qemu-devel] [PATCH 5/6] qdev/prop: convert m48t59 Gerd Hoffmann
2009-07-13  9:36 ` [Qemu-devel] [PATCH 6/6] qdev/prop: convert tcx Gerd Hoffmann

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=1247477765-17026-4-git-send-email-kraxel@redhat.com \
    --to=kraxel@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).