[Ocfs2-tools-devel] [PATCH 1/1] ocfs2-tools: add pwd command support for debugfs.ocfs2
Sunil Mushran
sunil.mushran at oracle.com
Mon Apr 6 14:32:56 PDT 2009
debugfs.ocfs2 allows chroot. So print the current root like debugfs.
debugfs: pwd
[pwd] INODE: 977283 PATH: /usr/bin
[root] INODE: 977281 PATH: /usr
Also, traversing the entire tree on every pwd will be very expensive.
How about caching the current dir? But do note that the tool allows
cd <inodenum>.
You can always look at debugfs in e2fsprogs to get some ideas.
Sunil
Jeff Liu wrote:
> This patch add pwd command support for debugfs.ocfs2
>
> Signed-off-by: Jeff Liu <jeff.liu at oracle.com>
> ---
> debugfs.ocfs2/commands.c | 21 +++++++++++++++++++++
> 1 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
> index 0dea23f..f70cdcf 100644
> --- a/debugfs.ocfs2/commands.c
> +++ b/debugfs.ocfs2/commands.c
> @@ -74,6 +74,7 @@ static void do_icheck (char **args);
> static void do_dlm_locks (char **args);
> static void do_controld(char **args);
> static void do_dirblocks(char **args);
> +static void do_pwd(char **args);
>
> dbgfs_gbls gbls;
>
> @@ -110,6 +111,7 @@ static Command commands[] = {
> { "encode", do_encode_lockres },
> { "decode", do_decode_lockres },
> { "dirblocks", do_dirblocks },
> + { "pwd", do_pwd },
> };
>
> /*
> @@ -1769,3 +1771,22 @@ static void do_icheck(char **args)
>
> return;
> }
> +
> +/*
> + * do_pwd()
> + *
> + */
> +static void do_pwd(char **args)
> +{
> + uint64_t blkno[1];
> + int findall = 1;
> + int count = 1;
> +
> + if (check_device_open())
> + return;
> +
> + blkno[0] = gbls.cwd_blkno;
> + find_inode_paths(gbls.fs, args, findall, count, blkno, stdout);
> +
> + return ;
> +}
>
More information about the Ocfs2-tools-devel
mailing list