mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
Mirrors fsimpl/gofer's caching model: each dentry holds one ref on its parent; childMap is a weak map. refs == 0 means cache-eligible; refs == -1 means destroyed. Cached children still hold their parent's ref, so a parent only enters the cache after all its children are gone. Per-dentry cachingMu serializes caching state; fs.cacheMu is held only for LRU list mutations. Eviction re-checks under parent.dirMu, severs from childMap, then destroys, cascading checkCaching up the tree. Cache limit is 1000. Co-authored-by: Ayush Ranjan <[email protected]>
82 lines
1.8 KiB
Python
82 lines
1.8 KiB
Python
load("//tools:defs.bzl", "go_library")
|
|
load("//tools/go_generics:defs.bzl", "go_template_instance")
|
|
|
|
package(
|
|
default_applicable_licenses = ["//:license"],
|
|
licenses = ["notice"],
|
|
)
|
|
|
|
go_template_instance(
|
|
name = "fstree",
|
|
out = "fstree.go",
|
|
package = "erofs",
|
|
prefix = "generic",
|
|
template = "//pkg/sentry/vfs/genericfstree:generic_fstree",
|
|
types = {
|
|
"Dentry": "dentry",
|
|
"Filesystem": "filesystem",
|
|
},
|
|
)
|
|
|
|
go_template_instance(
|
|
name = "dentry_list",
|
|
out = "dentry_list.go",
|
|
package = "erofs",
|
|
prefix = "dentry",
|
|
template = "//pkg/ilist:generic_list",
|
|
types = {
|
|
"Element": "*dentry",
|
|
"Linker": "*dentry",
|
|
},
|
|
)
|
|
|
|
go_template_instance(
|
|
name = "inode_refs",
|
|
out = "inode_refs.go",
|
|
package = "erofs",
|
|
prefix = "inode",
|
|
template = "//pkg/refs:refs_template",
|
|
types = {
|
|
"T": "inode",
|
|
},
|
|
)
|
|
|
|
go_library(
|
|
name = "erofs",
|
|
srcs = [
|
|
"dentry_list.go",
|
|
"directory.go",
|
|
"erofs.go",
|
|
"filesystem.go",
|
|
"fstree.go",
|
|
"inode_refs.go",
|
|
"regular_file.go",
|
|
"save_restore.go",
|
|
],
|
|
visibility = ["//pkg/sentry:internal"],
|
|
deps = [
|
|
"//pkg/abi/linux",
|
|
"//pkg/atomicbitops",
|
|
"//pkg/cleanup",
|
|
"//pkg/context",
|
|
"//pkg/erofs",
|
|
"//pkg/errors/linuxerr",
|
|
"//pkg/fspath",
|
|
"//pkg/hostarch",
|
|
"//pkg/log",
|
|
"//pkg/refs",
|
|
"//pkg/safemem",
|
|
"//pkg/sentry/checkpoint",
|
|
"//pkg/sentry/fsimpl/lock",
|
|
"//pkg/sentry/fsutil",
|
|
"//pkg/sentry/hostfd",
|
|
"//pkg/sentry/kernel/auth",
|
|
"//pkg/sentry/memmap",
|
|
"//pkg/sentry/socket/unix/transport",
|
|
"//pkg/sentry/vfs",
|
|
"//pkg/sync",
|
|
"//pkg/usermem",
|
|
"@org_golang_x_sys//unix:go_default_library",
|
|
],
|
|
)
|