1. 15 10月, 2019 1 次提交
  2. 10 9月, 2019 1 次提交
  3. 06 9月, 2019 1 次提交
  4. 16 4月, 2019 1 次提交
    • L
      util: eliminate duplicate function virDBusMessageRead · 687f5567
      Laine Stump 提交于
      When virDBusMessageRead() and virDBusMessageDecode were first added in
      commit 834c9c94, they were identical except that virDBusMessageRead()
      would unref the message after decoding it.
      
      This difference was eliminated later in commit dc7f3ffc after it
      became apparent that unref-ing the message so soon was never the right
      thing to do. The two identical functions remained though, with the
      tests and virDBus library itself calling the Decode variant, and all
      other users calling the Read variant.
      
      This patch eliminates the duplication, switching all users to
      virDBusMessageDecode (and moving the nice API documentation comment
      from the Read function up to the Decode function).
      Signed-off-by: NLaine Stump <laine@laine.org>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      687f5567
  5. 28 1月, 2019 1 次提交
    • M
      lib: Use more of VIR_STEAL_PTR() · 5772885d
      Michal Privoznik 提交于
      We have this very handy macro called VIR_STEAL_PTR() which steals
      one pointer into the other and sets the other to NULL. The
      following coccinelle patch was used to create this commit:
      
        @ rule1 @
        identifier a, b;
        @@
      
        - b = a;
          ...
        - a = NULL;
        + VIR_STEAL_PTR(b, a);
      
      Some places were clean up afterwards to make syntax-check happy
      (e.g. some curly braces were removed where the body become a one
      liner).
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      5772885d
  6. 14 12月, 2018 2 次提交
  7. 26 9月, 2018 4 次提交
  8. 24 9月, 2018 1 次提交
  9. 03 11月, 2017 1 次提交
    • A
      Remove backslash alignment attempts · 3e7db8d3
      Andrea Bolognani 提交于
      Right-aligning backslashes when defining macros or using complex
      commands in Makefiles looks cute, but as soon as any changes is
      required to the code you end up with either distractingly broken
      alignment or unnecessarily big diffs where most of the changes
      are just pushing all backslashes a few characters to one side.
      
      Generated using
      
        $ git grep -El '[[:blank:]][[:blank:]]\\$' | \
          grep -E '*\.([chx]|am|mk)$$' | \
          while read f; do \
            sed -Ei 's/[[:blank:]]*[[:blank:]]\\$/ \\/g' "$f"; \
          done
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      3e7db8d3
  10. 24 11月, 2016 1 次提交
  11. 11 2月, 2016 1 次提交
    • M
      dbus: Don't unref NULL messages · 862298a2
      Michal Privoznik 提交于
      Apparently we are not the only ones with dumb free functions
      because dbus_message_unref() does not accept NULL either. But if
      I were to vote, this one is even more evil. Instead of returning
      an error just like we do it immediately dereference any pointer
      passed and thus crash you app. Well done DBus!
      
        Program received signal SIGSEGV, Segmentation fault.
        [Switching to Thread 0x7f878ebda700 (LWP 31264)]
        0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
        (gdb) bt
        #0  0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
        #1  0x00007f87be3f004e in dbus_message_unref () from /usr/lib64/libdbus-1.so.3
        #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
        #3  0x00007f879761bd4d in qemuConnectCgroup (driver=0x7f87600a32a0, vm=0x7f87600c7550) at qemu/qemu_cgroup.c:909
        #4  0x00007f87976386b7 in qemuProcessReconnect (opaque=0x7f87600db840) at qemu/qemu_process.c:3386
        #5  0x00007f87bf6edfff in virThreadHelper (data=0x7f87600d5580) at util/virthread.c:206
        #6  0x00007f87bb602334 in start_thread (arg=0x7f878ebda700) at pthread_create.c:333
        #7  0x00007f87bb3481bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
        (gdb) frame 2
        #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
        228         dbus_message_unref(reply);
        (gdb) p reply
        $1 = (DBusMessage *) 0x0
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      862298a2
  12. 05 9月, 2015 1 次提交
    • J
      util: Avoid Coverity FORWARD_NULL · c78e1cfc
      John Ferlan 提交于
      Coverity claims it could be possible to call virDBusTypeStackFree with
      *stack == NULL and although the two API's that call it don't appear to
      allow that - I suppose it's better to be safe than sorry
      c78e1cfc
  13. 26 1月, 2015 2 次提交
    • D
      systemd: avoid string comparisons on dbus error messages · 2d8b59c0
      Daniel P. Berrange 提交于
      Add a virDBusErrorIsUnknownMethod helper so that callers
      don't need todo string comparisons themselves to detect
      standard error names.
      2d8b59c0
    • D
      systemd: fix build without dbus · d13b586a
      Daniel P. Berrange 提交于
      The virDBusMethodCall method has a DBusError as one of its
      parameters. If the caller wants to pass a non-NULL value
      for this, it immediately makes the calling code require
      DBus at build time. This has led to breakage of non-DBus
      builds several times. It is desirable that only the virdbus.c
      file should need WITH_DBUS conditionals, so we must ideally
      remove the DBusError parameter from the method.
      
      We can't simply raise a libvirt error, since the whole point
      of this parameter is to give the callers a way to check if
      the error is one they want to ignore, without having the logs
      polluted with an error message. So, we add a virErrorPtr
      parameter which the caller can then either ignore or raise
      using the new virReportErrorObject method.
      
      This new method is distinct from virSetError in that it
      ensures the logging hooks are run.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d13b586a
  14. 15 1月, 2015 1 次提交
    • D
      Add systemd/dtrace probes for DBus APIs · d83ce91f
      Daniel P. Berrange 提交于
      When debugging libvirt it is helpful to set probes around RPC
      calls. We already have probes for libvirt's native RPC layer,
      so it makes sense to add them for the DBus RPC layer too.
      d83ce91f
  15. 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
  16. 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
  17. 15 11月, 2014 1 次提交
  18. 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
  19. 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
  20. 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
  21. 21 5月, 2014 2 次提交
  22. 06 5月, 2014 1 次提交
  23. 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
  24. 25 3月, 2014 1 次提交
  25. 21 3月, 2014 8 次提交
  26. 18 3月, 2014 1 次提交
  27. 04 3月, 2014 1 次提交