* [PATCH] debugfs: allow <inode> for ncheck
@ 2022-03-01 4:10 Andreas Dilger
2022-08-13 1:12 ` Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Dilger @ 2022-03-01 4:10 UTC (permalink / raw)
To: tytso; +Cc: linux-ext4, Andreas Dilger, Li Dongyang
If the arg string is of the form <ino>, allow it for ncheck.
Improve the error message, use "Invalid inode number" instead
of "Bad inode", which implies the inode content being bad.
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
---
debugfs/ncheck.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/debugfs/ncheck.c b/debugfs/ncheck.c
index 011f26de..3be4be19 100644
--- a/debugfs/ncheck.c
+++ b/debugfs/ncheck.c
@@ -134,9 +134,21 @@ void do_ncheck(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
iw.names_left = 0;
for (i=0; i < argc; i++) {
- iw.iarray[i] = strtol(argv[i], &tmp, 0);
+ char *str = argv[i];
+ int len = strlen(str);
+
+ if ((len > 2) && (str[0] == '<') && (str[len-1] == '>')) {
+ str[len-1] = '\0';
+ str++;
+ }
+ iw.iarray[i] = strtol(str, &tmp, 0);
if (*tmp) {
- com_err("ncheck", 0, "Bad inode - %s", argv[i]);
+ if (str != argv[i]) {
+ str--;
+ str[len-1] = '>';
+ }
+ com_err("ncheck", 0, "Invalid inode number - '%s'",
+ argv[i]);
goto error_out;
}
if (debugfs_read_inode(iw.iarray[i], &inode, *argv))
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] debugfs: allow <inode> for ncheck
2022-03-01 4:10 [PATCH] debugfs: allow <inode> for ncheck Andreas Dilger
@ 2022-08-13 1:12 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2022-08-13 1:12 UTC (permalink / raw)
To: Andreas Dilger; +Cc: linux-ext4, Li Dongyang
On Mon, Feb 28, 2022 at 09:10:31PM -0700, Andreas Dilger wrote:
> If the arg string is of the form <ino>, allow it for ncheck.
> Improve the error message, use "Invalid inode number" instead
> of "Bad inode", which implies the inode content being bad.
>
> Signed-off-by: Li Dongyang <dongyangli@ddn.com>
> Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Applied, thanks!
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-13 1:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 4:10 [PATCH] debugfs: allow <inode> for ncheck Andreas Dilger
2022-08-13 1:12 ` Theodore Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.