github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/pkg/sentry/mm/BUILD (about) 1 load("//tools:defs.bzl", "go_library", "go_test") 2 load("//tools/go_generics:defs.bzl", "go_template_instance") 3 4 package(licenses = ["notice"]) 5 6 go_template_instance( 7 name = "file_refcount_set", 8 out = "file_refcount_set.go", 9 imports = { 10 "memmap": "gvisor.dev/gvisor/pkg/sentry/memmap", 11 }, 12 package = "mm", 13 prefix = "fileRefcount", 14 template = "//pkg/segment:generic_set", 15 types = { 16 "Key": "uint64", 17 "Range": "memmap.FileRange", 18 "Value": "int32", 19 "Functions": "fileRefcountSetFunctions", 20 }, 21 ) 22 23 go_template_instance( 24 name = "vma_set", 25 out = "vma_set.go", 26 consts = { 27 "minDegree": "8", 28 "trackGaps": "1", 29 }, 30 imports = { 31 "hostarch": "gvisor.dev/gvisor/pkg/hostarch", 32 }, 33 package = "mm", 34 prefix = "vma", 35 template = "//pkg/segment:generic_set", 36 types = { 37 "Key": "hostarch.Addr", 38 "Range": "hostarch.AddrRange", 39 "Value": "vma", 40 "Functions": "vmaSetFunctions", 41 }, 42 ) 43 44 go_template_instance( 45 name = "pma_set", 46 out = "pma_set.go", 47 consts = { 48 "minDegree": "8", 49 }, 50 imports = { 51 "hostarch": "gvisor.dev/gvisor/pkg/hostarch", 52 }, 53 package = "mm", 54 prefix = "pma", 55 template = "//pkg/segment:generic_set", 56 types = { 57 "Key": "hostarch.Addr", 58 "Range": "hostarch.AddrRange", 59 "Value": "pma", 60 "Functions": "pmaSetFunctions", 61 }, 62 ) 63 64 go_template_instance( 65 name = "io_list", 66 out = "io_list.go", 67 package = "mm", 68 prefix = "io", 69 template = "//pkg/ilist:generic_list", 70 types = { 71 "Element": "*ioResult", 72 "Linker": "*ioResult", 73 }, 74 ) 75 76 go_template_instance( 77 name = "aio_mappable_refs", 78 out = "aio_mappable_refs.go", 79 package = "mm", 80 prefix = "aioMappable", 81 template = "//pkg/refsvfs2:refs_template", 82 types = { 83 "T": "aioMappable", 84 }, 85 ) 86 87 go_template_instance( 88 name = "special_mappable_refs", 89 out = "special_mappable_refs.go", 90 package = "mm", 91 prefix = "SpecialMappable", 92 template = "//pkg/refsvfs2:refs_template", 93 types = { 94 "T": "SpecialMappable", 95 }, 96 ) 97 98 go_library( 99 name = "mm", 100 srcs = [ 101 "address_space.go", 102 "aio_context.go", 103 "aio_context_state.go", 104 "aio_mappable_refs.go", 105 "debug.go", 106 "file_refcount_set.go", 107 "io.go", 108 "io_list.go", 109 "lifecycle.go", 110 "metadata.go", 111 "mm.go", 112 "pma.go", 113 "pma_set.go", 114 "procfs.go", 115 "save_restore.go", 116 "shm.go", 117 "special_mappable.go", 118 "special_mappable_refs.go", 119 "syscalls.go", 120 "vma.go", 121 "vma_set.go", 122 ], 123 visibility = ["//pkg/sentry:internal"], 124 deps = [ 125 "//pkg/abi/linux", 126 "//pkg/atomicbitops", 127 "//pkg/context", 128 "//pkg/errors/linuxerr", 129 "//pkg/hostarch", 130 "//pkg/log", 131 "//pkg/refs", 132 "//pkg/refsvfs2", 133 "//pkg/safecopy", 134 "//pkg/safemem", 135 "//pkg/sentry/arch", 136 "//pkg/sentry/fs/proc/seqfile", 137 "//pkg/sentry/fsbridge", 138 "//pkg/sentry/kernel/auth", 139 "//pkg/sentry/kernel/futex", 140 "//pkg/sentry/kernel/shm", 141 "//pkg/sentry/limits", 142 "//pkg/sentry/memmap", 143 "//pkg/sentry/pgalloc", 144 "//pkg/sentry/platform", 145 "//pkg/sentry/usage", 146 "//pkg/sync", 147 "//pkg/syserror", 148 "//pkg/tcpip/buffer", 149 "//pkg/usermem", 150 ], 151 ) 152 153 go_test( 154 name = "mm_test", 155 size = "small", 156 srcs = ["mm_test.go"], 157 library = ":mm", 158 deps = [ 159 "//pkg/context", 160 "//pkg/errors/linuxerr", 161 "//pkg/hostarch", 162 "//pkg/sentry/arch", 163 "//pkg/sentry/contexttest", 164 "//pkg/sentry/limits", 165 "//pkg/sentry/memmap", 166 "//pkg/sentry/pgalloc", 167 "//pkg/sentry/platform", 168 "//pkg/usermem", 169 ], 170 )