Print this page
patch tsoome-feedback


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #pragma ident   "%Z%%M% %I%     %E% SMI"
  28 
  29 /*
  30  * After having been declared, events, FMRIs and authorities must be defined
  31  * (instantiated) before they can be used as the subjects of commands.
  32  */
  33 
  34 #include <sys/sysmacros.h>
  35 #include <libnvpair.h>
  36 #include <string.h>
  37 #include <assert.h>
  38 
  39 #include <inj_event.h>
  40 #include <inj_err.h>
  41 #include <inj_lex.h>
  42 #include <inj_string.h>
  43 #include <inj.h>
  44 
  45 static inj_hash_t inj_defns[3];
  46 static int inj_defns_initialized;
  47 
  48 /* Intrinsics (signed and unsigned integer integer constants) */


  87         for (/* */; m != NULL; m = n) {
  88                 n = inj_list_next(m);
  89 
  90                 switch (m->dfm_type) {
  91                 case DEFNMEM_ARRAY:
  92                 case DEFNMEM_LIST:
  93                         inj_defn_destroy_memlist(inj_list_next(&m->dfm_list));
  94                         break;
  95                 default:
  96                         inj_strfree(m->dfm_str);
  97                 }
  98         }
  99 }
 100 
 101 void
 102 inj_defn_destroy(inj_defn_t *defn)
 103 {
 104         if (defn->defn_name != NULL)
 105                 inj_strfree(defn->defn_name);
 106 
 107         if (defn->defn_nvl != NULL)
 108                 nvlist_free(defn->defn_nvl);
 109 
 110         inj_defn_destroy_memlist(inj_list_next(&defn->defn_members));
 111 }
 112 
 113 static inj_defnmem_t *
 114 inj_defn_mem_create_common(inj_defnmemtype_t type)
 115 {
 116         inj_defnmem_t *dfm = inj_zalloc(sizeof (inj_defnmem_t));
 117 
 118         dfm->dfm_type = type;
 119         dfm->dfm_lineno = yylineno;
 120 
 121         return (dfm);
 122 }
 123 
 124 inj_defnmem_t *
 125 inj_defn_mem_create(const char *str, inj_defnmemtype_t type)
 126 {
 127         inj_defnmem_t *dfm = inj_defn_mem_create_common(type);




   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 


  27 /*
  28  * After having been declared, events, FMRIs and authorities must be defined
  29  * (instantiated) before they can be used as the subjects of commands.
  30  */
  31 
  32 #include <sys/sysmacros.h>
  33 #include <libnvpair.h>
  34 #include <string.h>
  35 #include <assert.h>
  36 
  37 #include <inj_event.h>
  38 #include <inj_err.h>
  39 #include <inj_lex.h>
  40 #include <inj_string.h>
  41 #include <inj.h>
  42 
  43 static inj_hash_t inj_defns[3];
  44 static int inj_defns_initialized;
  45 
  46 /* Intrinsics (signed and unsigned integer integer constants) */


  85         for (/* */; m != NULL; m = n) {
  86                 n = inj_list_next(m);
  87 
  88                 switch (m->dfm_type) {
  89                 case DEFNMEM_ARRAY:
  90                 case DEFNMEM_LIST:
  91                         inj_defn_destroy_memlist(inj_list_next(&m->dfm_list));
  92                         break;
  93                 default:
  94                         inj_strfree(m->dfm_str);
  95                 }
  96         }
  97 }
  98 
  99 void
 100 inj_defn_destroy(inj_defn_t *defn)
 101 {
 102         if (defn->defn_name != NULL)
 103                 inj_strfree(defn->defn_name);
 104 

 105         nvlist_free(defn->defn_nvl);
 106 
 107         inj_defn_destroy_memlist(inj_list_next(&defn->defn_members));
 108 }
 109 
 110 static inj_defnmem_t *
 111 inj_defn_mem_create_common(inj_defnmemtype_t type)
 112 {
 113         inj_defnmem_t *dfm = inj_zalloc(sizeof (inj_defnmem_t));
 114 
 115         dfm->dfm_type = type;
 116         dfm->dfm_lineno = yylineno;
 117 
 118         return (dfm);
 119 }
 120 
 121 inj_defnmem_t *
 122 inj_defn_mem_create(const char *str, inj_defnmemtype_t type)
 123 {
 124         inj_defnmem_t *dfm = inj_defn_mem_create_common(type);