main: add "-fsname" option

As requested in https://github.com/rfjakob/gocryptfs/issues/73 .
This commit is contained in:
Jakob Unterwurzacher 2017-01-26 22:13:57 +01:00
parent 39eca53677
commit de200aad72
3 changed files with 12 additions and 2 deletions

View File

@ -67,6 +67,11 @@ Options:
: Stay in the foreground instead of forking away. Implies "-nosyslog".
For compatability, "-f" is also accepted, but "-fg" is preferred.
**-fsname string**
: Override the filesystem name (first column in df -T). Can also be
passed as "-o fsname=" and is equivalent to libfuse's option of the
same name. By default, CIPHERDIR is used.
**-fusedebug**
: Enable fuse library debug output

View File

@ -20,7 +20,7 @@ type argContainer struct {
longnames, allow_other, ro, reverse, aessiv, nonempty, raw64,
noprealloc bool
masterkey, mountpoint, cipherdir, cpuprofile, extpass,
memprofile, ko, passfile, ctlsock string
memprofile, ko, passfile, ctlsock, fsname string
// Configuration file name override
config string
notifypid, scryptn int
@ -118,6 +118,7 @@ func parseCliOpts() (args argContainer) {
flagSet.StringVar(&args.passfile, "passfile", "", "Read password from file")
flagSet.StringVar(&args.ko, "ko", "", "Pass additional options directly to the kernel, comma-separated list")
flagSet.StringVar(&args.ctlsock, "ctlsock", "", "Create control socket at specified path")
flagSet.StringVar(&args.fsname, "fsname", "", "Override the filesystem name")
flagSet.IntVar(&args.notifypid, "notifypid", 0, "Send USR1 to the specified process after "+
"successful mount - used internally for daemonization")
flagSet.IntVar(&args.scryptn, "scryptn", configfile.ScryptDefaultLogN, "scrypt cost parameter logN. "+

View File

@ -243,7 +243,11 @@ func initFuseFrontend(key []byte, args *argContainer, confFile *configfile.ConfF
}
// Set values shown in "df -T" and friends
// First column, "Filesystem"
mOpts.Options = append(mOpts.Options, "fsname="+args.cipherdir)
fsname := args.cipherdir
if args.fsname != "" {
fsname = args.fsname
}
mOpts.Options = append(mOpts.Options, "fsname="+fsname)
// Second column, "Type", will be shown as "fuse." + Name
mOpts.Name = "gocryptfs"
if args.reverse {