1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _MDB_ARGVEC_H 28 #define _MDB_ARGVEC_H 29 30 #include <sys/types.h> 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 struct mdb_arg; 37 38 typedef struct mdb_argvec { 39 struct mdb_arg *a_data; /* Array of arguments */ 40 size_t a_nelems; /* Number of valid elements */ 41 size_t a_size; /* Array size */ 42 } mdb_argvec_t; 43 44 /* see mdb_modapi.h for 1-6 */ 45 #define MDB_OPT_SUBOPTS 7 /* Option requires a mdb_subopt_t */ 46 /* list and a value argument */ 47 48 typedef struct mdb_subopt { 49 uint_t sop_flag; /* Option flag */ 50 const char *sop_str; /* Sub-option name */ 51 int sop_index; /* Index of subopt in argument */ 52 } mdb_subopt_t; 53 54 typedef struct mdb_opt { 55 char opt_char; /* Option name */ 56 void *opt_valp; /* Value storage pointer */ 57 uint_t opt_bits; /* Bits to set or clear for booleans */ 58 boolean_t *opt_flag; /* pointer to flag (uintptr_set) */ 59 mdb_subopt_t *opt_subopts; /* List of mdb_subopt_t */ 60 uint_t opt_type; /* Option type (see above) */ 61 } mdb_opt_t; 62 63 #ifdef _MDB 64 65 #ifdef _BIG_ENDIAN 66 #ifdef _LP64 67 #define MDB_INIT_CHAR(x) ((const char *)((uintptr_t)(uchar_t)(x) << 56)) 68 #else /* _LP64 */ 69 #define MDB_INIT_CHAR(x) ((const char *)((uintptr_t)(uchar_t)(x) << 24)) 70 #endif /* _LP64 */ 71 #else /* _BIG_ENDIAN */ 72 #define MDB_INIT_CHAR(x) ((const char *)(uchar_t)(x)) 73 #endif /* _BIG_ENDIAN */ 74 #define MDB_INIT_STRING(x) ((const char *)(x)) 75 76 extern void mdb_argvec_create(mdb_argvec_t *); 77 extern void mdb_argvec_destroy(mdb_argvec_t *); 78 extern void mdb_argvec_append(mdb_argvec_t *, const struct mdb_arg *); 79 extern void mdb_argvec_reset(mdb_argvec_t *); 80 extern void mdb_argvec_zero(mdb_argvec_t *); 81 extern void mdb_argvec_copy(mdb_argvec_t *, const mdb_argvec_t *); 82 83 extern char *mdb_argv_to_str(int, const struct mdb_arg *); 84 85 #endif /* _MDB */ 86 87 #ifdef __cplusplus 88 } 89 #endif 90 91 #endif /* _MDB_ARGVEC_H */ 92