2020-01-27 10:04:07 -08:00
|
|
|
load("//tools:defs.bzl", "go_library", "go_test")
|
2018-04-27 10:37:02 -07:00
|
|
|
load("//tools/go_generics:defs.bzl", "go_template_instance")
|
|
|
|
|
|
2023-03-02 10:46:34 -08:00
|
|
|
package(
|
|
|
|
|
default_applicable_licenses = ["//:license"],
|
|
|
|
|
licenses = ["notice"],
|
|
|
|
|
)
|
2019-10-16 16:27:55 -07:00
|
|
|
|
2018-04-27 10:37:02 -07:00
|
|
|
go_template_instance(
|
|
|
|
|
name = "mappable_range",
|
|
|
|
|
out = "mappable_range.go",
|
|
|
|
|
package = "memmap",
|
|
|
|
|
prefix = "Mappable",
|
|
|
|
|
template = "//pkg/segment:generic_range",
|
|
|
|
|
types = {
|
|
|
|
|
"T": "uint64",
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
go_template_instance(
|
|
|
|
|
name = "mapping_set_impl",
|
|
|
|
|
out = "mapping_set_impl.go",
|
|
|
|
|
package = "memmap",
|
|
|
|
|
prefix = "Mapping",
|
|
|
|
|
template = "//pkg/segment:generic_set",
|
|
|
|
|
types = {
|
|
|
|
|
"Key": "uint64",
|
|
|
|
|
"Range": "MappableRange",
|
|
|
|
|
"Value": "MappingsOfRange",
|
|
|
|
|
"Functions": "mappingSetFunctions",
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|
2020-07-27 11:57:11 -07:00
|
|
|
go_template_instance(
|
|
|
|
|
name = "file_range",
|
|
|
|
|
out = "file_range.go",
|
|
|
|
|
package = "memmap",
|
|
|
|
|
prefix = "File",
|
|
|
|
|
template = "//pkg/segment:generic_range",
|
|
|
|
|
types = {
|
|
|
|
|
"T": "uint64",
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|
2018-04-27 10:37:02 -07:00
|
|
|
go_library(
|
|
|
|
|
name = "memmap",
|
|
|
|
|
srcs = [
|
2020-07-27 11:57:11 -07:00
|
|
|
"file_range.go",
|
2018-04-27 10:37:02 -07:00
|
|
|
"mappable_range.go",
|
|
|
|
|
"mapping_set.go",
|
|
|
|
|
"mapping_set_impl.go",
|
|
|
|
|
"memmap.go",
|
|
|
|
|
],
|
|
|
|
|
visibility = ["//pkg/sentry:internal"],
|
|
|
|
|
deps = [
|
2020-01-27 15:17:58 -08:00
|
|
|
"//pkg/context",
|
2025-03-13 17:04:40 -07:00
|
|
|
"//pkg/errors/linuxerr",
|
2021-03-29 13:28:32 -07:00
|
|
|
"//pkg/hostarch",
|
2018-04-27 10:37:02 -07:00
|
|
|
"//pkg/log",
|
2020-07-27 11:57:11 -07:00
|
|
|
"//pkg/safemem",
|
2020-01-27 15:17:58 -08:00
|
|
|
"//pkg/usermem",
|
2018-04-27 10:37:02 -07:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
go_test(
|
|
|
|
|
name = "memmap_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["mapping_set_test.go"],
|
2020-01-27 10:04:07 -08:00
|
|
|
library = ":memmap",
|
2021-03-29 13:28:32 -07:00
|
|
|
deps = ["//pkg/hostarch"],
|
2018-04-27 10:37:02 -07:00
|
|
|
)
|