qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 1590d2: qom: strdup() target property name on


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 1590d2: qom: strdup() target property name on object_prope...
Date: Mon, 22 Jun 2015 07:00:07 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 1590d266d96b3f9b42443d6388dfc38f527ac2d8
      
https://github.com/qemu/qemu/commit/1590d266d96b3f9b42443d6388dfc38f527ac2d8
  Author: Eduardo Habkost <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M qom/object.c

  Log Message:
  -----------
  qom: strdup() target property name on object_property_add_alias()

With this, object_property_add_alias() callers can safely free the
target property name, like what already happens with the 'name' argument
to all object_property_add*() functions.

Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 6bc5cf92c0ab0085ba9a6e0cebcf5a544f416ca7
      
https://github.com/qemu/qemu/commit/6bc5cf92c0ab0085ba9a6e0cebcf5a544f416ca7
  Author: Eduardo Habkost <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M hw/core/qdev.c

  Log Message:
  -----------
  qdev: Free property names after registering gpio aliases

Now that object_property_add_alias() strdup()s target_name, we can free
the property names in qdev_pass_gpios().

Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 53f77e4562f85ccf82c8831a4448e9aefb538837
      
https://github.com/qemu/qemu/commit/53f77e4562f85ccf82c8831a4448e9aefb538837
  Author: Andreas Färber <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M tests/ahci-test.c
    M tests/e1000-test.c
    M tests/eepro100-test.c
    M tests/endianness-test.c
    M tests/pc-cpu-test.c
    M tests/qom-test.c

  Log Message:
  -----------
  tests: Use qtest_add_data_func() consistently

Replace uses of g_test_add_data_func() for QTest test cases.

It is still valid to use it for any non-QTest test cases,
which are not run for multiple target binaries.

Suggested-by: John Snow <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: ff5397bc72a1716bb34302dd470343ebee7d6bf2
      
https://github.com/qemu/qemu/commit/ff5397bc72a1716bb34302dd470343ebee7d6bf2
  Author: Martin Cerveny <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M scripts/qmp/qom-tree

  Log Message:
  -----------
  scripts: Add support for path as argument of qom-tree

Add processing of optional argument path as "tree base".

Signed-off-by: Martin Cerveny <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: b1028b4e8683740cd257a9b77577734664e61511
      
https://github.com/qemu/qemu/commit/b1028b4e8683740cd257a9b77577734664e61511
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M backends/hostmem.c

  Log Message:
  -----------
  backends: Fix typename of 'policy' enum property in hostmem obj

The 'policy' property was being registered with a typename of
'str', but it is in fact an enum of the 'HostMemPolicy' type.

Signed-off-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: b9174d4f250cacb43b7cd9e07cf9f86818d62afd
      
https://github.com/qemu/qemu/commit/b9174d4f250cacb43b7cd9e07cf9f86818d62afd
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M qemu-options.hx

  Log Message:
  -----------
  doc: Document user creatable object types in help text

The QEMU help for -object is essentially useless, just giving users
the generic syntax. Move it down into its own section and introduce
a nested table where each user creatable object can be documented.
The existing memory-backend-file, rng-random and rng-egd object
types are documented.

Signed-off-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: f08f9271bfe3f19a5eb3d7a2f48532065304d5c8
      
https://github.com/qemu/qemu/commit/f08f9271bfe3f19a5eb3d7a2f48532065304d5c8
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M vl.c

  Log Message:
  -----------
  vl: Create (most) objects before creating chardev backends

Some types of object must be created before chardevs, other types of
object must be created after chardevs. As such there is no option but
to create objects in two phases.

This takes the decision to create as many object types as possible
right away before anyother backends are created, and only delay
creation of those few which have an explicit dependency on the
chardevs. Hopefully the set which need delaying will remain small
over time.

Signed-off-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: bc2256c4ae86308a1521c89456b599d441119418
      
https://github.com/qemu/qemu/commit/bc2256c4ae86308a1521c89456b599d441119418
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M include/qom/object.h
    M iothread.c
    M numa.c
    M qmp.c
    M qom/object.c

  Log Message:
  -----------
  qom: Add helper function for getting user objects root

Add object_get_objects_root() function which is a convenience for
obtaining the Object * located at /objects in the object
composition tree. Convert existing code over to use the new
API where appropriate.

Signed-off-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: a31bdae5a76ecc060c1eb8a66be1896072c1e8b2
      
https://github.com/qemu/qemu/commit/a31bdae5a76ecc060c1eb8a66be1896072c1e8b2
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M include/qemu/compiler.h
    M include/qom/object.h
    M qom/object.c
    M tests/.gitignore
    M tests/Makefile
    A tests/check-qom-proplist.c

  Log Message:
  -----------
  qom: Add object_new_with_props() / object_new_withpropv() helpers

It is reasonably common to want to create an object, set a
number of properties, register it in the hierarchy and then
mark it as complete (if a user creatable type). This requires
quite a lot of error prone, verbose, boilerplate code to achieve.

First a pair of functions object_set_props() / object_set_propv()
are added which allow for a list of objects to be set in
one single API call.

Then object_new_with_props() / object_new_with_propv() constructors
are added which simplify the sequence of calls to create an
object, populate properties, register in the object composition
tree and mark the object complete, into a single method call.

Usage would be:

   Error *err = NULL;
   Object *obj;
   obj = object_new_with_propv(TYPE_MEMORY_BACKEND_FILE,
                         object_get_objects_root(),
                         "hostmem0",
                         &err,
                         "share", "yes",
                         "mem-path", "/dev/shm/somefile",
                         "prealloc", "yes",
                         "size", "1048576",
                         NULL);

Note all property values are passed in string form and will
be parsed into their required data types, using normal QOM
semantics for parsing from string format.

Signed-off-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 2e4450ff432daef524cb3557fca68a3b7b5c7823
      
https://github.com/qemu/qemu/commit/2e4450ff432daef524cb3557fca68a3b7b5c7823
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M include/hw/qdev-core.h
    M include/qapi/util.h
    M include/qapi/visitor-impl.h
    M include/qapi/visitor.h
    M include/qom/object.h
    M qapi/qapi-dealloc-visitor.c
    M qapi/qapi-util.c
    M qapi/qapi-visit-core.c
    M qom/object.c
    M scripts/qapi-types.py

  Log Message:
  -----------
  qom: Make enum string tables const-correct

The enum string table parameters in various QOM/QAPI methods
are declared 'const char *strings[]'. This results in const
warnings if passed a variable that was declared as

   static const char * const strings[] = { .... };

Add the extra const annotation to the parameters, since
neither the string elements, nor the array itself should
ever be modified.

Signed-off-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: a8e3fbedc827f992657f5670212e854f62ec12ad
      
https://github.com/qemu/qemu/commit/a8e3fbedc827f992657f5670212e854f62ec12ad
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M include/qom/object.h
    M qom/object.c
    M tests/check-qom-proplist.c

  Log Message:
  -----------
  qom: Add an object_property_add_enum() helper function

A QOM property can be parsed as enum using the visit_type_enum()
helper function, but this forces callers to use the more complex
generic object_property_add() method when registering it. It
also requires that users of that object have access to the
string map when they want to read the property value.

This patch introduces a specialized object_property_add_enum()
method which simplifies the use of enum properties, so the
setters/getters directly get passed the int value.

  typedef enum {
     MYDEV_TYPE_FROG,
     MYDEV_TYPE_ALLIGATOR,
     MYDEV_TYPE_PLATYPUS,

     MYDEV_TYPE_LAST
  } MyDevType;

Then provide a table of enum <-> string mappings

  static const char *const mydevtypemap[MYDEV_TYPE_LAST + 1] = {
     [MYDEV_TYPE_FROG] = "frog",
     [MYDEV_TYPE_ALLIGATOR] = "alligator",
     [MYDEV_TYPE_PLATYPUS] = "platypus",
     [MYDEV_TYPE_LAST] = NULL,
  };

Assuming an object struct of

   typedef struct {
      Object parent_obj;
      MyDevType devtype;
      ...other fields...
   } MyDev;

The property can then be registered as follows:

   static int mydev_prop_get_devtype(Object *obj,
                               Error **errp G_GNUC_UNUSED)
   {
       MyDev *dev = MYDEV(obj);
  return dev->devtype;
   }

   static void mydev_prop_set_devtype(Object *obj,
                                int value,
                                Error **errp G_GNUC_UNUSED)
   {
       MyDev *dev = MYDEV(obj);
  dev->devtype = value;
   }

   object_property_add_enum(obj, "devtype",
                      mydevtypemap, "MyDevType",
                      mydev_prop_get_devtype,
                      mydev_prop_set_devtype,
                      NULL);

Note there is no need to check the range of 'value' in
the setter, because the string->enum conversion code will
have already done that and reported an error as required.

Signed-off-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: a3590dacce94519c1747d8bf423744c6bb7d9941
      
https://github.com/qemu/qemu/commit/a3590dacce94519c1747d8bf423744c6bb7d9941
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M backends/hostmem.c
    M include/qom/object.h
    M numa.c
    M qom/object.c
    M tests/check-qom-proplist.c

  Log Message:
  -----------
  qom: Don't pass string table to object_get_enum() function

Now that properties can be explicitly registered as an enum
type, there is no need to pass the string table to the
object_get_enum() function. The object property registration
already has a pointer to the string table.

In changing this method signature, the hostmem backend object
has to be converted to use the new enum property registration
code, which simplifies it somewhat.

Signed-off-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 0210afe6690be045cb849b2f16bffabda575a9bf
      
https://github.com/qemu/qemu/commit/0210afe6690be045cb849b2f16bffabda575a9bf
  Author: Markus Armbruster <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M hw/core/qdev.c
    M include/hw/qdev-core.h

  Log Message:
  -----------
  qdev: Deprecated qdev_init() is finally unused, drop

qdev_init() is a wrapper around setting property "realized" to true,
plus error handling that passes errors to qerror_report_err().
qerror_report_err() is a transitional interface to help with
converting existing monitor commands to QMP.  It should not be used
elsewhere.

All code has been modernized to avoid qdev_init() and its
inappropriate error handling.  We can finally drop it.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: daeba9699d41ad79e2f3d34acea9c85c5d67a2ac
      
https://github.com/qemu/qemu/commit/daeba9699d41ad79e2f3d34acea9c85c5d67a2ac
  Author: Markus Armbruster <address@hidden>
  Date:   2015-06-19 (Fri, 19 Jun 2015)

  Changed paths:
    M include/hw/qdev-core.h

  Log Message:
  -----------
  qdev: Un-deprecate qdev_init_nofail()

It's a perfectly sensible helper function.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 0a3346f5dea0a679322df804e1e78d7c10d12a9f
      
https://github.com/qemu/qemu/commit/0a3346f5dea0a679322df804e1e78d7c10d12a9f
  Author: Peter Maydell <address@hidden>
  Date:   2015-06-22 (Mon, 22 Jun 2015)

  Changed paths:
    M backends/hostmem.c
    M hw/core/qdev.c
    M include/hw/qdev-core.h
    M include/qapi/util.h
    M include/qapi/visitor-impl.h
    M include/qapi/visitor.h
    M include/qemu/compiler.h
    M include/qom/object.h
    M iothread.c
    M numa.c
    M qapi/qapi-dealloc-visitor.c
    M qapi/qapi-util.c
    M qapi/qapi-visit-core.c
    M qemu-options.hx
    M qmp.c
    M qom/object.c
    M scripts/qapi-types.py
    M scripts/qmp/qom-tree
    M tests/.gitignore
    M tests/Makefile
    M tests/ahci-test.c
    A tests/check-qom-proplist.c
    M tests/e1000-test.c
    M tests/eepro100-test.c
    M tests/endianness-test.c
    M tests/pc-cpu-test.c
    M tests/qom-test.c
    M vl.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' 
into staging

QOM infrastructure fixes and device conversions

* Changes to name string ownership for alias properties
* Improvements around enum properties
* Cleanups around -object handling
* New helper functions
* Cleanups of qdev init helper functions
* Add path argument to qom-tree script
* QTest cleanup to use new qtest_add_data_func() consistently

# gpg: Signature made Fri Jun 19 18:14:38 2015 BST using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <address@hidden>"
# gpg:                 aka "Andreas Färber <address@hidden>"

* remotes/afaerber/tags/qom-devices-for-peter:
  qdev: Un-deprecate qdev_init_nofail()
  qdev: Deprecated qdev_init() is finally unused, drop
  qom: Don't pass string table to object_get_enum() function
  qom: Add an object_property_add_enum() helper function
  qom: Make enum string tables const-correct
  qom: Add object_new_with_props() / object_new_withpropv() helpers
  qom: Add helper function for getting user objects root
  vl: Create (most) objects before creating chardev backends
  doc: Document user creatable object types in help text
  backends: Fix typename of 'policy' enum property in hostmem obj
  scripts: Add support for path as argument of qom-tree
  tests: Use qtest_add_data_func() consistently
  qdev: Free property names after registering gpio aliases
  qom: strdup() target property name on object_property_add_alias()

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/cb4e0f9ddf7d...0a3346f5dea0

reply via email to

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