From patchwork Thu Jan 14 15:37:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 12019961 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BF1AC433E0 for ; Thu, 14 Jan 2021 15:38:59 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id EE27A23B3E for ; Thu, 14 Jan 2021 15:38:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE27A23B3E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.67223.119876 (Exim 4.92) (envelope-from ) id 1l04i2-0003Zh-R2; Thu, 14 Jan 2021 15:38:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 67223.119876; Thu, 14 Jan 2021 15:38:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l04i2-0003ZS-Mw; Thu, 14 Jan 2021 15:38:50 +0000 Received: by outflank-mailman (input) for mailman id 67223; Thu, 14 Jan 2021 15:38:48 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l04i0-0002SV-NE for xen-devel@lists.xenproject.org; Thu, 14 Jan 2021 15:38:48 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b6ff7336-ed46-4fe2-9fa1-9189bac2523b; Thu, 14 Jan 2021 15:38:13 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3C3DDAEAB; Thu, 14 Jan 2021 15:38:11 +0000 (UTC) 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: b6ff7336-ed46-4fe2-9fa1-9189bac2523b 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=1610638691; 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=Q3Epbt8OR3UBm1QPWykCutE8f5kciM9+d3WgR+ZCjTo=; b=Iwheql/VbKbwrDblLXiGRdmCZ52UidfDnAlUWlNpnCmWk/LXB4UdJ6X6GVwJ9U5cie6ROs eLbSeGxfKRW5swIZ6ki64ZxYU76WdxnpwboTL+f0Xi7C7Wca2L3EPSNnn0rB/iDTclkD1y 5g7UtNLFrwooRqKHn3FAZ96x3tZhmsw= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu , Julien Grall , Paul Durrant Subject: [PATCH v11 22/27] tools/xenstore: add reading global state for live update Date: Thu, 14 Jan 2021 16:37:58 +0100 Message-Id: <20210114153803.2591-23-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210114153803.2591-1-jgross@suse.com> References: <20210114153803.2591-1-jgross@suse.com> MIME-Version: 1.0 Add reading the global state for live update. Signed-off-by: Juergen Gross Acked-by: Julien Grall Reviewed-by: Paul Durrant --- tools/xenstore/xenstored_control.c | 1 + tools/xenstore/xenstored_core.c | 9 +++++++++ tools/xenstore/xenstored_core.h | 2 ++ 3 files changed, 12 insertions(+) diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c index 7d0faa9667..497e1f2a63 100644 --- a/tools/xenstore/xenstored_control.c +++ b/tools/xenstore/xenstored_control.c @@ -536,6 +536,7 @@ void lu_read_state(void) head = (void *)head + sizeof(*head) + head->length) { switch (head->type) { case XS_STATE_TYPE_GLOBAL: + read_state_global(ctx, head + 1); break; case XS_STATE_TYPE_CONN: break; diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index 395a120bef..71c0f8617b 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -2505,6 +2505,15 @@ const char *dump_state_nodes(FILE *fp, const void *ctx) return dump_state_node_tree(fp, path); } +void read_state_global(const void *ctx, const void *state) +{ + const struct xs_state_global *glb = state; + + sock = glb->socket_fd; + + domain_init(glb->evtchn_fd); +} + /* * Local variables: * mode: C diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h index c7567eaf0b..ac9fe1559e 100644 --- a/tools/xenstore/xenstored_core.h +++ b/tools/xenstore/xenstored_core.h @@ -265,6 +265,8 @@ const char *dump_state_node_perms(FILE *fp, struct xs_state_node *sn, const struct xs_permissions *perms, unsigned int n_perms); +void read_state_global(const void *ctx, const void *state); + #endif /* _XENSTORED_CORE_H */ /*