From nobody Mon Feb 9 19:10:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578042618; cv=none; d=zohomail.com; s=zohoarc; b=X51ihsuVChcQySS5xBj1O2Xh33dBLlcHvzGxGdY0dtA8KX+WyNdaYNQC0eqkdjLC79nVdhjQZ72OZnMA/90dEXode+jy44RFW6JeUxzIo03HVFiDMrK2XZwrOs8ka6qERl2rgddkKhpsdBl/OuUo2beLOQdkmXC6rfh9pgCa7O4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578042618; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0FWWYxlBN7Pk6/eX53YyVxaINIkOAizELQM3kTnJNc8=; b=kDIOjIiO8zNUZzDiEGGKD9UJ4oAKVZWDEUFgznZ2vKTviBy26BF2Fgp/WZinf1/3yErgATJFr3mZ0w7dLRPfdSWJPkf6F7G1gnt9yg/M/SO4r0fp4m+8yoTlcsn9R0Ozy4cbowAWeCWPB4sI0afWzbIx7x8JgjEsMiJxwYTph50= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1578042618447416.065205917253; Fri, 3 Jan 2020 01:10:18 -0800 (PST) Received: from localhost ([::1]:50178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inIyG-0002Db-P7 for importer@patchew.org; Fri, 03 Jan 2020 04:10:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50857) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inIxL-0001FI-Gj for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:09:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inIxK-0007Sb-4y for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:09:19 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:31944 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1inIxK-0007Py-1E for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:09:18 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-308-D2FtpmMrMMaEkCmPcGCzmA-1; Fri, 03 Jan 2020 04:09:16 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4A5C7800EB8; Fri, 3 Jan 2020 09:09:15 +0000 (UTC) Received: from localhost (ovpn-112-30.ams2.redhat.com [10.36.112.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 578C35D9C9; Fri, 3 Jan 2020 09:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578042557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0FWWYxlBN7Pk6/eX53YyVxaINIkOAizELQM3kTnJNc8=; b=asLlU+23dZj4dJ5SI+lQWjgMXsxbi/1aEXprK9SQmnpxCIcMXB/cmkl1VwsQqAIZ40ooSv aryGwft1Zv+ZaYYlBM69W1kMj6OUzLXVA+i3WKfsU/0XOyWLS/fkE+XNmaWTHgbd0S753L GG+HsIDS9bZyZQXskIhT7myghO9nEgk= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL v2 1/7] console: add graphic_hw_update_done() Date: Fri, 3 Jan 2020 13:08:47 +0400 Message-Id: <20200103090853.1014627-2-marcandre.lureau@redhat.com> In-Reply-To: <20200103090853.1014627-1-marcandre.lureau@redhat.com> References: <20200103090853.1014627-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: D2FtpmMrMMaEkCmPcGCzmA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a function to be called when a graphic update is done. Declare the QXL renderer as async: render_update_cookie_num counts the number of outstanding updates, and graphic_hw_update_done() is called when it reaches none. (note: this is preliminary work for asynchronous screendump support) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 --- hw/display/qxl-render.c | 9 +++++++-- hw/display/qxl.c | 1 + include/ui/console.h | 2 ++ ui/console.c | 9 +++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c index f7fdc4901e..3ce2e57b8f 100644 --- a/hw/display/qxl-render.c +++ b/hw/display/qxl-render.c @@ -109,7 +109,7 @@ static void qxl_render_update_area_unlocked(PCIQXLDevic= e *qxl) qxl->guest_primary.surface= .mem, MEMSLOT_GROUP_GUEST); if (!qxl->guest_primary.data) { - return; + goto end; } qxl_set_rect_to_surface(qxl, &qxl->dirty[0]); qxl->num_dirty_rects =3D 1; @@ -137,7 +137,7 @@ static void qxl_render_update_area_unlocked(PCIQXLDevic= e *qxl) } =20 if (!qxl->guest_primary.data) { - return; + goto end; } for (i =3D 0; i < qxl->num_dirty_rects; i++) { if (qemu_spice_rect_is_empty(qxl->dirty+i)) { @@ -158,6 +158,11 @@ static void qxl_render_update_area_unlocked(PCIQXLDevi= ce *qxl) qxl->dirty[i].bottom - qxl->dirty[i].top); } qxl->num_dirty_rects =3D 0; + +end: + if (qxl->render_update_cookie_num =3D=3D 0) { + graphic_hw_update_done(qxl->ssd.dcl.con); + } } =20 /* diff --git a/hw/display/qxl.c b/hw/display/qxl.c index cd7eb39d20..6d43b7433c 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -1181,6 +1181,7 @@ static const QXLInterface qxl_interface =3D { =20 static const GraphicHwOps qxl_ops =3D { .gfx_update =3D qxl_hw_update, + .gfx_update_async =3D true, }; =20 static void qxl_enter_vga_mode(PCIQXLDevice *d) diff --git a/include/ui/console.h b/include/ui/console.h index f981696848..281f9c145b 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -365,6 +365,7 @@ static inline void console_write_ch(console_ch_t *dest,= uint32_t ch) typedef struct GraphicHwOps { void (*invalidate)(void *opaque); void (*gfx_update)(void *opaque); + bool gfx_update_async; /* if true, calls graphic_hw_update_done() */ void (*text_update)(void *opaque, console_ch_t *text); void (*update_interval)(void *opaque, uint64_t interval); int (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info); @@ -380,6 +381,7 @@ void graphic_console_set_hwops(QemuConsole *con, void graphic_console_close(QemuConsole *con); =20 void graphic_hw_update(QemuConsole *con); +void graphic_hw_update_done(QemuConsole *con); void graphic_hw_invalidate(QemuConsole *con); void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata); void graphic_hw_gl_block(QemuConsole *con, bool block); diff --git a/ui/console.c b/ui/console.c index 82d1ddac9c..3c941528d2 100644 --- a/ui/console.c +++ b/ui/console.c @@ -259,13 +259,22 @@ static void gui_setup_refresh(DisplayState *ds) ds->have_text =3D have_text; } =20 +void graphic_hw_update_done(QemuConsole *con) +{ +} + void graphic_hw_update(QemuConsole *con) { + bool async =3D false; if (!con) { con =3D active_console; } if (con && con->hw_ops->gfx_update) { con->hw_ops->gfx_update(con->hw); + async =3D con->hw_ops->gfx_update_async; + } + if (!async) { + graphic_hw_update_done(con); } } =20 --=20 2.24.0.308.g228f53135a From nobody Mon Feb 9 19:10:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578042739; cv=none; d=zohomail.com; s=zohoarc; b=PNYJJhg5X9Dz5ST4A2Lr+dtX6hdHOvnOFyVsgVihk4nfnseFca2mxpAKcrQPxY+eP2DcGU1cnnhK7+S+u9wNm1ktL1DnvcrdQ94Tk9nhay5tolXSFPZQCx5+an0Td58VSFuFjls3Bjgiezz16VsIxPQ7JN4QagghvnuM8tPnZhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578042739; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JY6AQzrDnS+Z1i9WDo6L3HcKsZ6Xsjg4nEeKG37YkrU=; b=HonDHZ3gylKElihjIO0BqdhG+rQ0r0FtYf+TQFLi4z5ofQIWArS3eRam6Lwev+sLhmz7XHn50iONBhBhXbkltXRMA/9n6IRjWzxvSAvb81GJD5ffSo3MCDxPqDa1qVP0OQtDmF/p90895g+hVbfGUY+gX4GUTjnoZpVeD2x+lSM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1578042739950924.2824223912626; Fri, 3 Jan 2020 01:12:19 -0800 (PST) Received: from localhost ([::1]:50212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inJ0E-0004r7-Dh for importer@patchew.org; Fri, 03 Jan 2020 04:12:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51656) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inIxa-0001e0-MG for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:09:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inIxZ-0007yk-Bp for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:09:34 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:29255 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1inIxZ-0007xl-7I for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:09:33 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-vqj7IuGxOAKF9tsLoZ0A1g-1; Fri, 03 Jan 2020 04:09:28 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6ACA800D48; Fri, 3 Jan 2020 09:09:27 +0000 (UTC) Received: from localhost (ovpn-112-30.ams2.redhat.com [10.36.112.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C78F27BFA3; Fri, 3 Jan 2020 09:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578042572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JY6AQzrDnS+Z1i9WDo6L3HcKsZ6Xsjg4nEeKG37YkrU=; b=K+OnuVk7DXKovKe939nF7452wRUKVHUjrhd+/JuZh5Yu0koGEFh0pdoQ9RcOy09+F6TkNn dV3fq/aUlsvQzzbtL/SECm9pdmddBqLgmuEGxg7nRqWko8Z/Y7Du+a1f2+eq5N+0qvvTKV R+dIMOBTbnILB5BaG21Kr0TtDX5VfM4= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL v2 2/7] ppm-save: pass opened fd Date: Fri, 3 Jan 2020 13:08:48 +0400 Message-Id: <20200103090853.1014627-3-marcandre.lureau@redhat.com> In-Reply-To: <20200103090853.1014627-1-marcandre.lureau@redhat.com> References: <20200103090853.1014627-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: vqj7IuGxOAKF9tsLoZ0A1g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This will allow to pre-open the file before running the async finish handler and avoid potential monitor fdset races. (note: this is preliminary work for asynchronous screendump support) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 45 ++++++++++++++++++++++----------------------- ui/trace-events | 2 +- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/ui/console.c b/ui/console.c index 3c941528d2..77d62fe76d 100644 --- a/ui/console.c +++ b/ui/console.c @@ -193,6 +193,7 @@ static void dpy_refresh(DisplayState *s); static DisplayState *get_alloc_displaystate(void); static void text_console_update_cursor_timer(void); static void text_console_update_cursor(void *opaque); +static bool ppm_save(int fd, DisplaySurface *ds, Error **errp); =20 static void gui_update(void *opaque) { @@ -308,29 +309,22 @@ void graphic_hw_invalidate(QemuConsole *con) } } =20 -static void ppm_save(const char *filename, DisplaySurface *ds, - Error **errp) +static bool ppm_save(int fd, DisplaySurface *ds, Error **errp) { int width =3D pixman_image_get_width(ds->image); int height =3D pixman_image_get_height(ds->image); - int fd; FILE *f; int y; int ret; pixman_image_t *linebuf; + bool success =3D false; =20 - trace_ppm_save(filename, ds); - fd =3D qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 06= 66); - if (fd =3D=3D -1) { - error_setg(errp, "failed to open file '%s': %s", filename, - strerror(errno)); - return; - } + trace_ppm_save(fd, ds); f =3D fdopen(fd, "wb"); ret =3D fprintf(f, "P6\n%d %d\n%d\n", width, height, 255); if (ret < 0) { linebuf =3D NULL; - goto write_err; + goto end; } linebuf =3D qemu_pixman_linebuf_create(PIXMAN_BE_r8g8b8, width); for (y =3D 0; y < height; y++) { @@ -339,21 +333,16 @@ static void ppm_save(const char *filename, DisplaySur= face *ds, ret =3D fwrite(pixman_image_get_data(linebuf), 1, pixman_image_get_stride(linebuf), f); (void)ret; - if (ferror(f)) { - goto write_err; - } + success =3D !ferror(f); } =20 -out: +end: + if (!success) { + error_setg(errp, "failed to write to PPM file: %s", strerror(errno= )); + } qemu_pixman_image_unref(linebuf); fclose(f); - return; - -write_err: - error_setg(errp, "failed to write to file '%s': %s", filename, - strerror(errno)); - unlink(filename); - goto out; + return success; } =20 void qmp_screendump(const char *filename, bool has_device, const char *dev= ice, @@ -361,6 +350,7 @@ void qmp_screendump(const char *filename, bool has_devi= ce, const char *device, { QemuConsole *con; DisplaySurface *surface; + int fd; =20 if (has_device) { con =3D qemu_console_lookup_by_device_name(device, has_head ? head= : 0, @@ -387,7 +377,16 @@ void qmp_screendump(const char *filename, bool has_dev= ice, const char *device, return; } =20 - ppm_save(filename, surface, errp); + fd =3D qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 06= 66); + if (fd =3D=3D -1) { + error_setg(errp, "failed to open file '%s': %s", filename, + strerror(errno)); + return; + } + + if (!ppm_save(fd, surface, errp)) { + unlink(filename); + } } =20 void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata) diff --git a/ui/trace-events b/ui/trace-events index 63de72a798..0dcda393c1 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -15,7 +15,7 @@ displaysurface_create_pixman(void *display_surface) "surf= ace=3D%p" displaysurface_free(void *display_surface) "surface=3D%p" displaychangelistener_register(void *dcl, const char *name) "%p [ %s ]" displaychangelistener_unregister(void *dcl, const char *name) "%p [ %s ]" -ppm_save(const char *filename, void *display_surface) "%s surface=3D%p" +ppm_save(int fd, void *display_surface) "fd=3D%d surface=3D%p" =20 # gtk.c # gtk-gl-area.c --=20 2.24.0.308.g228f53135a From nobody Mon Feb 9 19:10:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578042680; cv=none; d=zohomail.com; s=zohoarc; b=ZOaTg5zdpx+VMkVFevUal2xYZXk7elliW5REFXBCQc2drceXmCVQo3EtW1WzPafU7YhuCKlaJLIx9IPPr37d65ZXxfjQgWhK/Fu3NrMc/nmKj0mHEspCVggO0togdxcQQTt8ZKhx8PpX/eeeE3GyC9MVZOZ0m7XoxS5TcoW+z0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578042680; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=R063N5ie8o145AAXdc1hIyKgs8ANiq/iY8KELqpfZLw=; b=XIgXac1y3NDiGwJx2yUEmFY5pVtu2CbGBzlFxSVKXC+3/e53suWYXFlWCQoTnBElZOpiM2g8qaAwI1wC4uy6nj5luIo19obs0LRpqNPwoDfJLDFqmbFM6GNo9WTI8SgJWI+MePR0fzBzaSPO+zQXMzEEMFSJsiqhO9X4UWVCS3w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1578042680557106.38604669420761; Fri, 3 Jan 2020 01:11:20 -0800 (PST) Received: from localhost ([::1]:50206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inIzH-0003W8-5n for importer@patchew.org; Fri, 03 Jan 2020 04:11:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52102) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inIxm-0001vK-4V for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:09:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inIxl-0008J0-3O for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:09:46 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:29258 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1inIxk-0008IX-VT for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:09:45 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-262-gZ2ej1inPTeBq3XLrCmKFg-1; Fri, 03 Jan 2020 04:09:41 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4A11A185432D; Fri, 3 Jan 2020 09:09:40 +0000 (UTC) Received: from localhost (ovpn-112-30.ams2.redhat.com [10.36.112.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFFA583C09; Fri, 3 Jan 2020 09:09:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578042584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R063N5ie8o145AAXdc1hIyKgs8ANiq/iY8KELqpfZLw=; b=cgcl6uFCYOpEPMwPCeSIxpE0DJWUkInOuWrq5FlaUgX2CEf84UGjuIii0XSowf7QkUTTNY MjRBRTgU78pEfdMKrLjCFM5KgzhBSZn1CIkZ5A+daNlcTKFT8Kis+8NzyDboYksXSGN8Xw A6UoDHc5/J73ooXl8rYq0mp95OpXA18= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL v2 3/7] ui: add pixman image g_autoptr support Date: Fri, 3 Jan 2020 13:08:49 +0400 Message-Id: <20200103090853.1014627-4-marcandre.lureau@redhat.com> In-Reply-To: <20200103090853.1014627-1-marcandre.lureau@redhat.com> References: <20200103090853.1014627-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: gZ2ej1inPTeBq3XLrCmKFg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- include/ui/qemu-pixman.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h index 0668109305..3b7cf70157 100644 --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@ -90,4 +90,6 @@ void qemu_pixman_glyph_render(pixman_image_t *glyph, pixman_color_t *bgcol, int x, int y, int cw, int ch); =20 +G_DEFINE_AUTOPTR_CLEANUP_FUNC(pixman_image_t, qemu_pixman_image_unref) + #endif /* QEMU_PIXMAN_H */ --=20 2.24.0.308.g228f53135a From nobody Mon Feb 9 19:10:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578042809; cv=none; d=zohomail.com; s=zohoarc; b=lFd5XnUFZuav399cZgBzYe7mfxAxJCXLeyNQtl1po3Tu0xpdBkNV8xcYg8gTR7ghjubGSfr6fP4hrh85Oa4spumOEmxIHtXLkNkWhJUCpXKXgMCqIMtLKvp1qhjI+aZe7XG9rPsQtHrZNaNGHEbcUNdkgAN8AXAcDYfnXDRXll4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578042809; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uZ492ip0+fI0VQCW9S4eYVfwzGKlxnI/K5IAS3UZ5vs=; b=oF74JN3ebwZanBVPwfqqnOaVCuBb3Mj2e8PldZcgDbYCqGlGQpbj1ZjP8hPdFYzgD/shvVR3ARHOEHyEo6Tf+zKwTAe+XTzH2qSEKhaml4bWc0ELm1ikrkhsraOpEXzhMVCPhOsZjMyX/RNiWll/upr4ZzylB3BI6g7WNCpxAXw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1578042809109827.2374075410223; Fri, 3 Jan 2020 01:13:29 -0800 (PST) Received: from localhost ([::1]:50226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inJ1L-0006Kn-N9 for importer@patchew.org; Fri, 03 Jan 2020 04:13:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52311) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inIxw-0002Dh-Ic for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:09:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inIxv-00004q-Km for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:09:56 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:54892 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1inIxv-0008WA-Hy for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:09:55 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-7FT7mgMANoGm6lC7m_l7ZQ-1; Fri, 03 Jan 2020 04:09:54 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 38363477; Fri, 3 Jan 2020 09:09:53 +0000 (UTC) Received: from localhost (ovpn-112-30.ams2.redhat.com [10.36.112.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 036A45D9C9; Fri, 3 Jan 2020 09:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578042595; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uZ492ip0+fI0VQCW9S4eYVfwzGKlxnI/K5IAS3UZ5vs=; b=DESc+e8O8jgwclPUcYNP1LbNw79n51qFFCMu8MjZNuLJSCySsOKnZvTsTdcNwRkwwKYViX gPGKVxNi81bfuMguGaR8l4QLbMr2YlShojo8NIZY2ZZIRjbnoYbIwJ/z5pMOLqRkD6PVQE bjTUDlNg4NgE7Mt//yw1MvwYm86QNh0= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL v2 4/7] object: add g_autoptr support Date: Fri, 3 Jan 2020 13:08:50 +0400 Message-Id: <20200103090853.1014627-5-marcandre.lureau@redhat.com> In-Reply-To: <20200103090853.1014627-1-marcandre.lureau@redhat.com> References: <20200103090853.1014627-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: 7FT7mgMANoGm6lC7m_l7ZQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- include/qom/object.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index 1d7b7e5a79..54a548868c 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1766,4 +1766,7 @@ Object *container_get(Object *root, const char *path); * Returns the instance_size of the given @typename. */ size_t object_type_get_instance_size(const char *typename); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(Object, object_unref) + #endif --=20 2.24.0.308.g228f53135a From nobody Mon Feb 9 19:10:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578042861; cv=none; d=zohomail.com; s=zohoarc; b=Br2eVDWb27+nKRD+zUmTNQP03FwOofph3AEGjKCvUJdrASP49hfDuJrOLG2Aq2tGtThvWK/AD4GwDxtFdqrIZODXCbBLkARw0Dz5Kb4eBV1WUmxtCcxObDWekVeHO6NHrr+qofYYUnvGIF5tQBxFGOLHbgXGGnWuaHJj43tToLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578042861; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ELBgWw34BNGVKXXTbMo2iIoDpa6hhPVBdb8ILrquj6g=; b=Q3KVmrqmyXbuEWv8a5+Pxyb2lS4uYLwMzJqhC674dSFkqXwBiEyt7UE+5+h0+fe9+mPhqtmWBNPwzHCEHdInIFdyUy3DemmnFPGWVXrOiIKnAPCudUTRO0/75DduiVf9c7PoDH+97qCdo5ixKQgC+n4ReKRPUlzBQUBsJFfeyCc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1578042861485726.7904575822757; Fri, 3 Jan 2020 01:14:21 -0800 (PST) Received: from localhost ([::1]:50230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inJ2B-0007ZY-Vd for importer@patchew.org; Fri, 03 Jan 2020 04:14:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52671) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inIyE-0002fp-6F for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:10:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inIyC-0000Mw-V9 for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:10:14 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:55175 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1inIyC-0000Lp-R3 for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:10:12 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-195-de9O8cFNMK6kRj8jV-JoKw-1; Fri, 03 Jan 2020 04:10:09 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 15FE01005502; Fri, 3 Jan 2020 09:10:08 +0000 (UTC) Received: from localhost (ovpn-112-30.ams2.redhat.com [10.36.112.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 007787BA25; Fri, 3 Jan 2020 09:09:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578042612; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ELBgWw34BNGVKXXTbMo2iIoDpa6hhPVBdb8ILrquj6g=; b=Q8+U/amBjnojI1T8ZO0Ge2qOiGFYt8fsNC2CM1YCLm82U9bi+n46GvqJu5rUcqaCPzzVjv gl8mVlp5WZ0ijL2laVTIXZp4qI/1c1UGx8CqQkZesm1TrJvsa2cP7+U3i7ojtV/NQHZGpV l4ZPwWW67hlYAV/M40zzfG+LEi59UqE= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL v2 5/7] screendump: replace FILE with QIOChannel and fix close()/qemu_close() Date: Fri, 3 Jan 2020 13:08:51 +0400 Message-Id: <20200103090853.1014627-6-marcandre.lureau@redhat.com> In-Reply-To: <20200103090853.1014627-1-marcandre.lureau@redhat.com> References: <20200103090853.1014627-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: de9O8cFNMK6kRj8jV-JoKw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The file opened for ppm_save() may be a /dev/fdset, in which case a dup fd is added to the fdset. It should be removed by calling qemu_close(), instead of the implicit close() on fclose(). I don't see a convenient way to solve that with stdio streams, so I switched the code to QIOChannel which uses qemu_close(). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/ui/console.c b/ui/console.c index 77d62fe76d..82c0b72e7e 100644 --- a/ui/console.c +++ b/ui/console.c @@ -33,6 +33,7 @@ #include "chardev/char-fe.h" #include "trace.h" #include "exec/memory.h" +#include "io/channel-file.h" =20 #define DEFAULT_BACKSCROLL 512 #define CONSOLE_CURSOR_PERIOD 500 @@ -313,36 +314,30 @@ static bool ppm_save(int fd, DisplaySurface *ds, Erro= r **errp) { int width =3D pixman_image_get_width(ds->image); int height =3D pixman_image_get_height(ds->image); - FILE *f; + g_autoptr(Object) ioc =3D OBJECT(qio_channel_file_new_fd(fd)); + g_autofree char *header =3D NULL; + g_autoptr(pixman_image_t) linebuf =3D NULL; int y; - int ret; - pixman_image_t *linebuf; - bool success =3D false; =20 trace_ppm_save(fd, ds); - f =3D fdopen(fd, "wb"); - ret =3D fprintf(f, "P6\n%d %d\n%d\n", width, height, 255); - if (ret < 0) { - linebuf =3D NULL; - goto end; + + header =3D g_strdup_printf("P6\n%d %d\n%d\n", width, height, 255); + if (qio_channel_write_all(QIO_CHANNEL(ioc), + header, strlen(header), errp) < 0) { + return false; } + linebuf =3D qemu_pixman_linebuf_create(PIXMAN_BE_r8g8b8, width); for (y =3D 0; y < height; y++) { qemu_pixman_linebuf_fill(linebuf, ds->image, width, 0, y); - clearerr(f); - ret =3D fwrite(pixman_image_get_data(linebuf), 1, - pixman_image_get_stride(linebuf), f); - (void)ret; - success =3D !ferror(f); + if (qio_channel_write_all(QIO_CHANNEL(ioc), + (char *)pixman_image_get_data(linebuf), + pixman_image_get_stride(linebuf), errp) = < 0) { + return false; + } } =20 -end: - if (!success) { - error_setg(errp, "failed to write to PPM file: %s", strerror(errno= )); - } - qemu_pixman_image_unref(linebuf); - fclose(f); - return success; + return true; } =20 void qmp_screendump(const char *filename, bool has_device, const char *dev= ice, --=20 2.24.0.308.g228f53135a From nobody Mon Feb 9 19:10:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578042725; cv=none; d=zohomail.com; s=zohoarc; b=fwVqhpPJbpAza54MRTkgnOZxYmasa7tCeFvUWNHGAZIXjk12RaxBG2kpCXChIHxS7EiOhIDhGZzRWGj3f1ewuQTHk+XJptKRhYC2J7J0BROgl+m1oP+J24Wpotn/9of9FNuvcKIVpgBcthBOOIwu30ZyijSYpbeOMhVPZ6BrTUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578042725; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rWpV14O1SwpY09dfHGy2OUMa9GddTvXPTc1StMy0gqs=; b=QMaB+ZW8AvMPurqM3Z5xvmlq4Ij79Y7z0Ey51Pq3uIeymCkoM/r+STvKO16SoND9/FXKYwatiBbKjGQah1Ge2grxVKOcEkD/oxwfk2+txQMrQllu6qDMu3kna9jpaIOvDlgTUXN87PLx2Gwh8sRlIck+cXfjGG6B3a0R7EBRXHw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1578042725323593.8531318113816; Fri, 3 Jan 2020 01:12:05 -0800 (PST) Received: from localhost ([::1]:50210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inJ00-0004cT-3j for importer@patchew.org; Fri, 03 Jan 2020 04:12:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53368) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inIyQ-0002yt-BM for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:10:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inIyP-0000qM-5U for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:10:26 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:48006 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1inIyP-0000p6-1K for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:10:25 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-401-0JHNvUyfOx24XXYKnwRt8g-1; Fri, 03 Jan 2020 04:10:21 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9850310054E3; Fri, 3 Jan 2020 09:10:20 +0000 (UTC) Received: from localhost (ovpn-112-30.ams2.redhat.com [10.36.112.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8302465E80; Fri, 3 Jan 2020 09:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578042624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rWpV14O1SwpY09dfHGy2OUMa9GddTvXPTc1StMy0gqs=; b=RBpJ+l/jwhcIBAuyAv+xkCMDdTF2Ca1oNltW1MjigXc/M9Ws7Hhu4Xo/XbTAb1qNY8SqoG vNlBSaTfwGGMvrTdwa9H4zHbYLK5XkENQShQZnRewzRukSEcUtUDEcCXJ5HKm2w5iGIXun eUtIO2ac74tlRzs5pN+OkI+A98635oA= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL v2 6/7] osdep: add qemu_unlink() Date: Fri, 3 Jan 2020 13:08:52 +0400 Message-Id: <20200103090853.1014627-7-marcandre.lureau@redhat.com> In-Reply-To: <20200103090853.1014627-1-marcandre.lureau@redhat.com> References: <20200103090853.1014627-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: 0JHNvUyfOx24XXYKnwRt8g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a helper function to match qemu_open() which may return files under the /dev/fdset prefix. Those shouldn't be removed, since it's only a qemu namespace. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- include/qemu/osdep.h | 1 + util/osdep.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 0f97d68586..9bd3dcfd13 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -462,6 +462,7 @@ int qemu_mprotect_none(void *addr, size_t size); =20 int qemu_open(const char *name, int flags, ...); int qemu_close(int fd); +int qemu_unlink(const char *name); #ifndef _WIN32 int qemu_dup(int fd); #endif diff --git a/util/osdep.c b/util/osdep.c index 3f04326040..f7d06050f7 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -370,6 +370,21 @@ int qemu_close(int fd) return close(fd); } =20 +/* + * Delete a file from the filesystem, unless the filename is /dev/fdset/... + * + * Returns: On success, zero is returned. On error, -1 is returned, + * and errno is set appropriately. + */ +int qemu_unlink(const char *name) +{ + if (g_str_has_prefix(name, "/dev/fdset/")) { + return 0; + } + + return unlink(name); +} + /* * A variant of write(2) which handles partial write. * --=20 2.24.0.308.g228f53135a From nobody Mon Feb 9 19:10:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578042844; cv=none; d=zohomail.com; s=zohoarc; b=K6IdJEw0ZXIYXhRybHyy96VZ4+NauPINPOK04t41bcIXUptYxQQyN3ZJbQYKSFs/Cx4RnV84Prr8bMs71vnaU/GGfuObbQSwHLXKrTlyehN7YwUxyOX0nggJQHdMnzBnQS40SX/gJLLdK9yv+5jfLbMsVAIBaQFKxpxXVvyhpKc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578042844; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mIyWeLe9/4KTz1fos/XdE26IsRTTG0I8FLhY4s/4PkM=; b=IyxW81VYB18GkFnYBi5Hxtkv1J0IJicCFetC/QSN1oPgAsHGb5AQyk/mWEKCdvmYDU2uBV9cXUc+Bw+103MwNWc8iZQmpIHmfWq9+WGsALhlaUziAwR+YRTEPRfzzHh27izCzk/tn2R4w+53PwKBaV8L1ZhlKchpgQLmzCZ85ns= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1578042844979762.190444885715; Fri, 3 Jan 2020 01:14:04 -0800 (PST) Received: from localhost ([::1]:50228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inJ1v-0007Fi-La for importer@patchew.org; Fri, 03 Jan 2020 04:14:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54417) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inIyc-0003K1-7E for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:10:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inIyb-0001cM-5h for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:10:38 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:48392 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1inIya-0001Zj-Vh for qemu-devel@nongnu.org; Fri, 03 Jan 2020 04:10:37 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-160-PbcktCcrM8Cn_FMUW4Q_lA-1; Fri, 03 Jan 2020 04:10:34 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F05910CE788; Fri, 3 Jan 2020 09:10:33 +0000 (UTC) Received: from localhost (ovpn-112-30.ams2.redhat.com [10.36.112.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA0D27D95F; Fri, 3 Jan 2020 09:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578042636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mIyWeLe9/4KTz1fos/XdE26IsRTTG0I8FLhY4s/4PkM=; b=h9SFNAOtNPEXRrPo5soWyGZBogQdacION0iwrYd5dVm8S3P2h9PdzCQEp4SqdgRNGOOuAm GG0EgIVMX9BIS8248WZanOj/L17INIMsmRXDBjtI7QDDYN8CeJIvMz1sxsImp5YiwP3Tj/ aoRpJbsAkNxa+fgyn3/HnY4uipnQJ0g= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL v2 7/7] screendump: use qemu_unlink() Date: Fri, 3 Jan 2020 13:08:53 +0400 Message-Id: <20200103090853.1014627-8-marcandre.lureau@redhat.com> In-Reply-To: <20200103090853.1014627-1-marcandre.lureau@redhat.com> References: <20200103090853.1014627-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: PbcktCcrM8Cn_FMUW4Q_lA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Don't attempt to remove /dev/fdset files. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/console.c b/ui/console.c index 82c0b72e7e..ac79d679f5 100644 --- a/ui/console.c +++ b/ui/console.c @@ -380,7 +380,7 @@ void qmp_screendump(const char *filename, bool has_devi= ce, const char *device, } =20 if (!ppm_save(fd, surface, errp)) { - unlink(filename); + qemu_unlink(filename); } } =20 --=20 2.24.0.308.g228f53135a