From nobody Mon Feb 9 08:55:18 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=1608050194; cv=none; d=zohomail.com; s=zohoarc; b=PEXNJVh7awVPtULVFvwVcK0o6veM1M3FsU4w40HKBBVkvqE+q1Li+EQ1/XQGfuvkup/NLt+qUFiZnxZwik67KZTasn09HkNhvT1DjHJr1tbczv9V5H24a4bEq7Ylbqn/ZO6IYhYKojULs0SEP34sWu7rf/MkkUEx5LwUow70OfM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608050194; 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=3PuHi28Ilah+6+tULvxDPYy5ikYx4BHQrVKKI8OOPfk=; b=D1IlXqPW0rxEzVOjXZ16eqVvGI0j2DUe0yESMq0sCNBh7KcWRNsw+aY3QmzTI7cyFHODsevkroNR5SEVlMk2FIEOG2nuGpz94PMiU6XR57XfV8xJD2TZFcAXBRP5RAis+BToeQH99ZaG1tVXQehY7qoVKxdfICY+uaLYnHZRDqY= 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) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 160805019432415.497410696545785; Tue, 15 Dec 2020 08:36:34 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.54530.94852 (Exim 4.92) (envelope-from ) id 1kpDJB-0006DR-Rq; Tue, 15 Dec 2020 16:36:17 +0000 Received: by outflank-mailman (output) from mailman id 54530.94852; Tue, 15 Dec 2020 16:36:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kpDJB-0006DI-NE; Tue, 15 Dec 2020 16:36:17 +0000 Received: by outflank-mailman (input) for mailman id 54530; Tue, 15 Dec 2020 16:36:16 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kpDJA-00066M-HY for xen-devel@lists.xenproject.org; Tue, 15 Dec 2020 16:36:16 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2487bee8-80c9-4fc5-a19c-ec077f182862; Tue, 15 Dec 2020 16:36:08 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0F68EAD60; Tue, 15 Dec 2020 16:36:08 +0000 (UTC) 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: 2487bee8-80c9-4fc5-a19c-ec077f182862 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1608050168; 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=3PuHi28Ilah+6+tULvxDPYy5ikYx4BHQrVKKI8OOPfk=; b=HVWTV8zu8kcDgmNvdRRp4axdAd+XJXPUrNLtCjKyGguVtlf0u8JKk2RDWduVaLetAjKvjn brq5T7y+XZoZLXQC84UlFpdYkeTRz44nFn52ABubZOH7dAHodvHx6h2OABNnz/OQesw4cV C2ZHbbC2ALfzS9mghwruUvKL7VNd+yw= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu , Paul Durrant Subject: [PATCH v10 02/25] tools/xenstore: make set_tdb_key() non-static Date: Tue, 15 Dec 2020 17:35:40 +0100 Message-Id: <20201215163603.21700-3-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201215163603.21700-1-jgross@suse.com> References: <20201215163603.21700-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" set_tdb_key() can be used by destroy_node(), too. So remove the static attribute and move it to xenstored_core.c. Signed-off-by: Juergen Gross Reviewed-by: Paul Durrant --- V5: - new patch V6: - add comment (Julien Grall) Signed-off-by: Juergen Gross --- tools/xenstore/xenstored_core.c | 14 +++++++++++--- tools/xenstore/xenstored_core.h | 2 ++ tools/xenstore/xenstored_transaction.c | 6 ------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_cor= e.c index 3082a36d3a..ab1c7835b8 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -352,6 +352,16 @@ static void initialize_fds(int *p_sock_pollfd_idx, int= *ptimeout) } } =20 +void set_tdb_key(const char *name, TDB_DATA *key) +{ + /* + * Dropping const is fine here, as the key will never be modified + * by TDB. + */ + key->dptr =3D (char *)name; + key->dsize =3D strlen(name); +} + /* * If it fails, returns NULL and sets errno. * Temporary memory allocations will be done with ctx. @@ -985,9 +995,7 @@ static int destroy_node(void *_node) if (streq(node->name, "/")) corrupt(NULL, "Destroying root node!"); =20 - key.dptr =3D (void *)node->name; - key.dsize =3D strlen(node->name); - + set_tdb_key(node->name, &key); tdb_delete(tdb_ctx, key); =20 domain_entry_dec(talloc_parent(node), node); diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_cor= e.h index 4c6c3d6f20..fb59d862a2 100644 --- a/tools/xenstore/xenstored_core.h +++ b/tools/xenstore/xenstored_core.h @@ -220,6 +220,8 @@ extern xengnttab_handle **xgt_handle; =20 int remember_string(struct hashtable *hash, const char *str); =20 +void set_tdb_key(const char *name, TDB_DATA *key); + #endif /* _XENSTORED_CORE_H */ =20 /* diff --git a/tools/xenstore/xenstored_transaction.c b/tools/xenstore/xensto= red_transaction.c index 2881f3b2e4..52355f4ed8 100644 --- a/tools/xenstore/xenstored_transaction.c +++ b/tools/xenstore/xenstored_transaction.c @@ -168,12 +168,6 @@ struct transaction extern int quota_max_transaction; uint64_t generation; =20 -static void set_tdb_key(const char *name, TDB_DATA *key) -{ - key->dptr =3D (char *)name; - key->dsize =3D strlen(name); -} - static struct accessed_node *find_accessed_node(struct transaction *trans, const char *name) { --=20 2.26.2