treewide: Fix ENUM_VALUE_PREFIX rule exception
Change-Id: Ibc2fd66711f6aa347e88e2379c12db1898373700
Reviewed-on: https://review.monogon.dev/c/monogon/+/3804
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/cloud/agent/api/BUILD.bazel b/cloud/agent/api/BUILD.bazel
index 606c745..e07df2d 100644
--- a/cloud/agent/api/BUILD.bazel
+++ b/cloud/agent/api/BUILD.bazel
@@ -8,7 +8,6 @@
except_rules = [
"PACKAGE_VERSION_SUFFIX",
"MESSAGE_PASCAL_CASE",
- "ENUM_VALUE_PREFIX", # TODO: evaluate correctness
"ENUM_ZERO_VALUE_SUFFIX", # TODO: evaluate correctness
],
protos = [":api_proto"],
diff --git a/cloud/agent/api/hwreport.proto b/cloud/agent/api/hwreport.proto
index 7c5d4fd..98299d7 100644
--- a/cloud/agent/api/hwreport.proto
+++ b/cloud/agent/api/hwreport.proto
@@ -23,11 +23,11 @@
int32 physical_block_size_bytes = 8;
enum Protocol {
- UNKNOWN = 0;
- SCSI = 1;
- ATA = 2;
- NVME = 3;
- MMC = 4;
+ PROTOCOL_UNKNOWN = 0;
+ PROTOCOL_SCSI = 1;
+ PROTOCOL_ATA = 2;
+ PROTOCOL_NVME = 3;
+ PROTOCOL_MMC = 4;
}
Protocol protocol = 9;
@@ -97,23 +97,23 @@
enum EFISupport {
// EFI support was not evaluated by the report generator.
- EFI_INVALID = 0;
+ EFI_SUPPORT_INVALID = 0;
// It is not known if EFI is supported by the node. EFI runtime services are
// not available. This occurs if the report generator generally supports
// reporting EFI support, but none of its mechanisms to determine EFI support
// returned any data.
- EFI_UNKNOWN = 1;
+ EFI_SUPPORT_UNKNOWN = 1;
// The firmware indicates that EFI is not supported by the node. EFI runtime
// services are not available.
// Note that the firmware indication can be wrong.
- EFI_UNSUPPORTED = 2;
+ EFI_SUPPORT_UNSUPPORTED = 2;
// The firmware indicates that EFI is supported, but EFI runtime services
// are not available. This usually means that the hardware report was
// generated from a kernel booted in Compatibility Support Mode (CSM).
// Note that the firmware indication can be wrong.
- EFI_SUPPORTED = 3;
+ EFI_SUPPORT_SUPPORTED = 3;
// EFI and its runtime services are available and working.
- EFI_ENABLED = 4;
+ EFI_SUPPORT_ENABLED = 4;
}
message Node {
diff --git a/cloud/agent/hwreport.go b/cloud/agent/hwreport.go
index da50749..c37a640 100644
--- a/cloud/agent/hwreport.go
+++ b/cloud/agent/hwreport.go
@@ -48,9 +48,9 @@
if smbTbl.BIOSInformationRaw != nil && smbTbl.BIOSInformationRaw.StructureVersion.AtLeast(2, 2) {
uefiSupport := smbTbl.BIOSInformationRaw.BIOSCharacteristicsExtensionByte2&smbios.UEFISpecificationSupported != 0
if uefiSupport {
- c.node.EfiSupport = api.EFISupport_EFI_SUPPORTED
+ c.node.EfiSupport = api.EFISupport_EFI_SUPPORT_SUPPORTED
} else {
- c.node.EfiSupport = api.EFISupport_EFI_UNSUPPORTED
+ c.node.EfiSupport = api.EFISupport_EFI_SUPPORT_UNSUPPORTED
}
}
for _, d := range smbTbl.MemoryDevicesRaw {
@@ -192,7 +192,7 @@
var FRUUnavailable = [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
func (c *hwReportContext) gatherNVMe(bd *api.BlockDevice, bde os.DirEntry) error {
- bd.Protocol = api.BlockDevice_NVME
+ bd.Protocol = api.BlockDevice_PROTOCOL_NVME
nvmeDev, err := nvme.Open("/dev/" + bde.Name())
if err != nil {
return fmt.Errorf("unable to open NVMe device: %w", err)
@@ -218,7 +218,7 @@
}
func (c *hwReportContext) gatherSCSI(bd *api.BlockDevice, bde os.DirEntry) error {
- bd.Protocol = api.BlockDevice_SCSI
+ bd.Protocol = api.BlockDevice_PROTOCOL_SCSI
scsiDev, err := scsi.Open("/dev/" + bde.Name())
if err != nil {
return fmt.Errorf("unable to open SCSI device: %w", err)
@@ -234,7 +234,7 @@
// SAT-5 R8 Table 14
if inquiryData.Vendor == "ATA" { // ATA device behind SAT
- bd.Protocol = api.BlockDevice_ATA
+ bd.Protocol = api.BlockDevice_PROTOCOL_ATA
// TODO: ATA Vendor from WWN if available
} else { // Normal SCSI device
bd.Vendor = inquiryData.Vendor
@@ -326,7 +326,7 @@
}
if strings.HasPrefix(bde.Name(), "mmcblk") {
// TODO: MMC information
- bd.Protocol = api.BlockDevice_MMC
+ bd.Protocol = api.BlockDevice_PROTOCOL_MMC
c.node.BlockDevice = append(c.node.BlockDevice, &bd)
}
}
@@ -403,7 +403,7 @@
hwReportCtx := hwReportContext{
node: &api.Node{},
}
- hwReportCtx.node.EfiSupport = api.EFISupport_EFI_UNKNOWN
+ hwReportCtx.node.EfiSupport = api.EFISupport_EFI_SUPPORT_UNKNOWN
hwReportCtx.gatherCPU()
hwReportCtx.gatherSMBIOS()
@@ -420,7 +420,7 @@
hwReportCtx.gatherBlockDevices()
if _, err := os.Stat("/sys/firmware/efi/runtime"); err == nil {
- hwReportCtx.node.EfiSupport = api.EFISupport_EFI_ENABLED
+ hwReportCtx.node.EfiSupport = api.EFISupport_EFI_SUPPORT_ENABLED
}
return hwReportCtx.node, hwReportCtx.errors