ipmi: replace IPMI_ADD_RSP_DATA() macro with inline helpers
commita580d82085278bffbabc3ab1a6fee9670b0c5e54
authorCédric Le Goater <clg@fr.ibm.com>
Thu, 10 Mar 2016 14:03:55 +0000 (10 15:03 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 11 Mar 2016 14:59:13 +0000 (11 16:59 +0200)
tree7cc094f8aae9faf0895166640feda0d428f47570
parent4f298a4b2957b7833bc607c951ca27c458d98d88
ipmi: replace IPMI_ADD_RSP_DATA() macro with inline helpers

The IPMI command handlers in the BMC simulator use a macro
IPMI_ADD_RSP_DATA() to push bytes in a response buffer. The macro
hides the fact that it implicitly uses variables local to the handler,
which is misleading.

This patch introduces a simple 'struct RspBuffer' and inlined helper
routines to store byte(s) in a response buffer. rsp_buffer_push()
replaces the macro IPMI_ADD_RSP_DATA() and rsp_buffer_pushmore() is
new helper to push multiple bytes. The latest is used in the command
handlers get_msg() and get_sdr() which are manipulating the buffer
directly.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Acked-by: Corey Minyard <cminyard@mvista.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/ipmi/ipmi_bmc_sim.c