1. 13 10月, 2016 1 次提交
    • D
      ui: remove misleading comment from vnc_init_state · ecccaea2
      Daniel P. Berrange 提交于
      The last line in vnc_init_state() says
      
           /* vs might be free()ed here */
      
      This was added in
      
        commit 198a0039
        Author: Gerd Hoffmann <kraxel@redhat.com>
        Date:   Tue Jun 16 14:19:48 2009 +0200
      
          vnc: rework VncState release workflow.
      
      because the preceeding 'vnc_update_client()' could indeed
      release the VncState instance.
      
      The call to vnc_update_client() was removed not long after
      though in
      
        commit 1fc62412
        Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
        Date:   Mon Aug 3 10:54:32 2009 +0100
      
          single vnc server surface
      
      and so the comment has been wrong ever since
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-id: 1475163940-26094-2-git-send-email-berrange@redhat.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      ecccaea2
  2. 13 9月, 2016 1 次提交
    • G
      vnc: fix qemu crash because of SIGSEGV · 3e10c3ec
      Gonglei 提交于
      The backtrace is:
      
      0x00007f0b75cdf880 in pixman_image_get_stride () from /lib64/libpixman-1.so.0
      0x00007f0b77bcb3cf in vnc_server_fb_stride (vd=0x7f0b7a1a2bb0) at ui/vnc.c:680
      vnc_dpy_copy (dcl=0x7f0b7a1a2c00, src_x=224, src_y=263, dst_x=319, dst_y=363, w=1, h=1) at ui/vnc.c:915
      0x00007f0b77bbcc35 in dpy_gfx_copy (con=0x7f0b7a146210, src_x=src_x@entry=224, src_y=src_y@entry=263, dst_x=dst_x@entry=319,
      dst_y=dst_y@entry=363, w=1, h=1) at ui/console.c:1575
      0x00007f0b77bbda4e in qemu_console_copy (con=<optimized out>, src_x=src_x@entry=224, src_y=src_y@entry=263, dst_x=dst_x@entry=319,
      dst_y=dst_y@entry=363, w=<optimized out>, h=<optimized out>) at ui/console.c:2111
      0x00007f0b77ac0980 in cirrus_do_copy (h=<optimized out>, w=<optimized out>, src=<optimized out>, dst=<optimized out>, s=0x7f0b7b086090) at hw/display/cirrus_vga.c:774
      cirrus_bitblt_videotovideo_copy (s=0x7f0b7b086090) at hw/display/cirrus_vga.c:793
      cirrus_bitblt_videotovideo (s=0x7f0b7b086090) at hw/display/cirrus_vga.c:915
      cirrus_bitblt_start (s=0x7f0b7b086090) at hw/display/cirrus_vga.c:1056
      0x00007f0b77965cfb in memory_region_write_accessor (mr=0x7f0b7b096e40, addr=320, value=<optimized out>, size=1, shift=<optimized out>,mask=<optimized out>, attrs=...) at /root/rpmbuild/BUILD/master/qemu/memory.c:525
      0x00007f0b77963f59 in access_with_adjusted_size (addr=addr@entry=320, value=value@entry=0x7f0b69a268d8, size=size@entry=4,
      access_size_min=<optimized out>, access_size_max=<optimized out>, access=access@entry=0x7f0b77965c80 <memory_region_write_accessor>,
      mr=mr@entry=0x7f0b7b096e40, attrs=attrs@entry=...) at /root/rpmbuild/BUILD/master/qemu/memory.c:591
      0x00007f0b77968315 in memory_region_dispatch_write (mr=mr@entry=0x7f0b7b096e40, addr=addr@entry=320, data=18446744073709551362,
      size=size@entry=4, attrs=attrs@entry=...) at /root/rpmbuild/BUILD/master/qemu/memory.c:1262
      0x00007f0b779256a9 in address_space_write_continue (mr=0x7f0b7b096e40, l=4, addr1=320, len=4, buf=0x7f0b77713028 "\002\377\377\377",
      attrs=..., addr=4273930560, as=0x7f0b7827d280 <address_space_memory>) at /root/rpmbuild/BUILD/master/qemu/exec.c:2544
      address_space_write (as=<optimized out>, addr=<optimized out>, attrs=..., buf=<optimized out>, len=<optimized out>) at /root/rpmbuild/BUILD/master/qemu/exec.c:2601
      0x00007f0b77925c1d in address_space_rw (as=<optimized out>, addr=<optimized out>, attrs=..., attrs@entry=...,
      buf=buf@entry=0x7f0b77713028 "\002\377\377\377", len=<optimized out>, is_write=<optimized out>) at /root/rpmbuild/BUILD/master/qemu/exec.c:2703
      0x00007f0b77962f53 in kvm_cpu_exec (cpu=cpu@entry=0x7f0b79fcc2d0) at /root/rpmbuild/BUILD/master/qemu/kvm-all.c:1965
      0x00007f0b77950cc6 in qemu_kvm_cpu_thread_fn (arg=0x7f0b79fcc2d0) at /root/rpmbuild/BUILD/master/qemu/cpus.c:1078
      0x00007f0b744b3dc5 in start_thread (arg=0x7f0b69a27700) at pthread_create.c:308
      0x00007f0b70d3d66d in clone () from /lib64/libc.so.6
      
      The code path while meeting segfault:
       vnc_dpy_copy
         vnc_update_client
           vnc_disconnect_finish [while vnc_disconnect_start() is invoked because somethins wrong]
             vnc_update_server_surface
               vd->server = NULL;
         vnc_server_fb_stride
           pixman_image_get_stride(vd->server)
      
      Let's add a non-NULL check before calling vnc_server_fb_stride() to avoid segmentation fault.
      
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Daniel P. Berrange <berrange@redhat.com>
      Reported-by: NYanying Zhuang <ann.zhuangyanying@huawei.com>
      Signed-off-by: NGonglei <arei.gonglei@huawei.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-id: 1472788698-120964-1-git-send-email-arei.gonglei@huawei.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      3e10c3ec
  3. 30 8月, 2016 1 次提交
    • D
      ui: fix refresh of VNC server surface · b69a553b
      Daniel P. Berrange 提交于
      In previous commit
      
        commit c7628bff
        Author: Gerd Hoffmann <kraxel@redhat.com>
        Date:   Fri Oct 30 12:10:09 2015 +0100
      
          vnc: only alloc server surface with clients connected
      
      the VNC server was changed so that the 'vd->server' pixman
      image was only allocated when a client is connected.
      
      Since then if a client disconnects and then reconnects to
      the VNC server all they will see is a black screen until
      they do something that triggers a refresh. On a graphical
      desktop this is not often noticed since there's many things
      going on which cause a refresh. On a plain text console it
      is really obvious since nothing refreshes frequently.
      
      The problem is that the VNC server didn't update the guest
      dirty bitmap, so still believes its server image is in sync
      with the guest contents.
      
      To fix this we must explicitly mark the entire guest desktop
      as dirty after re-creating the server surface. Move this
      logic into vnc_update_server_surface() so it is guaranteed
      to be call in all code paths that re-create the surface
      instead of only in vnc_dpy_switch()
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NPeter Lieven <pl@kamp.de>
      Tested-by: NPeter Lieven <pl@kamp.de>
      Message-id: 1471365032-18096-1-git-send-email-berrange@redhat.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      b69a553b
  4. 08 8月, 2016 1 次提交
  5. 03 8月, 2016 3 次提交
    • D
      vnc: ensure connection sharing/limits is always configured · 12e29b16
      Daniel P. Berrange 提交于
      The connection sharing / limits are only set in the
      vnc_display_open() method and so missed when VNC is running
      with '-vnc none'. This in turn prevents clients being added
      to the VNC server with the QMP "add_client" command.
      
      This was introduced in
      
        commit e5f34cdd
        Author: Gerd Hoffmann <kraxel@redhat.com>
        Date:   Thu Oct 2 12:09:34 2014 +0200
      
            vnc: track & limit connections
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-id: 1470134726-15697-4-git-send-email-berrange@redhat.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      12e29b16
    • D
      vnc: fix crash when vnc_server_info_get has an error · 3e7f136d
      Daniel P. Berrange 提交于
      The vnc_server_info_get will allocate the VncServerInfo
      struct and then call vnc_init_basic_info_from_server_addr
      to populate the basic fields. If this returns an error
      though, the qapi_free_VncServerInfo call will then crash
      because the VncServerInfo struct instance was not properly
      NULL-initialized and thus contains random stack garbage.
      
       #0  0x00007f1987c8e6f5 in raise () at /lib64/libc.so.6
       #1  0x00007f1987c902fa in abort () at /lib64/libc.so.6
       #2  0x00007f1987ccf600 in __libc_message () at /lib64/libc.so.6
       #3  0x00007f1987cd7d4a in _int_free () at /lib64/libc.so.6
       #4  0x00007f1987cdb2ac in free () at /lib64/libc.so.6
       #5  0x00007f198b654f6e in g_free () at /lib64/libglib-2.0.so.0
       #6  0x0000559193cdcf54 in visit_type_str (v=v@entry=
           0x5591972f14b0, name=name@entry=0x559193de1e29 "host", obj=obj@entry=0x5591961dbfa0, errp=errp@entry=0x7fffd7899d80)
           at qapi/qapi-visit-core.c:255
       #7  0x0000559193cca8f3 in visit_type_VncBasicInfo_members (v=v@entry=
           0x5591972f14b0, obj=obj@entry=0x5591961dbfa0, errp=errp@entry=0x7fffd7899dc0) at qapi-visit.c:12307
       #8  0x0000559193ccb523 in visit_type_VncServerInfo_members (v=v@entry=
           0x5591972f14b0, obj=0x5591961dbfa0, errp=errp@entry=0x7fffd7899e00) at qapi-visit.c:12632
       #9  0x0000559193ccb60b in visit_type_VncServerInfo (v=v@entry=
           0x5591972f14b0, name=name@entry=0x0, obj=obj@entry=0x7fffd7899e48, errp=errp@entry=0x0) at qapi-visit.c:12658
       #10 0x0000559193cb53d8 in qapi_free_VncServerInfo (obj=<optimized out>) at qapi-types.c:3970
       #11 0x0000559193c1e6ba in vnc_server_info_get (vd=0x7f1951498010) at ui/vnc.c:233
       #12 0x0000559193c24275 in vnc_connect (vs=0x559197b2f200, vs=0x559197b2f200, event=QAPI_EVENT_VNC_CONNECTED) at ui/vnc.c:284
       #13 0x0000559193c24275 in vnc_connect (vd=vd@entry=0x7f1951498010, sioc=sioc@entry=0x559196bf9c00, skipauth=skipauth@entry=tru e, websocket=websocket@entry=false) at ui/vnc.c:3039
       #14 0x0000559193c25806 in vnc_display_add_client (id=<optimized out>, csock=<optimized out>, skipauth=<optimized out>)
           at ui/vnc.c:3877
       #15 0x0000559193a90c28 in qmp_marshal_add_client (args=<optimized out>, ret=<optimized out>, errp=0x7fffd7899f90)
           at qmp-marshal.c:105
       #16 0x000055919399c2b7 in handle_qmp_command (parser=<optimized out>, tokens=<optimized out>)
           at /home/berrange/src/virt/qemu/monitor.c:3971
       #17 0x0000559193ce3307 in json_message_process_token (lexer=0x559194ab0838, input=0x559194a6d940, type=JSON_RCURLY, x=111, y=1 2) at qobject/json-streamer.c:105
       #18 0x0000559193cfa90d in json_lexer_feed_char (lexer=lexer@entry=0x559194ab0838, ch=125 '}', flush=flush@entry=false)
           at qobject/json-lexer.c:319
       #19 0x0000559193cfaa1e in json_lexer_feed (lexer=0x559194ab0838, buffer=<optimized out>, size=<optimized out>)
           at qobject/json-lexer.c:369
       #20 0x0000559193ce33c9 in json_message_parser_feed (parser=<optimized out>, buffer=<optimized out>, size=<optimized out>)
           at qobject/json-streamer.c:124
       #21 0x000055919399a85b in monitor_qmp_read (opaque=<optimized out>, buf=<optimized out>, size=<optimized out>)
           at /home/berrange/src/virt/qemu/monitor.c:3987
       #22 0x0000559193a87d00 in tcp_chr_read (chan=<optimized out>, cond=<optimized out>, opaque=0x559194a7d900)
           at qemu-char.c:2895
       #23 0x00007f198b64f703 in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
       #24 0x0000559193c484b3 in main_loop_wait () at main-loop.c:213
       #25 0x0000559193c484b3 in main_loop_wait (timeout=<optimized out>) at main-loop.c:258
       #26 0x0000559193c484b3 in main_loop_wait (nonblocking=<optimized out>) at main-loop.c:506
       #27 0x0000559193964c55 in main () at vl.c:1908
       #28 0x0000559193964c55 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4603
      
      This was introduced in
      
        commit 98481bfc
        Author: Eric Blake <eblake@redhat.com>
        Date:   Mon Oct 26 16:34:45 2015 -0600
      
          vnc: Hoist allocation of VncBasicInfo to callers
      
      which added error reporting for vnc_init_basic_info_from_server_addr
      but didn't change the g_malloc calls to g_malloc0.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-id: 1470134726-15697-3-git-send-email-berrange@redhat.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      3e7f136d
    • D
      vnc: don't crash getting server info if lsock is NULL · 624cdd46
      Daniel P. Berrange 提交于
      When VNC is started with '-vnc none' there will be no
      listener socket present. When we try to populate the
      VncServerInfo we'll crash accessing a NULL 'lsock'
      field.
      
       #0  qio_channel_socket_get_local_address (ioc=0x0, errp=errp@entry=0x7ffd5b8aa0f0) at io/channel-socket.c:33
       #1  0x00007f4b9a297d6f in vnc_init_basic_info_from_server_addr (errp=0x7ffd5b8aa0f0, info=0x7f4b9d425460, ioc=<optimized out>)  at ui/vnc.c:146
       #2  vnc_server_info_get (vd=0x7f4b9e858000) at ui/vnc.c:223
       #3  0x00007f4b9a29d318 in vnc_qmp_event (vs=0x7f4b9ef82000, vs=0x7f4b9ef82000, event=QAPI_EVENT_VNC_CONNECTED) at ui/vnc.c:279
       #4  vnc_connect (vd=vd@entry=0x7f4b9e858000, sioc=sioc@entry=0x7f4b9e8b3a20, skipauth=skipauth@entry=true, websocket=websocket @entry=false) at ui/vnc.c:2994
       #5  0x00007f4b9a29e8c8 in vnc_display_add_client (id=<optimized out>, csock=<optimized out>, skipauth=<optimized out>) at ui/v nc.c:3825
       #6  0x00007f4b9a18d8a1 in qmp_marshal_add_client (args=<optimized out>, ret=<optimized out>, errp=0x7ffd5b8aa230) at qmp-marsh al.c:123
       #7  0x00007f4b9a0b53f5 in handle_qmp_command (parser=<optimized out>, tokens=<optimized out>) at /usr/src/debug/qemu-2.6.0/mon itor.c:3922
       #8  0x00007f4b9a348580 in json_message_process_token (lexer=0x7f4b9c78dfe8, input=0x7f4b9c7350e0, type=JSON_RCURLY, x=111, y=5 9) at qobject/json-streamer.c:94
       #9  0x00007f4b9a35cfeb in json_lexer_feed_char (lexer=lexer@entry=0x7f4b9c78dfe8, ch=125 '}', flush=flush@entry=false) at qobj ect/json-lexer.c:310
       #10 0x00007f4b9a35d0ae in json_lexer_feed (lexer=0x7f4b9c78dfe8, buffer=<optimized out>, size=<optimized out>) at qobject/json -lexer.c:360
       #11 0x00007f4b9a348679 in json_message_parser_feed (parser=<optimized out>, buffer=<optimized out>, size=<optimized out>) at q object/json-streamer.c:114
       #12 0x00007f4b9a0b3a1b in monitor_qmp_read (opaque=<optimized out>, buf=<optimized out>, size=<optimized out>) at /usr/src/deb ug/qemu-2.6.0/monitor.c:3938
       #13 0x00007f4b9a186751 in tcp_chr_read (chan=<optimized out>, cond=<optimized out>, opaque=0x7f4b9c7add40) at qemu-char.c:2895
       #14 0x00007f4b92b5c79a in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
       #15 0x00007f4b9a2bb0c0 in glib_pollfds_poll () at main-loop.c:213
       #16 os_host_main_loop_wait (timeout=<optimized out>) at main-loop.c:258
       #17 main_loop_wait (nonblocking=<optimized out>) at main-loop.c:506
       #18 0x00007f4b9a0835cf in main_loop () at vl.c:1934
       #19 main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4667
      
      Do an upfront check for a NULL lsock and report an error to
      the caller, which matches behaviour from before
      
        commit 04d2529d
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Fri Feb 27 16:20:57 2015 +0000
      
          ui: convert VNC server to use QIOChannelSocket
      
      where getsockname() would be given a FD value -1 and thus report
      an error to the caller.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-id: 1470134726-15697-2-git-send-email-berrange@redhat.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      624cdd46
  6. 15 7月, 2016 1 次提交
  7. 12 7月, 2016 2 次提交
  8. 29 6月, 2016 1 次提交
  9. 10 6月, 2016 2 次提交
  10. 03 6月, 2016 2 次提交
  11. 23 3月, 2016 1 次提交
  12. 18 3月, 2016 1 次提交
    • E
      qapi: Don't special-case simple union wrappers · 32bafa8f
      Eric Blake 提交于
      Simple unions were carrying a special case that hid their 'data'
      QMP member from the resulting C struct, via the hack method
      QAPISchemaObjectTypeVariant.simple_union_type().  But by using
      the work we started by unboxing flat union and alternate
      branches, coupled with the ability to visit the members of an
      implicit type, we can now expose the simple union's implicit
      type in qapi-types.h:
      
      | struct q_obj_ImageInfoSpecificQCow2_wrapper {
      |     ImageInfoSpecificQCow2 *data;
      | };
      |
      | struct q_obj_ImageInfoSpecificVmdk_wrapper {
      |     ImageInfoSpecificVmdk *data;
      | };
      ...
      | struct ImageInfoSpecific {
      |     ImageInfoSpecificKind type;
      |     union { /* union tag is @type */
      |         void *data;
      |-        ImageInfoSpecificQCow2 *qcow2;
      |-        ImageInfoSpecificVmdk *vmdk;
      |+        q_obj_ImageInfoSpecificQCow2_wrapper qcow2;
      |+        q_obj_ImageInfoSpecificVmdk_wrapper vmdk;
      |     } u;
      | };
      
      Doing this removes asymmetry between QAPI's QMP side and its
      C side (both sides now expose 'data'), and means that the
      treatment of a simple union as sugar for a flat union is now
      equivalent in both languages (previously the two approaches used
      a different layer of dereferencing, where the simple union could
      be converted to a flat union with equivalent C layout but
      different {} on the wire, or to an equivalent QMP wire form
      but with different C representation).  Using the implicit type
      also lets us get rid of the simple_union_type() hack.
      
      Of course, now all clients of simple unions have to adjust from
      using su->u.member to using su->u.member.data; while this touches
      a number of files in the tree, some earlier cleanup patches
      helped minimize the change to the initialization of a temporary
      variable rather than every single member access.  The generated
      qapi-visit.c code is also affected by the layout change:
      
      |@@ -7393,10 +7393,10 @@ void visit_type_ImageInfoSpecific_member
      |     }
      |     switch (obj->type) {
      |     case IMAGE_INFO_SPECIFIC_KIND_QCOW2:
      |-        visit_type_ImageInfoSpecificQCow2(v, "data", &obj->u.qcow2, &err);
      |+        visit_type_q_obj_ImageInfoSpecificQCow2_wrapper_members(v, &obj->u.qcow2, &err);
      |         break;
      |     case IMAGE_INFO_SPECIFIC_KIND_VMDK:
      |-        visit_type_ImageInfoSpecificVmdk(v, "data", &obj->u.vmdk, &err);
      |+        visit_type_q_obj_ImageInfoSpecificVmdk_wrapper_members(v, &obj->u.vmdk, &err);
      |         break;
      |     default:
      |         abort();
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1458254921-17042-13-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      32bafa8f
  13. 17 3月, 2016 1 次提交
  14. 08 3月, 2016 1 次提交
  15. 05 3月, 2016 1 次提交
    • E
      util: Shorten references into SocketAddress · 0399293e
      Eric Blake 提交于
      An upcoming patch will alter how simple unions, like SocketAddress,
      are laid out, which will impact all lines of the form 'addr->u.XXX'
      (expanding it to the longer 'addr->u.XXX.data').  For better
      legibility in that patch, and less need for line wrapping, it's better
      to use a temporary variable to reduce the effect of a layout change to
      just the variable initializations, rather than every reference within
      a SocketAddress.  Also, take advantage of some C99 initialization where
      it makes sense (simplifying g_new0() to g_new()).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1457021813-10704-7-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      0399293e
  16. 01 3月, 2016 2 次提交
  17. 05 2月, 2016 1 次提交
    • P
      ui: Clean up includes · e16f4c87
      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-2-git-send-email-peter.maydell@linaro.org
      e16f4c87
  18. 19 1月, 2016 1 次提交
    • D
      vnc: distiguish between ipv4/ipv6 omitted vs set to off · 3f0230e9
      Daniel P. Berrange 提交于
      The VNC code for interpreting QemuOpts does not currently
      distinguish between ipv4/ipv6 being omitted, and being
      set to 'off', because historically the 'ipv4' and 'ipv6'
      options were just flags which did not accept a value.
      
      The upshot is that if someone runs
      
        $QEMU -vnc localhost:1,ipv6=off
      
      QEMU still uses PF_UNSPEC and thus may still bind to IPv6,
      when it should use PF_INET.
      
      This is another instance of the problem previously fixed
      for chardevs in
      
        commit b77e7c8e
        Author: Paolo Bonzini <pbonzini@redhat.com>
        Date:   Mon Oct 12 15:35:16 2015 +0200
      
          qemu-sockets: fix conversion of ipv4/ipv6 JSON to QemuOpts
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-id: 1452518225-11751-6-git-send-email-berrange@redhat.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      3f0230e9
  19. 18 1月, 2016 2 次提交
  20. 13 1月, 2016 1 次提交
    • M
      error: Use error_reportf_err() where it makes obvious sense · c29b77f9
      Markus Armbruster 提交于
      Done with this Coccinelle semantic patch
      
          @@
          expression FMT, E, S;
          expression list ARGS;
          @@
          -    error_report(FMT, ARGS, error_get_pretty(E));
          +    error_reportf_err(E, FMT/*@@@*/, ARGS);
          (
          -    error_free(E);
          |
      	 exit(S);
          |
      	 abort();
          )
      
      followed by a replace of '%s"/*@@@*/' by '"' and some line rewrapping,
      because I can't figure out how to make Coccinelle transform strings.
      
      We now use the error whole instead of just its message obtained with
      error_get_pretty().  This avoids suppressing its hint (see commit
      50b7b000), but I can't see how the errors touched in this commit could
      come with hints.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1450452927-8346-12-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      c29b77f9
  21. 18 12月, 2015 3 次提交
  22. 17 12月, 2015 2 次提交
    • E
      qapi: Change munging of CamelCase enum values · d20a580b
      Eric Blake 提交于
      When munging enum values, the fact that we were passing the entire
      prefix + value through camel_to_upper() meant that enum values
      spelled with CamelCase could be turned into CAMEL_CASE.  However,
      this provides a potential collision (both OneTwo and One-Two would
      munge into ONE_TWO) for enum types, when the same two names are
      valid side-by-side as QAPI member names.  By changing the generation
      of enum constants to always be prefix + '_' + c_name(value,
      False).upper(), and ensuring that there are no case collisions (in
      the next patches), we no longer have to worry about names that
      would be distinct as QAPI members but collide as variant tag names,
      without having to think about what munging the heuristics in
      camel_to_upper() will actually perform on an enum value.
      
      Making the change will affect enums that did not follow coding
      conventions, using 'CamelCase' rather than desired 'lower-case'.
      
      Thankfully, there are only two culprits: InputButton and ErrorClass.
      We already tweaked ErrorClass to make it an alias of QapiErrorClass,
      where only the alias needs changing rather than the whole tree.  So
      the bulk of this change is modifying INPUT_BUTTON_WHEEL_UP to the
      new INPUT_BUTTON_WHEELUP (and likewise for WHEELDOWN).  That part
      of this commit may later need reverting if we rename the enum
      constants from 'WheelUp' to 'wheel-up' as part of moving
      x-input-send-event to a stable interface; but at least we have
      documentation bread crumbs in place to remind us (commit 513e7cdb),
      and it matches the fact that SDL constants are also spelled
      SDL_BUTTON_WHEELUP.
      
      Suggested by: Markus Armbruster <armbru@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1447836791-369-27-git-send-email-eblake@redhat.com>
      [Commit message tweaked]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      d20a580b
    • E
      qapi: Don't let implicit enum MAX member collide · 7fb1cf16
      Eric Blake 提交于
      Now that we guarantee the user doesn't have any enum values
      beginning with a single underscore, we can use that for our
      own purposes.  Renaming ENUM_MAX to ENUM__MAX makes it obvious
      that the sentinel is generated.
      
      This patch was mostly generated by applying a temporary patch:
      
      |diff --git a/scripts/qapi.py b/scripts/qapi.py
      |index e6d014b..b862ec9 100644
      |--- a/scripts/qapi.py
      |+++ b/scripts/qapi.py
      |@@ -1570,6 +1570,7 @@ const char *const %(c_name)s_lookup[] = {
      |     max_index = c_enum_const(name, 'MAX', prefix)
      |     ret += mcgen('''
      |     [%(max_index)s] = NULL,
      |+// %(max_index)s
      | };
      | ''',
      |                max_index=max_index)
      
      then running:
      
      $ cat qapi-{types,event}.c tests/test-qapi-types.c |
          sed -n 's,^// \(.*\)MAX,s|\1MAX|\1_MAX|g,p' > list
      $ git grep -l _MAX | xargs sed -i -f list
      
      The only things not generated are the changes in scripts/qapi.py.
      
      Rejecting enum members named 'MAX' is now useless, and will be dropped
      in the next patch.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1447836791-369-23-git-send-email-eblake@redhat.com>
      Reviewed-by: NJuan Quintela <quintela@redhat.com>
      [Rebased to current master, commit message tweaked]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      7fb1cf16
  23. 03 12月, 2015 1 次提交
  24. 26 11月, 2015 1 次提交
  25. 06 11月, 2015 1 次提交
  26. 05 11月, 2015 5 次提交