aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-11-27 22:27:24 +0100
committerJakob Unterwurzacher2015-11-27 22:30:38 +0100
commitb3d96b6a208e7679a0e7dc936d76bcec271ecddf (patch)
tree817b905fd3f420614608db99814f890e36e15489 /main.go
parenta04a92cdab11df43f072db685b8ade6c973f8995 (diff)
main: pass args struct instead of having a huge function call
Diffstat (limited to 'main.go')
-rw-r--r--main.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/main.go b/main.go
index 87ae67a..a6131e1 100644
--- a/main.go
+++ b/main.go
@@ -267,7 +267,7 @@ func main() {
args.plaintextnames = confFile.IsFeatureFlagSet(cryptfs.FlagPlaintextNames)
}
// Initialize FUSE server
- srv := pathfsFrontend(masterkey, args.cipherdir, args.mountpoint, args.fusedebug, args.openssl, args.plaintextnames)
+ srv := pathfsFrontend(masterkey, args)
cryptfs.Info.Println("Filesystem ready.")
// We are ready - send USR1 signal to our parent
if args.notifypid > 0 {
@@ -281,12 +281,11 @@ func main() {
// main exits with code 0
}
-// pathfsFrontend - initialize FUSE server based on go-fuse's PathFS
+// pathfsFrontend - initialize FUSE server based on go-fuse's PathFS.
// Calls os.Exit on errors
-func pathfsFrontend(key []byte, cipherdir string, mountpoint string,
- debug bool, openssl bool, plaintextNames bool) *fuse.Server {
+func pathfsFrontend(key []byte, args argContainer) *fuse.Server {
- finalFs := pathfs_frontend.NewFS(key, cipherdir, openssl, plaintextNames)
+ finalFs := pathfs_frontend.NewFS(key, args.cipherdir, args.openssl, args.plaintextnames)
pathFsOpts := &pathfs.PathNodeFsOptions{ClientInodes: true}
pathFs := pathfs.NewPathNodeFs(finalFs, pathFsOpts)
fuseOpts := &nodefs.Options{
@@ -301,16 +300,16 @@ func pathfsFrontend(key []byte, cipherdir string, mountpoint string,
mOpts.AllowOther = false
// Set values shown in "df -T" and friends
// First column, "Filesystem"
- mOpts.Options = append(mOpts.Options, "fsname="+cipherdir)
+ mOpts.Options = append(mOpts.Options, "fsname="+args.cipherdir)
// Second column, "Type", will be shown as "fuse." + Name
mOpts.Name = "gocryptfs"
- srv, err := fuse.NewServer(conn.RawFS(), mountpoint, &mOpts)
+ srv, err := fuse.NewServer(conn.RawFS(), args.mountpoint, &mOpts)
if err != nil {
fmt.Printf("Mount failed: %v", err)
os.Exit(ERREXIT_MOUNT)
}
- srv.SetDebug(debug)
+ srv.SetDebug(args.debug)
return srv
}