Exemplo n.º 1
0
int
ipmi_check_cmd (fiid_obj_t obj_cmd, uint8_t cmd)
{
  uint8_t cmd_recv;
  uint64_t val;

  if (!fiid_obj_valid (obj_cmd))
    {
      SET_ERRNO (EINVAL);
      return (-1);
    }

  if (FIID_OBJ_FIELD_LOOKUP (obj_cmd, "cmd") < 0)
    {
      FIID_OBJECT_ERROR_TO_ERRNO (obj_cmd);
      return (-1);
    }

  if (FIID_OBJ_GET (obj_cmd, "cmd", &val) < 0)
    {
      FIID_OBJECT_ERROR_TO_ERRNO (obj_cmd);
      return (-1);
    }
  cmd_recv = val;

  return ((cmd_recv == cmd) ? 1 : 0);
}
Exemplo n.º 2
0
int
ipmi_check_completion_code (fiid_obj_t obj_cmd, uint8_t completion_code)
{
  uint8_t completion_code_recv;
  uint64_t val;

  if (!fiid_obj_valid (obj_cmd))
    {
      SET_ERRNO (EINVAL);
      return (-1);
    }

  if (FIID_OBJ_FIELD_LOOKUP (obj_cmd, "comp_code") < 0)
    {
      FIID_OBJECT_ERROR_TO_ERRNO (obj_cmd);
      return (-1);
    }

  if (FIID_OBJ_GET (obj_cmd, "comp_code", &val) < 0)
    {
      FIID_OBJECT_ERROR_TO_ERRNO (obj_cmd);
      return (-1);
    }
  completion_code_recv = val;

  return ((completion_code_recv == completion_code) ? 1 : 0);
}
Exemplo n.º 3
0
int
ipmi_completion_code_strerror_cmd_r (fiid_obj_t obj_cmd,
                                     uint8_t netfn,
                                     char *errstr,
                                     size_t len)
{
    uint8_t cmd, comp_code;
    uint64_t val;

    /* The netfn need not be valid */
    if (!fiid_obj_valid (obj_cmd)
            || !errstr)
    {
        SET_ERRNO (EINVAL);
        return (-1);
    }

    if (FIID_OBJ_FIELD_LOOKUP (obj_cmd, "cmd") < 0)
    {
        FIID_OBJECT_ERROR_TO_ERRNO (obj_cmd);
        return (-1);
    }

    if (FIID_OBJ_FIELD_LOOKUP (obj_cmd, "comp_code") < 0)
    {
        FIID_OBJECT_ERROR_TO_ERRNO (obj_cmd);
        return (-1);
    }

    if (FIID_OBJ_GET (obj_cmd, "cmd", &val) < 0)
    {
        FIID_OBJECT_ERROR_TO_ERRNO (obj_cmd);
        return (-1);
    }
    cmd = val;

    if (FIID_OBJ_GET (obj_cmd, "comp_code", &val) < 0)
    {
        FIID_OBJECT_ERROR_TO_ERRNO (obj_cmd);
        return (-1);
    }
    comp_code = val;

    return (ipmi_completion_code_strerror_r (cmd, netfn, comp_code, errstr, len));
}