Adiantum encrypting VFS. (#77)

This commit is contained in:
Nuno Cruces
2024-04-18 01:39:47 +01:00
committed by GitHub
parent e86789b285
commit ec1ed22149
20 changed files with 479 additions and 21 deletions

View File

@@ -25,7 +25,7 @@ func (s *mmapState) init(ctx context.Context, enabled bool) context.Context {
return ctx
}
func CanMap(ctx context.Context) bool {
func CanMapFiles(ctx context.Context) bool {
s := ctx.Value(moduleKey{}).(*moduleState)
return s.mmapState.enabled
}

View File

@@ -10,6 +10,6 @@ func (s *mmapState) init(ctx context.Context, _ bool) context.Context {
return ctx
}
func CanMap(ctx context.Context) bool {
func CanMapFiles(ctx context.Context) bool {
return false
}

8
internal/util/unwrap.go Normal file
View File

@@ -0,0 +1,8 @@
package util
func Unwrap[T any](v T) T {
if u, ok := any(v).(interface{ Unwrap() T }); ok {
return u.Unwrap()
}
return v
}