From nobody Mon Feb 9 11:33:38 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=1674035472; cv=none; d=zohomail.com; s=zohoarc; b=GGO9NbriI/e5lBHlNqetQnzqQAONLYJZrU0SSWy8cfZT/WuHdeHxlM+xX3uaRG0gDGKA9j1Vy/sSDMKpiBLaF4VRKxfY6I2WkIMXJdgHDjZpk2JgcLNbmdG0Y+SXhPD7U8wKInnRX+RA+/0bm9L82Ce2IRhmP/4srVsxazk6Ho8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674035472; 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=iWM249T7on3CZ5p3PxYw3ebFU4l9Os88mNOImsi4Puo=; b=A92vlNjxOkZxxXva/VlN118N2XLmJmB9mzp9WKpeu+ab8JRrzAFxtDkiwoxFIzsHfYroiwfbXX9W2T+LxlWSNDsKBImRYP5rdgmcZZy6i0gZRz12waU2TfLz46z5Qxw3ns3jHpACn8PzqcMNEwUKV2CRmUc0VN8lOyLvnRjpyGw= 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 1674035472275109.55569849545998; Wed, 18 Jan 2023 01:51:12 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.480329.744701 (Exim 4.92) (envelope-from ) id 1pI55s-000427-8v; Wed, 18 Jan 2023 09:50:56 +0000 Received: by outflank-mailman (output) from mailman id 480329.744701; Wed, 18 Jan 2023 09:50:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pI55s-000420-5t; Wed, 18 Jan 2023 09:50:56 +0000 Received: by outflank-mailman (input) for mailman id 480329; Wed, 18 Jan 2023 09:50:55 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pI55r-0001BV-1f for xen-devel@lists.xenproject.org; Wed, 18 Jan 2023 09:50:55 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [2001:67c:2178:6::1c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 644e0224-9715-11ed-b8d1-410ff93cb8f0; Wed, 18 Jan 2023 10:49:25 +0100 (CET) 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-out1.suse.de (Postfix) with ESMTPS id F00E7340AE; Wed, 18 Jan 2023 09:50:52 +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 BDE42139D2; Wed, 18 Jan 2023 09:50:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KIbuLPzAx2OAQwAAMHmgww (envelope-from ); Wed, 18 Jan 2023 09:50:52 +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: 644e0224-9715-11ed-b8d1-410ff93cb8f0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1674035452; 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=iWM249T7on3CZ5p3PxYw3ebFU4l9Os88mNOImsi4Puo=; b=WyO3MVgn1JrKHPJ3XkDF9V8ghEzFQ3kKZnpgxTFeG/9QpAB9rgmfvu29HDBW4sBAW4+meE SH2Ug84IHV1L84ugwHmXTTtYC3BSBvG5loQ4kRWxLkO8OyrHWmBJc6L18x5KY6m4pXfKDX +/94+mACf/n3nRAaNefrurXztVA3Hlk= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD , Julien Grall Subject: [PATCH v4 06/17] tools/xenstore: replace watch->relative_path with a prefix length Date: Wed, 18 Jan 2023 10:50:05 +0100 Message-Id: <20230118095016.13091-7-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230118095016.13091-1-jgross@suse.com> References: <20230118095016.13091-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1674035473855100001 Content-Type: text/plain; charset="utf-8" Instead of storing a pointer to the path which is prepended to relative paths in struct watch, just use the length of the prepended path. It should be noted that the now removed special case of the relative path being "" in get_watch_path() can't happen at all. Signed-off-by: Juergen Gross Reviewed-by: Julien Grall --- V2: - don't open code get_watch_path() (Julien Grall) V3: - drop needless modification of dump_state_watches() (Julien Grall) --- tools/xenstore/xenstored_watch.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/tools/xenstore/xenstored_watch.c b/tools/xenstore/xenstored_wa= tch.c index 75748ac109..8ad0229df6 100644 --- a/tools/xenstore/xenstored_watch.c +++ b/tools/xenstore/xenstored_watch.c @@ -39,8 +39,8 @@ struct watch /* Current outstanding events applying to this watch. */ struct list_head events; =20 - /* Is this relative to connnection's implicit path? */ - const char *relative_path; + /* Offset into path for skipping prefix (used for relative paths). */ + unsigned int prefix_len; =20 char *token; char *node; @@ -66,15 +66,7 @@ static bool is_child(const char *child, const char *pare= nt) =20 static const char *get_watch_path(const struct watch *watch, const char *n= ame) { - const char *path =3D name; - - if (watch->relative_path) { - path +=3D strlen(watch->relative_path); - if (*path =3D=3D '/') /* Could be "" */ - path++; - } - - return path; + return name + watch->prefix_len; } =20 /* @@ -211,10 +203,7 @@ static struct watch *add_watch(struct connection *conn= , char *path, char *token, no_quota_check)) goto nomem; =20 - if (relative) - watch->relative_path =3D get_implicit_path(conn); - else - watch->relative_path =3D NULL; + watch->prefix_len =3D relative ? strlen(get_implicit_path(conn)) + 1 : 0; =20 INIT_LIST_HEAD(&watch->events); =20 --=20 2.35.3