[PATCH phosphor-host-ipmid v2] Add get sel time cmd

Patrick Williams patrick at stwcx.xyz
Fri Oct 23 09:15:43 AEDT 2015


On Thu, Oct 22, 2015 at 04:31:31PM -0500, OpenBMC Patches wrote:
> From: Adriana Kobylak <anoo at us.ibm.com>
> 
> Add support for IPMI function Get SEL Time
> ---
>  storagehandler.C | 72 +++++++++++++++++++++++++++++++++++++-------------------
>  storagehandler.h |  5 ++--
>  2 files changed, 51 insertions(+), 26 deletions(-)
> 
> diff --git a/storagehandler.C b/storagehandler.C
> index 659fff5..276dd70 100644
> --- a/storagehandler.C
> +++ b/storagehandler.C
...
> +ipmi_ret_t ipmi_storage_get_sel_time(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
> +                              ipmi_request_t request, ipmi_response_t response,
> +                              ipmi_data_len_t data_len, ipmi_context_t context)
> +{
> +    time_t currtime;
> +    ipmi_ret_t rc = IPMI_CC_OK;
> +
> +    // Get current time in seconds since jan 1 1970
> +    time(&currtime);
> +
> +    printf("IPMI Handling GET-SEL-TIME\n");
> +
> +    // From the IPMI Spec 2.0, response should be a 32-bit value
> +    *data_len = sizeof(uint32_t);
> +
> +    // Pack the actual response
> +    memcpy(response, &currtime, *data_len);

I previously made the following comments on this change:
------------------------------------------------------------------------
How do you ensure the proper endianness?

I don't think this is correct anyhow.  currtime is time_t, which is
typically a signed 64 bits now in order to avoid the 2030/ 2100 problem.
You need to convert it into an unsigned 32 bit (and ensure the
endianness is correct).
------------------------------------------------------------------------

-- 
Patrick Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20151022/44e528f4/attachment.sig>


More information about the openbmc mailing list