17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 22d9638e54Smws 237c478bd9Sstevel@tonic-gate /* 24*7aec1d6eScindi * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 257c478bd9Sstevel@tonic-gate * Use is subject to license terms. 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #ifndef _FMD_CONF_H 297c478bd9Sstevel@tonic-gate #define _FMD_CONF_H 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #include <sys/types.h> 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #ifdef __cplusplus 367c478bd9Sstevel@tonic-gate extern "C" { 377c478bd9Sstevel@tonic-gate #endif 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate struct fmd_conf_param; 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate typedef struct fmd_conf_ops { 427c478bd9Sstevel@tonic-gate int (*co_set)(struct fmd_conf_param *, const char *); 437c478bd9Sstevel@tonic-gate void (*co_get)(const struct fmd_conf_param *, void *); 447c478bd9Sstevel@tonic-gate int (*co_del)(struct fmd_conf_param *, const char *); 457c478bd9Sstevel@tonic-gate void (*co_free)(struct fmd_conf_param *); 467c478bd9Sstevel@tonic-gate } fmd_conf_ops_t; 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate typedef struct fmd_conf_formal { 497c478bd9Sstevel@tonic-gate const char *cf_name; 507c478bd9Sstevel@tonic-gate const fmd_conf_ops_t *cf_ops; 517c478bd9Sstevel@tonic-gate const char *cf_default; 527c478bd9Sstevel@tonic-gate } fmd_conf_formal_t; 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate typedef struct fmd_conf_param { 557c478bd9Sstevel@tonic-gate const fmd_conf_formal_t *cp_formal; 567c478bd9Sstevel@tonic-gate struct fmd_conf_param *cp_next; 577c478bd9Sstevel@tonic-gate union { 587c478bd9Sstevel@tonic-gate uint64_t cpv_num; 597c478bd9Sstevel@tonic-gate char *cpv_str; 607c478bd9Sstevel@tonic-gate void *cpv_ptr; 617c478bd9Sstevel@tonic-gate } cp_value; 627c478bd9Sstevel@tonic-gate } fmd_conf_param_t; 637c478bd9Sstevel@tonic-gate 64d9638e54Smws typedef struct fmd_conf_defer { 65d9638e54Smws char *cd_name; 66d9638e54Smws char *cd_value; 67d9638e54Smws struct fmd_conf_defer *cd_next; 68d9638e54Smws } fmd_conf_defer_t; 69d9638e54Smws 707c478bd9Sstevel@tonic-gate typedef struct fmd_conf { 717c478bd9Sstevel@tonic-gate pthread_rwlock_t cf_lock; 727c478bd9Sstevel@tonic-gate const fmd_conf_formal_t *cf_argv; 737c478bd9Sstevel@tonic-gate int cf_argc; 74d9638e54Smws uint_t cf_flag; 757c478bd9Sstevel@tonic-gate fmd_conf_param_t *cf_params; 767c478bd9Sstevel@tonic-gate fmd_conf_param_t **cf_parhash; 777c478bd9Sstevel@tonic-gate uint_t cf_parhashlen; 78d9638e54Smws fmd_conf_defer_t *cf_defer; 797c478bd9Sstevel@tonic-gate } fmd_conf_t; 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate typedef struct fmd_conf_verb { 827c478bd9Sstevel@tonic-gate const char *cv_name; 837c478bd9Sstevel@tonic-gate int (*cv_exec)(fmd_conf_t *, int, char *[]); 847c478bd9Sstevel@tonic-gate } fmd_conf_verb_t; 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate typedef struct fmd_conf_path { 877c478bd9Sstevel@tonic-gate const char **cpa_argv; 887c478bd9Sstevel@tonic-gate int cpa_argc; 897c478bd9Sstevel@tonic-gate } fmd_conf_path_t; 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate typedef struct fmd_conf_mode { 927c478bd9Sstevel@tonic-gate const char *cm_name; 937c478bd9Sstevel@tonic-gate const char *cm_desc; 947c478bd9Sstevel@tonic-gate uint_t cm_bits; 957c478bd9Sstevel@tonic-gate } fmd_conf_mode_t; 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate extern int fmd_conf_mode_set(const fmd_conf_mode_t *, 987c478bd9Sstevel@tonic-gate fmd_conf_param_t *, const char *); 997c478bd9Sstevel@tonic-gate extern void fmd_conf_mode_get(const fmd_conf_param_t *, void *); 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate extern int fmd_conf_notsup(fmd_conf_param_t *, const char *); 1027c478bd9Sstevel@tonic-gate extern void fmd_conf_nop(fmd_conf_param_t *); 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t fmd_conf_bool; /* int */ 105d9638e54Smws extern const fmd_conf_ops_t fmd_conf_int8; /* int8_t */ 106d9638e54Smws extern const fmd_conf_ops_t fmd_conf_uint8; /* uint8_t */ 107d9638e54Smws extern const fmd_conf_ops_t fmd_conf_int16; /* int16_t */ 108d9638e54Smws extern const fmd_conf_ops_t fmd_conf_uint16; /* uint16_t */ 1097c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t fmd_conf_int32; /* int32_t */ 1107c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t fmd_conf_uint32; /* uint32_t */ 1117c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t fmd_conf_int64; /* int64_t */ 1127c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t fmd_conf_uint64; /* uint64_t */ 1137c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t fmd_conf_string; /* const char* */ 1147c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t fmd_conf_path; /* fmd_conf_path_t* */ 1157c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t fmd_conf_list; /* fmd_conf_path_t* */ 1167c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t fmd_conf_time; /* hrtime_t */ 1177c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t fmd_conf_size; /* uint64_t */ 1187c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t fmd_conf_signal; /* int */ 1197c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t fmd_conf_parent; /* any */ 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate extern const char FMD_PROP_SUBSCRIPTIONS[]; /* fmd_conf_list */ 1227c478bd9Sstevel@tonic-gate extern const char FMD_PROP_DICTIONARIES[]; /* fmd_conf_list */ 1237c478bd9Sstevel@tonic-gate 124d9638e54Smws #define FMD_CONF_DEFER 0x1 /* permit deferred settings */ 125d9638e54Smws 126d9638e54Smws extern fmd_conf_t *fmd_conf_open(const char *, 127d9638e54Smws int, const fmd_conf_formal_t *, uint_t); 1287c478bd9Sstevel@tonic-gate extern void fmd_conf_merge(fmd_conf_t *, const char *); 129d9638e54Smws extern void fmd_conf_propagate(fmd_conf_t *, fmd_conf_t *, const char *); 1307c478bd9Sstevel@tonic-gate extern void fmd_conf_close(fmd_conf_t *); 1317c478bd9Sstevel@tonic-gate 132*7aec1d6eScindi extern const char *fmd_conf_getnzstr(fmd_conf_t *, const char *); 1337c478bd9Sstevel@tonic-gate extern const fmd_conf_ops_t *fmd_conf_gettype(fmd_conf_t *, const char *); 1347c478bd9Sstevel@tonic-gate extern int fmd_conf_getprop(fmd_conf_t *, const char *, void *); 1357c478bd9Sstevel@tonic-gate extern int fmd_conf_setprop(fmd_conf_t *, const char *, const char *); 1367c478bd9Sstevel@tonic-gate extern int fmd_conf_delprop(fmd_conf_t *, const char *, const char *); 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1397c478bd9Sstevel@tonic-gate } 1407c478bd9Sstevel@tonic-gate #endif 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate #endif /* _FMD_CONF_H */ 143