From nobody Thu May 2 17:22:36 2024 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=1574855644; cv=none; d=zohomail.com; s=zohoarc; b=CHO4hsamJ6mkOVBzz40UnPD8/4AZQImCAommmpPBdUHXE33rfRvEuBLX4gXmwWhqtp8CuK83D8VZBqEF8X3efqFDuafEAENS9fTocNKH5+7riyENlBDCl61Dah6s2fI+5U+atD/2f/1U7CVJgNTPE61P9mBWzIP4GZ6JySxn8wM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574855644; 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=d1ucJ6NKYXWH5sQrD20ObkaHhvH2o7eTENB8vIcNSk0=; b=BhjZ80HnkCVSH6uvhQEhEuRIEiSbGUFJV47R2+BQNnKSc+qlzcyVNto2xrBsb7tOuJ1YkFqU4DkNCflBmkdE5T/pob5ogoc20uzQDJIJgUw1jamItz6POSajUwp8+VuOXmXmxKUPL2Evx8voo1y+BcNVc35d9xx17n68tq5l1QM= 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 1574855644506146.81190107110592; Wed, 27 Nov 2019 03:54:04 -0800 (PST) Received: from localhost ([::1]:37356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvtR-0000C2-Pn for importer@patchew.org; Wed, 27 Nov 2019 06:54:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50310) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvrt-0007XT-2P for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:52:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZvrr-0005Rt-Sv for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:52:25 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:45725 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 1iZvrr-0005RY-P5 for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:52:23 -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-93-hwVecMjFOaKsyR6zNbdAXA-1; Wed, 27 Nov 2019 06:52:22 -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 2D5701005516 for ; Wed, 27 Nov 2019 11:52:21 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44D06608EB; Wed, 27 Nov 2019 11:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574855543; 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=d1ucJ6NKYXWH5sQrD20ObkaHhvH2o7eTENB8vIcNSk0=; b=h8iRX7YzDT8oYpxzLQRqJLZMKkNqL/usRZv47VoF+iHdpakXMn2AVCsWXees+gN0GynaqK iX67Qms2lxX02C2k/xr6oW877SG0uWXr4obJUwjzGBYU/zqCToqByNwBMyG9nI9Y5Ijsvt KFPZ04IVcjXFomi1APpu3xhY/Yozn14= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 1/7] console: add graphic_hw_update_done() Date: Wed, 27 Nov 2019 15:51:56 +0400 Message-Id: <20191127115202.375107-2-marcandre.lureau@redhat.com> In-Reply-To: <20191127115202.375107-1-marcandre.lureau@redhat.com> References: <20191127115202.375107-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: hwVecMjFOaKsyR6zNbdAXA-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: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann 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 Acked-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 From nobody Thu May 2 17:22:36 2024 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=1574855668; cv=none; d=zohomail.com; s=zohoarc; b=V+UHI19In8j4j0T+yRwt62SHIeTzmkTDBimOWimU1v2EEYvQHvRGNdz6IvjC+0KhENla8J1d5pER3zkmbza1U4dBfxNW+cBipeBGYobbvWm1/8D76kzEnoxIaHKo2B9/Q5Chwv+ZVxxuR/8nEPApglZJG4jr9maFlIJ1g02cEfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574855668; 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=dVNGbdRBc0EVBd/bdcS5Tn0A4DUqVuXwxGbVsrJRq2M=; b=Km1DVHNVBoPxWYWu5bDYa5loKU7bYpEMOaJ3qfhg+twKrd53CJsSeqz0SCkE/xzoLOncwiH3w0mCOZuZGm1Y/VmxQKqRlU5zooFzuFd7as7ZKOb1lXzJ4tIKcQJRi96WrIcx+kJ+gyjxVUsKU03ypZ2JTTg7m86ogj9uGB3lRhw= 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 1574855668138310.2179766128909; Wed, 27 Nov 2019 03:54:28 -0800 (PST) Received: from localhost ([::1]:37366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvtq-0000n3-PU for importer@patchew.org; Wed, 27 Nov 2019 06:54:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50331) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvs7-0007sU-I2 for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:52:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZvs6-0005ah-8H for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:52:39 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:42873 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 1iZvs6-0005aQ-48 for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:52:38 -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-251-zJXo-k-2NhO3Ab6HZ2GxMw-1; Wed, 27 Nov 2019 06:52:36 -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 4A10C18B9FAB for ; Wed, 27 Nov 2019 11:52:35 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DB883B7; Wed, 27 Nov 2019 11:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574855557; 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=dVNGbdRBc0EVBd/bdcS5Tn0A4DUqVuXwxGbVsrJRq2M=; b=aGPW5yKyVcx3tBAFwrk424nqhieMR/qfVRvJm7WatOvnRBmBnlkF6DgKjzmSOJdHoEK4X6 CHk73h2BVG0ZKfwR4DvE+rrr1LW69Z63vWpaOrQnIdlB/Ho7ML6/WJi4bfLiupDiqq7T3S eys/+wrILgBj9NmAsrSjhUQPkasizjE= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 2/7] ppm-save: pass opened fd Date: Wed, 27 Nov 2019 15:51:57 +0400 Message-Id: <20191127115202.375107-3-marcandre.lureau@redhat.com> In-Reply-To: <20191127115202.375107-1-marcandre.lureau@redhat.com> References: <20191127115202.375107-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: zJXo-k-2NhO3Ab6HZ2GxMw-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: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann 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 Acked-by: Gerd Hoffmann 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 From nobody Thu May 2 17:22:36 2024 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=1574855836; cv=none; d=zohomail.com; s=zohoarc; b=RdAGTwC4qBo4czcaln0RbLNiCzA6WwaGQ4RKOj6TstMmp4Uzls/zYCHyzWclOWI7z4gsD+P0ijUqTPn1ypKtrl6jNGTGkF6UXxPKdldLUEJTxRlBUmwxctWjAjCHHCmDaG4hheKz19OgbyR/1RP/7geySy3RlI+nqWPKSABuRdU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574855836; 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=AUi6QEZalbLTxvUCWZJyEZQMUqLH8rpUCT9b1rwUQl8=; b=fJlyrCknsR7KIqlL1XQz5YD/n+DyJIV9ORPbRvWE7234bzH2Awmaye9/niTMX6UEh0Hzul+mb/06uuFQNvoRUvLZtcuFiobv0n+l+Q6ZE3Ef/YuIX2EJsiTodTNk7i0y/6TJ8rQWO5Q4jqfyScflXuOykKZB0NnrnArP5bFfrb0= 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 1574855836354651.6953883114663; Wed, 27 Nov 2019 03:57:16 -0800 (PST) Received: from localhost ([::1]:37396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvwY-0004It-Ny for importer@patchew.org; Wed, 27 Nov 2019 06:57:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50343) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvsJ-0008Bq-Ff for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:52:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZvsI-0005i7-Hc for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:52:51 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:46427 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 1iZvsI-0005hp-Dz for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:52: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-313-pKPuQX7mMfmW8MEqyvshww-1; Wed, 27 Nov 2019 06:52:48 -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 17DE6911E9 for ; Wed, 27 Nov 2019 11:52:47 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id A00AE600C8; Wed, 27 Nov 2019 11:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574855569; 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=AUi6QEZalbLTxvUCWZJyEZQMUqLH8rpUCT9b1rwUQl8=; b=QxDoN5cUeBg8lxoK+jmYw6xfntS4cww6Fg1pNrA3gtJJVQsgNzKonZgmCtvgpzKV9IRScC 01Gibup2rvJKmUs2gZVTr7ZmCUnUcROA9mi8OrwrFDF20HsRGr+mcPCdEL3VG3bLFwWb5J bLfsi190UTkkKEbhZIzv6Ktglm8rBnI= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 3/7] ui: add pixman image g_autoptr support Date: Wed, 27 Nov 2019 15:51:58 +0400 Message-Id: <20191127115202.375107-4-marcandre.lureau@redhat.com> In-Reply-To: <20191127115202.375107-1-marcandre.lureau@redhat.com> References: <20191127115202.375107-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: pKPuQX7mMfmW8MEqyvshww-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: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann 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 Acked-by: Gerd Hoffmann 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 From nobody Thu May 2 17:22:36 2024 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=1574855797; cv=none; d=zohomail.com; s=zohoarc; b=iot1zF8sfV7WxhaL7anCrCjyEw8P22OQg8S/U+gHOYCwhVe9L7cTCIKh3gGOV2P5cC2eumn3iLDkAATWRhD2olVsgQpQqocBqH9mq9KLa6wPK2RYbjetFy5MSCV2nThEUBgQbPTFgj0u4aK3xGsfpbybCQ6WtnDmeQuzaGmTj64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574855797; 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=i/jhfPVbaw9zN74ATSitQu5mKIuSj4RbYiPEOhbuIgk=; b=OPGKfry1PPCbvjrSgocuJSDC77a29nVJfU0O5pAS4GIXS7P9SiH9X9PF3zlIoH0KDIOnsb6tWf9Rtb7+QpUU3iy1CrKW5j1ilwg/ce8/EiSuc8SueUyndYheiffI0gB/HwdmQ8Hgg5xACMnpO6rlZig1uZYTzdhs6tZG9rrBhy8= 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 15748557972391012.9722174044908; Wed, 27 Nov 2019 03:56:37 -0800 (PST) Received: from localhost ([::1]:37386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvvv-0003bk-Oo for importer@patchew.org; Wed, 27 Nov 2019 06:56:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50400) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvsZ-0008On-60 for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZvsX-0005rU-23 for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:07 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:27801 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 1iZvsW-0005p9-3J for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:04 -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-Wf-WpC5tNGWEjFzpczfMWQ-1; Wed, 27 Nov 2019 06:53:00 -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 A8A008017CC for ; Wed, 27 Nov 2019 11:52:59 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70C7C3B7; Wed, 27 Nov 2019 11:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574855581; 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=i/jhfPVbaw9zN74ATSitQu5mKIuSj4RbYiPEOhbuIgk=; b=decNwre6jE08oPWuauMzFX+58QBrXKyr0Tpr4SJhLnLb9O5zfX8V4aOX6Z0OQijJKuLi4I lIc+7ihOgo31bnvSpLMleNGbQZukrvpyAxmKJZQQsK7GozoAZpYfy/lCZ+sS22CxC9OdD8 5UBjnhYfMtlxMgvfz3Bytn2TskT5dsY= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 4/7] object: add g_autoptr support Date: Wed, 27 Nov 2019 15:51:59 +0400 Message-Id: <20191127115202.375107-5-marcandre.lureau@redhat.com> In-Reply-To: <20191127115202.375107-1-marcandre.lureau@redhat.com> References: <20191127115202.375107-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: Wf-WpC5tNGWEjFzpczfMWQ-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?= , Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann 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 Acked-by: Gerd Hoffmann 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 128d00c77f..f96a44be64 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1747,4 +1747,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 From nobody Thu May 2 17:22:36 2024 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=1574855791; cv=none; d=zohomail.com; s=zohoarc; b=NMMPi5NesuwLQkTZkuBtoFRTwzSz995ck3zYon3hDdZJMbREXdO2vNpovyXr5X1NI/ts/TieDmFQ+b5Qwtj6R4ivRUTpz0zVmADPeJXwIBlBPmYGQMoJ6h/fFvV153JpYbQbm2H5r1OBqtkghSL8w+bEg8OpmQduaGVr0c0tgqA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574855791; 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=V/mcHvKX7InUGUgT0KSXWZlTMQTnyJjgwdgTbknSH9s=; b=WWK7BUpYZ9xng8CWa4DScD10bWLKSS9Hni4H6bMqTONiH7FZQ3e8bu6TMoU/ACZ57EIhRGGxsKUcGgakXJXbwEfudbhMZlHAsmQd/rwG4SLoHhR7NA40bPSMvrckLtIUxdrl1wZUaQyiRgBvThqZZ8Mg/hU5byTpoB9QCDpDFTA= 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 1574855791437606.248893407741; Wed, 27 Nov 2019 03:56:31 -0800 (PST) Received: from localhost ([::1]:37384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvvp-0003Qd-Vb for importer@patchew.org; Wed, 27 Nov 2019 06:56:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50429) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvsj-0000DD-KG for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZvsi-0005yv-B2 for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:17 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:27504 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 1iZvsi-0005yj-5q for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:16 -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-140-svxyzO-dNQmPdcgKPyfYwA-1; Wed, 27 Nov 2019 06:53:14 -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 6F1F8800D4E for ; Wed, 27 Nov 2019 11:53:13 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4AC160618; Wed, 27 Nov 2019 11:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574855595; 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=V/mcHvKX7InUGUgT0KSXWZlTMQTnyJjgwdgTbknSH9s=; b=Tys1pocZgW8Fo0Q7Endn8WR0GXAIy5TDSw9xQc0dhsRm3A+f1rLGcweIHSxlLHn9M4bFAi TQewjVEynViEgJAw2CkJA/fCehge6vn342jNVrAl9oDPy0wY6RSEqsAcJcBZA6zqG3yH46 w3rc6q7SO4+ny6SDE4sl50flfCmXMfE= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 5/7] screendump: replace FILE with QIOChannel and fix close()/qemu_close() Date: Wed, 27 Nov 2019 15:52:00 +0400 Message-Id: <20191127115202.375107-6-marcandre.lureau@redhat.com> In-Reply-To: <20191127115202.375107-1-marcandre.lureau@redhat.com> References: <20191127115202.375107-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: svxyzO-dNQmPdcgKPyfYwA-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?= , Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann 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 Acked-by: Gerd Hoffmann 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 From nobody Thu May 2 17:22:36 2024 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=1574855956; cv=none; d=zohomail.com; s=zohoarc; b=L2GdJe7yiauDDur6IrVvS2GTeDe5+p/Z2K/SwI/Ix72kCBFpRmYzC5IPNO0BXUk7VpvaX3q3GbFW/98wX9gRys/bE+DYxVJRQVashpZgW5QHCGCi53jk6R8Bp5uPPp8Mj8InXrHebepJxV+Pq2W6AIqWWlkpEkZKn8VR59bBm1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574855956; 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=p8tsVTUfoEfZv9VhDPcAAEq3rQMQDEoIiccaTGADpU8=; b=ho/0OVLxpXA2ULSwS/XkK7+KgAKwPdrnmgn34liRYjzAQkch3u4rFHPWfv5kI1UlIh3kDEdFJEwTSklpYo1gAMBIWKokp4Cf1/jDDsU7kvldQdfZY+7iXp0Lbio31GZgfX1ukPUnLsxWG32Q4W2x8FBcjhCHboXiRhU2FlH7NCU= 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 1574855956721165.3037805096984; Wed, 27 Nov 2019 03:59:16 -0800 (PST) Received: from localhost ([::1]:37426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvyV-0006cn-GP for importer@patchew.org; Wed, 27 Nov 2019 06:59:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50478) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvt3-0000Yu-OG for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZvt1-0006DV-Ap for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:37 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:41896 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 1iZvsw-0006AC-Q6 for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:31 -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-175-S04vU510OGONQCQnN3iTjg-1; Wed, 27 Nov 2019 06:53: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 EDA6E107ACE3 for ; Wed, 27 Nov 2019 11:53:25 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C9E610246E3; Wed, 27 Nov 2019 11:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574855610; 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=p8tsVTUfoEfZv9VhDPcAAEq3rQMQDEoIiccaTGADpU8=; b=ZXZZFns+sYE8CiQLbjDkeIv69+5T8k/AZLpuQBFcUtfZY/Jaz/JkbkHKrH4uscsz5iiMTw QFrzjyteJlnn7hjQhx7wsYBWkWamfF+bVx0MNWnv70CIm4xtBwD5eXv/4OtvNlUvlItbf4 xDbUmy0D+Ta1KFbwfe0ar2k3IYD8VPY= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 6/7] osdep: add qemu_unlink() Date: Wed, 27 Nov 2019 15:52:01 +0400 Message-Id: <20191127115202.375107-7-marcandre.lureau@redhat.com> In-Reply-To: <20191127115202.375107-1-marcandre.lureau@redhat.com> References: <20191127115202.375107-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: S04vU510OGONQCQnN3iTjg-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?= , Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann 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 Acked-by: Gerd Hoffmann 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 From nobody Thu May 2 17:22:36 2024 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=1574855736; cv=none; d=zohomail.com; s=zohoarc; b=cjeRq2LdhstMoUxp589F3VeCjI3pqlcg59Vt5QiDPR03cMpq9PN4MQllSAhREwxLVcUEIxEpctti9rpSOk/yNnczfus+vqJFcVBdlbWndClBpGEKlwIyLD2hw4HhyWLBtch8asp35TAU9waidT8tsYvXduKbDxfYDyli5pOWyqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574855736; 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=sTE5AxWhHFArGW+tZpivPFPM3d7d8XOs49LHe2Qq4Fk=; b=JM/N+V2q/wjsI6pGlHdxDT11QQNnGv9PQxKY5XzDBlfwcZ+ftPmO8T1R2IiQuL2XXjq4pgrYYdaz1z8ZS3H3+9T7bsycIY4Hjs44SJhfbiAyUQCpWLd4cBcZJ20qGTwfAndJXAsKSpLXDwXc12wb0hmQ17e9MM0F7Nd/7nobNIw= 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 1574855736088674.5396846462028; Wed, 27 Nov 2019 03:55:36 -0800 (PST) Received: from localhost ([::1]:37378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvuw-0002Hu-EE for importer@patchew.org; Wed, 27 Nov 2019 06:55:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50504) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvtA-0000aL-Qa for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZvt9-0006Jn-2X for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:44 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:46087 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 1iZvt8-0006J8-VU for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:43 -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-155-61ccDH9BOHu8rzr3bJQdvg-1; Wed, 27 Nov 2019 06:53:39 -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 4926318B9FC3 for ; Wed, 27 Nov 2019 11:53:38 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC9995C21B; Wed, 27 Nov 2019 11:53:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574855622; 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=sTE5AxWhHFArGW+tZpivPFPM3d7d8XOs49LHe2Qq4Fk=; b=GU9uHbTdhAoxeYuM3PX7pdQJXLGHIXNlh+OZsedTTBg1enb+UoXbreifNvVvEkme1I18yH pA2vHw6xDbD75EI58Hzg06ayCWN7R0kEZPJvCDTiLi/dC3zBja6jw1A2EDZG5cDICeACce Lu+D+Kj/6ZhNNGoh5lcrQCns3jAuBtQ= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 7/7] screendump: use qemu_unlink() Date: Wed, 27 Nov 2019 15:52:02 +0400 Message-Id: <20191127115202.375107-8-marcandre.lureau@redhat.com> In-Reply-To: <20191127115202.375107-1-marcandre.lureau@redhat.com> References: <20191127115202.375107-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: 61ccDH9BOHu8rzr3bJQdvg-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: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann 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 Acked-by: Gerd Hoffmann 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