1. 05 2月, 2016 1 次提交
    • P
      qga: Clean up includes · 4459bf38
      Peter Maydell 提交于
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1454089805-5470-9-git-send-email-peter.maydell@linaro.org
      4459bf38
  2. 10 9月, 2015 3 次提交
    • M
      error: On abort, report where the error was created · 1e9b65bb
      Markus Armbruster 提交于
      This is particularly useful when we abort in error_propagate(),
      because there the stack backtrace doesn't lead to where the error was
      created.  Looks like this:
      
          Unexpected error in parse_block_error_action() at .../qemu/blockdev.c:322:
          qemu-system-x86_64: -drive if=none,werror=foo: 'foo' invalid write error action
          Aborted (core dumped)
      
      Note: to get this example output, I monkey-patched drive_new() to pass
      &error_abort to blockdev_init().
      
      To keep the error handling boiler plate from growing even more, all
      error_setFOO() become macros expanding into error_setFOO_internal()
      with additional __FILE__, __LINE__, __func__ arguments.  Not exactly
      pretty, but it works.
      
      The macro trickery breaks down when you take the address of an
      error_setFOO().  Fortunately, we do that in just one place: qemu-ga's
      Windows VSS provider and requester DLL wants to call
      error_setg_win32() through a function pointer "to avoid linking glib
      to the DLL".  Use error_setg_win32_internal() there.  The use of the
      function pointer is already wrapped in a macro, so the churn isn't
      bad.
      
      Code size increases by some 35KiB for me (0.7%).  Tolerable.  Could be
      less if we passed relative rather than absolute source file names to
      the compiler, or forwent reporting __func__.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Acked-by: NLaszlo Ersek <lersek@redhat.com>
      1e9b65bb
    • M
      qga/vss-win32: Document the DLL requires non-null errp · 08e64640
      Markus Armbruster 提交于
      requester.cpp uses this pattern to receive an error and pass it on to
      the caller (err_is_set() macro peeled off for clarity):
      
          ... code that may set errset->errp ...
          if (errset->errp && *errset->errp) {
              ... handle error ...
          }
      
      This breaks when errset->errp is null.  As far as I can tell, it
      currently isn't, so this is merely fragile, not actually broken.
      
      The robust way to do this is to receive the error in a local variable,
      then propagate it up, like this:
      
          Error *err = NULL;
      
          ... code that may set err ...
          if (err)
              ... handle error ...
              error_propagate(errset->errp, err);
          }
      
      See also commit 5e54769c, 0f230bf7, a903f40c.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      08e64640
    • M
      qga: Clean up unnecessarily dirty casts · e7cf59e8
      Markus Armbruster 提交于
      qga_vss_fsfreeze() casts error_set_win32() from
      
          void (*)(Error **, int, ErrorClass, const char *, ...)
      
      to
      
          void (*)(void **, int, int, const char *, ...)
      
      The result is later called.  Since the two types are not compatible,
      the call is undefined behavior.  It works in practice anyway.
      
      However, there's no real need for trickery here.  Clean it up as
      follows:
      
      * Declare struct Error, and fix the first parameter.
      
      * Switch to error_setg_win32().  This gets rid of the troublesome
        ErrorClass parameter.  Requires converting error_setg_win32() from
        macro to function, but that's trivially easy, because this is the
        only user of error_set_win32().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      e7cf59e8
  3. 09 5月, 2014 1 次提交
  4. 10 9月, 2013 2 次提交