diff options
author | William A. Kennington III <wak@google.com> | 2018-12-10 15:56:24 -0800 |
---|---|---|
committer | Tom Joseph <tomjoseph@in.ibm.com> | 2018-12-20 10:43:14 +0000 |
commit | 343d0611277a7506bfb4aba9be6a4028b3f80a13 (patch) | |
tree | 3c265e9c4e2e9395f9b77c8f32cd64b0ae698f38 | |
parent | 06df8765c586d03211177efd4aa095a5418dbf91 (diff) | |
download | phosphor-host-ipmid-343d0611277a7506bfb4aba9be6a4028b3f80a13.tar.gz phosphor-host-ipmid-343d0611277a7506bfb4aba9be6a4028b3f80a13.zip |
libipmi: Decouple user commands
This makes them an optional, separate provider like the sysfs cmds.
Tested:
Ran on real hardware that included libusercmds.so in
/usr/lib/host-ipmid and on a machine that did not include it. Ran
ipmitool on the host to verify that the user commands were present
when expected.
Change-Id: I07b3af5ae603c3e5f1ea41f0afc309329f4e185d
Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r-- | Makefile.am | 17 | ||||
-rw-r--r-- | apphandler.cpp | 4 | ||||
-rw-r--r-- | ipmid.cpp | 1 | ||||
-rw-r--r-- | systemintfcmds.cpp | 1 | ||||
-rw-r--r-- | user_channel/channelcommands.cpp | 1 | ||||
-rw-r--r-- | user_channel/usercommands.cpp | 1 |
6 files changed, 15 insertions, 10 deletions
diff --git a/Makefile.am b/Makefile.am index 6ced8fc..63718f9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -66,7 +66,6 @@ channel-gen.cpp: $(AM_V_GEN)@CHANNELGEN@ -o $(top_builddir) generate-cpp providers_LTLIBRARIES += libipmi20.la -libipmi20_la_LIBADD = user_channel/libuserlayer.la libipmi20_la_SOURCES = \ net.cpp \ app/channel.cpp \ @@ -88,8 +87,6 @@ libipmi20_la_SOURCES = \ ipmi_fru_info_area.cpp \ read_fru_data.cpp \ sensordatahandler.cpp \ - user_channel/usercommands.cpp \ - user_channel/channelcommands.cpp \ $(libipmi20_BUILT_LIST) @CODE_COVERAGE_RULES@ @@ -104,7 +101,6 @@ libipmi20_la_LDFLAGS = \ $(libmapper_LIBS) \ $(PHOSPHOR_LOGGING_LIBS) \ $(PHOSPHOR_DBUS_INTERFACES_LIBS) \ - $(LIBS) \ -lstdc++fs \ -version-info 0:0:0 -shared libipmi20_la_CXXFLAGS = \ @@ -115,6 +111,19 @@ libipmi20_la_CXXFLAGS = \ $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \ -flto +providers_LTLIBRARIES += libusercmds.la +libusercmds_la_LIBADD = user_channel/libuserlayer.la +libusercmds_la_SOURCES = \ + user_channel/usercommands.cpp \ + user_channel/channelcommands.cpp +libusercmds_la_LDFLAGS = \ + $(PHOSPHOR_LOGGING_LIBS) \ + $(LIBS) \ + -version-info 0:0:0 -shared +libusercmds_la_CXXFLAGS = \ + $(PHOSPHOR_LOGGING_CFLAGS) \ + -flto + providers_LTLIBRARIES += libsysintfcmds.la libsysintfcmds_la_SOURCES = \ systemintfcmds.cpp \ diff --git a/apphandler.cpp b/apphandler.cpp index bed16ca..f99cbe8 100644 --- a/apphandler.cpp +++ b/apphandler.cpp @@ -6,8 +6,6 @@ #include "sys_info_param.hpp" #include "transporthandler.hpp" #include "types.hpp" -#include "user_channel/channelcommands.hpp" -#include "user_channel/usercommands.hpp" #include "utils.hpp" #include <arpa/inet.h> @@ -1152,7 +1150,5 @@ void register_netfn_app_functions() // <Get System Info Command> ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_SYSTEM_INFO, NULL, ipmi_app_get_system_info, PRIVILEGE_USER); - ipmi::registerUserIpmiFunctions(); - ipmi::registerChannelFunctions(); return; } @@ -11,7 +11,6 @@ #include <dirent.h> #include <dlfcn.h> #include <errno.h> -#include <mapper.h> #include <sys/time.h> #include <systemd/sd-bus.h> #include <unistd.h> diff --git a/systemintfcmds.cpp b/systemintfcmds.cpp index e0ff156..06a46d0 100644 --- a/systemintfcmds.cpp +++ b/systemintfcmds.cpp @@ -6,7 +6,6 @@ #include "host-interface.hpp" #include <host-ipmid/ipmid-api.h> -#include <mapper.h> #include <cstring> #include <host-ipmid/ipmid-host-cmd.hpp> diff --git a/user_channel/channelcommands.cpp b/user_channel/channelcommands.cpp index cf2c998..a0caeb6 100644 --- a/user_channel/channelcommands.cpp +++ b/user_channel/channelcommands.cpp @@ -390,6 +390,7 @@ ipmi_ret_t ipmiGetChannelInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, return IPMI_CC_OK; } +void registerChannelFunctions() __attribute__((constructor)); void registerChannelFunctions() { ipmiChannelInit(); diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp index 3bed8c5..d901e2c 100644 --- a/user_channel/usercommands.cpp +++ b/user_channel/usercommands.cpp @@ -493,6 +493,7 @@ ipmi_ret_t ipmiSetUserPassword(ipmi_netfn_t netfn, ipmi_cmd_t cmd, return IPMI_CC_INVALID_FIELD_REQUEST; } +void registerUserIpmiFunctions() __attribute__((constructor)); void registerUserIpmiFunctions() { ipmiUserInit(); |