From nobody Mon Feb 9 10:47:05 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=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577966263; cv=none; d=zohomail.com; s=zohoarc; b=LRkzsyfVX7dPswBu0U6RfRn5XIulOPr3erPYvwcRuQWxKCqYU+ZKt0BLfidH71ixW2JbGKQ1H1DRHZyJrPia9RBbW6d91TbbN6MbQFmtl9eMq4NhbLYmmycGokEi4iTBa/IkgfHNNM1P6bc83d/1ssK9T66IT9I1bxBrY0dHGbA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577966263; 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=RFXBjpRHsICUJZKa/cBVhjhQVbnIYZpKsnoMgNgNKOGoAZcIRdMBN4MPel3i5amVc4cmhgK02F+TiFYUZyQIIhaIV5z8sCSBL7GLZ4HWn2J08hea9Ya+CO1S/GbFGO/FFwXT4FgvKKXRTfCOSr1TEE5a4s28SSxuCeLnSzfdAJc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 157796626301441.60591517664932; Thu, 2 Jan 2020 03:57:43 -0800 (PST) Received: from localhost ([::1]:40224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz6j-000424-QT for importer@patchew.org; Thu, 02 Jan 2020 06:57:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47581) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz56-0002O8-Uo for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imz55-0006WE-IY for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:00 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:30969 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 1imz4a-0006Pp-0C for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:55:28 -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-268-1czFX3E4PYyWgDaLjL2D2g-1; Thu, 02 Jan 2020 06:55:26 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AE8D718B633E for ; Thu, 2 Jan 2020 11:55:25 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A9C610013D9; Thu, 2 Jan 2020 11:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577966127; 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=aw5azOicRvFtOTvPTub5QCsQQ8pHcbpiHN3YqtTDJBw3yMN7jX+b2bZ0n7wF4jiKVbzu64 duHNa1d5LqYz5K75B9CcjElP0hNSN/Y8HHste9WQH9cPkSNb9lx7b8xTvLvNbJehxJPSWv Ce+MJNaJOVRzYRZASXDDfl4TM0XJ6dM= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 1/7] console: add graphic_hw_update_done() Date: Thu, 2 Jan 2020 15:54:53 +0400 Message-Id: <20200102115459.854103-2-marcandre.lureau@redhat.com> In-Reply-To: <20200102115459.854103-1-marcandre.lureau@redhat.com> References: <20200102115459.854103-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: 1czFX3E4PYyWgDaLjL2D2g-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: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 10:47:05 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=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577966346; cv=none; d=zohomail.com; s=zohoarc; b=kFwZSSfyk8wvhlONnG8UB5eWjbyBZD+NgWdPCg0khd6hfSmR0CbifKN7azh1rwqTlOIGyqHx7LDJ2evihcYKjzl2xOb2JwUTzPOoMUUsZWWAXn3qXLGOLElD5QpxhvL97s1oQ0AP7YJKxgtv5yAczDfb1kCwRJ3ZQ8uJcxDocKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577966346; 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=GH3JxcbMc1nmCjSiY12EfbAnQwha3aAYHqKPvB7+wo/Y1kdJHQsbCd17ZycH0/AoEX8dQM6LQ5bI7YQoF5fYntwcYAraNS+/hrFs+yblHc1T9cpXa0WAexlSmcqV7r0l7fJHl9cQr8tWZYswtZVl0W5TcNRpX5hPPwnyj9J74LA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1577966346509119.45094513250751; Thu, 2 Jan 2020 03:59:06 -0800 (PST) Received: from localhost ([::1]:40240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz84-0006WI-Ay for importer@patchew.org; Thu, 02 Jan 2020 06:59:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47587) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz57-0002OL-4G for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imz55-0006YE-Jo for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:01 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:52210 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 1imz54-0006TY-Nr for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:55:59 -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-374-RJ_qZ5ZlO5erBGpLMS9zqA-1; Thu, 02 Jan 2020 06:55:38 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 145F19121F for ; Thu, 2 Jan 2020 11:55:38 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70C4560BFB; Thu, 2 Jan 2020 11:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577966140; 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=Qa+LGd0p52JnqSscgXko4O4OySqOiXeqpACOnE/kgTkc1d1ysRHr9NycO33B/DpSO6F1J6 n5ooarRjvLMRrWcIgUBSHsuCP9wRgu0ka/ich5xpD0a34Xo2WjdyRQX5tDrsc9yZpxdd6K u16faa3Kf7jzOfceWJG5aO7x4tzOGd8= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 2/7] ppm-save: pass opened fd Date: Thu, 2 Jan 2020 15:54:54 +0400 Message-Id: <20200102115459.854103-3-marcandre.lureau@redhat.com> In-Reply-To: <20200102115459.854103-1-marcandre.lureau@redhat.com> References: <20200102115459.854103-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: RJ_qZ5ZlO5erBGpLMS9zqA-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: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 10:47:05 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=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577966259; cv=none; d=zohomail.com; s=zohoarc; b=Jy6bckzd5BooC66GhniG6w7Zejb7jMOBCctz1G2NCGVOEmCU6kPeIePjUofQgZV2+4eNV3qo1gW4fG8UTrxgp3PXq7hx9L4OKZdm8e0prsa//lKFHQCWj4T16z+2QlHYsSpfdMyD8qbdDhXI1Oy4sD1S0RgdXnB8ozEOeGf3Zg8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577966259; 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=J9eu0pK+YlhUgAESgA2s0XxHGd5f6YRrJNUXQQ1qGDSyAr01ALYsMBKZoZp9aGteu6tw16/Jh6EYXlWOv62OJ3NMFp/Qgn6MiS7CNhkHJo7BkMDy3sdHJJuEYapOAaEqoonu1f4nDEJTEpz7NPPjdLnS5cfaUxfqVP8aIH4LUNw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1577966259680246.75415055961741; Thu, 2 Jan 2020 03:57:39 -0800 (PST) Received: from localhost ([::1]:40222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz6g-0003yP-4L for importer@patchew.org; Thu, 02 Jan 2020 06:57:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47582) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz56-0002O9-Vg for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imz55-0006Xk-Jr for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:00 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:43350 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 1imz53-0006Uq-NP for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:55:59 -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-274-DYQvPtr7N2qSK7NS0LqZxg-1; Thu, 02 Jan 2020 06:55:53 -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 2F9D4A13C4 for ; Thu, 2 Jan 2020 11:55:52 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 243255DA70; Thu, 2 Jan 2020 11:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577966154; 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=ZfgOP8jNjd3RHl9T+bB421odycUcIoyHsmZ3ZB9cUowttkewJdZ6mEWFYQUInIygVBqZK+ oXkzvd0ZLcwT7qHzA0uF3I47SRzms6A2OStXaxzVpchc6EHW9f4jP5eDkp7N1/jg1McwZQ tyxo6/MiQAwDJejyJnya41p1SrNeSBo= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 3/7] ui: add pixman image g_autoptr support Date: Thu, 2 Jan 2020 15:54:55 +0400 Message-Id: <20200102115459.854103-4-marcandre.lureau@redhat.com> In-Reply-To: <20200102115459.854103-1-marcandre.lureau@redhat.com> References: <20200102115459.854103-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: DYQvPtr7N2qSK7NS0LqZxg-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: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 10:47:05 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=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577966263; cv=none; d=zohomail.com; s=zohoarc; b=PadeW5tBpppMS3qqOxE9/zcEoclWecBhht6sLlTs8IjqxEnFzkr8TpITX0mrDG0btjtEWh4Fa52a6wdCafTAqDxfScWznOHHpfviB5ncjNpRJPJsQMOUJbFjTBIS7cuR6NU2LH4lzp2FO2uLmsHOfy0jsTy+Ma6UBULNFxgnTps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577966263; 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=Pt/oB6o/WxpRwLvKTMcpR/mWrJUDUdklaTyuJxLHpsVuRH/UeH/MTnqRGe2lXZRhMJyPsRHZnBh50TiQo2kVzqOIx2DIS1XmmyF72S9eDFd9io9V7yXorhYUknNzxAnYQM9paRNL/42lfPlAMEadxCHD5IrlnSo9Pm1+SC9XOMc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1577966263657647.6454571811317; Thu, 2 Jan 2020 03:57:43 -0800 (PST) Received: from localhost ([::1]:40226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz6k-00045W-9W for importer@patchew.org; Thu, 02 Jan 2020 06:57:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47628) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz5G-0002TA-F6 for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imz5F-00070G-F9 for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:10 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:41666 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 1imz5F-0006sZ-Ag for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:09 -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-149-d9CJHsoGN0aJcE4uGsvOdw-1; Thu, 02 Jan 2020 06:56:05 -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 9AA41104ED67 for ; Thu, 2 Jan 2020 11:56:04 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4530F7A04F; Thu, 2 Jan 2020 11:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577966168; 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=W0d1dWejR3oaJfUEYt0MGfTBT/k4CKoSi9Khcr80uh7+/thURq0GHmDRFu48EtATkEdKQg Y7Q+sr91Mztxt90Hz67fBR6tiWrehbE8E60ShvFstKWor+t1Tiohs5yGXUuLE4GNYPLyhz RRy4zmhdxUm16QQkZRMom2pIJJHF0Do= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 4/7] object: add g_autoptr support Date: Thu, 2 Jan 2020 15:54:56 +0400 Message-Id: <20200102115459.854103-5-marcandre.lureau@redhat.com> In-Reply-To: <20200102115459.854103-1-marcandre.lureau@redhat.com> References: <20200102115459.854103-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: d9CJHsoGN0aJcE4uGsvOdw-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: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 10:47:05 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=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577966418; cv=none; d=zohomail.com; s=zohoarc; b=MC1fcZ9EOqHgpPkNkLrV0xGaM1TzykONy3UZLBQR9eyqvUL3Qxrgt4vy6WMDPu/vJPqP0pfaCjPWa85cT7mEpQaqTT0oroXZVj5A2tSMS8r9a57GC/rQW5hBdqsna4pRxCfOnNSLJs3rKjS+hFzx9rjf4OCJLoB09R/75ucSEjo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577966418; 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=cZuJFppdIygI7a0JFt5qSBIq2Ddt1WNFM8RuXUYvobw=; b=XVfoZtL10HKiowIZXk39x301LhzZ6k0NXY0dy7UdEhoihGIpa6aw/OuIXGiHvSEN0ywY0liKEVfxYeO4YQ2PkVhxIb5j1MbBoAi84FAOwXOjAfyUl0rAZU0O5+i2Jrg8AHrqqQmxywRy6Sov/7CqUeeIYM6jk5wcsIdxCk1qNgY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1577966418276818.8185599800053; Thu, 2 Jan 2020 04:00:18 -0800 (PST) Received: from localhost ([::1]:40268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz9F-0008Iq-4A for importer@patchew.org; Thu, 02 Jan 2020 07:00:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47658) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz5S-0002fO-L7 for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imz5R-0007Q3-Gk for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:22 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:29951 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 1imz5R-0007Or-04 for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:21 -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-258-7SQQfBl_Mr6jhRyWqRaSyg-1; Thu, 02 Jan 2020 06:56:19 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E2BD18C43CD for ; Thu, 2 Jan 2020 11:56:18 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A20B10013D9; Thu, 2 Jan 2020 11:56:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577966180; 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=cZuJFppdIygI7a0JFt5qSBIq2Ddt1WNFM8RuXUYvobw=; b=IzXQmCMvpNv2FfICycX18SDMAXrOQB/uooipzKTg5W/q/8ZbNrpn9RK757VKlGY/VYMFvu hudRrEhGRReGCJMsZlqJbtl2SVn7zisPVbNBblyYpHtmfYkBFIbhI7I4dl8q6q6Lng2g+y xhwPLMfJaDGhqPYHbz3xlH4KEvwYZ3o= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 5/7] screendump: replace FILE with QIOChannel and fix close()/qemu_close() Date: Thu, 2 Jan 2020 15:54:57 +0400 Message-Id: <20200102115459.854103-6-marcandre.lureau@redhat.com> In-Reply-To: <20200102115459.854103-1-marcandre.lureau@redhat.com> References: <20200102115459.854103-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: 7SQQfBl_Mr6jhRyWqRaSyg-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: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/ui/console.c b/ui/console.c index 77d62fe76d..587edf4ed4 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,31 @@ 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; + g_autoptr(GError) error =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 10:47:05 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=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577966347; cv=none; d=zohomail.com; s=zohoarc; b=ncXkuQWaRk/ccerPMdDHgPc15nIZNNN93XV+8c4RRbhpZdXeKN20KXhIfTwGvEkn1fc2b7J4LtAdOWTfIoQgwrO8x4JMxDGi9ePBDkJMtMK16Cg6xAhat0Mq0dQ1J4wVHPwqEjhoVvRGQitb4tYE4paBTG8QSnE0OVUExr9mLRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577966347; 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=GorB9HLz6IZunOEfyexrI0EAaTVQd9HbTk0+c3S30HBvRYO0fPn4pDz8ViEe1gD8reHP3Ga2QxE3hEuMiKsQY64J2k8b8hWv9BpiJ63wYsTzfai6P8XLMQTwpGgpDTfUoVXEDXVhF54VxfgQbst9XEGm/pBI1zgcQmmq1+U/Vck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1577966347862469.453669964372; Thu, 2 Jan 2020 03:59:07 -0800 (PST) Received: from localhost ([::1]:40242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz86-0006ba-OH for importer@patchew.org; Thu, 02 Jan 2020 06:59:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47678) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz5g-0002v1-RR for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imz5f-0007gV-MQ for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:36 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:60291 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 1imz5f-0007gL-Ie for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:35 -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-238-G9FsUW72OQ-nxDSQX1GLxA-1; Thu, 02 Jan 2020 06:56:34 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47B8A104ED3D for ; Thu, 2 Jan 2020 11:56:33 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id E842E19C58; Thu, 2 Jan 2020 11:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577966195; 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=ZKAmBpKxULPQxH1DuaAZ5zO3KdIfkR5Bxraurkum2YvnPbYJXL3hMTAJx+twHMdl0W8SWr wt99FZwMpmPU8TyZRw9n4xB5RohbIN0V1iFoPvTokvB/svzAcRkBTjS+oZJ1ryfJ5eL4TJ sna4JP1iv6Rhn2iTtLoxDHMzsGiNlIg= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 6/7] osdep: add qemu_unlink() Date: Thu, 2 Jan 2020 15:54:58 +0400 Message-Id: <20200102115459.854103-7-marcandre.lureau@redhat.com> In-Reply-To: <20200102115459.854103-1-marcandre.lureau@redhat.com> References: <20200102115459.854103-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: G9FsUW72OQ-nxDSQX1GLxA-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: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 10:47:05 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=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577966522; cv=none; d=zohomail.com; s=zohoarc; b=mD18nsGxIupLIMwVgvnnmfsqDLaqfL1VlJgKn5YKxlVXEuItTFtVOgmPAo3TUwFjzrwyJnQ2TmfpCfwgwoIBX9RI1qt4oAz15HG8vqViqAtoU+eBZYC46ayjvGwVMlQd29pF2DrbIDsXT1v/Mz8EV8jNZWnPs3gqyJ8zaEj911k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577966522; 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=Uy7YsceqeObUlt59EYv1aZgf34yb/zm3rnX0WXuRV7M=; b=Q9GrCoQTBJ3olZt3mSxijWQFc+LJZ/o9NUZHYGwn8wj+j7Y8GPgRY29k8vC3HLMGWZLCTODsB/l26EJu6jHtu3CHffN+1DR3PyHYFHpo6Hb+lHjcP4TRpYTKfmuzaWK5pJKpGoyu3PF38dHkD5DP2qS0fi8EZ05RX1tB2NtZlrA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1577966522256625.3903960737082; Thu, 2 Jan 2020 04:02:02 -0800 (PST) Received: from localhost ([::1]:40288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imzAu-0000ui-QG for importer@patchew.org; Thu, 02 Jan 2020 07:02:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47707) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imz5v-0003Jd-3L for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imz5u-0007mP-3I for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:50 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:25364 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 1imz5t-0007mI-VQ for qemu-devel@nongnu.org; Thu, 02 Jan 2020 06:56:50 -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-274-i6Or8Zp_OlaCia1WHfKM0g-1; Thu, 02 Jan 2020 06:56:47 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C5C89800D53 for ; Thu, 2 Jan 2020 11:56:46 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C5B060BFB; Thu, 2 Jan 2020 11:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577966209; 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=Uy7YsceqeObUlt59EYv1aZgf34yb/zm3rnX0WXuRV7M=; b=T8XKDhna+V0czpb49ApP1rzxwduJBP38peOUdEQoVIkqOr+9VRJztjk/6rzThpZcuR9S+4 7DssChM7D2RT6iDqCx9mWLxqoSjlO3eR9MYsqLSyVDBjiEgrchSbP4Dv8nI+7S1cg+fBVy q3mLsKz9P4k964v25NOvlUKmkZ1jT/g= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 7/7] screendump: use qemu_unlink() Date: Thu, 2 Jan 2020 15:54:59 +0400 Message-Id: <20200102115459.854103-8-marcandre.lureau@redhat.com> In-Reply-To: <20200102115459.854103-1-marcandre.lureau@redhat.com> References: <20200102115459.854103-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: i6Or8Zp_OlaCia1WHfKM0g-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: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 587edf4ed4..e6ac462aa0 100644 --- a/ui/console.c +++ b/ui/console.c @@ -381,7 +381,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