This patch adds --tmpfs as a option for mounting tmpfs on directories
It will Tar up contents of child directory onto tmpfs if mounted over This patch will use the new PreMount and PostMount hooks to "tar" up the contents of the base image on top of tmpfs mount points. Signed-off-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
c631a9bec7
commit
bd052b6116
1 changed files with 22 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
package mount
|
package mount
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -67,3 +68,24 @@ func parseOptions(options string) (int, string) {
|
||||||
}
|
}
|
||||||
return flag, strings.Join(data, ",")
|
return flag, strings.Join(data, ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ParseTmpfsOptions parse fstab type mount options into flags and data
|
||||||
|
func ParseTmpfsOptions(options string) (int, string, error) {
|
||||||
|
flags, data := parseOptions(options)
|
||||||
|
validFlags := map[string]bool{
|
||||||
|
"size": true,
|
||||||
|
"mode": true,
|
||||||
|
"uid": true,
|
||||||
|
"gid": true,
|
||||||
|
"nr_inodes": true,
|
||||||
|
"nr_blocks": true,
|
||||||
|
"mpol": true,
|
||||||
|
}
|
||||||
|
for _, o := range strings.Split(data, ",") {
|
||||||
|
opt := strings.SplitN(o, "=", 2)
|
||||||
|
if !validFlags[opt[0]] {
|
||||||
|
return 0, "", fmt.Errorf("Invalid tmpfs option %q", opt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flags, data, nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue