/*
* 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) 2012 by Delphix. All rights reserved.
*/
#ifndef _SYS_NVPAIR_H
#define _SYS_NVPAIR_H
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
DATA_TYPE_UNKNOWN = 0,
#if !defined(_KERNEL)
#else
#endif
} data_type_t;
typedef struct nvpair {
/* name string */
/* aligned ptr array for string arrays */
/* aligned array of data for value */
} nvpair_t;
/* nvlist header */
typedef struct nvlist {
} nvlist_t;
/* nvp implementation version */
#define NV_VERSION 0
/* nvlist pack encoding */
#define NV_ENCODE_NATIVE 0
/* nvlist persistent unique name flags, stored in nvl_nvflags */
/* nvlist lookup pairs related flags */
/* convenience macros */
+ (nvp)->nvp_name_sz))
/* NV allocator framework */
typedef struct nv_alloc {
void *nva_arg;
} nv_alloc_t;
struct nv_alloc_ops {
};
extern const nv_alloc_ops_t *nv_fixed_ops;
extern nv_alloc_t *nv_alloc_nosleep;
extern nv_alloc_t *nv_alloc_sleep;
#endif
void nv_alloc_reset(nv_alloc_t *);
void nv_alloc_fini(nv_alloc_t *);
/* list management */
void nvlist_free(nvlist_t *);
int nvlist_add_boolean(nvlist_t *, const char *);
int nvlist_add_string(nvlist_t *, const char *, const char *);
#if !defined(_KERNEL)
int nvlist_add_double(nvlist_t *, const char *, double);
#endif
int nvlist_remove_all(nvlist_t *, const char *);
int nvlist_lookup_boolean(nvlist_t *, const char *);
int nvlist_lookup_string(nvlist_t *, const char *, char **);
int nvlist_lookup_boolean_array(nvlist_t *, const char *,
int nvlist_lookup_nvlist_array(nvlist_t *, const char *,
int nvlist_lookup_pairs(nvlist_t *, int, ...);
#if !defined(_KERNEL)
int nvlist_lookup_double(nvlist_t *, const char *, double *);
#endif
int *, char **);
/* processing nvpair */
char *nvpair_name(nvpair_t *);
int nvpair_type_is_array(nvpair_t *);
int nvpair_value_string(nvpair_t *, char **);
#if !defined(_KERNEL)
int nvpair_value_double(nvpair_t *, double *);
#endif
nvlist_t *fnvlist_alloc(void);
void fnvlist_free(nvlist_t *);
void fnvlist_pack_free(char *, size_t);
void fnvlist_add_boolean(nvlist_t *, const char *);
void fnvlist_add_string(nvlist_t *, const char *, const char *);
void fnvlist_remove(nvlist_t *, const char *);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_NVPAIR_H */