diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-10-07 21:38:31 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-10-07 21:38:31 +0900 |
| commit | 584ce3da685352847e5c6189e5050bd5cb0307e9 (patch) | |
| tree | 4bd313118df607449569bbe23a910af501e9166b /hst | |
| parent | 5d18af00077ae6ba8ef686d1fd93d888f69681b2 (diff) | |
container/bits: move bind bits
This allows referring to the bits without importing container.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst')
| -rw-r--r-- | hst/fsbind.go | 10 | ||||
| -rw-r--r-- | hst/fsbind_test.go | 13 |
2 files changed, 12 insertions, 11 deletions
diff --git a/hst/fsbind.go b/hst/fsbind.go index 8b7b5fe8..f94e467b 100644 --- a/hst/fsbind.go +++ b/hst/fsbind.go @@ -4,7 +4,7 @@ import ( "encoding/gob" "strings" - "hakurei.app/container" + "hakurei.app/container/bits" "hakurei.app/container/check" "hakurei.app/container/fhs" ) @@ -96,16 +96,16 @@ func (b *FSBind) Apply(z *ApplyState) { } var flags int if b.Write { - flags |= container.BindWritable + flags |= bits.BindWritable } if b.Device { - flags |= container.BindDevice | container.BindWritable + flags |= bits.BindDevice | bits.BindWritable } if b.Ensure { - flags |= container.BindEnsure + flags |= bits.BindEnsure } if b.Optional { - flags |= container.BindOptional + flags |= bits.BindOptional } switch { diff --git a/hst/fsbind_test.go b/hst/fsbind_test.go index 4b9cc19c..62de240e 100644 --- a/hst/fsbind_test.go +++ b/hst/fsbind_test.go @@ -4,6 +4,7 @@ import ( "testing" "hakurei.app/container" + "hakurei.app/container/bits" "hakurei.app/hst" ) @@ -21,7 +22,7 @@ func TestFSBind(t *testing.T) { }, true, container.Ops{&container.BindMountOp{ Source: m("/mnt/dev"), Target: m("/dev"), - Flags: container.BindWritable | container.BindDevice | container.BindOptional, + Flags: bits.BindWritable | bits.BindDevice | bits.BindOptional, }}, m("/dev"), ms("/mnt/dev"), "d+/mnt/dev:/dev"}, @@ -33,7 +34,7 @@ func TestFSBind(t *testing.T) { }, true, container.Ops{&container.BindMountOp{ Source: m("/mnt/dev"), Target: m("/dev"), - Flags: container.BindWritable | container.BindDevice | container.BindEnsure, + Flags: bits.BindWritable | bits.BindDevice | bits.BindEnsure, }}, m("/dev"), ms("/mnt/dev"), "d-/mnt/dev:/dev"}, @@ -45,7 +46,7 @@ func TestFSBind(t *testing.T) { }, true, container.Ops{&container.BindMountOp{ Source: m("/mnt/dev"), Target: m("/dev"), - Flags: container.BindWritable | container.BindDevice, + Flags: bits.BindWritable | bits.BindDevice, }}, m("/dev"), ms("/mnt/dev"), "d*/mnt/dev:/dev"}, @@ -56,7 +57,7 @@ func TestFSBind(t *testing.T) { }, true, container.Ops{&container.BindMountOp{ Source: m("/mnt/tmp"), Target: m("/tmp"), - Flags: container.BindWritable, + Flags: bits.BindWritable, }}, m("/tmp"), ms("/mnt/tmp"), "w*/mnt/tmp:/tmp"}, @@ -95,7 +96,7 @@ func TestFSBind(t *testing.T) { Special: true, }, true, container.Ops{&container.AutoRootOp{ Host: m("/"), - Flags: container.BindWritable, + Flags: bits.BindWritable, }}, m("/"), ms("/"), "autoroot:w"}, {"autoroot silly", &hst.FSBind{ @@ -105,7 +106,7 @@ func TestFSBind(t *testing.T) { Special: true, }, true, container.Ops{&container.AutoRootOp{ Host: m("/etc"), - Flags: container.BindWritable, + Flags: bits.BindWritable, }}, m("/"), ms("/etc"), "autoroot:w:/etc"}, {"autoetc", &hst.FSBind{ |
