Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC046C0015E for ; Mon, 24 Jul 2023 11:03:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.568732.888583 (Exim 4.92) (envelope-from ) id 1qNtLJ-0000xb-MF; Mon, 24 Jul 2023 11:03:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 568732.888583; Mon, 24 Jul 2023 11:03:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qNtLJ-0000xR-Im; Mon, 24 Jul 2023 11:03:09 +0000 Received: by outflank-mailman (input) for mailman id 568732; Mon, 24 Jul 2023 11:03:07 +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 1qNtLH-0000KR-Q0 for xen-devel@lists.xenproject.org; Mon, 24 Jul 2023 11:03:07 +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 ab4d4a66-2a11-11ee-b23a-6b7b168915f2; Mon, 24 Jul 2023 13:03:07 +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 1D14020695; Mon, 24 Jul 2023 11:03:07 +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 DE56013476; Mon, 24 Jul 2023 11:03:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QgPXNGpavmRVYQAAMHmgww (envelope-from ); Mon, 24 Jul 2023 11:03:06 +0000 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: ab4d4a66-2a11-11ee-b23a-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1690196587; 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=SQf628ebvedy/oSH7lsRps7bb3KYzWqEHfLoukckbyU=; b=N3OsHHCa1qqmtwZ6iexrpcTMEBbBIgUl8kaOV7Of4r+BskBO9y80MPhlh4r4PorEiGcZwG Tv/4+5GEc0Ow4VSfqQalbSNAk4l3zxDWBjALtzUe3FfJNxLQjVkDGHzuylzNusZf+aUm1A 9Tbzy/gQSFeMRVA2Ajb6OZHrZZ+6sDs= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD , Julien Grall Subject: [PATCH v3 03/25] tools/xenstore: let transaction_prepend() return the name for access Date: Mon, 24 Jul 2023 13:02:25 +0200 Message-Id: <20230724110247.10520-4-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230724110247.10520-1-jgross@suse.com> References: <20230724110247.10520-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Instead of setting the TDB key for accessing the node in the data base, let transaction_prepend() return the associated name instead. This is in preparation to replace TDB with a more simple data storage. Signed-off-by: Juergen Gross Reviewed-by: Julien Grall --- tools/xenstore/xenstored_core.c | 4 +++- tools/xenstore/xenstored_transaction.c | 11 ++++------- tools/xenstore/xenstored_transaction.h | 3 +-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index ba4798dd6e..474bc57e73 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -695,6 +695,7 @@ struct node *read_node(struct connection *conn, const void *ctx, TDB_DATA key, data; struct xs_tdb_record_hdr *hdr; struct node *node; + const char *db_name; int err; node = talloc(ctx, struct node); @@ -709,7 +710,8 @@ struct node *read_node(struct connection *conn, const void *ctx, return NULL; } - transaction_prepend(conn, name, &key); + db_name = transaction_prepend(conn, name); + set_tdb_key(db_name, &key); data = tdb_fetch(tdb_ctx, key); diff --git a/tools/xenstore/xenstored_transaction.c b/tools/xenstore/xenstored_transaction.c index 020b70d954..36567db753 100644 --- a/tools/xenstore/xenstored_transaction.c +++ b/tools/xenstore/xenstored_transaction.c @@ -196,20 +196,17 @@ static char *transaction_get_node_name(void *ctx, struct transaction *trans, * Prepend the transaction to name if node has been modified in the current * transaction. */ -void transaction_prepend(struct connection *conn, const char *name, - TDB_DATA *key) +const char *transaction_prepend(struct connection *conn, const char *name) { struct accessed_node *i; if (conn && conn->transaction) { i = find_accessed_node(conn->transaction, name); - if (i) { - set_tdb_key(i->trans_name, key); - return; - } + if (i) + return i->trans_name; } - set_tdb_key(name, key); + return name; } /* diff --git a/tools/xenstore/xenstored_transaction.h b/tools/xenstore/xenstored_transaction.h index f6a2e2f7f5..b196b1ab07 100644 --- a/tools/xenstore/xenstored_transaction.h +++ b/tools/xenstore/xenstored_transaction.h @@ -47,8 +47,7 @@ int __must_check access_node(struct connection *conn, struct node *node, void queue_watches(struct connection *conn, const char *name, bool watch_exact); /* Prepend the transaction to name if appropriate. */ -void transaction_prepend(struct connection *conn, const char *name, - TDB_DATA *key); +const char *transaction_prepend(struct connection *conn, const char *name); /* Mark the transaction as failed. This will prevent it to be committed. */ void fail_transaction(struct transaction *trans); -- 2.35.3