From patchwork Sat May 13 14:20:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 13240250 Received: from esa12.hc1455-7.c3s2.iphmx.com (esa12.hc1455-7.c3s2.iphmx.com [139.138.37.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A42F63C8 for ; Sat, 13 May 2023 14:21:01 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10708"; a="96025989" X-IronPort-AV: E=Sophos;i="5.99,272,1677510000"; d="scan'208";a="96025989" Received: from unknown (HELO yto-r3.gw.nic.fujitsu.com) ([218.44.52.219]) by esa12.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2023 23:20:51 +0900 Received: from yto-m1.gw.nic.fujitsu.com (yto-nat-yto-m1.gw.nic.fujitsu.com [192.168.83.64]) by yto-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id 7013CE4289 for ; Sat, 13 May 2023 23:20:48 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by yto-m1.gw.nic.fujitsu.com (Postfix) with ESMTP id BB3C2CFB67 for ; Sat, 13 May 2023 23:20:47 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id 3A84D2007CDE5; Sat, 13 May 2023 23:20:47 +0900 (JST) From: Li Zhijian To: nvdimm@lists.linux.dev Cc: Li Zhijian Subject: [ndctl PATCH 1/6] cxl/monitor: Fix monitor not working Date: Sat, 13 May 2023 22:20:33 +0800 Message-Id: <20230513142038.753351-2-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230513142038.753351-1-lizhijian@fujitsu.com> References: <20230513142038.753351-1-lizhijian@fujitsu.com> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-27622.007 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-27622.007 X-TMASE-Result: 10--7.603700-10.000000 X-TMASE-MatchedRID: iuUHfCgXiTNujdbubeNfI5jnsVPBNMvRG24YVeuZGmPk6Qbi+9i6DwzK NF0GZctoN/7rnrBxoxzmn3xyPJAJoh2P280ZiGmRuLt50vtxBA5+tO36GYDlsj3SHZ6GCFLZo8W MkQWv6iV3LAytsQR4e42j49Ftap9EOwBXM346/+wy9G73P9DbMVuwe9LV+wr+rZ3TaYPN2sEEbV 9K1w1C14m9ixJ12P85 X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 It looks that someone forgot to rewrite this part after ba5825b0b7e0 ("ndctl/monitor: move common logging functions to util/log.c") # build/cxl/cxl monitor -l ./monitor.log Segmentation fault (core dumped) Fixes: 299f69f974a6 ("cxl/monitor: add a new monitor command for CXL trace events") Signed-off-by: Li Zhijian Reviewed-by: Dave Jiang --- cxl/monitor.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cxl/monitor.c b/cxl/monitor.c index e3469b9a4792..4043928db3ef 100644 --- a/cxl/monitor.c +++ b/cxl/monitor.c @@ -37,7 +37,6 @@ const char *default_log = "/var/log/cxl-monitor.log"; static struct monitor { const char *log; struct log_ctx ctx; - FILE *log_file; bool human; bool verbose; bool daemon; @@ -189,8 +188,8 @@ int cmd_monitor(int argc, const char **argv, struct cxl_ctx *ctx) if (!monitor.log) log = default_log; - monitor.log_file = fopen(log, "a+"); - if (!monitor.log_file) { + monitor.ctx.log_file = fopen(log, "a+"); + if (!monitor.ctx.log_file) { rc = -errno; error("open %s failed: %d\n", monitor.log, rc); goto out; @@ -210,7 +209,7 @@ int cmd_monitor(int argc, const char **argv, struct cxl_ctx *ctx) rc = monitor_event(ctx); out: - if (monitor.log_file) - fclose(monitor.log_file); + if (monitor.ctx.log_file) + fclose(monitor.ctx.log_file); return rc; } From patchwork Sat May 13 14:20:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 13240249 Received: from esa4.hc1455-7.c3s2.iphmx.com (esa4.hc1455-7.c3s2.iphmx.com [68.232.139.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A43CA2263E for ; Sat, 13 May 2023 14:21:00 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10708"; a="116525315" X-IronPort-AV: E=Sophos;i="5.99,272,1677510000"; d="scan'208";a="116525315" Received: from unknown (HELO yto-r4.gw.nic.fujitsu.com) ([218.44.52.220]) by esa4.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2023 23:20:51 +0900 Received: from yto-m2.gw.nic.fujitsu.com (yto-nat-yto-m2.gw.nic.fujitsu.com [192.168.83.65]) by yto-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id D2F7FCD6C0 for ; Sat, 13 May 2023 23:20:48 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by yto-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id 1199AD5E86 for ; Sat, 13 May 2023 23:20:48 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id 836112007CDE6; Sat, 13 May 2023 23:20:47 +0900 (JST) From: Li Zhijian To: nvdimm@lists.linux.dev Cc: Li Zhijian Subject: [ndctl PATCH 2/6] cxl/monitor: compare the whole filename with reserved words Date: Sat, 13 May 2023 22:20:34 +0800 Message-Id: <20230513142038.753351-3-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230513142038.753351-1-lizhijian@fujitsu.com> References: <20230513142038.753351-1-lizhijian@fujitsu.com> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-27622.007 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-27622.007 X-TMASE-Result: 10--4.797400-10.000000 X-TMASE-MatchedRID: IAkHRTl/xj1ujdbubeNfIyoiRKlBVkYIMC4zO7d4kaPAuQ0xDMaXkH4q tYI9sRE/KqrQ7lLcMnxRzi+uKjH4IZH0YXYnbGozFEUknJ/kEl5jFT88f69nG/oLR4+zsDTtjoc zmuoPCq37Cu2a4WDaU0ZOXxkv2Gc9WaogLJqKD25J5fd8V3ESyWcHEgh/NuPzpfbrmfPbzvjacC tPgmIKEDIW6PkGTevcvTlZnIcT2uEVwbf5lERMgI/2RRfVn5u4Tcu6aRtCI3BUKpNI+7y1VHsDE gQ63iHZ X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 For example: $ cxl monitor -l standard.log User is most likely want to save log to ./standard.log instead of stdout. Signed-off-by: Li Zhijian --- cxl/monitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cxl/monitor.c b/cxl/monitor.c index 4043928db3ef..842e54b186ab 100644 --- a/cxl/monitor.c +++ b/cxl/monitor.c @@ -181,7 +181,8 @@ int cmd_monitor(int argc, const char **argv, struct cxl_ctx *ctx) if (monitor.log) { if (strncmp(monitor.log, "./", 2) != 0) fix_filename(prefix, (const char **)&monitor.log); - if (strncmp(monitor.log, "./standard", 10) == 0 && !monitor.daemon) { + + if (strcmp(monitor.log, "./standard") == 0 && !monitor.daemon) { monitor.ctx.log_fn = log_standard; } else { const char *log = monitor.log; From patchwork Sat May 13 14:20:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 13240251 Received: from esa12.hc1455-7.c3s2.iphmx.com (esa12.hc1455-7.c3s2.iphmx.com [139.138.37.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2471263C8 for ; Sat, 13 May 2023 14:21:04 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10708"; a="96025990" X-IronPort-AV: E=Sophos;i="5.99,272,1677510000"; d="scan'208";a="96025990" Received: from unknown (HELO yto-r1.gw.nic.fujitsu.com) ([218.44.52.217]) by esa12.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2023 23:20:51 +0900 Received: from yto-m1.gw.nic.fujitsu.com (yto-nat-yto-m1.gw.nic.fujitsu.com [192.168.83.64]) by yto-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 0779FDAE0C for ; Sat, 13 May 2023 23:20:49 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by yto-m1.gw.nic.fujitsu.com (Postfix) with ESMTP id 5167BCFB67 for ; Sat, 13 May 2023 23:20:48 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id CAB382007CDDD; Sat, 13 May 2023 23:20:47 +0900 (JST) From: Li Zhijian To: nvdimm@lists.linux.dev Cc: Li Zhijian Subject: [ndctl PATCH 3/6] cxl/monitor: Enable default_log and refactor sanity check Date: Sat, 13 May 2023 22:20:35 +0800 Message-Id: <20230513142038.753351-4-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230513142038.753351-1-lizhijian@fujitsu.com> References: <20230513142038.753351-1-lizhijian@fujitsu.com> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-27622.007 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-27622.007 X-TMASE-Result: 10--10.932400-10.000000 X-TMASE-MatchedRID: 3egoFLofC9QmIUsxKhH73EhwlOfYeSqxIfyQNHR2naZUjspoiX02F9/o yHSxbX6QC3E/pZVge5ocDvR0/knYncgqWOFh1Y7mSZJFFtJz2zfBOVz0Jwcxl6vCrG0TnfVUIb5 NpqK++5rMP8Zz0+GC1SAJB0U5f8Y908q9KSsUtVfNgrlT5Ajc7sCY5/Mqi1OiTNObyxjW9zqjxY yRBa/qJcFwgTvxipFajoczmuoPCq2BdyV2Bgygdc9eXW151k2XjiAVtCLqefIPbjab2Bq73UPy0 aphFd2x X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 The default_log is not working at all. Simply the sanity check and re-enable default log file so that it can be consistent with the document. Please note that i also removed following addition stuff, since we have added this prefix if needed during parsing the FILENAME. if (strncmp(monitor.log, "./", 2) != 0) fix_filename(prefix, (const char **)&monitor.log); Signed-off-by: Li Zhijian --- cxl/monitor.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/cxl/monitor.c b/cxl/monitor.c index 842e54b186ab..139506aed85a 100644 --- a/cxl/monitor.c +++ b/cxl/monitor.c @@ -163,6 +163,7 @@ int cmd_monitor(int argc, const char **argv, struct cxl_ctx *ctx) }; const char *prefix ="./"; int rc = 0, i; + const char *log; argc = parse_options_prefix(argc, argv, prefix, options, u, 0); for (i = 0; i < argc; i++) @@ -170,32 +171,32 @@ int cmd_monitor(int argc, const char **argv, struct cxl_ctx *ctx) if (argc) usage_with_options(u, options); - log_init(&monitor.ctx, "cxl/monitor", "CXL_MONITOR_LOG"); - monitor.ctx.log_fn = log_standard; + // sanity check + if (monitor.daemon && monitor.log && !strncmp(monitor.log, "./", 2)) { + error("standard or relative path for will not work for daemon mode\n"); + return -EINVAL; + } + + if (monitor.log) + log = monitor.log; + else + log = monitor.daemon ? default_log : "./standard"; + log_init(&monitor.ctx, "cxl/monitor", "CXL_MONITOR_LOG"); if (monitor.verbose) monitor.ctx.log_priority = LOG_DEBUG; else monitor.ctx.log_priority = LOG_INFO; - if (monitor.log) { - if (strncmp(monitor.log, "./", 2) != 0) - fix_filename(prefix, (const char **)&monitor.log); - - if (strcmp(monitor.log, "./standard") == 0 && !monitor.daemon) { - monitor.ctx.log_fn = log_standard; - } else { - const char *log = monitor.log; - - if (!monitor.log) - log = default_log; - monitor.ctx.log_file = fopen(log, "a+"); - if (!monitor.ctx.log_file) { - rc = -errno; - error("open %s failed: %d\n", monitor.log, rc); - goto out; - } - monitor.ctx.log_fn = log_file; + if (strcmp(log, "./standard") == 0) + monitor.ctx.log_fn = log_standard; + else { + monitor.ctx.log_fn = log_file; + monitor.ctx.log_file = fopen(log, "a+"); + if (!monitor.ctx.log_file) { + rc = -errno; + error("open %s failed: %d\n", log, rc); + goto out; } } From patchwork Sat May 13 14:20:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 13240255 Received: from esa1.hc1455-7.c3s2.iphmx.com (esa1.hc1455-7.c3s2.iphmx.com [207.54.90.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93CE763CA for ; Sat, 13 May 2023 14:22:07 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10708"; a="116441724" X-IronPort-AV: E=Sophos;i="5.99,272,1677510000"; d="scan'208";a="116441724" Received: from unknown (HELO oym-r2.gw.nic.fujitsu.com) ([210.162.30.90]) by esa1.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2023 23:20:53 +0900 Received: from oym-m1.gw.nic.fujitsu.com (oym-nat-oym-m1.gw.nic.fujitsu.com [192.168.87.58]) by oym-r2.gw.nic.fujitsu.com (Postfix) with ESMTP id 52E55D4322 for ; Sat, 13 May 2023 23:20:49 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by oym-m1.gw.nic.fujitsu.com (Postfix) with ESMTP id 8BD4FD88B5 for ; Sat, 13 May 2023 23:20:48 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id 138D32007CDE5; Sat, 13 May 2023 23:20:48 +0900 (JST) From: Li Zhijian To: nvdimm@lists.linux.dev Cc: Li Zhijian Subject: [ndctl PATCH 4/6] cxl/monitor: always log started message Date: Sat, 13 May 2023 22:20:36 +0800 Message-Id: <20230513142038.753351-5-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230513142038.753351-1-lizhijian@fujitsu.com> References: <20230513142038.753351-1-lizhijian@fujitsu.com> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-27622.007 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-27622.007 X-TMASE-Result: 10--1.454700-10.000000 X-TMASE-MatchedRID: ZYjN+pfhQkov+0FNnM7lDQPZZctd3P4BmSLeIgEDej/PWp1UK7zV928g t97yUnX94vM1YF6AJbadn/a8z5b7FtAtbEEX0MxBxEHRux+uk8hxKpvEGAbTDjOf+hPWh33rZdq WI7mmTxUtUw8gDMXGog0p1KsOkL0iEqbkIH4I8Zg3sdcYTO4+VW5Oyxs3FFYCzcYlmUtMTAehkZ FqIiAEuVuMG6V02+QySir3tZId0WN+6klq53W5kJ9Gzq4huQVX X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 Tell people monitor is starting Signed-off-by: Li Zhijian --- cxl/monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cxl/monitor.c b/cxl/monitor.c index 139506aed85a..6761f3bb97af 100644 --- a/cxl/monitor.c +++ b/cxl/monitor.c @@ -205,8 +205,8 @@ int cmd_monitor(int argc, const char **argv, struct cxl_ctx *ctx) err(&monitor, "daemon start failed\n"); goto out; } - info(&monitor, "cxl monitor daemon started.\n"); } + info(&monitor, "cxl monitor started.\n"); rc = monitor_event(ctx); From patchwork Sat May 13 14:20:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 13240254 Received: from esa8.hc1455-7.c3s2.iphmx.com (esa8.hc1455-7.c3s2.iphmx.com [139.138.61.253]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B0B563CB for ; Sat, 13 May 2023 14:22:04 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10708"; a="104611334" X-IronPort-AV: E=Sophos;i="5.99,272,1677510000"; d="scan'208";a="104611334" Received: from unknown (HELO oym-r1.gw.nic.fujitsu.com) ([210.162.30.89]) by esa8.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2023 23:20:52 +0900 Received: from oym-m2.gw.nic.fujitsu.com (oym-nat-oym-m2.gw.nic.fujitsu.com [192.168.87.59]) by oym-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id ACEF0CC144 for ; Sat, 13 May 2023 23:20:49 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by oym-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id E36AABF496 for ; Sat, 13 May 2023 23:20:48 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id 5CE672007CDDD; Sat, 13 May 2023 23:20:48 +0900 (JST) From: Li Zhijian To: nvdimm@lists.linux.dev Cc: Li Zhijian Subject: [ndctl PATCH 5/6] Documentation/cxl/cxl-monitor.txt: Fix inaccurate description Date: Sat, 13 May 2023 22:20:37 +0800 Message-Id: <20230513142038.753351-6-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230513142038.753351-1-lizhijian@fujitsu.com> References: <20230513142038.753351-1-lizhijian@fujitsu.com> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-27622.007 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-27622.007 X-TMASE-Result: 10--4.028400-10.000000 X-TMASE-MatchedRID: qT9V7Qri989lYwkarmHZPhF4zyLyne+ATJDl9FKHbrk8DTfVRLTQzGtC SH0t7mTXCaWhCMLM4iM1hvF/jmI7sx8TzIzimOwPlpYqKNmWxsHZs3HUcS/scCq2rl3dzGQ1R9Z hy3GxKcWP1rsEtYf0PMTgIROGAdZIzcEqMArWfCOVM0+Xr7B8A8lBMvaqb8g34OAc0T7V8JkBg0 bU7ew8YGgZBmgHRVb07jOrYwIKPdAVxRB/din+uJ07T8ZSLiAVvR84/OmB1wQp4n8eQBnwiw== X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 No syslog is supported by cxl-monitor Signed-off-by: Li Zhijian Reviewed-by: Dave Jiang --- Documentation/cxl/cxl-monitor.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/cxl/cxl-monitor.txt b/Documentation/cxl/cxl-monitor.txt index 3fc992e4d4d9..c284099f16c3 100644 --- a/Documentation/cxl/cxl-monitor.txt +++ b/Documentation/cxl/cxl-monitor.txt @@ -39,8 +39,7 @@ OPTIONS --log=:: Send log messages to the specified destination. - "": - Send log messages to specified . When fopen() is not able - to open , log messages will be forwarded to syslog. + Send log messages to specified . - "standard": Send messages to standard output. From patchwork Sat May 13 14:20:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 13240253 Received: from esa1.hc1455-7.c3s2.iphmx.com (esa1.hc1455-7.c3s2.iphmx.com [207.54.90.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 568B063CA for ; Sat, 13 May 2023 14:22:04 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10708"; a="116441723" X-IronPort-AV: E=Sophos;i="5.99,272,1677510000"; d="scan'208";a="116441723" Received: from unknown (HELO oym-r2.gw.nic.fujitsu.com) ([210.162.30.90]) by esa1.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2023 23:20:52 +0900 Received: from oym-m3.gw.nic.fujitsu.com (oym-nat-oym-m3.gw.nic.fujitsu.com [192.168.87.60]) by oym-r2.gw.nic.fujitsu.com (Postfix) with ESMTP id EDFC1D432C for ; Sat, 13 May 2023 23:20:49 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by oym-m3.gw.nic.fujitsu.com (Postfix) with ESMTP id 2F6EBD9463 for ; Sat, 13 May 2023 23:20:49 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id A41BD2007CDE5; Sat, 13 May 2023 23:20:48 +0900 (JST) From: Li Zhijian To: nvdimm@lists.linux.dev Cc: Li Zhijian Subject: [ndctl PATCH 6/6] ndctl/monitor: compare the whole filename with reserved words Date: Sat, 13 May 2023 22:20:38 +0800 Message-Id: <20230513142038.753351-7-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230513142038.753351-1-lizhijian@fujitsu.com> References: <20230513142038.753351-1-lizhijian@fujitsu.com> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-27622.007 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-27622.007 X-TMASE-Result: 10--4.797400-10.000000 X-TMASE-MatchedRID: IAkHRTl/xj1ujdbubeNfIyoiRKlBVkYIMC4zO7d4kaPAuQ0xDMaXkH4q tYI9sRE/KqrQ7lLcMnxRzi+uKjH4IWMAzi+7d0chngIgpj8eDcAZ1CdBJOsoY9mzcdRxL+xwKra uXd3MZDVkxLLBHGto3S1ApTvoxKRwKMZ9aHFjjAdspQgnOmreX+JjyF/rn4BqbJ/H0CNrzM93bq ahVsXC3wGgxWMmIpkPTt6vbu386HDRkHs++pxogRXFEH92Kf64nTtPxlIuIBW9Hzj86YHXBCnif x5AGfCL X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 For example: $ ndctl monitor -l standard.log User is most likely want to save log to ./standard.log instead of stdout. Signed-off-by: Li Zhijian --- ndctl/monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ndctl/monitor.c b/ndctl/monitor.c index 89903def63d4..bd8a74863476 100644 --- a/ndctl/monitor.c +++ b/ndctl/monitor.c @@ -610,9 +610,9 @@ int cmd_monitor(int argc, const char **argv, struct ndctl_ctx *ctx) if (monitor.log) { if (strncmp(monitor.log, "./", 2) != 0) fix_filename(prefix, (const char **)&monitor.log); - if (strncmp(monitor.log, "./syslog", 8) == 0) + if (strcmp(monitor.log, "./syslog") == 0) monitor.ctx.log_fn = log_syslog; - else if (strncmp(monitor.log, "./standard", 10) == 0) + else if (strcmp(monitor.log, "./standard") == 0) monitor.ctx.log_fn = log_standard; else { monitor.ctx.log_file = fopen(monitor.log, "a+");