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 /internal | |
| 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 'internal')
| -rw-r--r-- | internal/app/app_test.go | 36 | ||||
| -rw-r--r-- | internal/app/spcontainer.go | 2 | ||||
| -rw-r--r-- | internal/app/spruntime.go | 4 | ||||
| -rw-r--r-- | internal/app/sptmpdir.go | 4 |
4 files changed, 23 insertions, 23 deletions
diff --git a/internal/app/app_test.go b/internal/app/app_test.go index e0f9305f..90c45792 100644 --- a/internal/app/app_test.go +++ b/internal/app/app_test.go @@ -93,20 +93,20 @@ func TestApp(t *testing.T) { "XDG_SESSION_TYPE=tty", }, Ops: new(container.Ops). - Root(m("/"), container.BindWritable). + Root(m("/"), bits.BindWritable). Proc(m("/proc/")). Tmpfs(hst.AbsTmp, 4096, 0755). DevWritable(m("/dev/"), true). Tmpfs(m("/dev/shm"), 0, 01777). - Bind(m("/dev/kvm"), m("/dev/kvm"), container.BindWritable|container.BindDevice|container.BindOptional). + Bind(m("/dev/kvm"), m("/dev/kvm"), bits.BindWritable|bits.BindDevice|bits.BindOptional). Etc(m("/etc/"), "4a450b6596d7bc15bd01780eb9a607ac"). Tmpfs(m("/run/user/1971"), 8192, 0755). Tmpfs(m("/run/nscd"), 8192, 0755). Tmpfs(m("/run/dbus"), 8192, 0755). Remount(m("/dev/"), syscall.MS_RDONLY). Tmpfs(m("/run/user/"), 4096, 0755). - Bind(m("/tmp/hakurei.0/runtime/0"), m("/run/user/65534"), container.BindWritable). - Bind(m("/tmp/hakurei.0/tmpdir/0"), m("/tmp/"), container.BindWritable). + Bind(m("/tmp/hakurei.0/runtime/0"), m("/run/user/65534"), bits.BindWritable). + Bind(m("/tmp/hakurei.0/tmpdir/0"), m("/tmp/"), bits.BindWritable). Place(m("/etc/passwd"), []byte("chronos:x:65534:65534:Hakurei:/home/chronos:/run/current-system/sw/bin/zsh\n")). Place(m("/etc/group"), []byte("hakurei:x:65534:\n")). Remount(m("/"), syscall.MS_RDONLY), @@ -260,21 +260,21 @@ func TestApp(t *testing.T) { "XDG_SESSION_TYPE=tty", }, Ops: new(container.Ops). - Root(m("/"), container.BindWritable). + Root(m("/"), bits.BindWritable). Proc(m("/proc/")). Tmpfs(hst.AbsTmp, 4096, 0755). DevWritable(m("/dev/"), true). Tmpfs(m("/dev/shm"), 0, 01777). - Bind(m("/dev/dri"), m("/dev/dri"), container.BindWritable|container.BindDevice|container.BindOptional). - Bind(m("/dev/kvm"), m("/dev/kvm"), container.BindWritable|container.BindDevice|container.BindOptional). + Bind(m("/dev/dri"), m("/dev/dri"), bits.BindWritable|bits.BindDevice|bits.BindOptional). + Bind(m("/dev/kvm"), m("/dev/kvm"), bits.BindWritable|bits.BindDevice|bits.BindOptional). Etc(m("/etc/"), "ebf083d1b175911782d413369b64ce7c"). Tmpfs(m("/run/user/1971"), 8192, 0755). Tmpfs(m("/run/nscd"), 8192, 0755). Tmpfs(m("/run/dbus"), 8192, 0755). Remount(m("/dev/"), syscall.MS_RDONLY). Tmpfs(m("/run/user/"), 4096, 0755). - Bind(m("/tmp/hakurei.0/runtime/9"), m("/run/user/65534"), container.BindWritable). - Bind(m("/tmp/hakurei.0/tmpdir/9"), m("/tmp/"), container.BindWritable). + Bind(m("/tmp/hakurei.0/runtime/9"), m("/run/user/65534"), bits.BindWritable). + Bind(m("/tmp/hakurei.0/tmpdir/9"), m("/tmp/"), bits.BindWritable). Place(m("/etc/passwd"), []byte("chronos:x:65534:65534:Hakurei:/home/chronos:/run/current-system/sw/bin/zsh\n")). Place(m("/etc/group"), []byte("hakurei:x:65534:\n")). Bind(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/wayland"), m("/run/user/65534/wayland-0"), 0). @@ -412,19 +412,19 @@ func TestApp(t *testing.T) { Bind(m("/usr/bin/"), m("/usr/bin/"), 0). Bind(m("/nix/store"), m("/nix/store"), 0). Bind(m("/run/current-system"), m("/run/current-system"), 0). - Bind(m("/sys/block"), m("/sys/block"), container.BindOptional). - Bind(m("/sys/bus"), m("/sys/bus"), container.BindOptional). - Bind(m("/sys/class"), m("/sys/class"), container.BindOptional). - Bind(m("/sys/dev"), m("/sys/dev"), container.BindOptional). - Bind(m("/sys/devices"), m("/sys/devices"), container.BindOptional). + Bind(m("/sys/block"), m("/sys/block"), bits.BindOptional). + Bind(m("/sys/bus"), m("/sys/bus"), bits.BindOptional). + Bind(m("/sys/class"), m("/sys/class"), bits.BindOptional). + Bind(m("/sys/dev"), m("/sys/dev"), bits.BindOptional). + Bind(m("/sys/devices"), m("/sys/devices"), bits.BindOptional). Bind(m("/run/opengl-driver"), m("/run/opengl-driver"), 0). - Bind(m("/dev/dri"), m("/dev/dri"), container.BindDevice|container.BindWritable|container.BindOptional). + Bind(m("/dev/dri"), m("/dev/dri"), bits.BindDevice|bits.BindWritable|bits.BindOptional). Etc(m("/etc/"), "8e2c76b066dabe574cf073bdb46eb5c1"). - Bind(m("/var/lib/persist/module/hakurei/0/1"), m("/var/lib/persist/module/hakurei/0/1"), container.BindWritable|container.BindEnsure). + Bind(m("/var/lib/persist/module/hakurei/0/1"), m("/var/lib/persist/module/hakurei/0/1"), bits.BindWritable|bits.BindEnsure). Remount(m("/dev/"), syscall.MS_RDONLY). Tmpfs(m("/run/user/"), 4096, 0755). - Bind(m("/tmp/hakurei.0/runtime/1"), m("/run/user/1971"), container.BindWritable). - Bind(m("/tmp/hakurei.0/tmpdir/1"), m("/tmp/"), container.BindWritable). + Bind(m("/tmp/hakurei.0/runtime/1"), m("/run/user/1971"), bits.BindWritable). + Bind(m("/tmp/hakurei.0/tmpdir/1"), m("/tmp/"), bits.BindWritable). Place(m("/etc/passwd"), []byte("u0_a1:x:1971:100:Hakurei:/var/lib/persist/module/hakurei/0/1:/run/current-system/sw/bin/zsh\n")). Place(m("/etc/group"), []byte("hakurei:x:100:\n")). Bind(m("/run/user/1971/wayland-0"), m("/run/user/1971/wayland-0"), 0). diff --git a/internal/app/spcontainer.go b/internal/app/spcontainer.go index aed6d927..96afecb7 100644 --- a/internal/app/spcontainer.go +++ b/internal/app/spcontainer.go @@ -104,7 +104,7 @@ func (s *spParamsOp) toContainer(state *outcomeStateParams) error { if !state.Container.Device { state.params.DevWritable(fhs.AbsDev, true) } else { - state.params.Bind(fhs.AbsDev, fhs.AbsDev, container.BindWritable|container.BindDevice) + state.params.Bind(fhs.AbsDev, fhs.AbsDev, bits.BindWritable|bits.BindDevice) } // /dev is mounted readonly later on, this prevents /dev/shm from going readonly with it state.params.Tmpfs(fhs.AbsDev.Append("shm"), 0, 01777) diff --git a/internal/app/spruntime.go b/internal/app/spruntime.go index be188853..d327003f 100644 --- a/internal/app/spruntime.go +++ b/internal/app/spruntime.go @@ -1,7 +1,7 @@ package app import ( - "hakurei.app/container" + "hakurei.app/container/bits" "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/hst" @@ -35,7 +35,7 @@ func (s spRuntimeOp) toContainer(state *outcomeStateParams) error { _, runtimeDirInst := s.commonPaths(state.outcomeState) state.params.Tmpfs(fhs.AbsRunUser, 1<<12, 0755) - state.params.Bind(runtimeDirInst, state.runtimeDir, container.BindWritable) + state.params.Bind(runtimeDirInst, state.runtimeDir, bits.BindWritable) return nil } diff --git a/internal/app/sptmpdir.go b/internal/app/sptmpdir.go index 265e51ca..4cc0c7da 100644 --- a/internal/app/sptmpdir.go +++ b/internal/app/sptmpdir.go @@ -1,7 +1,7 @@ package app import ( - "hakurei.app/container" + "hakurei.app/container/bits" "hakurei.app/container/check" "hakurei.app/container/fhs" "hakurei.app/hst" @@ -24,7 +24,7 @@ func (s spTmpdirOp) toSystem(state *outcomeStateSys, _ *hst.Config) error { func (s spTmpdirOp) toContainer(state *outcomeStateParams) error { // mount inner /tmp from share so it shares persistence and storage behaviour of host /tmp _, tmpdirInst := s.commonPaths(state.outcomeState) - state.params.Bind(tmpdirInst, fhs.AbsTmp, container.BindWritable) + state.params.Bind(tmpdirInst, fhs.AbsTmp, bits.BindWritable) return nil } |
