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/struct_test.go b/metropolis/pkg/nvme/struct_test.go
new file mode 100644
index 0000000..b26a48e
--- /dev/null
+++ b/metropolis/pkg/nvme/struct_test.go
@@ -0,0 +1,15 @@
+package nvme
+
+import (
+ "encoding/binary"
+ "testing"
+)
+
+// TestStruct tests if the struct passed to Linux's ioctl has the ABI-specified
+// size.
+func TestStruct(t *testing.T) {
+ passthruCmdSize := binary.Size(passthruCmd{})
+ if passthruCmdSize != 72 {
+ t.Errorf("passthroughCmd is %d bytes, expected 72", passthruCmdSize)
+ }
+}