1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

bhnd(4): minor style(9) fixes

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D8755
This commit is contained in:
Landon J. Fuller 2016-12-19 20:07:58 +00:00
parent e4ad7e3451
commit 58efe68622
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310290
14 changed files with 131 additions and 135 deletions

View File

@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
* @param cls The NVRAM class.
*/
const char *
bhnd_nvram_data_class_desc(bhnd_nvram_data_class_t *cls)
bhnd_nvram_data_class_desc(bhnd_nvram_data_class *cls)
{
return (cls->desc);
}
@ -80,7 +80,7 @@ bhnd_nvram_data_class_desc(bhnd_nvram_data_class_t *cls)
* code should be returned.
*/
int
bhnd_nvram_data_probe(bhnd_nvram_data_class_t *cls, struct bhnd_nvram_io *io)
bhnd_nvram_data_probe(bhnd_nvram_data_class *cls, struct bhnd_nvram_io *io)
{
return (cls->op_probe(io));
}
@ -106,10 +106,10 @@ bhnd_nvram_data_probe(bhnd_nvram_data_class_t *cls, struct bhnd_nvram_io *io)
*/
int
bhnd_nvram_data_probe_classes(struct bhnd_nvram_data **data,
struct bhnd_nvram_io *io, bhnd_nvram_data_class_t *classes[],
struct bhnd_nvram_io *io, bhnd_nvram_data_class *classes[],
size_t num_classes)
{
bhnd_nvram_data_class_t *cls;
bhnd_nvram_data_class *cls;
int error, prio, result;
cls = NULL;
@ -124,7 +124,7 @@ bhnd_nvram_data_probe_classes(struct bhnd_nvram_data **data,
/* Try to find the best data class capable of parsing io */
for (size_t i = 0; i < num_classes; i++) {
bhnd_nvram_data_class_t *next_cls;
bhnd_nvram_data_class *next_cls;
next_cls = classes[i];
@ -196,8 +196,8 @@ bhnd_nvram_data_probe_classes(struct bhnd_nvram_data **data,
* regular unix error code will be returned.
*/
int
bhnd_nvram_data_new(bhnd_nvram_data_class_t *cls,
struct bhnd_nvram_data **nv, struct bhnd_nvram_io *io)
bhnd_nvram_data_new(bhnd_nvram_data_class *cls, struct bhnd_nvram_data **nv,
struct bhnd_nvram_io *io)
{
struct bhnd_nvram_data *data;
int error;
@ -263,8 +263,8 @@ bhnd_nvram_data_release(struct bhnd_nvram_data *nv)
*
* @param nv The NVRAM data instance to be queried.
*/
bhnd_nvram_data_class_t *
bhnd_nvram_data_class(struct bhnd_nvram_data *nv)
bhnd_nvram_data_class *
bhnd_nvram_data_get_class(struct bhnd_nvram_data *nv)
{
return (nv->cls);
}
@ -423,6 +423,7 @@ bhnd_nvram_data_getvar(struct bhnd_nvram_data *nv, void *cookiep, void *buf,
return (nv->cls->op_getvar(nv, cookiep, buf, len, type));
}
/**
* A generic implementation of bhnd_nvram_data_getvar().
*
@ -438,9 +439,9 @@ int
bhnd_nvram_data_generic_rp_getvar(struct bhnd_nvram_data *nv, void *cookiep,
void *outp, size_t *olen, bhnd_nvram_type otype)
{
bhnd_nvram_val_t val;
bhnd_nvram_val val;
const struct bhnd_nvram_vardefn *vdefn;
const bhnd_nvram_val_fmt_t *fmt;
const bhnd_nvram_val_fmt *fmt;
const char *name;
const void *vptr;
bhnd_nvram_type vtype;

View File

@ -46,7 +46,7 @@
#include "bhnd_nvram_io.h"
/* NVRAM data class */
typedef struct bhnd_nvram_data_class bhnd_nvram_data_class_t;
typedef struct bhnd_nvram_data_class bhnd_nvram_data_class;
/* NVRAM data instance */
struct bhnd_nvram_data;
@ -88,25 +88,24 @@ enum {
parsing */
};
const char *bhnd_nvram_data_class_desc(
bhnd_nvram_data_class_t *cls);
const char *bhnd_nvram_data_class_desc(bhnd_nvram_data_class *cls);
int bhnd_nvram_data_probe(bhnd_nvram_data_class_t *cls,
int bhnd_nvram_data_probe(bhnd_nvram_data_class *cls,
struct bhnd_nvram_io *io);
int bhnd_nvram_data_probe_classes(
struct bhnd_nvram_data **data,
struct bhnd_nvram_io *io,
bhnd_nvram_data_class_t *classes[],
bhnd_nvram_data_class *classes[],
size_t num_classes);
int bhnd_nvram_data_new(bhnd_nvram_data_class_t *cls,
int bhnd_nvram_data_new(bhnd_nvram_data_class *cls,
struct bhnd_nvram_data **nv,
struct bhnd_nvram_io *io);
struct bhnd_nvram_data *bhnd_nvram_data_retain(struct bhnd_nvram_data *nv);
void bhnd_nvram_data_release(struct bhnd_nvram_data *nv);
bhnd_nvram_data_class_t *bhnd_nvram_data_class(struct bhnd_nvram_data *nv);
bhnd_nvram_data_class *bhnd_nvram_data_get_class(struct bhnd_nvram_data *nv);
size_t bhnd_nvram_data_count(struct bhnd_nvram_data *nv);

View File

@ -670,7 +670,7 @@ static int
bhnd_nvram_sprom_getvar(struct bhnd_nvram_data *nv, void *cookiep, void *buf,
size_t *len, bhnd_nvram_type otype)
{
bhnd_nvram_val_t val;
bhnd_nvram_val val;
struct bhnd_nvram_sprom *sp;
struct sprom_opcode_idx *idx;
const struct bhnd_nvram_vardefn *var;

View File

@ -41,7 +41,7 @@
#include "bhnd_nvram_data.h"
/** Registered NVRAM parser class instances. */
SET_DECLARE(bhnd_nvram_data_class_set, bhnd_nvram_data_class_t);
SET_DECLARE(bhnd_nvram_data_class_set, bhnd_nvram_data_class);
void *bhnd_nvram_data_generic_find(struct bhnd_nvram_data *nv,
const char *name);

View File

@ -258,7 +258,7 @@ struct bhnd_nvram_vardefn {
bhnd_nvram_type type; /**< variable type */
uint8_t nelem; /**< element count, or 1 if not
an array-typed variable */
const bhnd_nvram_val_fmt_t *fmt; /**< value format, or NULL */
const bhnd_nvram_val_fmt *fmt; /**< value format, or NULL */
uint32_t flags; /**< flags (BHND_NVRAM_VF_*) */
};

View File

@ -140,7 +140,7 @@ bhnd_nvram_store_new(struct bhnd_nvram_store **store,
*/
int
bhnd_nvram_store_parse_new(struct bhnd_nvram_store **store,
struct bhnd_nvram_io *io, bhnd_nvram_data_class_t *cls)
struct bhnd_nvram_io *io, bhnd_nvram_data_class *cls)
{
struct bhnd_nvram_data *data;
int error;

View File

@ -56,7 +56,7 @@ int bhnd_nvram_store_new(struct bhnd_nvram_store **store,
struct bhnd_nvram_data *data);
int bhnd_nvram_store_parse_new(struct bhnd_nvram_store **store,
struct bhnd_nvram_io *io, bhnd_nvram_data_class_t *cls);
struct bhnd_nvram_io *io, bhnd_nvram_data_class *cls);
void bhnd_nvram_store_free(struct bhnd_nvram_store *store);

View File

@ -698,7 +698,7 @@ int
bhnd_nvram_value_vprintf(const char *fmt, const void *inp, size_t ilen,
bhnd_nvram_type itype, char *outp, size_t *olen, va_list ap)
{
bhnd_nvram_val_t val;
bhnd_nvram_val val;
int error;
/* Map input buffer as a value instance */
@ -848,7 +848,7 @@ int
bhnd_nvram_value_coerce(const void *inp, size_t ilen, bhnd_nvram_type itype,
void *outp, size_t *olen, bhnd_nvram_type otype)
{
bhnd_nvram_val_t val;
bhnd_nvram_val val;
int error;
/* Wrap input buffer in a value instance */

View File

@ -55,17 +55,15 @@ __FBSDID("$FreeBSD$");
#include "bhnd_nvram_valuevar.h"
static void *bhnd_nvram_val_alloc_bytes(bhnd_nvram_val_t *value,
size_t ilen, bhnd_nvram_type itype,
uint32_t flags);
static int bhnd_nvram_val_set(bhnd_nvram_val_t *value, const void *inp,
size_t ilen, bhnd_nvram_type itype,
uint32_t flags);
static int bhnd_nvram_val_set_inline(bhnd_nvram_val_t *value,
static void *bhnd_nvram_val_alloc_bytes(bhnd_nvram_val *value, size_t ilen,
bhnd_nvram_type itype, uint32_t flags);
static int bhnd_nvram_val_set(bhnd_nvram_val *value, const void *inp,
size_t ilen, bhnd_nvram_type itype, uint32_t flags);
static int bhnd_nvram_val_set_inline(bhnd_nvram_val *value,
const void *inp, size_t ilen, bhnd_nvram_type itype);
#define BHND_NVRAM_VAL_INITIALIZER(_fmt, _storage) \
(bhnd_nvram_val_t) { \
(bhnd_nvram_val) { \
.refs = 1, \
.val_storage = _storage, \
.fmt = _fmt, \
@ -85,9 +83,9 @@ static int bhnd_nvram_val_set_inline(bhnd_nvram_val_t *value,
/* Common initialization support for bhnd_nvram_val_init() and
* bhnd_nvram_val_new() */
static int
bhnd_nvram_val_init_common(bhnd_nvram_val_t *value, bhnd_nvram_val_storage_t
val_storage, const bhnd_nvram_val_fmt_t *fmt, const void *inp, size_t ilen,
bhnd_nvram_type itype, uint32_t flags)
bhnd_nvram_val_init_common(bhnd_nvram_val *value,
bhnd_nvram_val_storage val_storage, const bhnd_nvram_val_fmt *fmt,
const void *inp, size_t ilen, bhnd_nvram_type itype, uint32_t flags)
{
void *outp;
bhnd_nvram_type otype;
@ -97,7 +95,7 @@ bhnd_nvram_val_init_common(bhnd_nvram_val_t *value, bhnd_nvram_val_storage_t
/* Determine expected data type, and allow the format to delegate to
* a new format instance */
if (fmt != NULL && fmt->op_filter != NULL) {
const bhnd_nvram_val_fmt_t *nfmt = fmt;
const bhnd_nvram_val_fmt *nfmt = fmt;
/* Use the filter function to determine whether direct
* initialization from is itype permitted */
@ -181,7 +179,7 @@ bhnd_nvram_val_init_common(bhnd_nvram_val_t *value, bhnd_nvram_val_storage_t
* @p fmt representation.
*/
int
bhnd_nvram_val_init(bhnd_nvram_val_t *value, const bhnd_nvram_val_fmt_t *fmt,
bhnd_nvram_val_init(bhnd_nvram_val *value, const bhnd_nvram_val_fmt *fmt,
const void *inp, size_t ilen, bhnd_nvram_type itype, uint32_t flags)
{
int error;
@ -218,7 +216,7 @@ bhnd_nvram_val_init(bhnd_nvram_val_t *value, const bhnd_nvram_val_fmt_t *fmt,
* @p fmt representation.
*/
int
bhnd_nvram_val_new(bhnd_nvram_val_t **value, const bhnd_nvram_val_fmt_t *fmt,
bhnd_nvram_val_new(bhnd_nvram_val **value, const bhnd_nvram_val_fmt *fmt,
const void *inp, size_t ilen, bhnd_nvram_type itype, uint32_t flags)
{
int error;
@ -246,13 +244,13 @@ bhnd_nvram_val_new(bhnd_nvram_val_t **value, const bhnd_nvram_val_fmt_t *fmt,
*
* @param value The value to be copied (or retained).
*
* @retval bhnd_nvram_val_t if @p value was successfully copied or retained.
* @retval bhnd_nvram_val if @p value was successfully copied or retained.
* @retval NULL if allocation failed.
*/
bhnd_nvram_val_t *
bhnd_nvram_val_copy(bhnd_nvram_val_t *value)
bhnd_nvram_val *
bhnd_nvram_val_copy(bhnd_nvram_val *value)
{
bhnd_nvram_val_t *result;
bhnd_nvram_val *result;
const void *bytes;
bhnd_nvram_type type;
size_t len;
@ -306,7 +304,7 @@ bhnd_nvram_val_copy(bhnd_nvram_val_t *value)
* @param value The value to be released.
*/
void
bhnd_nvram_val_release(bhnd_nvram_val_t *value)
bhnd_nvram_val_release(bhnd_nvram_val *value)
{
BHND_NV_ASSERT(value->refs >= 1, ("value over-released"));
@ -720,7 +718,7 @@ bhnd_nvram_val_encode_int(void *outp, size_t *olen, bhnd_nvram_type otype,
* a @p otype representation.
*/
int
bhnd_nvram_val_encode(bhnd_nvram_val_t *value, void *outp, size_t *olen,
bhnd_nvram_val_encode(bhnd_nvram_val *value, void *outp, size_t *olen,
bhnd_nvram_type otype)
{
/* Prefer format implementation */
@ -755,7 +753,7 @@ bhnd_nvram_val_encode(bhnd_nvram_val_t *value, void *outp, size_t *olen,
* a @p otype representation.
*/
int
bhnd_nvram_val_encode_elem(bhnd_nvram_val_t *value, const void *inp,
bhnd_nvram_val_encode_elem(bhnd_nvram_val *value, const void *inp,
size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype)
{
/* Prefer format implementation */
@ -777,7 +775,7 @@ bhnd_nvram_val_encode_elem(bhnd_nvram_val_t *value, const void *inp,
* @param[out] otype Data type.
*/
const void *
bhnd_nvram_val_bytes(bhnd_nvram_val_t *value, size_t *olen,
bhnd_nvram_val_bytes(bhnd_nvram_val *value, size_t *olen,
bhnd_nvram_type *otype)
{
/* Provide type and length */
@ -819,7 +817,7 @@ bhnd_nvram_val_bytes(bhnd_nvram_val_t *value, size_t *olen,
* @retval NULL If the end of the element array is reached.
*/
const void *
bhnd_nvram_val_next(bhnd_nvram_val_t *value, const void *prev, size_t *len)
bhnd_nvram_val_next(bhnd_nvram_val *value, const void *prev, size_t *len)
{
/* Prefer the format implementation */
if (value->fmt != NULL && value->fmt->op_next != NULL)
@ -834,7 +832,7 @@ bhnd_nvram_val_next(bhnd_nvram_val_t *value, const void *prev, size_t *len)
* @param value The value to be queried.
*/
bhnd_nvram_type
bhnd_nvram_val_elem_type(bhnd_nvram_val_t *value)
bhnd_nvram_val_elem_type(bhnd_nvram_val *value)
{
return (bhnd_nvram_base_type(value->data_type));
}
@ -843,7 +841,7 @@ bhnd_nvram_val_elem_type(bhnd_nvram_val_t *value)
* Return the total number of elements represented by @p value.
*/
size_t
bhnd_nvram_val_nelem(bhnd_nvram_val_t *value)
bhnd_nvram_val_nelem(bhnd_nvram_val *value)
{
const void *bytes;
bhnd_nvram_type type;
@ -890,7 +888,7 @@ bhnd_nvram_val_nelem(bhnd_nvram_val_t *value)
* all supported NVRAM data types.
*/
int
bhnd_nvram_val_generic_encode(bhnd_nvram_val_t *value, void *outp, size_t *olen,
bhnd_nvram_val_generic_encode(bhnd_nvram_val *value, void *outp, size_t *olen,
bhnd_nvram_type otype)
{
const void *inp;
@ -1003,7 +1001,7 @@ bhnd_nvram_val_generic_encode(bhnd_nvram_val_t *value, void *outp, size_t *olen,
* all supported NVRAM data types.
*/
int
bhnd_nvram_val_generic_encode_elem(bhnd_nvram_val_t *value, const void *inp,
bhnd_nvram_val_generic_encode_elem(bhnd_nvram_val *value, const void *inp,
size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype)
{
bhnd_nvram_type itype;
@ -1037,7 +1035,7 @@ bhnd_nvram_val_generic_encode_elem(bhnd_nvram_val_t *value, const void *inp,
* all supported NVRAM data types.
*/
const void *
bhnd_nvram_val_generic_next(bhnd_nvram_val_t *value, const void *prev,
bhnd_nvram_val_generic_next(bhnd_nvram_val *value, const void *prev,
size_t *len)
{
const uint8_t *inp;
@ -1101,7 +1099,7 @@ bhnd_nvram_val_generic_next(bhnd_nvram_val_t *value, const void *prev,
* @p itype.
*/
static int
bhnd_nvram_val_set(bhnd_nvram_val_t *value, const void *inp, size_t ilen,
bhnd_nvram_val_set(bhnd_nvram_val *value, const void *inp, size_t ilen,
bhnd_nvram_type itype, uint32_t flags)
{
void *bytes;
@ -1154,7 +1152,7 @@ bhnd_nvram_val_set(bhnd_nvram_val_t *value, const void *inp, size_t ilen,
* @p itype.
*/
static int
bhnd_nvram_val_set_inline(bhnd_nvram_val_t *value, const void *inp, size_t ilen,
bhnd_nvram_val_set_inline(bhnd_nvram_val *value, const void *inp, size_t ilen,
bhnd_nvram_type itype)
{
BHND_NVRAM_VAL_ASSERT_EMPTY(value);
@ -1278,7 +1276,7 @@ bhnd_nvram_val_set_inline(bhnd_nvram_val_t *value, const void *inp, size_t ilen,
* @retval NULL If @p value is an externally allocated instance.
*/
static void *
bhnd_nvram_val_alloc_bytes(bhnd_nvram_val_t *value, size_t ilen,
bhnd_nvram_val_alloc_bytes(bhnd_nvram_val *value, size_t ilen,
bhnd_nvram_type itype, uint32_t flags)
{
void *ptr;

View File

@ -42,51 +42,51 @@
#include "bhnd_nvram.h"
typedef struct bhnd_nvram_val_fmt bhnd_nvram_val_fmt_t;
typedef struct bhnd_nvram_val bhnd_nvram_val_t;
typedef struct bhnd_nvram_val_fmt bhnd_nvram_val_fmt;
typedef struct bhnd_nvram_val bhnd_nvram_val;
int bhnd_nvram_val_init(bhnd_nvram_val_t *value,
const bhnd_nvram_val_fmt_t *fmt,
int bhnd_nvram_val_init(bhnd_nvram_val *value,
const bhnd_nvram_val_fmt *fmt,
const void *inp, size_t ilen,
bhnd_nvram_type itype, uint32_t flags);
int bhnd_nvram_val_new(bhnd_nvram_val_t **value,
const bhnd_nvram_val_fmt_t *fmt,
int bhnd_nvram_val_new(bhnd_nvram_val **value,
const bhnd_nvram_val_fmt *fmt,
const void *inp, size_t ilen,
bhnd_nvram_type itype, uint32_t flags);
bhnd_nvram_val_t *bhnd_nvram_val_copy(bhnd_nvram_val_t *value);
bhnd_nvram_val *bhnd_nvram_val_copy(bhnd_nvram_val *value);
void bhnd_nvram_val_release(
bhnd_nvram_val_t *value);
bhnd_nvram_val *value);
int bhnd_nvram_val_encode(bhnd_nvram_val_t *value,
int bhnd_nvram_val_encode(bhnd_nvram_val *value,
void *outp, size_t *olen,
bhnd_nvram_type otype);
int bhnd_nvram_val_encode_elem(
bhnd_nvram_val_t *value, const void *inp,
bhnd_nvram_val *value, const void *inp,
size_t ilen, void *outp, size_t *olen,
bhnd_nvram_type otype);
int bhnd_nvram_val_printf(bhnd_nvram_val_t *value,
int bhnd_nvram_val_printf(bhnd_nvram_val *value,
const char *fmt, char *outp, size_t *olen,
...);
int bhnd_nvram_val_vprintf(bhnd_nvram_val_t *value,
int bhnd_nvram_val_vprintf(bhnd_nvram_val *value,
const char *fmt, char *outp, size_t *olen,
va_list ap);
const void *bhnd_nvram_val_bytes(bhnd_nvram_val_t *value,
const void *bhnd_nvram_val_bytes(bhnd_nvram_val *value,
size_t *len, bhnd_nvram_type *itype);
bhnd_nvram_type bhnd_nvram_val_elem_type(
bhnd_nvram_val_t *value);
bhnd_nvram_val *value);
const void *bhnd_nvram_val_next(bhnd_nvram_val_t *value,
const void *bhnd_nvram_val_next(bhnd_nvram_val *value,
const void *prev, size_t *len);
size_t bhnd_nvram_val_nelem(bhnd_nvram_val_t *value);
size_t bhnd_nvram_val_nelem(bhnd_nvram_val *value);
/**
* NVRAM value flags
@ -152,7 +152,7 @@ typedef enum {
* as-is.
*/
BHND_NVRAM_VAL_STORAGE_DYNAMIC = 2,
} bhnd_nvram_val_storage_t;
} bhnd_nvram_val_storage;
/**
* @internal
@ -183,16 +183,16 @@ typedef enum {
* when deallocating the value
*/
BHND_NVRAM_VAL_DATA_EXT_ALLOC = 4,
} bhnd_nvram_val_data_storage_t;
} bhnd_nvram_val_data_storage;
/**
* NVRAM value
*/
struct bhnd_nvram_val {
volatile u_int refs; /**< reference count */
bhnd_nvram_val_storage_t val_storage; /**< value structure storage */
const bhnd_nvram_val_fmt_t *fmt; /**< value format, or NULL for default behavior */
bhnd_nvram_val_data_storage_t data_storage; /**< data storage */
bhnd_nvram_val_storage val_storage; /**< value structure storage */
const bhnd_nvram_val_fmt *fmt; /**< value format, or NULL for default behavior */
bhnd_nvram_val_data_storage data_storage; /**< data storage */
bhnd_nvram_type data_type; /**< data type */
size_t data_len; /**< data size */
@ -213,7 +213,7 @@ struct bhnd_nvram_val {
/** Declare a bhnd_nvram_val_fmt with name @p _n */
#define BHND_NVRAM_VAL_TYPE_DECL(_n) \
extern const bhnd_nvram_val_fmt_t bhnd_nvram_val_ ## _n ## _fmt;
extern const bhnd_nvram_val_fmt bhnd_nvram_val_ ## _n ## _fmt;
BHND_NVRAM_VAL_TYPE_DECL(bcm_decimal);
BHND_NVRAM_VAL_TYPE_DECL(bcm_hex);

View File

@ -63,61 +63,61 @@ static bool bhnd_nvram_ident_num_string(const char *inp,
size_t ilen, u_int base, u_int *obase);
static int bhnd_nvram_val_bcm_macaddr_filter(
const bhnd_nvram_val_fmt_t **fmt, const void *inp,
const bhnd_nvram_val_fmt **fmt, const void *inp,
size_t ilen, bhnd_nvram_type itype);
static int bhnd_nvram_val_bcm_macaddr_encode(
bhnd_nvram_val_t *value, void *outp, size_t *olen,
bhnd_nvram_val *value, void *outp, size_t *olen,
bhnd_nvram_type otype);
static int bhnd_nvram_val_bcm_macaddr_string_filter(
const bhnd_nvram_val_fmt_t **fmt, const void *inp,
const bhnd_nvram_val_fmt **fmt, const void *inp,
size_t ilen, bhnd_nvram_type itype);
static int bhnd_nvram_val_bcm_macaddr_string_encode_elem(
bhnd_nvram_val_t *value, const void *inp,
bhnd_nvram_val *value, const void *inp,
size_t ilen, void *outp, size_t *olen,
bhnd_nvram_type otype);
static const void *bhnd_nvram_val_bcm_macaddr_string_next(
bhnd_nvram_val_t *value, const void *prev,
bhnd_nvram_val *value, const void *prev,
size_t *len);
static int bhnd_nvram_val_bcm_int_filter(
const bhnd_nvram_val_fmt_t **fmt, const void *inp,
const bhnd_nvram_val_fmt **fmt, const void *inp,
size_t ilen, bhnd_nvram_type itype);
static int bhnd_nvram_val_bcm_int_encode(bhnd_nvram_val_t *value,
static int bhnd_nvram_val_bcm_int_encode(bhnd_nvram_val *value,
void *outp, size_t *olen, bhnd_nvram_type otype);
static int bhnd_nvram_val_bcm_decimal_encode_elem(
bhnd_nvram_val_t *value, const void *inp,
bhnd_nvram_val *value, const void *inp,
size_t ilen, void *outp, size_t *olen,
bhnd_nvram_type otype);
static int bhnd_nvram_val_bcm_hex_encode_elem(
bhnd_nvram_val_t *value, const void *inp,
bhnd_nvram_val *value, const void *inp,
size_t ilen, void *outp, size_t *olen,
bhnd_nvram_type otype);
static int bhnd_nvram_val_bcm_leddc_filter(
const bhnd_nvram_val_fmt_t **fmt, const void *inp,
const bhnd_nvram_val_fmt **fmt, const void *inp,
size_t ilen, bhnd_nvram_type itype);
static int bhnd_nvram_val_bcm_leddc_encode_elem(
bhnd_nvram_val_t *value, const void *inp,
bhnd_nvram_val *value, const void *inp,
size_t ilen, void *outp, size_t *olen,
bhnd_nvram_type otype);
static int bhnd_nvram_val_bcmstr_encode(bhnd_nvram_val_t *value,
static int bhnd_nvram_val_bcmstr_encode(bhnd_nvram_val *value,
void *outp, size_t *olen, bhnd_nvram_type otype);
static int bhnd_nvram_val_bcmstr_csv_filter(
const bhnd_nvram_val_fmt_t **fmt, const void *inp,
const bhnd_nvram_val_fmt **fmt, const void *inp,
size_t ilen, bhnd_nvram_type itype);
static const void *bhnd_nvram_val_bcmstr_csv_next(bhnd_nvram_val_t *value,
static const void *bhnd_nvram_val_bcmstr_csv_next(bhnd_nvram_val *value,
const void *prev, size_t *len);
/**
* Broadcom NVRAM MAC address format.
*/
const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_macaddr_fmt = {
const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_macaddr_fmt = {
.name = "bcm-macaddr",
.native_type = BHND_NVRAM_TYPE_UINT8_ARRAY,
.op_filter = bhnd_nvram_val_bcm_macaddr_filter,
@ -125,7 +125,7 @@ const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_macaddr_fmt = {
};
/** Broadcom NVRAM MAC address string format. */
static const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_macaddr_string_fmt = {
static const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_macaddr_string_fmt = {
.name = "bcm-macaddr-string",
.native_type = BHND_NVRAM_TYPE_STRING,
.op_filter = bhnd_nvram_val_bcm_macaddr_string_filter,
@ -136,7 +136,7 @@ static const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_macaddr_string_fmt = {
/**
* Broadcom NVRAM LED duty-cycle format.
*/
const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_leddc_fmt = {
const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_leddc_fmt = {
.name = "bcm-leddc",
.native_type = BHND_NVRAM_TYPE_UINT32,
.op_filter = bhnd_nvram_val_bcm_leddc_filter,
@ -152,7 +152,7 @@ const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_leddc_fmt = {
* - Positive values will be string-encoded without a prefix.
* - Negative values will be string-encoded with a leading '-' sign.
*/
const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_decimal_fmt = {
const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_decimal_fmt = {
.name = "bcm-decimal",
.native_type = BHND_NVRAM_TYPE_UINT64,
.op_filter = bhnd_nvram_val_bcm_int_filter,
@ -171,7 +171,7 @@ const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_decimal_fmt = {
* both signed and negative, it will be string encoded as a negative decimal
* value, not as a twos-complement hexadecimal value.
*/
const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_hex_fmt = {
const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_hex_fmt = {
.name = "bcm-hex",
.native_type = BHND_NVRAM_TYPE_UINT64,
.op_filter = bhnd_nvram_val_bcm_int_filter,
@ -185,14 +185,14 @@ const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_hex_fmt = {
* Handles standard, comma-delimited, and octet-string values as used in
* Broadcom NVRAM data.
*/
const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_string_fmt = {
const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_string_fmt = {
.name = "bcm-string",
.native_type = BHND_NVRAM_TYPE_STRING,
.op_encode = bhnd_nvram_val_bcmstr_encode,
};
/** Broadcom comma-delimited string. */
static const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_string_csv_fmt = {
static const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_string_csv_fmt = {
.name = "bcm-string[]",
.native_type = BHND_NVRAM_TYPE_STRING,
.op_filter = bhnd_nvram_val_bcmstr_csv_filter,
@ -203,7 +203,7 @@ static const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_string_csv_fmt = {
* Common hex/decimal integer filter implementation.
*/
static int
bhnd_nvram_val_bcm_int_filter(const bhnd_nvram_val_fmt_t **fmt, const void *inp,
bhnd_nvram_val_bcm_int_filter(const bhnd_nvram_val_fmt **fmt, const void *inp,
size_t ilen, bhnd_nvram_type itype)
{
bhnd_nvram_type itype_base;
@ -233,7 +233,7 @@ bhnd_nvram_val_bcm_int_filter(const bhnd_nvram_val_fmt_t **fmt, const void *inp,
* Broadcom hex/decimal integer encode implementation.
*/
static int
bhnd_nvram_val_bcm_int_encode(bhnd_nvram_val_t *value, void *outp, size_t *olen,
bhnd_nvram_val_bcm_int_encode(bhnd_nvram_val *value, void *outp, size_t *olen,
bhnd_nvram_type otype)
{
/* If encoding to a string, format multiple elements (if any) with a
@ -248,7 +248,7 @@ bhnd_nvram_val_bcm_int_encode(bhnd_nvram_val_t *value, void *outp, size_t *olen,
* Broadcom hex integer encode_elem implementation.
*/
static int
bhnd_nvram_val_bcm_hex_encode_elem(bhnd_nvram_val_t *value, const void *inp,
bhnd_nvram_val_bcm_hex_encode_elem(bhnd_nvram_val *value, const void *inp,
size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype)
{
bhnd_nvram_type itype;
@ -303,7 +303,7 @@ bhnd_nvram_val_bcm_hex_encode_elem(bhnd_nvram_val_t *value, const void *inp,
* Broadcom decimal integer encode_elem implementation.
*/
static int
bhnd_nvram_val_bcm_decimal_encode_elem(bhnd_nvram_val_t *value, const void *inp,
bhnd_nvram_val_bcm_decimal_encode_elem(bhnd_nvram_val *value, const void *inp,
size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype)
{
const char *sfmt;
@ -325,7 +325,7 @@ bhnd_nvram_val_bcm_decimal_encode_elem(bhnd_nvram_val_t *value, const void *inp,
* Broadcom LED duty-cycle filter.
*/
static int
bhnd_nvram_val_bcm_leddc_filter(const bhnd_nvram_val_fmt_t **fmt,
bhnd_nvram_val_bcm_leddc_filter(const bhnd_nvram_val_fmt **fmt,
const void *inp, size_t ilen, bhnd_nvram_type itype)
{
const char *p;
@ -356,7 +356,7 @@ bhnd_nvram_val_bcm_leddc_filter(const bhnd_nvram_val_fmt_t **fmt,
* Broadcom LED duty-cycle encode.
*/
static int
bhnd_nvram_val_bcm_leddc_encode_elem(bhnd_nvram_val_t *value, const void *inp,
bhnd_nvram_val_bcm_leddc_encode_elem(bhnd_nvram_val *value, const void *inp,
size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype)
{
bhnd_nvram_type itype;
@ -536,11 +536,11 @@ bhnd_nvram_val_bcm_leddc_encode_elem(bhnd_nvram_val_t *value, const void *inp,
* Broadcom NVRAM string encoding.
*/
static int
bhnd_nvram_val_bcmstr_encode(bhnd_nvram_val_t *value, void *outp,
size_t *olen, bhnd_nvram_type otype)
bhnd_nvram_val_bcmstr_encode(bhnd_nvram_val *value, void *outp, size_t *olen,
bhnd_nvram_type otype)
{
bhnd_nvram_val_t array;
const bhnd_nvram_val_fmt_t *array_fmt;
bhnd_nvram_val array;
const bhnd_nvram_val_fmt *array_fmt;
const void *inp;
bhnd_nvram_type itype;
size_t ilen;
@ -588,7 +588,7 @@ bhnd_nvram_val_bcmstr_encode(bhnd_nvram_val_t *value, void *outp,
* Broadcom NVRAM comma-delimited string filter.
*/
static int
bhnd_nvram_val_bcmstr_csv_filter(const bhnd_nvram_val_fmt_t **fmt,
bhnd_nvram_val_bcmstr_csv_filter(const bhnd_nvram_val_fmt **fmt,
const void *inp, size_t ilen, bhnd_nvram_type itype)
{
switch (itype) {
@ -604,7 +604,7 @@ bhnd_nvram_val_bcmstr_csv_filter(const bhnd_nvram_val_fmt_t **fmt,
* Broadcom NVRAM comma-delimited string iteration.
*/
static const void *
bhnd_nvram_val_bcmstr_csv_next(bhnd_nvram_val_t *value, const void *prev,
bhnd_nvram_val_bcmstr_csv_next(bhnd_nvram_val *value, const void *prev,
size_t *len)
{
const char *next;
@ -671,7 +671,7 @@ bhnd_nvram_val_bcmstr_csv_next(bhnd_nvram_val_t *value, const void *prev,
* MAC address filter.
*/
static int
bhnd_nvram_val_bcm_macaddr_filter(const bhnd_nvram_val_fmt_t **fmt,
bhnd_nvram_val_bcm_macaddr_filter(const bhnd_nvram_val_fmt **fmt,
const void *inp, size_t ilen, bhnd_nvram_type itype)
{
switch (itype) {
@ -690,7 +690,7 @@ bhnd_nvram_val_bcm_macaddr_filter(const bhnd_nvram_val_fmt_t **fmt,
* MAC address encoding.
*/
static int
bhnd_nvram_val_bcm_macaddr_encode(bhnd_nvram_val_t *value, void *outp,
bhnd_nvram_val_bcm_macaddr_encode(bhnd_nvram_val *value, void *outp,
size_t *olen, bhnd_nvram_type otype)
{
const void *inp;
@ -714,7 +714,7 @@ bhnd_nvram_val_bcm_macaddr_encode(bhnd_nvram_val_t *value, void *outp,
* MAC address string filter.
*/
static int
bhnd_nvram_val_bcm_macaddr_string_filter(const bhnd_nvram_val_fmt_t **fmt,
bhnd_nvram_val_bcm_macaddr_string_filter(const bhnd_nvram_val_fmt **fmt,
const void *inp, size_t ilen, bhnd_nvram_type itype)
{
switch (itype) {
@ -735,7 +735,7 @@ bhnd_nvram_val_bcm_macaddr_string_filter(const bhnd_nvram_val_fmt_t **fmt,
* MAC address string octet encoding.
*/
static int
bhnd_nvram_val_bcm_macaddr_string_encode_elem(bhnd_nvram_val_t *value,
bhnd_nvram_val_bcm_macaddr_string_encode_elem(bhnd_nvram_val *value,
const void *inp, size_t ilen, void *outp, size_t *olen,
bhnd_nvram_type otype)
{
@ -765,7 +765,7 @@ bhnd_nvram_val_bcm_macaddr_string_encode_elem(bhnd_nvram_val_t *value,
* MAC address string octet iteration.
*/
static const void *
bhnd_nvram_val_bcm_macaddr_string_next(bhnd_nvram_val_t *value, const void *prev,
bhnd_nvram_val_bcm_macaddr_string_next(bhnd_nvram_val *value, const void *prev,
size_t *len)
{
const char *next;

View File

@ -98,7 +98,7 @@ static char const bhnd_nv_hex2ascii[] = "0123456789abcdefghijklmnopqrstuvwxyz";
* underflow) the representation defined by @p fmt.
*/
int
bhnd_nvram_val_printf(bhnd_nvram_val_t *value, const char *fmt, char *outp,
bhnd_nvram_val_printf(bhnd_nvram_val *value, const char *fmt, char *outp,
size_t *olen, ...)
{
va_list ap;
@ -209,7 +209,7 @@ bhnd_nvram_val_printf(bhnd_nvram_val_t *value, const char *fmt, char *outp,
* underflow) the representation defined by @p fmt.
*/
int
bhnd_nvram_val_vprintf(bhnd_nvram_val_t *value, const char *fmt, char *outp,
bhnd_nvram_val_vprintf(bhnd_nvram_val *value, const char *fmt, char *outp,
size_t *olen, va_list ap)
{
const void *elem;

View File

@ -34,12 +34,12 @@
#include "bhnd_nvram_value.h"
int bhnd_nvram_val_generic_encode(bhnd_nvram_val_t *value,
int bhnd_nvram_val_generic_encode(bhnd_nvram_val *value,
void *outp, size_t *olen, bhnd_nvram_type otype);
int bhnd_nvram_val_generic_encode_elem(bhnd_nvram_val_t *value,
int bhnd_nvram_val_generic_encode_elem(bhnd_nvram_val *value,
const void *inp, size_t ilen, void *outp, size_t *olen,
bhnd_nvram_type otype);
const void *bhnd_nvram_val_generic_next(bhnd_nvram_val_t *value,
const void *bhnd_nvram_val_generic_next(bhnd_nvram_val *value,
const void *prev, size_t *len);
/**
* Filter input data prior to initialization.
@ -60,24 +60,24 @@ const void *bhnd_nvram_val_generic_next(bhnd_nvram_val_t *value,
* @retval EFAULT if @p ilen is not correctly aligned for elements of
* @p itype.
*/
typedef int (bhnd_nvram_val_op_filter)(const bhnd_nvram_val_fmt_t **fmt,
typedef int (bhnd_nvram_val_op_filter)(const bhnd_nvram_val_fmt **fmt,
const void *inp, size_t ilen, bhnd_nvram_type itype);
/** @see bhnd_nvram_val_encode() */
typedef int (bhnd_nvram_val_op_encode)(bhnd_nvram_val_t *value, void *outp,
typedef int (bhnd_nvram_val_op_encode)(bhnd_nvram_val *value, void *outp,
size_t *olen, bhnd_nvram_type otype);
/** @see bhnd_nvram_val_encode_elem() */
typedef int (bhnd_nvram_val_op_encode_elem)(bhnd_nvram_val_t *value,
typedef int (bhnd_nvram_val_op_encode_elem)(bhnd_nvram_val *value,
const void *inp, size_t ilen, void *outp, size_t *olen,
bhnd_nvram_type otype);
/** @see bhnd_nvram_val_next() */
typedef const void *(bhnd_nvram_val_op_next)(bhnd_nvram_val_t *value,
typedef const void *(bhnd_nvram_val_op_next)(bhnd_nvram_val *value,
const void *prev, size_t *len);
/** @see bhnd_nvram_val_nelem() */
typedef size_t (bhnd_nvram_val_op_nelem)(bhnd_nvram_val_t *value);
typedef size_t (bhnd_nvram_val_op_nelem)(bhnd_nvram_val *value);
/**
* NVRAM value format.

View File

@ -83,8 +83,7 @@ static int bhnd_nvram_iocfe_new(struct bhnd_nvram_io **io,
char *dname);
static struct bhnd_nvram_io *bhnd_nvram_find_cfedev(device_t dev,
char **dname,
bhnd_nvram_data_class_t **cls);
char **dname, bhnd_nvram_data_class **cls);
/** Known CFE NVRAM device names, in probe order. */
static char *nvram_cfe_devs[] = {
@ -95,7 +94,7 @@ static char *nvram_cfe_devs[] = {
};
/** Supported CFE NVRAM formats, in probe order. */
static bhnd_nvram_data_class_t * const nvram_cfe_fmts[] = {
static bhnd_nvram_data_class * const nvram_cfe_fmts[] = {
&bhnd_nvram_bcm_class,
&bhnd_nvram_tlv_class
};
@ -105,7 +104,7 @@ static int
bhnd_nvram_cfe_probe(device_t dev)
{
struct bhnd_nvram_io *io;
bhnd_nvram_data_class_t *cls;
bhnd_nvram_data_class *cls;
const char *cls_desc;
char *dname;
char *desc;
@ -135,7 +134,7 @@ static int
bhnd_nvram_cfe_attach(device_t dev)
{
struct bhnd_nvram_cfe_softc *sc;
bhnd_nvram_data_class_t *cls;
bhnd_nvram_data_class *cls;
struct bhnd_nvram_io *io;
char *dname;
int error;
@ -215,8 +214,7 @@ bhnd_nvram_cfe_setvar(device_t dev, const char *name, const void *buf,
* @retval NULL if no usable CFE NVRAM device could be found.
*/
static struct bhnd_nvram_io *
bhnd_nvram_find_cfedev(device_t dev, char **dname,
bhnd_nvram_data_class_t **cls)
bhnd_nvram_find_cfedev(device_t dev, char **dname, bhnd_nvram_data_class **cls)
{
struct bhnd_nvram_io *io;
int devinfo;