gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/pkg/sentry/fsimpl/tmpfs/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 = "tmpfs", 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 = "tmpfs", 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 = "inode_refs", 34 out = "inode_refs.go", 35 package = "tmpfs", 36 prefix = "inode", 37 template = "//pkg/refs:refs_template", 38 types = { 39 "T": "inode", 40 }, 41 ) 42 43 declare_mutex( 44 name = "inode_mutex", 45 out = "inode_mutex.go", 46 package = "tmpfs", 47 prefix = "inode", 48 ) 49 50 declare_mutex( 51 name = "pages_used_mutex", 52 out = "pages_used_mutex.go", 53 package = "tmpfs", 54 prefix = "pagesUsed", 55 ) 56 57 declare_mutex( 58 name = "iter_mutex", 59 out = "iter_mutex.go", 60 package = "tmpfs", 61 prefix = "iter", 62 ) 63 64 declare_rwmutex( 65 name = "filesystem_mutex", 66 out = "filesystem_mutex.go", 67 package = "tmpfs", 68 prefix = "filesystem", 69 ) 70 71 go_library( 72 name = "tmpfs", 73 srcs = [ 74 "dentry_list.go", 75 "device_file.go", 76 "directory.go", 77 "filesystem.go", 78 "filesystem_mutex.go", 79 "fstree.go", 80 "inode_mutex.go", 81 "inode_refs.go", 82 "iter_mutex.go", 83 "named_pipe.go", 84 "pages_used_mutex.go", 85 "regular_file.go", 86 "save_restore.go", 87 "socket_file.go", 88 "symlink.go", 89 "tmpfs.go", 90 ], 91 visibility = ["//pkg/sentry:internal"], 92 deps = [ 93 "//pkg/abi/linux", 94 "//pkg/atomicbitops", 95 "//pkg/context", 96 "//pkg/errors/linuxerr", 97 "//pkg/fd", 98 "//pkg/fspath", 99 "//pkg/hostarch", 100 "//pkg/log", 101 "//pkg/refs", 102 "//pkg/safemem", 103 "//pkg/sentry/arch", 104 "//pkg/sentry/fsimpl/lock", 105 "//pkg/sentry/fsmetric", 106 "//pkg/sentry/fsutil", 107 "//pkg/sentry/hostfd", 108 "//pkg/sentry/kernel/auth", 109 "//pkg/sentry/kernel/pipe", 110 "//pkg/sentry/kernel/time", 111 "//pkg/sentry/memmap", 112 "//pkg/sentry/pgalloc", 113 "//pkg/sentry/platform", 114 "//pkg/sentry/socket/unix/transport", 115 "//pkg/sentry/uniqueid", 116 "//pkg/sentry/usage", 117 "//pkg/sentry/vfs", 118 "//pkg/sentry/vfs/memxattr", 119 "//pkg/sync", 120 "//pkg/sync/locking", 121 "//pkg/usermem", 122 ], 123 ) 124 125 go_test( 126 name = "benchmark_test", 127 size = "small", 128 srcs = ["benchmark_test.go"], 129 deps = [ 130 ":tmpfs", 131 "//pkg/abi/linux", 132 "//pkg/fspath", 133 "//pkg/refs", 134 "//pkg/sentry/contexttest", 135 "//pkg/sentry/kernel/auth", 136 "//pkg/sentry/vfs", 137 ], 138 ) 139 140 go_test( 141 name = "tmpfs_test", 142 size = "small", 143 srcs = [ 144 "pipe_test.go", 145 "regular_file_test.go", 146 "stat_test.go", 147 "tmpfs_test.go", 148 ], 149 library = ":tmpfs", 150 deps = [ 151 "//pkg/abi/linux", 152 "//pkg/atomicbitops", 153 "//pkg/context", 154 "//pkg/errors/linuxerr", 155 "//pkg/fspath", 156 "//pkg/sentry/contexttest", 157 "//pkg/sentry/fsimpl/lock", 158 "//pkg/sentry/kernel/auth", 159 "//pkg/sentry/vfs", 160 "//pkg/usermem", 161 ], 162 )