dbus-sdr: prevent handler registration if dbus-sdr is enabled

Compile out the handler registration if it is using dynamic stack.
Reorder the handlers to have common handlers between the two
implementations alway registered.

Managing the handlers like this all code to be compiled during CI while
providing some control over the handlers used.

Change-Id: I6e9cffacfac4127d2307e8c5e548c84323742c94
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/storagehandler.cpp b/storagehandler.cpp
index 9608dcc..0bc842c 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -849,6 +849,10 @@
 {
     selCacheMapInitialized = false;
     initSELCache();
+    // Handlers with dbus-sdr handler implementation.
+    // Do not register the hander if it dynamic sensors stack is used.
+
+#ifndef FEATURE_DYNAMIC_SENSORS
     // <Get SEL Info>
     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage,
                           ipmi::storage::cmdGetSelInfo, ipmi::Privilege::User,
@@ -864,10 +868,6 @@
                           ipmi::storage::cmdSetSelTime,
                           ipmi::Privilege::Operator, ipmiStorageSetSelTime);
 
-    // <Reserve SEL>
-    ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage,
-                          ipmi::storage::cmdReserveSel, ipmi::Privilege::User,
-                          ipmiStorageReserveSel);
     // <Get SEL Entry>
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SEL_ENTRY, NULL,
                            getSELEntry, PRIVILEGE_USER);
@@ -911,6 +911,15 @@
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SDR, nullptr,
                            ipmi_sen_get_sdr, PRIVILEGE_USER);
 
+#endif
+
+    // Common Handers used by both implementation.
+
+    // <Reserve SEL>
+    ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage,
+                          ipmi::storage::cmdReserveSel, ipmi::Privilege::User,
+                          ipmiStorageReserveSel);
+
     ipmi::fru::registerCallbackHandler();
     return;
 }