/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2014 Gary Mills
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <strings.h>
#include <assert.h>
#include <pthread.h>
#include <sys/byteorder.h>
#include "libfru.h"
#include "libfrup.h"
#include "fru_tag.h"
#include "libfrureg.h"
#include "nvfru.h"
#define HEAD_ITER 0
static void
{
int i;
case FDTYPE_Binary:
#if PARSE_TIME == 1
case FDISP_Time:
/* too big for formatting */
return;
}
/* buffer too small */
return;
}
return;
#endif
case FDISP_Binary:
case FDISP_Octal:
case FDISP_Decimal:
case FDISP_Hex:
default:
value = 0;
switch (def->payloadLen) {
case 1:
break;
case 2:
break;
case 4:
break;
default:
}
return;
}
case FDTYPE_ASCII:
return;
case FDTYPE_Enumeration:
value = 0;
return;
}
}
}
/* nothing matched above, use byte array */
def->payloadLen);
}
static void
{
int i;
char *path;
/* construct path */
if ((def->iterationCount == 0) &&
} else {
}
/* iteration, record and field */
if (def->iterationCount) {
int iterlen, n;
/*
* make a new element definition to describe the components of
* the iteration.
*/
newdef.iterationCount = 0;
/* validate the content of the iteration control bytes */
/* invalid. show all iterations */
head = 0;
} else {
}
if (!nv_elems)
return;
return;
}
if (!from_iter) {
return;
}
} else {
}
B_FALSE);
}
} else {
}
}
static fru_regdef_t *
alloc_unknown_fru_regdef(void)
{
fru_regdef_t *p;
p = malloc(sizeof (fru_regdef_t));
if (!p) {
return (NULL);
}
p->version = REGDEF_VERSION;
p->tagType = -1;
p->tagDense = -1;
p->payloadLen = -1;
p->dataLength = -1;
p->dataType = FDTYPE_ByteArray;
p->purgeable = FRU_WHICH_UNDEFINED;
p->enumCount = 0;
p->iterationCount = 0;
p->exampleString = NULL;
return (p);
}
static int
{
int tag_type;
payload_length = 0;
/* check for unrecognized tag */
if ((tag_type == -1) ||
if (tag_type == -1) {
"INVALID");
} else {
}
} else {
}
return (FRU_SUCCESS);
}
static int
{
char *name;
int ret;
if (ret != FRU_SUCCESS) {
return (ret);
}
/* create a new nvlist for each segment */
if (ret) {
return (FRU_FAILURE);
}
/* convert the segment to an nvlist */
if (ret != FRU_SUCCESS) {
return (ret);
}
/* add the nvlist for this segment */
return (FRU_SUCCESS);
}
static int
{
int err;
return (-1);
}
if (fru_type != FRU_NODE_CONTAINER) {
return (-1);
}
if (err) {
return (err);
}
FRU_SUCCESS) {
return (-1);
}
return (0);
}
int
{
int err;
(void) pthread_mutex_lock(&gLock);
NULL);
if (fru_err != FRU_SUCCESS) {
(void) pthread_mutex_unlock(&gLock);
return (-1);
}
if (fru_err != FRU_SUCCESS) {
(void) pthread_mutex_unlock(&gLock);
return (-1);
}
(void) pthread_mutex_unlock(&gLock);
return (err);
}