sandbox: pass params to setup ops
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
e94b09d337
commit
a092b042ab
@ -90,7 +90,7 @@ type (
|
|||||||
|
|
||||||
Ops []Op
|
Ops []Op
|
||||||
Op interface {
|
Op interface {
|
||||||
apply() error
|
apply(params *InitParams) error
|
||||||
|
|
||||||
Is(op Op) bool
|
Is(op Op) bool
|
||||||
fmt.Stringer
|
fmt.Stringer
|
||||||
|
@ -126,7 +126,7 @@ func Init(exit func(code int)) {
|
|||||||
|
|
||||||
for i, op := range *params.Ops {
|
for i, op := range *params.Ops {
|
||||||
fmsg.Verbosef("mounting %s", op)
|
fmsg.Verbosef("mounting %s", op)
|
||||||
if err := op.apply(); err != nil {
|
if err := op.apply(¶ms.InitParams); err != nil {
|
||||||
fmsg.PrintBaseError(err,
|
fmsg.PrintBaseError(err,
|
||||||
fmt.Sprintf("cannot apply op %d:", i))
|
fmt.Sprintf("cannot apply op %d:", i))
|
||||||
exit(1)
|
exit(1)
|
||||||
|
@ -20,7 +20,7 @@ type BindMount struct {
|
|||||||
Flags int
|
Flags int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BindMount) apply() error {
|
func (b *BindMount) apply(*InitParams) error {
|
||||||
if !path.IsAbs(b.Source) || !path.IsAbs(b.Target) {
|
if !path.IsAbs(b.Source) || !path.IsAbs(b.Target) {
|
||||||
return fmsg.WrapError(syscall.EBADE,
|
return fmsg.WrapError(syscall.EBADE,
|
||||||
"path is not absolute")
|
"path is not absolute")
|
||||||
@ -47,7 +47,7 @@ type MountProc struct {
|
|||||||
Path string
|
Path string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *MountProc) apply() error {
|
func (p *MountProc) apply(*InitParams) error {
|
||||||
if !path.IsAbs(p.Path) {
|
if !path.IsAbs(p.Path) {
|
||||||
return fmsg.WrapError(syscall.EBADE,
|
return fmsg.WrapError(syscall.EBADE,
|
||||||
fmt.Sprintf("path %q is not absolute", p.Path))
|
fmt.Sprintf("path %q is not absolute", p.Path))
|
||||||
@ -78,7 +78,7 @@ type MountTmpfs struct {
|
|||||||
Perm os.FileMode
|
Perm os.FileMode
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *MountTmpfs) apply() error {
|
func (t *MountTmpfs) apply(*InitParams) error {
|
||||||
if !path.IsAbs(t.Path) {
|
if !path.IsAbs(t.Path) {
|
||||||
return fmsg.WrapError(syscall.EBADE,
|
return fmsg.WrapError(syscall.EBADE,
|
||||||
fmt.Sprintf("path %q is not absolute", t.Path))
|
fmt.Sprintf("path %q is not absolute", t.Path))
|
||||||
|
Loading…
Reference in New Issue
Block a user