From: Theodore Ts'o Date: Thu, 12 Jun 2025 19:00:08 +0000 (-0400) Subject: fuse2fs: rename the inusefile option to lockfile X-Git-Tag: v1.47.3-rc2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e83c0df0135f98108f9805ab1564b4a43b7e0965;p=thirdparty%2Fe2fsprogs.git fuse2fs: rename the inusefile option to lockfile Signed-off-by: Theodore Ts'o --- diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index d889bda4..0f9cb684 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -212,7 +212,7 @@ struct fuse2fs { unsigned long offset; unsigned int next_generation; unsigned long long cache_size; - char *inusefile; + char *lockfile; }; #define FUSE2FS_CHECK_MAGIC(fs, ptr, num) do {if ((ptr)->magic != (num)) \ @@ -4235,7 +4235,7 @@ static struct fuse_opt fuse2fs_opts[] = { FUSE_OPT_KEY("noblock_validity", FUSE2FS_IGNORED), FUSE_OPT_KEY("nodelalloc", FUSE2FS_IGNORED), FUSE_OPT_KEY("cache_size=%s", FUSE2FS_CACHE_SIZE), - FUSE2FS_OPT("inusefile=%s", inusefile, 0), + FUSE2FS_OPT("lockfile=%s", lockfile, 0), FUSE_OPT_KEY("-V", FUSE2FS_VERSION), FUSE_OPT_KEY("--version", FUSE2FS_VERSION), @@ -4288,7 +4288,7 @@ static int fuse2fs_opt_proc(void *data, const char *arg, " -o offset= similar to mount -o offset=, mount the partition starting at \n" " -o norecovery don't replay the journal\n" " -o fuse2fs_debug enable fuse2fs debugging\n" - " -o inusefile= file to show that fuse is still using the file system image\n" + " -o lockfile= file to show that fuse is still using the file system image\n" " -o kernel run this as if it were the kernel, which sets:\n" " allow_others,default_permissions,suid,dev\n" " -o directio use O_DIRECT to read and write the disk\n" @@ -4417,22 +4417,22 @@ int main(int argc, char *argv[]) fctx.alloc_all_blocks = 1; } - if(fctx.inusefile) { - FILE* inusefile=fopen(fctx.inusefile, "w"); - if(!inusefile) { - fprintf(stderr, "Requested inusefile=%s but couldn't open the file for writing\n", fctx.inusefile); + if(fctx.lockfile) { + FILE* lockfile=fopen(fctx.lockfile, "w"); + if(!lockfile) { + fprintf(stderr, "Requested lockfile=%s but couldn't open the file for writing\n", fctx.lockfile); exit(1); } - fclose(inusefile); - char* resolved = realpath(fctx.inusefile, NULL); + fclose(lockfile); + char* resolved = realpath(fctx.lockfile, NULL); if (!resolved) { perror("realpath"); - fprintf(stderr, "Could not resolve realpath for inusefile=%s\n", fctx.inusefile); - unlink(fctx.inusefile); + fprintf(stderr, "Could not resolve realpath for lockfile=%s\n", fctx.lockfile); + unlink(fctx.lockfile); exit(1); } - free(fctx.inusefile); - fctx.inusefile = resolved; + free(fctx.lockfile); + fctx.lockfile = resolved; } /* Start up the fs (while we still can use stdout) */ @@ -4639,14 +4639,14 @@ out: com_err(argv[0], err, "while closing fs"); global_fs = NULL; } - if(fctx.inusefile) { - err = unlink(fctx.inusefile); + if(fctx.lockfile) { + err = unlink(fctx.lockfile); if (err) com_err(argv[0], errno, "while unlinking '%s'", - fctx.inusefile); + fctx.lockfile); } - if (fctx.inusefile) - free(fctx.inusefile); + if (fctx.lockfile) + free(fctx.lockfile); if (fctx.device) free(fctx.device); fuse_opt_free_args(&args);