From a0d011018bc379ed9511362d5c88a0e032c7e684 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 20 Feb 2006 00:32:01 +0000 Subject: [PATCH] ntfsmount: add no_detach option --- ntfsprogs/ntfsmount.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 8693e72c..51ac13a3 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -99,6 +99,7 @@ typedef struct { BOOL force; BOOL debug; BOOL noatime; + BOOL no_detach; } ntfs_fuse_context_t; typedef enum { @@ -1602,6 +1603,13 @@ static char *parse_mount_options(const char *org_options) ctx->debug = TRUE; ntfs_log_set_levels(NTFS_LOG_LEVEL_DEBUG); ntfs_log_set_levels(NTFS_LOG_LEVEL_TRACE); + } else if (!strcmp(opt, "no_detach")) { + if (val) { + ntfs_log_error("'no_detach' option should not " + "have value.\n"); + goto err_exit; + } + ctx->no_detach = TRUE; } else if (!strcmp(opt, "remount")) { ntfs_log_error("Remounting is not supported at present." " You have to umount volume and then " @@ -1818,7 +1826,7 @@ int main(int argc, char *argv[]) if (fuse_opt_add_arg(&margs, "") == -1 || fuse_opt_add_arg(&margs, "-o") == -1) fh = NULL; - if (!ctx->debug) { + if (!ctx->debug && !ctx->no_detach) { if (fuse_opt_add_arg(&margs, "use_ino,kernel_cache") == -1) fh = NULL; } else { @@ -1830,7 +1838,7 @@ int main(int argc, char *argv[]) sizeof(ntfs_fuse_oper)); fuse_opt_free_args(&margs); #else - if (!ctx->debug) { + if (!ctx->debug && !ctx->no_detach) { if (fuse_is_lib_option("kernel_cache")) fh = fuse_new(ffd, "use_ino,kernel_cache", &ntfs_fuse_oper, @@ -1849,7 +1857,7 @@ int main(int argc, char *argv[]) ntfs_fuse_destroy(); return 6; } - if (!ctx->debug) { + if (!ctx->debug && !ctx->no_detach) { if (daemon(0, 0)) ntfs_log_error("Failed to daemonize.\n"); else {