aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/acl/perms.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-10-13 18:55:52 +0900
committerOphestra <cat@gensokyo.uk>2026-10-13 18:55:52 +0900
commit0abf367b1334b76f5e8f989cf0c07b5d00b25868 (patch)
tree9d78aae80b86770762e5d86358fd1d89c18c3f35 /internal/acl/perms.go
parent11e395a1a7453b93c695e849bd93d8c2c0af6aef (diff)
internal/acl: skip superfluous acl_set_file
This slightly reduces startup latency. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/acl/perms.go')
-rw-r--r--internal/acl/perms.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/internal/acl/perms.go b/internal/acl/perms.go
index fbc99e82..829b134f 100644
--- a/internal/acl/perms.go
+++ b/internal/acl/perms.go
@@ -1,18 +1,18 @@
package acl
-type Perms []Perm
+import "unsafe"
-func (ps Perms) String() string {
- var s = []byte("---")
- for _, p := range ps {
- switch p {
- case Read:
- s[0] = 'r'
- case Write:
- s[1] = 'w'
- case Execute:
- s[2] = 'x'
- }
+// String returns a text representation of perms.
+func (perms Perm) String() string {
+ buf := []byte{'-', '-', '-'}
+ if perms&Read != 0 {
+ buf[0] = 'r'
}
- return string(s)
+ if perms&Write != 0 {
+ buf[1] = 'w'
+ }
+ if perms&Execute != 0 {
+ buf[2] = 'x'
+ }
+ return unsafe.String(unsafe.SliceData(buf), len(buf))
}