mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 6/6] commands: stat: print mode in octal if type unknown
Date: Mon,  6 Jan 2025 10:18:35 +0100	[thread overview]
Message-ID: <20250106091835.3434836-6-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250106091835.3434836-1-a.fatoum@pengutronix.de>

The stat command is meant as debugging aid and thus it's useful to print
information about the mode, even for broken inodes that lack file type
information in their mode field.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 fs/fs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index 8cdd0c55202b..57bd781025f9 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -201,6 +201,8 @@ void stat_print(int dirfd, const char *filename, const struct stat *st)
 
 	if (type)
 		printf("  %s%s", typeprefix, type);
+	else
+		printf("  unknown (mode=0%o)", st->st_mode);
 
 	fdev = get_fsdevice_by_path(dirfd, filename);
 
-- 
2.39.5




  parent reply	other threads:[~2025-01-06  9:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-06  9:18 [PATCH 1/6] fs: ramfs: drop unneeded indirection during unlink Ahmad Fatoum
2025-01-06  9:18 ` [PATCH 2/6] fs: squashfs: delete unreferenced source file Ahmad Fatoum
2025-01-06  9:18 ` [PATCH 3/6] fs: collect legacy file system operation in new struct fs_legacy_ops Ahmad Fatoum
2025-01-06  9:18 ` [PATCH 4/6] fs: return error pointer not NULL from cdev_mount_default Ahmad Fatoum
2025-01-06  9:18 ` [PATCH 5/6] commands: stat: fix size display for FILE_SIZE_STREAM Ahmad Fatoum
2025-01-06  9:18 ` Ahmad Fatoum [this message]
2025-01-06 10:40 ` [PATCH 1/6] fs: ramfs: drop unneeded indirection during unlink Sascha Hauer

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=20250106091835.3434836-6-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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