diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-01-15 10:57:10 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-01-15 13:07:06 +0900 |
| commit | 3e11ce6868182f1a3f74d5bf6c1db761097666fa (patch) | |
| tree | 85c611acc2aadb5b5b7818ad5a6a0769a6d71fa4 /helper/bwrap/arg.static.string.go | |
| parent | 562f5ed7971603a4e4e3315a7fe4188153bfc205 (diff) | |
helper/bwrap: separate sequential/static args
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'helper/bwrap/arg.static.string.go')
| -rw-r--r-- | helper/bwrap/arg.static.string.go | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/helper/bwrap/arg.static.string.go b/helper/bwrap/arg.static.string.go deleted file mode 100644 index e7f5c332..00000000 --- a/helper/bwrap/arg.static.string.go +++ /dev/null @@ -1,65 +0,0 @@ -package bwrap - -const ( - Hostname = iota - Chdir - UnsetEnv - LockFile - - RemountRO - Procfs - DevTmpfs - Mqueue -) - -var stringArgs = [...]string{ - Hostname: "--hostname", - Chdir: "--chdir", - UnsetEnv: "--unsetenv", - LockFile: "--lock-file", - - RemountRO: "--remount-ro", - Procfs: "--proc", - DevTmpfs: "--dev", - Mqueue: "--mqueue", -} - -func (c *Config) stringArgs() Builder { - n := stringArg{ - UnsetEnv: c.UnsetEnv, - LockFile: c.LockFile, - } - - if c.Hostname != "" { - n[Hostname] = []string{c.Hostname} - } - if c.Chdir != "" { - n[Chdir] = []string{c.Chdir} - } - - // Arg types: - // RemountRO - // Procfs - // DevTmpfs - // Mqueue - // are handled by the sequential builder - - return &n -} - -type stringArg [len(stringArgs)][]string - -func (s *stringArg) Len() (l int) { - for _, arg := range s { - l += len(arg) * 2 - } - return -} - -func (s *stringArg) Append(args *[]string) { - for i, arg := range s { - for _, v := range arg { - *args = append(*args, stringArgs[i], v) - } - } -} |
