diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-14 23:44:11 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-14 23:44:11 +0900 |
| commit | ba3227bf1572654cf1a3a828f7ee22ddd0224261 (patch) | |
| tree | f37f9bb13f77eebd22a5257027bed5a4061d521d | |
| parent | 0e543a58b36d4ab5d61c02ce93cf72bf2f218857 (diff) | |
container: export overlay escape
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | container/mount.go | 4 | ||||
| -rw-r--r-- | container/mount_test.go | 2 | ||||
| -rw-r--r-- | container/ops.go | 6 | ||||
| -rw-r--r-- | container/path_test.go | 4 |
4 files changed, 8 insertions, 8 deletions
diff --git a/container/mount.go b/container/mount.go index 873f69c8..a17b3489 100644 --- a/container/mount.go +++ b/container/mount.go @@ -214,8 +214,8 @@ func parentPerm(perm os.FileMode) os.FileMode { return os.FileMode(pperm) } -// escapeOverlayDataSegment escapes a string for formatting into the data argument of an overlay mount call. -func escapeOverlayDataSegment(s string) string { +// EscapeOverlayDataSegment escapes a string for formatting into the data argument of an overlay mount call. +func EscapeOverlayDataSegment(s string) string { if s == zeroString { return zeroString } diff --git a/container/mount_test.go b/container/mount_test.go index 573f080b..eb904774 100644 --- a/container/mount_test.go +++ b/container/mount_test.go @@ -41,7 +41,7 @@ func TestEscapeOverlayDataSegment(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - if got := escapeOverlayDataSegment(tc.s); got != tc.want { + if got := EscapeOverlayDataSegment(tc.s); got != tc.want { t.Errorf("escapeOverlayDataSegment: %s, want %s", got, tc.want) } }) diff --git a/container/ops.go b/container/ops.go index be30fcce..518d1151 100644 --- a/container/ops.go +++ b/container/ops.go @@ -416,7 +416,7 @@ func (o *MountOverlayOp) early(*Params) error { if v, err := filepath.EvalSymlinks(o.Upper.String()); err != nil { return wrapErrSelf(err) } else { - o.upper = escapeOverlayDataSegment(toHost(v)) + o.upper = EscapeOverlayDataSegment(toHost(v)) } } @@ -424,7 +424,7 @@ func (o *MountOverlayOp) early(*Params) error { if v, err := filepath.EvalSymlinks(o.Work.String()); err != nil { return wrapErrSelf(err) } else { - o.work = escapeOverlayDataSegment(toHost(v)) + o.work = EscapeOverlayDataSegment(toHost(v)) } } } @@ -438,7 +438,7 @@ func (o *MountOverlayOp) early(*Params) error { if v, err := filepath.EvalSymlinks(a.String()); err != nil { return wrapErrSelf(err) } else { - o.lower[i] = escapeOverlayDataSegment(toHost(v)) + o.lower[i] = EscapeOverlayDataSegment(toHost(v)) } } return nil diff --git a/container/path_test.go b/container/path_test.go index 9af2d2f9..ce959614 100644 --- a/container/path_test.go +++ b/container/path_test.go @@ -38,5 +38,5 @@ func TestToHost(t *testing.T) { } } -// InternalToHostOvlEscape exports toHost passed to escapeOverlayDataSegment. -func InternalToHostOvlEscape(s string) string { return escapeOverlayDataSegment(toHost(s)) } +// InternalToHostOvlEscape exports toHost passed to EscapeOverlayDataSegment. +func InternalToHostOvlEscape(s string) string { return EscapeOverlayDataSegment(toHost(s)) } |
