aboutsummaryrefslogtreecommitdiffhomepage
path: root/fhs/abs.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-03-17 15:56:36 +0900
committerOphestra <cat@gensokyo.uk>2026-03-17 15:56:36 +0900
commit722989c68256469963aee963bed9c6ab4bf55b67 (patch)
treee31098961db50530d196e93e65f3fa770243cc03 /fhs/abs.go
parentb852402f67b22a3a850ce4eb1305a3ce5898d128 (diff)
fhs: move from container
This package is not container-specific. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'fhs/abs.go')
-rw-r--r--fhs/abs.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/fhs/abs.go b/fhs/abs.go
new file mode 100644
index 00000000..ce2ae34d
--- /dev/null
+++ b/fhs/abs.go
@@ -0,0 +1,49 @@
+package fhs
+
+import (
+ _ "unsafe" // for go:linkname
+
+ "hakurei.app/check"
+)
+
+/* constants in this file bypass abs check, be extremely careful when changing them! */
+
+// unsafeAbs returns check.Absolute on any string value.
+//
+//go:linkname unsafeAbs hakurei.app/check.unsafeAbs
+func unsafeAbs(pathname string) *check.Absolute
+
+var (
+ // AbsRoot is [Root] as [check.Absolute].
+ AbsRoot = unsafeAbs(Root)
+ // AbsEtc is [Etc] as [check.Absolute].
+ AbsEtc = unsafeAbs(Etc)
+ // AbsTmp is [Tmp] as [check.Absolute].
+ AbsTmp = unsafeAbs(Tmp)
+
+ // AbsRun is [Run] as [check.Absolute].
+ AbsRun = unsafeAbs(Run)
+ // AbsRunUser is [RunUser] as [check.Absolute].
+ AbsRunUser = unsafeAbs(RunUser)
+
+ // AbsUsr is [Usr] as [check.Absolute].
+ AbsUsr = unsafeAbs(Usr)
+ // AbsUsrBin is [UsrBin] as [check.Absolute].
+ AbsUsrBin = unsafeAbs(UsrBin)
+
+ // AbsVar is [Var] as [check.Absolute].
+ AbsVar = unsafeAbs(Var)
+ // AbsVarLib is [VarLib] as [check.Absolute].
+ AbsVarLib = unsafeAbs(VarLib)
+
+ // AbsDev is [Dev] as [check.Absolute].
+ AbsDev = unsafeAbs(Dev)
+ // AbsDevShm is [DevShm] as [check.Absolute].
+ AbsDevShm = unsafeAbs(DevShm)
+ // AbsProc is [Proc] as [check.Absolute].
+ AbsProc = unsafeAbs(Proc)
+ // AbsProcSelfExe is [ProcSelfExe] as [check.Absolute].
+ AbsProcSelfExe = unsafeAbs(ProcSelfExe)
+ // AbsSys is [Sys] as [check.Absolute].
+ AbsSys = unsafeAbs(Sys)
+)