blob: 35ec11e373615dc05aba08dbd92787e0dc5e67e8 [file] [log] [blame] [edit]
#ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_CENTRAL_CONFIG_CONFIG_H_
#define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_CENTRAL_CONFIG_CONFIG_H_
namespace milotic_tlbmc {
// A simple struct to hold all configurations for tlbmc.
// TlbmcConfig controls the behavior of tlbmc.
// Typical usage:
// In the main function:
// InitializeTlbmcConfig(TlbmcConfig{
// .allow_dangling_frus = ...,
// });
//
// In the code:
// if (GetTlbmcConfig().allow_dangling_frus) {
// // Handle dangling FRUs.
// }
//
// In unit tests:
// GetMutableTlbmcConfigForTest().allow_dangling_frus = true;
// // Test code.
// GetMutableTlbmcConfigForTest().allow_dangling_frus = false;
// // Restore the original config.
struct TlbmcConfig {
// If true, allow FRUs not mapping to a config. This is useful for testing.
// This should not be enabled in production: if a FRU does not map to a
// config, very likely the machine has unsupported hardware config. Making
// tlbmc own the chassis of the machine may cause incorrect links.
bool allow_dangling_frus = false;
};
TlbmcConfig& InitializeTlbmcConfig(const TlbmcConfig& config);
const TlbmcConfig& GetTlbmcConfig();
TlbmcConfig& GetMutableTlbmcConfigForTest();
} // namespace milotic_tlbmc
#endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_CENTRAL_CONFIG_CONFIG_H_