From 8fcd39a3b08f956edc0939c87b089b4dbb60afd6 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 1 Apr 2018 14:25:10 +0200 Subject: main: add "-fsck" flag The fsck operation is not yet implemented, this commits just adds the flag and improves cli flag handling. --- cli_args.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'cli_args.go') diff --git a/cli_args.go b/cli_args.go index 7bde89d..2f0c936 100644 --- a/cli_args.go +++ b/cli_args.go @@ -22,7 +22,7 @@ type argContainer struct { plaintextnames, quiet, nosyslog, wpanic, longnames, allow_other, ro, reverse, aessiv, nonempty, raw64, noprealloc, speed, hkdf, serialize_reads, forcedecode, hh, info, - sharedstorage, devrandom bool + sharedstorage, devrandom, fsck bool masterkey, mountpoint, cipherdir, cpuprofile, extpass, memprofile, ko, passfile, ctlsock, fsname, force_owner, trace string // Configuration file name override @@ -133,6 +133,7 @@ func parseCliOpts() (args argContainer) { flagSet.BoolVar(&args.info, "info", false, "Display information about CIPHERDIR") flagSet.BoolVar(&args.sharedstorage, "sharedstorage", false, "Make concurrent access to a shared CIPHERDIR safer") flagSet.BoolVar(&args.devrandom, "devrandom", false, "Use /dev/random for generating master key") + flagSet.BoolVar(&args.fsck, "fsck", false, "Run a filesystem check on CIPHERDIR") flagSet.StringVar(&args.masterkey, "masterkey", "", "Mount with explicit master key") flagSet.StringVar(&args.cpuprofile, "cpuprofile", "", "Write cpu profile to specified file") flagSet.StringVar(&args.memprofile, "memprofile", "", "Write memory profile to specified file") @@ -220,3 +221,21 @@ func prettyArgs() string { pa = pa[1 : len(pa)-1] return pa } + +// countOpFlags counts the number of operation flags we were passed. +func countOpFlags(args *argContainer) int { + var count int + if args.info { + count++ + } + if args.passwd { + count++ + } + if args.init { + count++ + } + if args.fsck { + count++ + } + return count +} -- cgit v1.2.3