bootcontrol: count slots correctly

Currently slots are miscounted on marlin because the count includes
both the bootlocker and boot partitions for each slot. Modify the
name used to find boot partitions to avoid this double counting. Add a
check to catch changes to slot suffixes that would break slot counting.

Bug: 68012387
Test: bootctl get-number-slots returns 2 on marlin
Change-Id: I5480273cf6de07fac2f47e4f8e249e2d547b686e
Signed-off-by: Connor O'Brien <connoro@google.com>
diff --git a/boot_control.cpp b/boot_control.cpp
index 539c52c..912e382 100644
--- a/boot_control.cpp
+++ b/boot_control.cpp
@@ -49,7 +49,7 @@
 #include "gpt-utils.h"
 
 #define BOOTDEV_DIR "/dev/block/bootdevice/by-name"
-#define BOOT_IMG_PTN_NAME "boot"
+#define BOOT_IMG_PTN_NAME "boot_"
 #define LUN_NAME_END_LOC 14
 #define BOOT_SLOT_PROP "ro.boot.slot_suffix"
 
@@ -266,6 +266,8 @@
 	while ((de = readdir(dir_bootdev))) {
 		if (de->d_name[0] == '.')
 			continue;
+		static_assert(AB_SLOT_A_SUFFIX[0] == '_', "Breaking change to slot A suffix");
+		static_assert(AB_SLOT_B_SUFFIX[0] == '_', "Breaking change to slot B suffix");
 		if (!strncmp(de->d_name, BOOT_IMG_PTN_NAME,
 					strlen(BOOT_IMG_PTN_NAME)))
 			slot_count++;