pkg/nvme: add NVMe package
This adds a NVMe package for performing various low-level operations on
NVMe devices. Only the most important (to us) calls are implemented as
NVMe has a vast API surface.
Change-Id: I532894c3c2eb780309993a1688226c92c91cdedf
Reviewed-on: https://review.monogon.dev/c/monogon/+/999
Reviewed-by: Mateusz Zalega <mateusz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/pkg/nvme/BUILD.bazel b/metropolis/pkg/nvme/BUILD.bazel
new file mode 100644
index 0000000..6a2438b
--- /dev/null
+++ b/metropolis/pkg/nvme/BUILD.bazel
@@ -0,0 +1,33 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "nvme",
+ srcs = [
+ "cmd_linux.go",
+ "cmd_unsupported.go",
+ "error.go",
+ "format.go",
+ "health.go",
+ "identify.go",
+ "nvme.go",
+ "selftest.go",
+ "uint128le.go",
+ ],
+ importpath = "source.monogon.dev/metropolis/pkg/nvme",
+ visibility = ["//visibility:public"],
+ deps = select({
+ "@io_bazel_rules_go//go/platform:android": [
+ "@org_golang_x_sys//unix",
+ ],
+ "@io_bazel_rules_go//go/platform:linux": [
+ "@org_golang_x_sys//unix",
+ ],
+ "//conditions:default": [],
+ }),
+)
+
+go_test(
+ name = "nvme_test",
+ srcs = ["struct_test.go"],
+ embed = [":nvme"],
+)