gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/pkg/sentry/fsimpl/kernfs/BUILD (about) 1 load("//pkg/sync/locking:locking.bzl", "declare_mutex", "declare_rwmutex") 2 load("//tools:defs.bzl", "go_library", "go_test") 3 load("//tools/go_generics:defs.bzl", "go_template_instance") 4 5 package(default_applicable_licenses = ["//:license"]) 6 7 licenses(["notice"]) 8 9 go_template_instance( 10 name = "dentry_list", 11 out = "dentry_list.go", 12 package = "kernfs", 13 prefix = "dentry", 14 template = "//pkg/ilist:generic_list", 15 types = { 16 "Element": "*Dentry", 17 "Linker": "*Dentry", 18 }, 19 ) 20 21 go_template_instance( 22 name = "fstree", 23 out = "fstree.go", 24 package = "kernfs", 25 prefix = "generic", 26 template = "//pkg/sentry/vfs/genericfstree:generic_fstree", 27 types = { 28 "Dentry": "Dentry", 29 }, 30 ) 31 32 go_template_instance( 33 name = "slot_list", 34 out = "slot_list.go", 35 package = "kernfs", 36 prefix = "slot", 37 template = "//pkg/ilist:generic_list", 38 types = { 39 "Element": "*slot", 40 "Linker": "*slot", 41 }, 42 ) 43 44 go_template_instance( 45 name = "static_directory_refs", 46 out = "static_directory_refs.go", 47 package = "kernfs", 48 prefix = "StaticDirectory", 49 template = "//pkg/refs:refs_template", 50 types = { 51 "T": "StaticDirectory", 52 }, 53 ) 54 55 go_template_instance( 56 name = "dir_refs", 57 out = "dir_refs.go", 58 package = "kernfs_test", 59 prefix = "dir", 60 template = "//pkg/refs:refs_template", 61 types = { 62 "T": "dir", 63 }, 64 ) 65 66 go_template_instance( 67 name = "readonly_dir_refs", 68 out = "readonly_dir_refs.go", 69 package = "kernfs_test", 70 prefix = "readonlyDir", 71 template = "//pkg/refs:refs_template", 72 types = { 73 "T": "readonlyDir", 74 }, 75 ) 76 77 go_template_instance( 78 name = "synthetic_directory_refs", 79 out = "synthetic_directory_refs.go", 80 package = "kernfs", 81 prefix = "syntheticDirectory", 82 template = "//pkg/refs:refs_template", 83 types = { 84 "T": "syntheticDirectory", 85 }, 86 ) 87 88 declare_rwmutex( 89 name = "filesystem_mutex", 90 out = "filesystem_mutex.go", 91 package = "kernfs", 92 prefix = "filesystem", 93 ) 94 95 declare_mutex( 96 name = "deferred_dec_refs_mutex", 97 out = "deferred_dec_refs_mutex.go", 98 package = "kernfs", 99 prefix = "deferredDecRefs", 100 ) 101 102 go_library( 103 name = "kernfs", 104 srcs = [ 105 "deferred_dec_refs_mutex.go", 106 "dentry_list.go", 107 "dynamic_bytes_file.go", 108 "fd_impl_util.go", 109 "filesystem.go", 110 "filesystem_mutex.go", 111 "fstree.go", 112 "inode_impl_util.go", 113 "kernfs.go", 114 "mmap_util.go", 115 "save_restore.go", 116 "slot_list.go", 117 "static_directory_refs.go", 118 "symlink.go", 119 "synthetic_directory.go", 120 "synthetic_directory_refs.go", 121 ], 122 visibility = ["//pkg/sentry:internal"], 123 deps = [ 124 "//pkg/abi/linux", 125 "//pkg/atomicbitops", 126 "//pkg/context", 127 "//pkg/errors/linuxerr", 128 "//pkg/fspath", 129 "//pkg/hostarch", 130 "//pkg/log", 131 "//pkg/refs", 132 "//pkg/safemem", 133 "//pkg/sentry/fsimpl/lock", 134 "//pkg/sentry/fsutil", 135 "//pkg/sentry/kernel/auth", 136 "//pkg/sentry/kernel/time", 137 "//pkg/sentry/memmap", 138 "//pkg/sentry/socket/unix/transport", 139 "//pkg/sentry/vfs", 140 "//pkg/sync", 141 "//pkg/sync/locking", 142 "//pkg/usermem", 143 ], 144 ) 145 146 go_test( 147 name = "kernfs_test", 148 size = "small", 149 srcs = [ 150 "dir_refs.go", 151 "kernfs_test.go", 152 "readonly_dir_refs.go", 153 ], 154 deps = [ 155 ":kernfs", 156 "//pkg/abi/linux", 157 "//pkg/atomicbitops", 158 "//pkg/context", 159 "//pkg/errors/linuxerr", 160 "//pkg/fspath", 161 "//pkg/log", 162 "//pkg/refs", 163 "//pkg/sentry/contexttest", 164 "//pkg/sentry/fsimpl/testutil", 165 "//pkg/sentry/kernel/auth", 166 "//pkg/sentry/vfs", 167 "//pkg/usermem", 168 "@com_github_google_go_cmp//cmp:go_default_library", 169 ], 170 )