From patchwork Thu Feb 15 06:55:41 2024 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: 13557520 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 259B1C48BEF for ; Thu, 15 Feb 2024 06:59:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.681304.1060078 (Exim 4.92) (envelope-from ) id 1raVie-0004iN-S6; Thu, 15 Feb 2024 06:59:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 681304.1060078; Thu, 15 Feb 2024 06:59:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1raVie-0004hX-Os; Thu, 15 Feb 2024 06:59:40 +0000 Received: by outflank-mailman (input) for mailman id 681304; Thu, 15 Feb 2024 06:59:39 +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 1raVgl-0003NA-5X for xen-devel@lists.xenproject.org; Thu, 15 Feb 2024 06:57:43 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 83c200a5-cbcf-11ee-8a4d-1f161083a0e0; Thu, 15 Feb 2024 07:57:42 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 435131F854; Thu, 15 Feb 2024 06:57:42 +0000 (UTC) Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 0E1961346A; Thu, 15 Feb 2024 06:57:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap2.dmz-prg2.suse.org with ESMTPSA id z9/jAea1zWWxSQAAn2gu4w (envelope-from ); Thu, 15 Feb 2024 06:57:42 +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: 83c200a5-cbcf-11ee-8a4d-1f161083a0e0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1707980262; 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=GGQ2M6ZDlC8Q8t5jjlaB/u1rTlT60Df0gemVV+Z+fCo=; b=MZuXh1/rRnf54vH7uhs4GK42aaJ1w/jf7bFQUZgbLMegMuJKE8VLTydKayhMWcTsTXjDhh qdDJmW/Ol1CEUz1s0i39PZ7bn4WaX4DUIVUD8mg5+NIgwzmm+yE4X14LdvnO6mEHalwiNs 8HYBPPJmb266QncFMxRP4JOtNtaXx54= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1707980262; 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=GGQ2M6ZDlC8Q8t5jjlaB/u1rTlT60Df0gemVV+Z+fCo=; b=MZuXh1/rRnf54vH7uhs4GK42aaJ1w/jf7bFQUZgbLMegMuJKE8VLTydKayhMWcTsTXjDhh qdDJmW/Ol1CEUz1s0i39PZ7bn4WaX4DUIVUD8mg5+NIgwzmm+yE4X14LdvnO6mEHalwiNs 8HYBPPJmb266QncFMxRP4JOtNtaXx54= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD , Jason Andryuk Subject: [PATCH v6 21/21] tools/xenstored: have a single do_control_memreport() Date: Thu, 15 Feb 2024 07:55:41 +0100 Message-Id: <20240215065541.21067-22-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240215065541.21067-1-jgross@suse.com> References: <20240215065541.21067-1-jgross@suse.com> MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [4.89 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[suse.com,xen.org,citrix.com,gmail.com]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.01)[50.66%] With 9pfs now available in Xenstore-stubdom, there is no reason to have distinct do_control_memreport() variants for the daemon and the stubdom implementations. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/xenstored/control.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/tools/xenstored/control.c b/tools/xenstored/control.c index dae23a5ac0..9561289179 100644 --- a/tools/xenstored/control.c +++ b/tools/xenstored/control.c @@ -216,23 +216,11 @@ static int do_control_logfile(const void *ctx, struct connection *conn, return 0; } -#ifdef __MINIOS__ -static int do_control_memreport(const void *ctx, struct connection *conn, - const char **vec, int num) -{ - if (num) - return EINVAL; - - talloc_report_full(NULL, stdout); - - send_ack(conn, XS_CONTROL); - return 0; -} -#else static int do_control_memreport(const void *ctx, struct connection *conn, const char **vec, int num) { FILE *fp; + const char *filename; int fd; if (num > 1) @@ -255,8 +243,12 @@ static int do_control_memreport(const void *ctx, struct connection *conn, if (!fp) close(fd); } - } else - fp = fopen(vec[0], "a"); + } else { + filename = absolute_filename(ctx, vec[0]); + if (!filename) + return ENOMEM; + fp = fopen(filename, "a"); + } if (!fp) return EBADF; @@ -267,7 +259,6 @@ static int do_control_memreport(const void *ctx, struct connection *conn, send_ack(conn, XS_CONTROL); return 0; } -#endif static int do_control_print(const void *ctx, struct connection *conn, const char **vec, int num) @@ -310,11 +301,7 @@ static struct cmd_s cmds[] = { " Default timeout is 60 seconds.", 5 }, #endif { "logfile", do_control_logfile, "" }, -#ifdef __MINIOS__ - { "memreport", do_control_memreport, "" }, -#else { "memreport", do_control_memreport, "[]" }, -#endif { "print", do_control_print, "" }, { "quota", do_control_quota, "[set ||max [-r]]" },