From 8c041aaa224cf2349c4df9718bc42d8925425ffa Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Tue, 4 Feb 2020 15:35:01 -0700 Subject: [PATCH] LU-13197 debugfs: allow comment lines in command file Allow comment lines with '#' at the start of the line in the command file passed in to debugfs via the "-f" option or from standard input. Signed-off-by: Andreas Dilger Change-Id: I9284a254104f355b0bac4c676ae85cbed63ebbe5 Reviewed-on: https://review.whamcloud.com/37438 Reviewed-by: Wang Shilong Tested-by: jenkins Tested-by: Maloo --- debugfs/debugfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index 15b0121..60931a9 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -2486,6 +2486,10 @@ static int source_file(const char *cmd_file, int ss_idx) while (!feof(f)) { if (fgets(buf, sizeof(buf), f) == NULL) break; + if (buf[0] == '#') { + printf("%s", buf); + continue; + } cp = strchr(buf, '\n'); if (cp) *cp = 0; -- 1.8.3.1