aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/vfs/mangle.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-03-17 15:16:46 +0900
committerOphestra <cat@gensokyo.uk>2026-03-17 15:30:30 +0900
commite9a72490db44426605debd3cc756a7924931d706 (patch)
tree1e8f8099c46aa16023367404ec2c9fb769db2c8e /container/vfs/mangle.go
parent0a12d456ce5869042dc06c43c360c43cab942d6b (diff)
vfs: move from container
This package is not container-specific. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/vfs/mangle.go')
-rw-r--r--container/vfs/mangle.go32
1 files changed, 0 insertions, 32 deletions
diff --git a/container/vfs/mangle.go b/container/vfs/mangle.go
deleted file mode 100644
index af7a0463..00000000
--- a/container/vfs/mangle.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package vfs
-
-import "strings"
-
-// Unmangle reverses mangling of strings done by the kernel. Its behaviour is
-// consistent with the equivalent function in util-linux.
-func Unmangle(s string) string {
- if !strings.ContainsRune(s, '\\') {
- return s
- }
-
- v := make([]byte, len(s))
- var (
- j int
- c byte
- )
- for i := 0; i < len(s); i++ {
- c = s[i]
- if c == '\\' && len(s) > i+3 &&
- (s[i+1] == '0' || s[i+1] == '1') &&
- (s[i+2] >= '0' && s[i+2] <= '7') &&
- (s[i+3] >= '0' && s[i+3] <= '7') {
- c = ((s[i+1] - '0') << 6) |
- ((s[i+2] - '0') << 3) |
- (s[i+3] - '0')
- i += 3
- }
- v[j] = c
- j++
- }
- return string(v[:j])
-}