From nobody Mon Feb 9 23:38:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1691999282; cv=none; d=zohomail.com; s=zohoarc; b=X5e2x+41HH5uUgXqP6Vn3I2DMuKH1cdXMMB12siBLVMpp+1ppW6dyR3MUtVc0bo/DYrvnvBGxcr3yC8L8tx8T2fshONeh8Layz0cZyIUT51TwWLEaA9yxbhBP+fK1bqJZ8QvsybpgEzQG19Lirsqqc7oXDzyUpJKtGu4shiffhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691999282; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BG6qvkTJomUkTWnj+OlsG8s/EdIwcHngnOtZ7JpxP6M=; b=WSOLczjhDeDETaiQqccGFa+IRL6mmQSjPQI7gRjEiX6hFJ4OJdsoTQ3xIPIrM9shRFv30613cG1zsnmC6FyJvVnd8y3iStVz0wBQuoSAGPfrNwpjUcn6pVVs47Ar8URVi89aN+tyKWDK7j54QPXXISm3fM45hD2H0uKjMIrl9mg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1691999282583514.8159375420398; Mon, 14 Aug 2023 00:48:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.583325.913506 (Exim 4.92) (envelope-from ) id 1qVSIj-0004XZ-VL; Mon, 14 Aug 2023 07:47:45 +0000 Received: by outflank-mailman (output) from mailman id 583325.913506; Mon, 14 Aug 2023 07:47:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qVSIj-0004XQ-SE; Mon, 14 Aug 2023 07:47:45 +0000 Received: by outflank-mailman (input) for mailman id 583325; Mon, 14 Aug 2023 07:47:44 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qVSIi-0002SK-PE for xen-devel@lists.xenproject.org; Mon, 14 Aug 2023 07:47:44 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id da82ddac-3a76-11ee-b288-6b7b168915f2; Mon, 14 Aug 2023 09:47:44 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 12F881FD60; Mon, 14 Aug 2023 07:47:44 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D4574138EE; Mon, 14 Aug 2023 07:47:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id T/+PMh/c2WTiQQAAMHmgww (envelope-from ); Mon, 14 Aug 2023 07:47:43 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: da82ddac-3a76-11ee-b288-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1691999264; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BG6qvkTJomUkTWnj+OlsG8s/EdIwcHngnOtZ7JpxP6M=; b=dToHoiLXuAix5YyO8lKnbdWE4Jd2JYRLWh79ZyMjzSTiUP12YZ3x//MMfL5c0lK2au+RdH 8Wz1CvYlgC8thJb7onpGoEmboATAIS6E56tPE4O8VwtfTEUDaTR4u4dZ8BKqqzD1m5PZm4 1N518dXE6J2m8YqR3qE2JXMDz6Az2IM= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD , Julien Grall Subject: [PATCH v4 06/19] tools/xenstore: let db_delete() return void Date: Mon, 14 Aug 2023 09:46:54 +0200 Message-Id: <20230814074707.27696-7-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230814074707.27696-1-jgross@suse.com> References: <20230814074707.27696-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1691999283940100001 Content-Type: text/plain; charset="utf-8" db_delete() only ever is returning 0. Switch it to return void and remove all the error handling dealing wit a non-zero return value. Suggested-by: Julien Grall Signed-off-by: Juergen Gross Reviewed-by: Julien Grall --- V2: - new patch --- tools/xenstore/xenstored_core.c | 11 ++++------- tools/xenstore/xenstored_core.h | 4 ++-- tools/xenstore/xenstored_transaction.c | 14 +++++--------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_cor= e.c index 2b94392fd4..a08962c3ea 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -677,8 +677,8 @@ int db_write(struct connection *conn, const char *db_na= me, void *data, return 0; } =20 -int db_delete(struct connection *conn, const char *name, - struct node_account_data *acc) +void db_delete(struct connection *conn, const char *name, + struct node_account_data *acc) { struct node_account_data tmp_acc; unsigned int domid; @@ -698,8 +698,6 @@ int db_delete(struct connection *conn, const char *name, domain_memory_add_nochk(conn, domid, -acc->memory - strlen(name)); } - - return 0; } =20 /* @@ -1670,9 +1668,8 @@ static int delnode_sub(const void *ctx, struct connec= tion *conn, if (domain_nbentry_dec(conn, get_node_owner(node))) return WALK_TREE_ERROR_STOP; =20 - /* In case of error stop the walk. */ - if (!ret && db_delete(conn, db_name, &node->acc)) - return WALK_TREE_ERROR_STOP; + if (!ret) + db_delete(conn, db_name, &node->acc); =20 /* * Fire the watches now, when we can still see the node permissions. diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_cor= e.h index ce40c61f44..e1aeb4aecd 100644 --- a/tools/xenstore/xenstored_core.h +++ b/tools/xenstore/xenstored_core.h @@ -366,8 +366,8 @@ struct xs_tdb_record_hdr *db_fetch(const char *db_name,= size_t *size); int db_write(struct connection *conn, const char *db_name, void *data, size_t size, struct node_account_data *acc, enum write_node_mode mode, bool no_quota_check); -int db_delete(struct connection *conn, const char *name, - struct node_account_data *acc); +void db_delete(struct connection *conn, const char *name, + struct node_account_data *acc); =20 void conn_free_buffered_data(struct connection *conn); =20 diff --git a/tools/xenstore/xenstored_transaction.c b/tools/xenstore/xensto= red_transaction.c index 378fe79763..fbcea3663e 100644 --- a/tools/xenstore/xenstored_transaction.c +++ b/tools/xenstore/xenstored_transaction.c @@ -377,10 +377,8 @@ static int finalize_transaction(struct connection *con= n, =20 /* Entries for unmodified nodes can be removed early. */ if (!i->modified) { - if (i->ta_node) { - if (db_delete(conn, i->trans_name, NULL)) - return EIO; - } + if (i->ta_node) + db_delete(conn, i->trans_name, NULL); list_del(&i->list); talloc_free(i); } @@ -397,8 +395,7 @@ static int finalize_transaction(struct connection *conn, ? NODE_CREATE : NODE_MODIFY; *is_corrupt |=3D db_write(conn, i->node, hdr, size, NULL, mode, true); - if (db_delete(conn, i->trans_name, NULL)) - *is_corrupt =3D true; + db_delete(conn, i->trans_name, NULL); } else { *is_corrupt =3D true; } @@ -408,9 +405,8 @@ static int finalize_transaction(struct connection *conn, * in this transaction will have no generation * information stored. */ - *is_corrupt |=3D (i->generation =3D=3D NO_GENERATION) - ? false - : db_delete(conn, i->node, NULL); + if (i->generation !=3D NO_GENERATION) + db_delete(conn, i->node, NULL); } if (i->fire_watch) fire_watches(conn, trans, i->node, NULL, i->watch_exact, --=20 2.35.3