From 1f0226f7e01822a2a5b37d8626b59b7b6f4d0144 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 7 Oct 2025 23:56:19 +0900 Subject: container/check: relocate overlay escape This is used in hst to format strings. Signed-off-by: Ophestra --- container/mount.go | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'container/mount.go') diff --git a/container/mount.go b/container/mount.go index 2749d0ec..0c459c9c 100644 --- a/container/mount.go +++ b/container/mount.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" "os" - "strings" . "syscall" "hakurei.app/container/vfs" @@ -85,13 +84,6 @@ const ( // OptionOverlayUserxattr represents the userxattr option of the overlay pseudo-filesystem. // Use the "user.overlay." xattr namespace instead of "trusted.overlay.". OptionOverlayUserxattr = "userxattr" - - // SpecialOverlayEscape is the escape string for overlay mount options. - SpecialOverlayEscape = `\` - // SpecialOverlayOption is the separator string between overlay mount options. - SpecialOverlayOption = "," - // SpecialOverlayPath is the separator string between overlay paths. - SpecialOverlayPath = ":" ) // bindMount mounts source on target and recursively applies flags if MS_REC is set. @@ -206,20 +198,3 @@ 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 { - if s == zeroString { - return zeroString - } - - if f := strings.SplitN(s, "\x00", 2); len(f) > 0 { - s = f[0] - } - - return strings.NewReplacer( - SpecialOverlayEscape, SpecialOverlayEscape+SpecialOverlayEscape, - SpecialOverlayOption, SpecialOverlayEscape+SpecialOverlayOption, - SpecialOverlayPath, SpecialOverlayEscape+SpecialOverlayPath, - ).Replace(s) -} -- cgit v1.3.1