public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 3/5] fuse2fs: use error logging macro for mount errors
Date: Thu, 24 Apr 2025 14:39:29 -0700	[thread overview]
Message-ID: <174553064509.1160047.12034355870702470696.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <174553064436.1160047.577374015997116030.stgit@frogsfrogsfrogs>

From: Darrick J. Wong <djwong@kernel.org>

Use err_printf for mount errors so that they all have a standard format
and go where all the other errors go.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 misc/fuse2fs.c |   35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)


diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index f2d0e1f2441f83..e3e747dec33fd9 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -3868,8 +3868,8 @@ int main(int argc, char *argv[])
 	err = ext2fs_open2(fctx.device, options, flags, 0, 0, unix_io_manager,
 			   &global_fs);
 	if (err) {
-		printf(_("%s: %s.\n"), fctx.device, error_message(err));
-		printf(_("Please run e2fsck -fy %s.\n"), fctx.device);
+		err_printf(&fctx, "%s.\n", error_message(err));
+		err_printf(&fctx, "%s\n", _("Please run e2fsck -fy."));
 		goto out;
 	}
 	fctx.fs = global_fs;
@@ -3886,17 +3886,16 @@ int main(int argc, char *argv[])
 			printf(_("%s: recovering journal\n"), fctx.device);
 			err = ext2fs_run_ext3_journal(&global_fs);
 			if (err) {
-				printf(_("%s: %s.\n"), fctx.device,
-				       error_message(err));
-				printf(_("Please run e2fsck -fy %s.\n"),
-				       fctx.device);
+				err_printf(&fctx, "%s.\n", error_message(err));
+				err_printf(&fctx, "%s\n",
+						_("Please run e2fsck -fy."));
 				goto out;
 			}
 			ext2fs_clear_feature_journal_needs_recovery(global_fs->super);
 			ext2fs_mark_super_dirty(global_fs);
 		} else {
-			printf("%s", _("Journal needs recovery; running "
-			       "`e2fsck -E journal_only' is required.\n"));
+			err_printf(&fctx, "%s\n",
+ _("Journal needs recovery; running `e2fsck -E journal_only' is required."));
 			goto out;
 		}
 	}
@@ -3918,24 +3917,24 @@ int main(int argc, char *argv[])
 	}
 
 	if (!(global_fs->super->s_state & EXT2_VALID_FS))
-		printf("%s", _("Warning: Mounting unchecked fs, running e2fsck "
-		       "is recommended.\n"));
+		err_printf(&fctx, "%s\n",
+ _("Warning: Mounting unchecked fs, running e2fsck is recommended."));
 	if (global_fs->super->s_max_mnt_count > 0 &&
 	    global_fs->super->s_mnt_count >= global_fs->super->s_max_mnt_count)
-		printf("%s", _("Warning: Maximal mount count reached, running "
-		       "e2fsck is recommended.\n"));
+		err_printf(&fctx, "%s\n",
+ _("Warning: Maximal mount count reached, running e2fsck is recommended."));
 	if (global_fs->super->s_checkinterval > 0 &&
 	    (time_t) (global_fs->super->s_lastcheck +
 		      global_fs->super->s_checkinterval) <= time(0))
-		printf("%s", _("Warning: Check time reached; running e2fsck "
-		       "is recommended.\n"));
+		err_printf(&fctx, "%s\n",
+ _("Warning: Check time reached; running e2fsck is recommended."));
 	if (global_fs->super->s_last_orphan)
-		printf("%s",
-		       _("Orphans detected; running e2fsck is recommended.\n"));
+		err_printf(&fctx, "%s\n",
+ _("Orphans detected; running e2fsck is recommended."));
 
 	if (global_fs->super->s_state & EXT2_ERROR_FS) {
-		printf("%s",
-		       _("Errors detected; running e2fsck is required.\n"));
+		err_printf(&fctx, "%s\n",
+ _("Errors detected; running e2fsck is required."));
 		goto out;
 	}
 


  parent reply	other threads:[~2025-04-24 21:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24 21:38 [PATCHSET 1/5] fuse2fs: better logging Darrick J. Wong
2025-04-24 21:38 ` [PATCH 1/5] fuse2fs: enable runtime debugging Darrick J. Wong
2025-04-24 21:39 ` [PATCH 2/5] fuse2fs: stop aliasing stderr with ff->err_fp Darrick J. Wong
2025-07-20  8:27   ` Sam James
2025-07-20 18:51     ` Darrick J. Wong
2025-07-21  5:42       ` Darrick J. Wong
2025-07-21 11:41         ` Theodore Ts'o
2025-07-21 17:01           ` Darrick J. Wong
2025-04-24 21:39 ` Darrick J. Wong [this message]
2025-04-24 21:39 ` [PATCH 4/5] fuse2fs: make other logging consistent Darrick J. Wong
2025-04-24 21:40 ` [PATCH 5/5] fuse2fs: redirect all messages when FUSE2FS_LOGFILE is set Darrick J. Wong
2025-05-21 14:51 ` [PATCHSET 1/5] fuse2fs: better logging Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=174553064509.1160047.12034355870702470696.stgit@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox