From nobody Tue Feb 10 16:21:42 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 ARC-Seal: i=1; a=rsa-sha256; t=1623854634; cv=none; d=zohomail.com; s=zohoarc; b=QzGmTdYFfxg6mZ/bmHVqgbgJEKnWxfA3EA44hGn6eysIPuBHhbjeBsvQTtt5qazWukf1QLOsGzvPEd/ZdSO8eWyl19lD9uTgK4cAf948jdGmeUiLYvblihOVlEAtbSutuZGgAb7ysz46P55sRNOKswFGm4yv+CwhwDlERsMzeCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623854634; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=xS2Ezk6IKf2znuGkPh4eU4xq2n4H9YnKOyWflMAxdpI=; b=RWZV25a6tyWJG5EmPNrX7b2l4W1R6gdnvZyM9cGC7vqnIlnLCp/BF+/PXBmxd+i7VXkm/Z+edBxcvFyKQyMu7zs2AuuhTE99Mlf2NLhAE95shG1qt2rzQIACuLlBCf5U7Ach7QkS+u7kY/QOyv+FPFx0ANWm6fC3Q3cAbNLcc2I= 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1623854634662967.5643546898405; Wed, 16 Jun 2021 07:43:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.143288.264213 (Exim 4.92) (envelope-from ) id 1ltWlb-0007lT-Q9; Wed, 16 Jun 2021 14:43:43 +0000 Received: by outflank-mailman (output) from mailman id 143288.264213; Wed, 16 Jun 2021 14:43:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ltWlb-0007js-Cb; Wed, 16 Jun 2021 14:43:43 +0000 Received: by outflank-mailman (input) for mailman id 143288; Wed, 16 Jun 2021 14:43:41 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ltWlZ-0007AL-2j for xen-devel@lists.xenproject.org; Wed, 16 Jun 2021 14:43:41 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ltWlY-0004F5-9d; Wed, 16 Jun 2021 14:43:40 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltWlY-0007D0-1H; Wed, 16 Jun 2021 14:43:40 +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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=xS2Ezk6IKf2znuGkPh4eU4xq2n4H9YnKOyWflMAxdpI=; b=rTI2FWbDmwOU+ZmJRYSDmZq+x Urw587evNvAsBzxoNv4yyEvVa3DN3rzzXLATjbW2U+u0iQ4JPV5cEEapLQLirpv+pdqB1TciCzf+V E9c2zPhuhG61R7p/A2q6dZazkAPyr+HWWffWt1ynbjUBCaNgreQxRPZEiZXHy/DUcVGu8=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: raphning@amazon.co.uk, doebel@amazon.de, Julien Grall , Ian Jackson , Wei Liu , Juergen Gross , Julien Grall Subject: [PATCH 09/10] tools/xenstored: Dump delayed requests Date: Wed, 16 Jun 2021 15:43:23 +0100 Message-Id: <20210616144324.31652-10-julien@xen.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210616144324.31652-1-julien@xen.org> References: <20210616144324.31652-1-julien@xen.org> X-ZohoMail-DKIM: pass (identity @xen.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Julien Grall Currently, only Live-Update request can be delayed. In a follow-up, we will want to delay more requests (e.g. transaction start). Therefore we want to preserve delayed requests across Live-Update. Delayed requests are just complete "in" buffer. So the code is refactored to allow sharing the code to dump "in" buffer. Signed-off-by: Julien Grall Reviewed-by: Luca Fancellu --- tools/xenstore/xenstored_core.c | 42 +++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_cor= e.c index 5b7ab7f74013..9eca58682b51 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -2403,25 +2403,47 @@ const char *dump_state_global(FILE *fp) return NULL; } =20 +static const char *dump_input_buffered_data(FILE *fp, + const struct buffered_data *in, + unsigned int *total_len) +{ + unsigned int hlen =3D in->inhdr ? in->used : sizeof(in->hdr); + + *total_len +=3D hlen; + if (fp && fwrite(&in->hdr, hlen, 1, fp) !=3D 1) + return "Dump read data error"; + if (!in->inhdr && in->used) { + *total_len +=3D in->used; + if (fp && fwrite(in->buffer, in->used, 1, fp) !=3D 1) + return "Dump read data error"; + } + + return NULL; +} + /* Called twice: first with fp =3D=3D NULL to get length, then for writing= data. */ const char *dump_state_buffered_data(FILE *fp, const struct connection *c, struct xs_state_connection *sc) { unsigned int len =3D 0, used; - struct buffered_data *out, *in =3D c->in; + struct buffered_data *out; bool partial =3D true; + struct delayed_request *req; + const char *ret; =20 - if (in) { - len =3D in->inhdr ? in->used : sizeof(in->hdr); - if (fp && fwrite(&in->hdr, len, 1, fp) !=3D 1) - return "Dump read data error"; - if (!in->inhdr && in->used) { - len +=3D in->used; - if (fp && fwrite(in->buffer, in->used, 1, fp) !=3D 1) - return "Dump read data error"; - } + /* Dump any command that was delayed */ + list_for_each_entry(req, &c->delayed, list) { + if (req->func !=3D process_delayed_message) + continue; + + assert(!req->in->inhdr); + if ((ret =3D dump_input_buffered_data(fp, req->in, &len))) + return ret; } =20 + if (c->in && (ret =3D dump_input_buffered_data(fp, c->in, &len))) + return ret; + if (sc) { sc->data_in_len =3D len; sc->data_resp_len =3D 0; --=20 2.17.1