1. 24 2月, 2017 4 次提交
    • M
      util/cutils: Clean up variable names around qemu_strtol() · 717adf96
      Markus Armbruster 提交于
      Name same things the same, different things differently.
      
      * qemu_strtol()'s parameter @nptr is called @p in
        check_strtox_error().  Rename the latter.
      
      * qemu_strtol()'s parameter @endptr is called @next in
        check_strtox_error().  Rename the latter.
      
      * qemu_strtol()'s variable @p is called @endptr in
        check_strtox_error().  Rename both to @ep.
      
      * qemu_strtol()'s variable @err is *negative* errno,
        check_strtox_error()'s parameter @err is *positive*.  Rename the
        latter to @libc_errno.
      
      Same for qemu_strtoul(), qemu_strtoi64(), qemu_strtou64(), of course.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1487708048-2131-8-git-send-email-armbru@redhat.com>
      717adf96
    • M
      util/cutils: Rename qemu_strtoll(), qemu_strtoull() · b30d1886
      Markus Armbruster 提交于
      The name qemu_strtoll() suggests conversion to long long, but it
      actually converts to int64_t.  Rename to qemu_strtoi64().
      
      The name qemu_strtoull() suggests conversion to unsigned long long,
      but it actually converts to uint64_t.  Rename to qemu_strtou64().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-Id: <1487708048-2131-7-git-send-email-armbru@redhat.com>
      b30d1886
    • M
      util/cutils: Rewrite documentation of qemu_strtol() & friends · 4295f879
      Markus Armbruster 提交于
      Fixes the following documentation bugs:
      
      * Fails to document that null @nptr is safe.
      
      * Fails to document that we return -EINVAL when no conversion could be
        performed (commit 47d4be12).
      
      * Confuses long long with int64_t, and unsigned long long with
        uint64_t.
      
      * Claims the unsigned conversions can underflow.  They can't.
      
      While there, mark problematic assumptions that int64_t is long long,
      and uint64_t is unsigned long long with FIXME comments.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-Id: <1487708048-2131-6-git-send-email-armbru@redhat.com>
      4295f879
    • M
      option: Assert value string isn't null · 8ee8409e
      Markus Armbruster 提交于
      Plenty of code relies on QemuOpt member @str not being null, including
      qemu_opts_print(), qemu_opts_to_qdict(), and callbacks passed to
      qemu_opt_foreach().
      
      Begs the question whether it can be null.  Only opt_set() creates
      QemuOpt.  It sets member @str to its argument @value.  Passing null
      for @value would plant a time bomb.  Callers:
      
      * opts_do_parse() can't pass null.
      
      * qemu_opt_set() passes its argument @value.  Callers:
      
        - qemu_opts_from_qdict_1() can't pass null
      
        - qemu_opts_set() passes its argument @value, but none of its
          callers pass null.
      
        - Many more outside qemu-option.c, but they shouldn't pass null,
          either.
      
      Assert member @str isn't null, so that misuse is caught right away.
      
      Simplify parse_option_bool(), parse_option_number() and
      parse_option_size() accordingly.  Best viewed with whitespace changes
      ignored.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1487708048-2131-3-git-send-email-armbru@redhat.com>
      8ee8409e
  2. 21 2月, 2017 14 次提交
  3. 14 2月, 2017 1 次提交
  4. 10 2月, 2017 1 次提交
  5. 31 1月, 2017 2 次提交
  6. 26 1月, 2017 1 次提交
  7. 25 1月, 2017 4 次提交
  8. 23 1月, 2017 2 次提交
  9. 20 1月, 2017 2 次提交
  10. 17 1月, 2017 2 次提交
    • C
      qemu-thread: fix qemu_thread_set_name() race in qemu_thread_create() · 2f75bd73
      Caoxinhua 提交于
      QEMU will crash with the follow backtrace if the new created thread exited before
      we call qemu_thread_set_name() for it.
      
        (gdb) bt
        #0 0x00007f9a68b095d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
        #1 0x00007f9a68b0acc8 in __GI_abort () at abort.c:90
        #2 0x00007f9a69cda389 in PAT_abort () from /usr/lib64/libuvpuserhotfix.so
        #3 0x00007f9a69cdda0d in patchIllInsHandler () from /usr/lib64/libuvpuserhotfix.so
        #4 <signal handler called>
        #5 pthread_setname_np (th=140298470549248, name=name@entry=0x8cc74a "io-task-worker") at ../nptl/sysdeps/unix/sysv/linux/pthread_setname.c:49
        #6 0x00000000007f5f20 in qemu_thread_set_name (thread=thread@entry=0x7ffd2ac09680, name=name@entry=0x8cc74a "io-task-worker") at util/qemu_thread_posix.c:459
        #7 0x00000000007f679e in qemu_thread_create (thread=thread@entry=0x7ffd2ac09680, name=name@entry=0x8cc74a "io-task-worker",start_routine=start_routine@entry=0x7c1300 <qio_task_thread_worker>, arg=arg@entry=0x7f99b8001720, mode=mode@entry=1) at util/qemu_thread_posix.c:498
        #8 0x00000000007c15b6 in qio_task_run_in_thread (task=task@entry=0x7f99b80033d0, worker=worker@entry=0x7bd920 <qio_channel_socket_connect_worker>, opaque=0x7f99b8003370, destroy=0x7c6220 <qapi_free_SocketAddress>) at io/task.c:133
        #9 0x00000000007bda04 in qio_channel_socket_connect_async (ioc=0x7f99b80014c0, addr=0x37235d0, callback=callback@entry=0x54ad00 <qemu_chr_socket_connected>, opaque=opaque@entry=0x38118b0, destroy=destroy@entry=0x0) at io/channel_socket.c:191
        #10 0x00000000005487f6 in socket_reconnect_timeout (opaque=0x38118b0) at qemu_char.c:4402
        #11 0x00007f9a6a1533b3 in g_timeout_dispatch () from /usr/lib64/libglib-2.0.so.0
        #12 0x00007f9a6a15299a in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
        #13 0x0000000000747386 in glib_pollfds_poll () at main_loop.c:227
        #14 0x0000000000747424 in os_host_main_loop_wait (timeout=404000000) at main_loop.c:272
        #15 0x0000000000747575 in main_loop_wait (nonblocking=nonblocking@entry=0) at main_loop.c:520
        #16 0x0000000000557d31 in main_loop () at vl.c:2170
        #17 0x000000000041c8b7 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:5083
      
      Let's detach the new thread after calling qemu_thread_set_name().
      Signed-off-by: NCaoxinhua <caoxinhua@huawei.com>
      Signed-off-by: Nzhanghailiang <zhang.zhanghailiang@huawei.com>
      Message-Id: <1483493521-9604-1-git-send-email-zhang.zhanghailiang@huawei.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2f75bd73
    • P
      event_notifier: cleanups around event_notifier_set_handler · d6da1e9e
      Paolo Bonzini 提交于
      Remove the useless is_external argument.  Since the iohandler
      AioContext is never used for block devices, aio_disable_external
      is never called on it.  This lets us remove stubs/iohandler.c.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      d6da1e9e
  11. 16 1月, 2017 2 次提交
  12. 09 1月, 2017 1 次提交
  13. 04 1月, 2017 1 次提交
  14. 29 11月, 2016 1 次提交
    • M
      hbitmap: Fix shifts of constants by granularity · 6725f887
      Max Reitz 提交于
      An hbitmap's granularity may be anything from 0 to 63, so when shifting
      constants by its value, they should not be plain ints.
      
      Even having changed the types, hbitmap_serialization_granularity() still
      tries to shift 64 to the right by the granularity. This operation is
      undefined if the granularity is greater than 57. Adding an assertion is
      fine for now, because serializing is done only in tests so far, but this
      means that only bitmaps with a granularity below 58 can be serialized
      and we should thus add a hbitmap_is_serializable() function later.
      
      One of the two places touched in this patch uses
      QEMU_ALIGN_UP(x, 1 << y). We can use ROUND_UP() there, since the second
      parameter is obviously a power of two.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-Id: <20161115224732.1334-1-mreitz@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NFam Zheng <famz@redhat.com>
      6725f887
  15. 22 11月, 2016 1 次提交
  16. 01 11月, 2016 1 次提交
    • P
      qemu-error: remove dependency of stubs on monitor · 397d30e9
      Paolo Bonzini 提交于
      Leave the implementation of error_vprintf and error_vprintf_unless_qmp
      (the latter now trivially wrapped by error_printf_unless_qmp) to
      libqemustub.a and monitor.c.  This has two advantages: it lets us
      remove the monitor_printf and monitor_vprintf stubs, and it lets
      tests provide a different implementation of the functions that uses
      g_test_message.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <1477326663-67817-2-git-send-email-pbonzini@redhat.com>
      397d30e9