1. 25 11月, 2014 1 次提交
    • E
      dbus: fix arrays of bools · 96e0d677
      Eric Blake 提交于
      Commit 2aa167ca tried to fix the DBus interaction code to allow
      callers to use native types instead of 4-byte bools.  But in
      fixing the issue, I missed the case of an arrayref; Conrad Meyer
      shows the following valid complaint issued by clang:
      
        CC       util/libvirt_util_la-virdbus.lo
      util/virdbus.c:956:13: error: cast from 'bool *' to 'dbus_bool_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
                  GET_NEXT_VAL(dbus_bool_t, bool_val, bool, "%d");
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      util/virdbus.c:858:17: note: expanded from macro 'GET_NEXT_VAL'
                  x = (dbustype *)(*xptrptr + (*narrayptr - 1));              \
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
      
      But fixing that points out that we have NEVER supported arrayrefs
      of sub-int types (byte, i16, u16, and now bool).  Again, while raw
      types promote, arrays do not; so the macros HAVE to deal with both
      size possibilities rather than assuming that an arrayref uses the
      same sizing as the promoted raw type.
      
      Obviously, our testsuite wasn't covering as much as it should have.
      
      * src/util/virdbus.c (GET_NEXT_VAL): Also fix array cases.
      (SET_NEXT_VAL): Fix uses of sub-int arrays.
      * tests/virdbustest.c (testMessageArray, testMessageArrayRef):
      Test it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      96e0d677
  2. 19 11月, 2014 1 次提交
    • E
      virdbus: don't force users to pass int for bool values · 2aa167ca
      Eric Blake 提交于
      Use of an 'int' to represent a 'bool' value is confusing.  Just
      because dbus made the mistake of cementing their 4-byte wire
      format of dbus_bool_t into their API doesn't mean we have to
      repeat the mistake.  With a little bit of finesse, we can
      guarantee that we provide a large-enough value to the DBus
      code, while still copying only the relevant one-byte bool
      to the client code, and isolate the rest of our code base from
      the DBus stupidity.
      
      * src/util/virdbus.c (GET_NEXT_VAL): Add parameter.
      (virDBusMessageIterDecode): Adjust all clients.
      * src/util/virpolkit.c (virPolkitCheckAuth): Use nicer type.
      * tests/virdbustest.c (testMessageSimple, testMessageStruct):
      Test new behavior.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2aa167ca
  3. 15 11月, 2014 1 次提交
  4. 29 10月, 2014 1 次提交
    • E
      maint: avoid static zero init in core files · 39871fce
      Eric Blake 提交于
      C guarantees that static variables are zero-initialized.  Some older
      compilers (and also gcc -fno-zero-initialized-in-bss) create larger
      binaries if you explicitly zero-initialize a static variable.
      
      * src/libvirt.c: Fix initialization.
      * src/util/viralloc.c: Likewise.
      * src/util/virdbus.c: Likewise.
      * src/util/virevent.c: Likewise.
      * src/util/virfile.c (safezero): Likewise.
      * src/util/virlog.c: Likewise.
      * src/util/virnetlink.c: Likewise.
      * src/util/virthread.h (VIR_ONCE_GLOBAL_INIT): Likewise.
      * src/util/virprocess.c (virProcessGetStartTime): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      39871fce
  5. 24 9月, 2014 1 次提交
    • D
      Support passing dict by reference for dbus messages · 88a2dc1f
      Daniel P. Berrange 提交于
      Currently DBus dict values must be passed inline
      
         virDBusMessageEncode("a{ss}",
                              3,
                              "key1", "val1",
                              "key2", "val2",
                              "key3", "val3");
         virDBusMessageDecode("a{ss}",
                              3,
                              &key1, &val1,
                              &key2, &val2,
                              &key3, &val3);
      
      This allows them to be passed by reference
      
         const char **dictin = {
            "key1", "val1",
            "key2", "val2",
            "key3", "val3"
         };
         char **dictout;
         size_t ndictout;
      
         virDBusMessageEncode("a&{ss}",
                              ARRAY_CARDINALITY(dict) / 2,
                              dictin);
         virDBusMessageDecode("a&{ss}",
                              &ndictout,
                              &dictout);
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      88a2dc1f
  6. 05 9月, 2014 1 次提交
    • E
      maint: use consistent if-else braces in remaining spots · d194d6e7
      Eric Blake 提交于
      I'm about to add a syntax check that enforces our documented
      HACKING style of always using matching {} on if-else statements.
      
      This patch focuses on all remaining problems, where there weren't
      enough issues to warrant splitting it further.
      
      * src/remote/remote_driver.c (doRemoteOpen): Correct use of {}.
      * src/security/virt-aa-helper.c (vah_add_path, valid_path, main):
      Likewise.
      * src/rpc/virnetsocket.c (virNetSocketNewConnectLibSSH2):
      Likewise.
      * src/esx/esx_vi_types.c (esxVI_Type_FromString): Likewise.
      * src/uml/uml_driver.c (umlDomainDetachDevice): Likewise.
      * src/util/viralloc.c (virShrinkN): Likewise.
      * src/util/virbuffer.c (virBufferURIEncodeString): Likewise.
      * src/util/virdbus.c (virDBusCall): Likewise.
      * src/util/virnetdev.c (virNetDevValidateConfig): Likewise.
      * src/util/virnetdevvportprofile.c
      (virNetDevVPortProfileGetNthParent): Likewise.
      * src/util/virpci.c (virPCIDeviceIterDevices)
      (virPCIDeviceWaitForCleanup)
      (virPCIDeviceIsBehindSwitchLackingACS): Likewise.
      * src/util/virsocketaddr.c (virSocketAddrGetNumNetmaskBits):
      Likewise.
      * src/util/viruri.c (virURIParseParams): Likewise.
      * daemon/stream.c (daemonStreamHandleAbort): Likewise.
      * tests/testutils.c (virtTestResult): Likewise.
      * tests/cputest.c (cpuTestBaseline): Likewise.
      * tools/virsh-domain.c (cmdDomPMSuspend): Likewise.
      * tools/virsh-host.c (cmdNodeSuspend): Likewise.
      * src/esx/esx_vi_generator.py (Type.generate_typefromstring):
      Tweak generated code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d194d6e7
  7. 21 5月, 2014 2 次提交
  8. 06 5月, 2014 1 次提交
  9. 15 4月, 2014 1 次提交
    • J
      Fix virsystemdtest without SYSTEMD_DAEMON · 6077be46
      Ján Tomko 提交于
      Commit 48976981 fixed the build without dbus by only building
      the virSystemdPMSupportTarget with SYSTEMD_DAEMON.
      
      Introduce a virDBusMessageUnref wrapper for dbus_message_unref
      to let virsystemd.c build without dbus, while still allowing
      virsystemdtest to run without SYSTEM_DAEMON.
      6077be46
  10. 25 3月, 2014 1 次提交
  11. 21 3月, 2014 8 次提交
  12. 18 3月, 2014 1 次提交
  13. 04 3月, 2014 2 次提交
  14. 12 2月, 2014 1 次提交
  15. 19 12月, 2013 1 次提交
  16. 14 10月, 2013 3 次提交
  17. 26 9月, 2013 1 次提交
  18. 11 9月, 2013 1 次提交
  19. 19 8月, 2013 1 次提交
    • P
      virdbus: Add virDBusHasSystemBus() · 2398dd3d
      Peter Krempa 提交于
      Some systems may not use DBus in their system. Add a method to check if
      the system bus is available that doesn't print error messages so that
      code can later check for this condition and use an alternative approach.
      2398dd3d
  20. 30 7月, 2013 1 次提交
  21. 29 7月, 2013 1 次提交
    • E
      build: fix virdbus build on mingw · 61fac39e
      Eric Blake 提交于
      Mingw headers pollute the namespace.
      
        CC       libvirt_util_la-virdbus.lo
      ../../src/util/virdbus.c:1102:35: error: expected ';', ',' or ')' before 'struct'
                             const char *interface,
                                         ^
      
      * src/util/virdbus.c (virDBusCallMethod): Avoid 'interface'.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      61fac39e
  22. 24 7月, 2013 2 次提交
    • E
      dbus: work with older dbus · b551d740
      Eric Blake 提交于
      dbus 1.2.24 (on RHEL 6) lacks DBUS_TYPE_UNIX_FD; but as we aren't
      trying to pass one of those anyways, we can just drop support for
      it in our wrapper.  Solves this build error introduced in commit
      834c9c94:
      
        CC     libvirt_util_la-virdbus.lo
      util/virdbus.c:242: error: 'DBUS_TYPE_UNIX_FD' undeclared here (not in a function)
      
      * src/util/virdbus.c (virDBusBasicTypes): Drop support for unix fds.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b551d740
    • D
      Fix handling of DBus errors emitted by the bus itself · c64904b7
      Daniel P. Berrange 提交于
      Current code for handling dbus errors only works for errors
      received from the remote application itself. We must also
      handle errors emitted by the bus itself, for example, when
      it fails to spawn the target service.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c64904b7
  23. 23 7月, 2013 1 次提交
    • R
      Add virDBusMessage(Encode,Decode) stubs · ac26b2b0
      Roman Bogorodskiy 提交于
      Commit 834c9c94 introduced virDBusMessageEncode and
      virDBusMessageDecode functions, however corresponding stubs
      were not added to !WITH_DBUS section, therefore 'make check'
      started to fail when compiled w/out dbus support like that:
      
      Expected symbol virDBusMessageDecode is not in ELF library
      ac26b2b0
  24. 22 7月, 2013 1 次提交
    • D
      Introduce virDBusCallMethod & virDBusMessageRead methods · 834c9c94
      Daniel P. Berrange 提交于
      Doing DBus method calls using libdbus.so is tedious in the
      extreme. systemd developers came up with a nice high level
      API for DBus method calls (sd_bus_call_method). While
      systemd doesn't use libdbus.so, their API design can easily
      be ported to libdbus.so.
      
      This patch thus introduces methods virDBusCallMethod &
      virDBusMessageRead, which are based on the code used for
      sd_bus_call_method and sd_bus_message_read. This code in
      systemd is under the LGPLv2+, so we're license compatible.
      
      This code is probably pretty unintelligible unless you are
      familiar with the DBus type system. So I added some API
      docs trying to explain how to use them, as well as test
      cases to validate that I didn't screw up the adaptation
      from the original systemd code.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      834c9c94
  25. 14 1月, 2013 1 次提交
  26. 21 12月, 2012 3 次提交