From nobody Tue Feb 10 06:58:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1573226872; cv=none; d=zoho.com; s=zohoarc; b=X5oQqiJ6yL0AuvJOrgTN6OROA6ETI6iPN1Gwht4DyCjcs+58b0g0ij7GqsSISgnaEQwQ0dwH+M195n678nFhN1Q1i4vVoYbE5KoJK5eBi9ouWp9/9Eulw1RsIB3LGlfkqO0/vfNDdHZCoqffoHpYGe5Vnfboy8Q3EtHk0HMX1/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573226872; 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=jIU5sd4cEJDAsEIbVZJ6sr5tofbERa/RaiBeM3X4Ttdrevesv7Y3rM/PH+yywVZ9dNKI6qyxJSvcRaGjidQu8HVtFJQ44AldLp74ljqyf17z82XJdN3T+ZWyxmQ/H/VRo4mY9bWnYE4XEgtwISw5MNk+wtXWxcSfD2JPK5K5oAU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1573226872468211.78388611142225; Fri, 8 Nov 2019 07:27:52 -0800 (PST) Received: from localhost ([::1]:56164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iT6Aw-0006Sf-AA for importer@patchew.org; Fri, 08 Nov 2019 10:27:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46894) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iT5pz-00077R-UQ for qemu-devel@nongnu.org; Fri, 08 Nov 2019 10:06:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iT5py-0006Up-Ov for qemu-devel@nongnu.org; Fri, 08 Nov 2019 10:06:11 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:35846 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 1iT5py-0006Ul-LU for qemu-devel@nongnu.org; Fri, 08 Nov 2019 10:06:10 -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-203-_sIIgBRpN5GmaQELGwyHUQ-1; Fri, 08 Nov 2019 10:06:07 -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 018C3800C72 for ; Fri, 8 Nov 2019 15:06:07 +0000 (UTC) Received: from localhost (ovpn-112-25.ams2.redhat.com [10.36.112.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 62F8350; Fri, 8 Nov 2019 15:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573225570; 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=P0SYLfkJGVGCb11QTJjMqlUAk20H+WQ5mqs3rRZmk/zucwuAvpgmMnkM1I+T0e4bcj9o+e VzYnts2khSCvYJi8K/ae7bGbj1rKfJaN9Pg8bSv/DbBsgMzb7B5avj8H6BL+nAv2LB/qRP tP7sD80B4N2Q4pc8eLmS4ZWpJDdnY7o= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v6 20/25] osdep: add qemu_unlink() Date: Fri, 8 Nov 2019 19:01:18 +0400 Message-Id: <20191108150123.12213-21-marcandre.lureau@redhat.com> In-Reply-To: <20191108150123.12213-1-marcandre.lureau@redhat.com> References: <20191108150123.12213-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: _sIIgBRpN5GmaQELGwyHUQ-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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , armbru@redhat.com, kraxel@redhat.com 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 --- 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