From 37af73315c3e1ff504db466b10e6269cc56dcc6c Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Fri, 2 Sep 2016 21:21:42 -0500 Subject: Allow out-of-tree builds Change-Id: If4b97e65f63c3abbf23140dd97b9febe00b3be0d Signed-off-by: Patrick Williams --- Makefile.am | 12 +++--- apphandler.cpp | 2 +- chassishandler.cpp | 2 +- dcmihandler.cpp | 2 +- globalhandler.cpp | 2 +- groupext.cpp | 2 +- host-ipmid/ipmid-api.h | 111 +++++++++++++++++++++++++++++++++++++++++++++++++ host-services.c | 2 +- ipmid-api.h | 111 ------------------------------------------------- ipmid.hpp | 2 +- sensorhandler.cpp | 2 +- storagehandler.cpp | 2 +- transporthandler.cpp | 2 +- 13 files changed, 126 insertions(+), 128 deletions(-) create mode 100644 host-ipmid/ipmid-api.h delete mode 100644 ipmid-api.h diff --git a/Makefile.am b/Makefile.am index d90cd38..4cab12c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,10 +18,10 @@ ipmid_LDFLAGS = $(SYSTEMD_LIBS) $(libmapper_LIBS) $(LIBADD_DLOPEN) -export-dynam WHITELIST_CONF ?= ${srcdir}/host-ipmid-whitelist.conf ipmiwhitelist.cpp: ${srcdir}/generate_whitelist.sh $(WHITELIST_CONF) - ${srcdir}/$^ > $@ + $(SHELL) $^ > $@ -libapphandlerdir = /usr/lib/host-ipmid +libapphandlerdir = ${libdir}/host-ipmid libapphandler_LTLIBRARIES = libapphandler.la libapphandler_la_SOURCES = \ apphandler.cpp \ @@ -37,17 +37,15 @@ libapphandler_la_SOURCES = \ libapphandler_la_LDFLAGS = $(SYSTEMD_LIBS) $(libmapper_LIBS) -version-info 0:0:0 -shared libapphandler_la_CXXFLAGS = $(SYSTEMD_CFLAGS) $(libmapper_CFLAGS) -libhostservicedir = /usr/lib/host-ipmid +libhostservicedir = ${libdir}/host-ipmid libhostservice_LTLIBRARIES = libhostservice.la libhostservice_la_SOURCES = \ host-services.c libhostservice_la_LDFLAGS = $(SYSTEMD_LIBS) $(libmapper_LIBS) -version-info 0:0:0 -shared libhostservice_la_CXXFLAGS = $(SYSTEMD_CFLAGS) $(libmapper_CFLAGS) -includedir = /usr/include/host-ipmid - -include_HEADERS = \ - ipmid-api.h +nobase_include_HEADERS = \ + host-ipmid/ipmid-api.h check_PROGRAMS = \ testit diff --git a/apphandler.cpp b/apphandler.cpp index bfc821e..8da85e4 100644 --- a/apphandler.cpp +++ b/apphandler.cpp @@ -1,5 +1,5 @@ #include "apphandler.h" -#include "ipmid-api.h" +#include "host-ipmid/ipmid-api.h" #include "ipmid.hpp" #include #include diff --git a/chassishandler.cpp b/chassishandler.cpp index 1df4c0a..2952725 100644 --- a/chassishandler.cpp +++ b/chassishandler.cpp @@ -1,5 +1,5 @@ #include "chassishandler.h" -#include "ipmid-api.h" +#include "host-ipmid/ipmid-api.h" #include #include #include diff --git a/dcmihandler.cpp b/dcmihandler.cpp index fafebdc..5775a35 100644 --- a/dcmihandler.cpp +++ b/dcmihandler.cpp @@ -1,5 +1,5 @@ #include "dcmihandler.h" -#include "ipmid-api.h" +#include "host-ipmid/ipmid-api.h" #include #include #include diff --git a/globalhandler.cpp b/globalhandler.cpp index 889d127..9008278 100644 --- a/globalhandler.cpp +++ b/globalhandler.cpp @@ -1,5 +1,5 @@ #include "globalhandler.h" -#include "ipmid-api.h" +#include "host-ipmid/ipmid-api.h" #include #include #include diff --git a/groupext.cpp b/groupext.cpp index 92edd04..ba43794 100644 --- a/groupext.cpp +++ b/groupext.cpp @@ -1,4 +1,4 @@ -#include "ipmid-api.h" +#include "host-ipmid/ipmid-api.h" #include "ipmid.hpp" #include #include diff --git a/host-ipmid/ipmid-api.h b/host-ipmid/ipmid-api.h new file mode 100644 index 0000000..0c92069 --- /dev/null +++ b/host-ipmid/ipmid-api.h @@ -0,0 +1,111 @@ +#ifndef __HOST_IPMID_IPMI_COMMON_H__ +#define __HOST_IPMID_IPMI_COMMON_H__ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// length of Completion Code and its ALWAYS _1_ +#define IPMI_CC_LEN 1 + +// IPMI Net Function number as specified by IPMI V2.0 spec. +// Example : +// NETFUN_APP = (0x06 << 2), +typedef unsigned char ipmi_netfn_t; + +// IPMI Command for a Net Function number as specified by IPMI V2.0 spec. +typedef unsigned char ipmi_cmd_t; + +// Buffer containing data from sender of netfn and command as part of request +typedef void* ipmi_request_t; + +// This is the response buffer that the provider of [netfn,cmd] will send back +// to the caller. Provider will allocate the memory inside the handler and then +// will do a memcpy to this response buffer and also will set the data size +// parameter to the size of the buffer. +// EXAMPLE : +// unsigned char str[] = {0x00, 0x01, 0xFE, 0xFF, 0x0A, 0x01}; +// *data_len = 6; +// memcpy(response, &str, *data_len); +typedef void* ipmi_response_t; + +// This buffer contains any *user specific* data that is of interest only to the +// plugin. For a ipmi function router, this data is opaque. At the time of +// registering the plugin handlers, plugin may optionally allocate a memory and +// fill in whatever needed that will be of help during the actual handling of +// command. IPMID will just pass the netfn, cmd and also this data to plugins +// during the command handler invocation. +typedef void* ipmi_context_t; + +// Length of request / response buffer depending on whether the data is a +// request or a response from a plugin handler. +typedef size_t* ipmi_data_len_t; + +// Plugin function return the status code +typedef unsigned char ipmi_ret_t; + +// This is the callback handler that the plugin registers with IPMID. IPMI +// function router will then make a call to this callback handler with the +// necessary arguments of netfn, cmd, request, response, size and context. +typedef ipmi_ret_t (*ipmid_callback_t)(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t, + ipmi_response_t, ipmi_data_len_t, ipmi_context_t); + +// This is the constructor function that is called into by each plugin handlers. +// When ipmi sets up the callback handlers, a call is made to this with +// information of netfn, cmd, callback handler pointer and context data. +void ipmi_register_callback(ipmi_netfn_t, ipmi_cmd_t, + ipmi_context_t, ipmid_callback_t); + +unsigned short get_sel_reserve_id(void); + +// These are the command network functions, the response +// network functions are the function + 1. So to determine +// the proper network function which issued the command +// associated with a response, subtract 1. +// Note: these are also shifted left to make room for the LUN. +enum ipmi_net_fns +{ + NETFUN_CHASSIS = 0x00, + NETFUN_BRIDGE = 0x02, + NETFUN_SENSOR = 0x04, + NETFUN_APP = 0x06, + NETFUN_FIRMWARE = 0x08, + NETFUN_STORAGE = 0x0a, + NETFUN_TRANSPORT = 0x0c, + NETFUN_GRPEXT = 0x2c, + NETFUN_NONE = 0x30, + NETFUN_OEM = 0x32 +}; + +// IPMI commands for net functions. Since this is to be used both by the ipmi +// function router and also the callback handler registration function, its put +// in this .H file. +enum ipmi_netfn_wild_card_cmd +{ + IPMI_CMD_WILDCARD = 0xFF, +}; + +// Return (completion) codes from a IPMI operation as needed by IPMI V2.0 spec. +enum ipmi_return_codes +{ + IPMI_CC_OK = 0x00, + IPMI_DCMI_CC_NO_ACTIVE_POWER_LIMIT = 0x80, + IPMI_CC_INVALID = 0xC1, + IPMI_CC_INVALID_RESERVATION_ID = 0xC5, + IPMI_CC_PARM_OUT_OF_RANGE = 0xC9, + IPMI_CC_SENSOR_INVALID = 0xCB, + IPMI_CC_RESPONSE_ERROR = 0xCE, + IPMI_CC_INSUFFICIENT_PRIVILEGE = 0xD4, + IPMI_CC_UNSPECIFIED_ERROR = 0xFF, +}; + +sd_bus *ipmid_get_sd_bus_connection(void); +sd_bus_slot *ipmid_get_sd_bus_slot(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/host-services.c b/host-services.c index 78ad4c3..4c8fc7c 100644 --- a/host-services.c +++ b/host-services.c @@ -3,7 +3,7 @@ #include #include #include -#include "ipmid-api.h" +#include "host-ipmid/ipmid-api.h" void register_host_services() __attribute__((constructor)); diff --git a/ipmid-api.h b/ipmid-api.h deleted file mode 100644 index 0c92069..0000000 --- a/ipmid-api.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef __HOST_IPMID_IPMI_COMMON_H__ -#define __HOST_IPMID_IPMI_COMMON_H__ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// length of Completion Code and its ALWAYS _1_ -#define IPMI_CC_LEN 1 - -// IPMI Net Function number as specified by IPMI V2.0 spec. -// Example : -// NETFUN_APP = (0x06 << 2), -typedef unsigned char ipmi_netfn_t; - -// IPMI Command for a Net Function number as specified by IPMI V2.0 spec. -typedef unsigned char ipmi_cmd_t; - -// Buffer containing data from sender of netfn and command as part of request -typedef void* ipmi_request_t; - -// This is the response buffer that the provider of [netfn,cmd] will send back -// to the caller. Provider will allocate the memory inside the handler and then -// will do a memcpy to this response buffer and also will set the data size -// parameter to the size of the buffer. -// EXAMPLE : -// unsigned char str[] = {0x00, 0x01, 0xFE, 0xFF, 0x0A, 0x01}; -// *data_len = 6; -// memcpy(response, &str, *data_len); -typedef void* ipmi_response_t; - -// This buffer contains any *user specific* data that is of interest only to the -// plugin. For a ipmi function router, this data is opaque. At the time of -// registering the plugin handlers, plugin may optionally allocate a memory and -// fill in whatever needed that will be of help during the actual handling of -// command. IPMID will just pass the netfn, cmd and also this data to plugins -// during the command handler invocation. -typedef void* ipmi_context_t; - -// Length of request / response buffer depending on whether the data is a -// request or a response from a plugin handler. -typedef size_t* ipmi_data_len_t; - -// Plugin function return the status code -typedef unsigned char ipmi_ret_t; - -// This is the callback handler that the plugin registers with IPMID. IPMI -// function router will then make a call to this callback handler with the -// necessary arguments of netfn, cmd, request, response, size and context. -typedef ipmi_ret_t (*ipmid_callback_t)(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t, - ipmi_response_t, ipmi_data_len_t, ipmi_context_t); - -// This is the constructor function that is called into by each plugin handlers. -// When ipmi sets up the callback handlers, a call is made to this with -// information of netfn, cmd, callback handler pointer and context data. -void ipmi_register_callback(ipmi_netfn_t, ipmi_cmd_t, - ipmi_context_t, ipmid_callback_t); - -unsigned short get_sel_reserve_id(void); - -// These are the command network functions, the response -// network functions are the function + 1. So to determine -// the proper network function which issued the command -// associated with a response, subtract 1. -// Note: these are also shifted left to make room for the LUN. -enum ipmi_net_fns -{ - NETFUN_CHASSIS = 0x00, - NETFUN_BRIDGE = 0x02, - NETFUN_SENSOR = 0x04, - NETFUN_APP = 0x06, - NETFUN_FIRMWARE = 0x08, - NETFUN_STORAGE = 0x0a, - NETFUN_TRANSPORT = 0x0c, - NETFUN_GRPEXT = 0x2c, - NETFUN_NONE = 0x30, - NETFUN_OEM = 0x32 -}; - -// IPMI commands for net functions. Since this is to be used both by the ipmi -// function router and also the callback handler registration function, its put -// in this .H file. -enum ipmi_netfn_wild_card_cmd -{ - IPMI_CMD_WILDCARD = 0xFF, -}; - -// Return (completion) codes from a IPMI operation as needed by IPMI V2.0 spec. -enum ipmi_return_codes -{ - IPMI_CC_OK = 0x00, - IPMI_DCMI_CC_NO_ACTIVE_POWER_LIMIT = 0x80, - IPMI_CC_INVALID = 0xC1, - IPMI_CC_INVALID_RESERVATION_ID = 0xC5, - IPMI_CC_PARM_OUT_OF_RANGE = 0xC9, - IPMI_CC_SENSOR_INVALID = 0xCB, - IPMI_CC_RESPONSE_ERROR = 0xCE, - IPMI_CC_INSUFFICIENT_PRIVILEGE = 0xD4, - IPMI_CC_UNSPECIFIED_ERROR = 0xFF, -}; - -sd_bus *ipmid_get_sd_bus_connection(void); -sd_bus_slot *ipmid_get_sd_bus_slot(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ipmid.hpp b/ipmid.hpp index f465072..bcf15b5 100644 --- a/ipmid.hpp +++ b/ipmid.hpp @@ -1,6 +1,6 @@ #ifndef __HOST_IPMID_IPMI_H__ #define __HOST_IPMID_IPMI_H__ -#include "ipmid-api.h" +#include "host-ipmid/ipmid-api.h" #include #include "host-services.h" diff --git a/sensorhandler.cpp b/sensorhandler.cpp index 39de660..ea8099d 100644 --- a/sensorhandler.cpp +++ b/sensorhandler.cpp @@ -1,5 +1,5 @@ #include "sensorhandler.h" -#include "ipmid-api.h" +#include "host-ipmid/ipmid-api.h" #include #include #include diff --git a/storagehandler.cpp b/storagehandler.cpp index 9622ed9..9379b0d 100644 --- a/storagehandler.cpp +++ b/storagehandler.cpp @@ -7,7 +7,7 @@ #include "storagehandler.h" #include "storageaddsel.h" -#include "ipmid-api.h" +#include "host-ipmid/ipmid-api.h" void register_netfn_storage_functions() __attribute__((constructor)); diff --git a/transporthandler.cpp b/transporthandler.cpp index 0739d06..f7a029b 100644 --- a/transporthandler.cpp +++ b/transporthandler.cpp @@ -4,7 +4,7 @@ #include #include -#include "ipmid-api.h" +#include "host-ipmid/ipmid-api.h" #include "ipmid.hpp" #include "transporthandler.h" -- cgit v1.2.1