[PATCH 04/21] Add quit command to ngnfs-cli
Valerie Aurora
val at versity.com
Tue Feb 11 13:19:01 PST 2025
Useful for benchmarks and scripts, and also for demonstrating the
correctness of fixes related to unmounting ngnfs.
Signed-off-by: Valerie Aurora <val at versity.com>
---
cli/debugfs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/cli/debugfs.c b/cli/debugfs.c
index f59d57c..368187c 100644
--- a/cli/debugfs.c
+++ b/cli/debugfs.c
@@ -29,6 +29,7 @@
struct debugfs_context {
struct ngnfs_fs_info *nfi;
u64 cwd_ino;
+ bool quit;
int ret;
};
@@ -64,6 +65,12 @@ static void cmd_mkfs(struct debugfs_context *ctx, int argc, char **argv)
printf("final sync error: "ENOF"\n", ENOA(-ret));
}
+static void cmd_quit(struct debugfs_context *ctx, int argc, char **argv)
+{
+ ctx->quit = true;
+ return;
+}
+
static void cmd_readdir(struct debugfs_context *ctx, int argc, char **argv)
{
struct ngnfs_readdir_entry *buf;
@@ -141,6 +148,7 @@ static struct command {
} commands[] = {
{ "create", cmd_create, },
{ "mkfs", cmd_mkfs, },
+ { "quit", cmd_quit, },
{ "readdir", cmd_readdir, },
{ "stat", cmd_stat, },
};
@@ -214,6 +222,9 @@ static void debugfs_thread(struct thread *thr, void *arg)
break;
parse_command(ctx, line, line_argv);
+
+ if (ctx->quit)
+ break;
}
ret = 0;
@@ -237,6 +248,7 @@ static int debugfs_func(int argc, char **argv)
struct debugfs_context ctx = {
.nfi = &nfi,
.cwd_ino = NGNFS_ROOT_INO,
+ .quit = false,
};
struct thread thr;
int ret;
--
2.48.1
More information about the ngnfs-devel
mailing list