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