17c478bd9Sstevel@tonic-gate %{ 27c478bd9Sstevel@tonic-gate /* 37c478bd9Sstevel@tonic-gate * CDDL HEADER START 47c478bd9Sstevel@tonic-gate * 57c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 6ffbafc53Scomay * Common Development and Distribution License (the "License"). 7ffbafc53Scomay * You may not use this file except in compliance 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 217e362f58Scomay */ 227e362f58Scomay 237e362f58Scomay /* 24*a20ee416SGlenn Faden * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #include <stdio.h> 28c94c1ef0Sjv #include <strings.h> 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #include "zonecfg.h" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate static cmd_t *cmd = NULL; /* Command being processed */ 337c478bd9Sstevel@tonic-gate static complex_property_ptr_t complex = NULL; 347c478bd9Sstevel@tonic-gate static list_property_ptr_t new_list = NULL, tmp_list, last, 357c478bd9Sstevel@tonic-gate list[MAX_EQ_PROP_PAIRS]; 367c478bd9Sstevel@tonic-gate static property_value_t property[MAX_EQ_PROP_PAIRS]; 377c478bd9Sstevel@tonic-gate 38bbec428eSgjelinek extern boolean_t newline_terminated; 397c478bd9Sstevel@tonic-gate extern int num_prop_vals; /* # of property values */ 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* yacc externals */ 427c478bd9Sstevel@tonic-gate extern int yydebug; 437c478bd9Sstevel@tonic-gate extern void yyerror(char *s); 447c478bd9Sstevel@tonic-gate 45c94c1ef0Sjv /* 46c94c1ef0Sjv * This function is used by the simple_prop_val reduction rules to set up 47c94c1ef0Sjv * a list_property_ptr_t and adjust the above global variables appropriately. 48c94c1ef0Sjv * Note that this function duplicates the specified string and makes 49c94c1ef0Sjv * the new list's lp_simple field point to the duplicate. This function does 50c94c1ef0Sjv * not free the original string. 51c94c1ef0Sjv * 52c94c1ef0Sjv * This function returns a pointer to the duplicated string or NULL if an error 53c94c1ef0Sjv * occurred. The simple_prop_val reduction rules that invoke this function 54c94c1ef0Sjv * should set $$ to the returned pointer. 55c94c1ef0Sjv */ 56c94c1ef0Sjv static char * 57c94c1ef0Sjv simple_prop_val_func(const char *str) 58c94c1ef0Sjv { 59c94c1ef0Sjv char *retstr; 60c94c1ef0Sjv 61c94c1ef0Sjv if ((new_list = alloc_list()) == NULL) 62c94c1ef0Sjv return (NULL); 63c94c1ef0Sjv if ((retstr = strdup(str)) == NULL) { 64c94c1ef0Sjv free_list(new_list); 65c94c1ef0Sjv return (NULL); 66c94c1ef0Sjv } 67c94c1ef0Sjv new_list->lp_simple = retstr; 68c94c1ef0Sjv new_list->lp_complex = NULL; 69c94c1ef0Sjv new_list->lp_next = NULL; 70c94c1ef0Sjv if (list[num_prop_vals] == NULL) { 71c94c1ef0Sjv list[num_prop_vals] = new_list; 72c94c1ef0Sjv } else { 73c94c1ef0Sjv for (tmp_list = list[num_prop_vals]; tmp_list != NULL; 74c94c1ef0Sjv tmp_list = tmp_list->lp_next) 75c94c1ef0Sjv last = tmp_list; 76c94c1ef0Sjv last->lp_next = new_list; 77c94c1ef0Sjv } 78c94c1ef0Sjv return (retstr); 79c94c1ef0Sjv } 80c94c1ef0Sjv 81c94c1ef0Sjv /* 82c94c1ef0Sjv * This function is used by the complex_piece reduction rules to set up a 83c94c1ef0Sjv * complex_property_prt_t and adjust the above global variables appropriately. 84c94c1ef0Sjv * Note that this function duplicates the specified string and makes the new 85c94c1ef0Sjv * complex_property_ptr_t's cp_value field point to the duplicate. It also sets 86c94c1ef0Sjv * the complex_property_ptr_t's cp_type field to cp_type and its cp_next field 87c94c1ef0Sjv * to cp_next. This function does not free the original string. 88c94c1ef0Sjv * 89c94c1ef0Sjv * This function returns a pointer to the complex_property_t created for the 90c94c1ef0Sjv * complex_piece or NULL if an error occurred. The complex_piece reduction 91c94c1ef0Sjv * rules that invoke this function should set $$ to the returned pointer. 92c94c1ef0Sjv */ 93c94c1ef0Sjv static complex_property_ptr_t 94c94c1ef0Sjv complex_piece_func(int cp_type, const char *str, complex_property_ptr_t cp_next) 95c94c1ef0Sjv { 96c94c1ef0Sjv complex_property_ptr_t retval; 97c94c1ef0Sjv 98c94c1ef0Sjv if ((retval = alloc_complex()) == NULL) 99c94c1ef0Sjv return (NULL); 100c94c1ef0Sjv if ((retval->cp_value = strdup(str)) == NULL) { 101c94c1ef0Sjv free_complex(retval); 102c94c1ef0Sjv return (NULL); 103c94c1ef0Sjv } 104c94c1ef0Sjv retval->cp_type = cp_type; 105c94c1ef0Sjv retval->cp_next = cp_next; 106c94c1ef0Sjv complex = retval; 107c94c1ef0Sjv return (retval); 108c94c1ef0Sjv } 109c94c1ef0Sjv 110c94c1ef0Sjv 1117c478bd9Sstevel@tonic-gate %} 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate %union { 1147c478bd9Sstevel@tonic-gate int ival; 1157c478bd9Sstevel@tonic-gate char *strval; 1167c478bd9Sstevel@tonic-gate cmd_t *cmd; 1177c478bd9Sstevel@tonic-gate complex_property_ptr_t complex; 1187c478bd9Sstevel@tonic-gate list_property_ptr_t list; 1197c478bd9Sstevel@tonic-gate } 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate %start commands 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate %token HELP CREATE EXPORT ADD DELETE REMOVE SELECT SET INFO CANCEL END VERIFY 124087719fdSdp %token COMMIT REVERT EXIT SEMICOLON TOKEN ZONENAME ZONEPATH AUTOBOOT POOL NET 125087719fdSdp %token FS IPD ATTR DEVICE RCTL SPECIAL RAW DIR OPTIONS TYPE ADDRESS PHYSICAL 1265679c89fSjv %token IPTYPE HOSTID 127087719fdSdp %token NAME MATCH PRIV LIMIT ACTION VALUE EQUAL OPEN_SQ_BRACKET CLOSE_SQ_BRACKET 128c97ad5cdSakolb %token OPEN_PAREN CLOSE_PAREN COMMA DATASET LIMITPRIV BOOTARGS BRAND PSET PCAP 1290209230bSgjelinek %token MCAP NCPUS IMPORTANCE SHARES MAXLWPS MAXSHMMEM MAXSHMIDS MAXMSGIDS 130cb8a054bSGlenn Faden %token MAXSEMIDS LOCKED SWAP SCHED CLEAR DEFROUTER ADMIN USER AUTHS 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate %type <strval> TOKEN EQUAL OPEN_SQ_BRACKET CLOSE_SQ_BRACKET 1337c478bd9Sstevel@tonic-gate property_value OPEN_PAREN CLOSE_PAREN COMMA simple_prop_val 1347c478bd9Sstevel@tonic-gate %type <complex> complex_piece complex_prop_val 135c97ad5cdSakolb %type <ival> resource_type NET FS IPD DEVICE RCTL ATTR DATASET PSET PCAP MCAP 136cb8a054bSGlenn Faden ADMIN 1377c478bd9Sstevel@tonic-gate %type <ival> property_name SPECIAL RAW DIR OPTIONS TYPE ADDRESS PHYSICAL NAME 1383f2f09c1Sdp MATCH ZONENAME ZONEPATH AUTOBOOT POOL LIMITPRIV BOOTARGS VALUE PRIV LIMIT 139cb8a054bSGlenn Faden ACTION BRAND SCHED IPTYPE DEFROUTER HOSTID USER AUTHS 1407c478bd9Sstevel@tonic-gate %type <cmd> command 1417c478bd9Sstevel@tonic-gate %type <cmd> add_command ADD 1427c478bd9Sstevel@tonic-gate %type <cmd> cancel_command CANCEL 1437c478bd9Sstevel@tonic-gate %type <cmd> commit_command COMMIT 1447c478bd9Sstevel@tonic-gate %type <cmd> create_command CREATE 1457c478bd9Sstevel@tonic-gate %type <cmd> delete_command DELETE 1467c478bd9Sstevel@tonic-gate %type <cmd> end_command END 1477c478bd9Sstevel@tonic-gate %type <cmd> exit_command EXIT 1487c478bd9Sstevel@tonic-gate %type <cmd> export_command EXPORT 1497c478bd9Sstevel@tonic-gate %type <cmd> help_command HELP 1507c478bd9Sstevel@tonic-gate %type <cmd> info_command INFO 1517c478bd9Sstevel@tonic-gate %type <cmd> remove_command REMOVE 1527c478bd9Sstevel@tonic-gate %type <cmd> revert_command REVERT 1537c478bd9Sstevel@tonic-gate %type <cmd> select_command SELECT 1547c478bd9Sstevel@tonic-gate %type <cmd> set_command SET 1550209230bSgjelinek %type <cmd> clear_command CLEAR 1567c478bd9Sstevel@tonic-gate %type <cmd> verify_command VERIFY 1577c478bd9Sstevel@tonic-gate %type <cmd> terminator 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate %% 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate commands: command terminator 1627c478bd9Sstevel@tonic-gate { 1637c478bd9Sstevel@tonic-gate if ($1 != NULL) { 1647c478bd9Sstevel@tonic-gate if ($1->cmd_handler != NULL) 1657c478bd9Sstevel@tonic-gate $1->cmd_handler($1); 1667c478bd9Sstevel@tonic-gate free_cmd($1); 1677c478bd9Sstevel@tonic-gate bzero(list, sizeof (list_property_t)); 1687c478bd9Sstevel@tonic-gate num_prop_vals = 0; 1697c478bd9Sstevel@tonic-gate } 1707c478bd9Sstevel@tonic-gate return (0); 1717c478bd9Sstevel@tonic-gate } 1727c478bd9Sstevel@tonic-gate | command error terminator 1737c478bd9Sstevel@tonic-gate { 1747c478bd9Sstevel@tonic-gate if ($1 != NULL) { 1757c478bd9Sstevel@tonic-gate free_cmd($1); 1767c478bd9Sstevel@tonic-gate bzero(list, sizeof (list_property_t)); 1777c478bd9Sstevel@tonic-gate num_prop_vals = 0; 1787c478bd9Sstevel@tonic-gate } 1797c478bd9Sstevel@tonic-gate if (YYRECOVERING()) 1807e362f58Scomay YYABORT; 1817c478bd9Sstevel@tonic-gate yyclearin; 1827c478bd9Sstevel@tonic-gate yyerrok; 1837c478bd9Sstevel@tonic-gate } 1847c478bd9Sstevel@tonic-gate | error terminator 1857c478bd9Sstevel@tonic-gate { 1867c478bd9Sstevel@tonic-gate if (YYRECOVERING()) 1877e362f58Scomay YYABORT; 1887c478bd9Sstevel@tonic-gate yyclearin; 1897c478bd9Sstevel@tonic-gate yyerrok; 1907c478bd9Sstevel@tonic-gate } 1917c478bd9Sstevel@tonic-gate | terminator 1927c478bd9Sstevel@tonic-gate { 1937c478bd9Sstevel@tonic-gate return (0); 1947c478bd9Sstevel@tonic-gate } 1957c478bd9Sstevel@tonic-gate 1967c478bd9Sstevel@tonic-gate command: add_command 1977c478bd9Sstevel@tonic-gate | cancel_command 1980209230bSgjelinek | clear_command 1997c478bd9Sstevel@tonic-gate | create_command 2007c478bd9Sstevel@tonic-gate | commit_command 2017c478bd9Sstevel@tonic-gate | delete_command 2027c478bd9Sstevel@tonic-gate | end_command 2037c478bd9Sstevel@tonic-gate | exit_command 2047c478bd9Sstevel@tonic-gate | export_command 2057c478bd9Sstevel@tonic-gate | help_command 2067c478bd9Sstevel@tonic-gate | info_command 2077c478bd9Sstevel@tonic-gate | remove_command 2087c478bd9Sstevel@tonic-gate | revert_command 2097c478bd9Sstevel@tonic-gate | select_command 2107c478bd9Sstevel@tonic-gate | set_command 2117c478bd9Sstevel@tonic-gate | verify_command 2127c478bd9Sstevel@tonic-gate 213bbec428eSgjelinek terminator: '\n' { newline_terminated = B_TRUE; } 214bbec428eSgjelinek | ';' { newline_terminated = B_FALSE; } 2157c478bd9Sstevel@tonic-gate 2167c478bd9Sstevel@tonic-gate add_command: ADD 2177c478bd9Sstevel@tonic-gate { 2187c478bd9Sstevel@tonic-gate short_usage(CMD_ADD); 2197c478bd9Sstevel@tonic-gate (void) fputs("\n", stderr); 220bbec428eSgjelinek usage(B_FALSE, HELP_RES_PROPS); 2217c478bd9Sstevel@tonic-gate YYERROR; 2227c478bd9Sstevel@tonic-gate } 2237c478bd9Sstevel@tonic-gate | ADD TOKEN 2247c478bd9Sstevel@tonic-gate { 2257c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 2267c478bd9Sstevel@tonic-gate YYERROR; 2277c478bd9Sstevel@tonic-gate cmd = $$; 2287c478bd9Sstevel@tonic-gate $$->cmd_handler = &add_func; 2297c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 2307c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 2317c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 2327c478bd9Sstevel@tonic-gate } 2337c478bd9Sstevel@tonic-gate | ADD resource_type 2347c478bd9Sstevel@tonic-gate { 2357c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 2367c478bd9Sstevel@tonic-gate YYERROR; 2377c478bd9Sstevel@tonic-gate cmd = $$; 2387c478bd9Sstevel@tonic-gate $$->cmd_handler = &add_func; 2397c478bd9Sstevel@tonic-gate $$->cmd_argc = 0; 2407c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 2417c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 0; 2427c478bd9Sstevel@tonic-gate } 2437c478bd9Sstevel@tonic-gate | ADD property_name property_value 2447c478bd9Sstevel@tonic-gate { 2457c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 2467c478bd9Sstevel@tonic-gate YYERROR; 2477c478bd9Sstevel@tonic-gate cmd = $$; 2487c478bd9Sstevel@tonic-gate $$->cmd_handler = &add_func; 2497c478bd9Sstevel@tonic-gate $$->cmd_argc = 0; 2507c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 2517c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $2; 2527c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 2537c478bd9Sstevel@tonic-gate } 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gate cancel_command: CANCEL 2567c478bd9Sstevel@tonic-gate { 2577c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 2587c478bd9Sstevel@tonic-gate YYERROR; 2597c478bd9Sstevel@tonic-gate cmd = $$; 2607c478bd9Sstevel@tonic-gate $$->cmd_handler = &cancel_func; 2617c478bd9Sstevel@tonic-gate $$->cmd_argc = 0; 2627c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 2637c478bd9Sstevel@tonic-gate } 2647c478bd9Sstevel@tonic-gate | CANCEL TOKEN 2657c478bd9Sstevel@tonic-gate { 2667c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 2677c478bd9Sstevel@tonic-gate YYERROR; 2687c478bd9Sstevel@tonic-gate cmd = $$; 2697c478bd9Sstevel@tonic-gate $$->cmd_handler = &cancel_func; 2707c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 2717c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 2727c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 2737c478bd9Sstevel@tonic-gate } 2747c478bd9Sstevel@tonic-gate 2757c478bd9Sstevel@tonic-gate create_command: CREATE 2767c478bd9Sstevel@tonic-gate { 2777c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 2787c478bd9Sstevel@tonic-gate YYERROR; 2797c478bd9Sstevel@tonic-gate cmd = $$; 2807c478bd9Sstevel@tonic-gate $$->cmd_handler = &create_func; 2817c478bd9Sstevel@tonic-gate $$->cmd_argc = 0; 2827c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 2837c478bd9Sstevel@tonic-gate } 2847c478bd9Sstevel@tonic-gate | CREATE TOKEN 2857c478bd9Sstevel@tonic-gate { 2867c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 2877c478bd9Sstevel@tonic-gate YYERROR; 2887c478bd9Sstevel@tonic-gate cmd = $$; 2897c478bd9Sstevel@tonic-gate $$->cmd_handler = &create_func; 2907c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 2917c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 2927c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 2937c478bd9Sstevel@tonic-gate } 2947c478bd9Sstevel@tonic-gate | CREATE TOKEN TOKEN 2957c478bd9Sstevel@tonic-gate { 2967c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 2977c478bd9Sstevel@tonic-gate YYERROR; 2987c478bd9Sstevel@tonic-gate cmd = $$; 2997c478bd9Sstevel@tonic-gate $$->cmd_handler = &create_func; 3007c478bd9Sstevel@tonic-gate $$->cmd_argc = 2; 3017c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 3027c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = $3; 3037c478bd9Sstevel@tonic-gate $$->cmd_argv[2] = NULL; 3047c478bd9Sstevel@tonic-gate } 3057c478bd9Sstevel@tonic-gate | CREATE TOKEN TOKEN TOKEN 3067c478bd9Sstevel@tonic-gate { 3077c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 3087c478bd9Sstevel@tonic-gate YYERROR; 3097c478bd9Sstevel@tonic-gate cmd = $$; 3107c478bd9Sstevel@tonic-gate $$->cmd_handler = &create_func; 3117c478bd9Sstevel@tonic-gate $$->cmd_argc = 3; 3127c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 3137c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = $3; 3147c478bd9Sstevel@tonic-gate $$->cmd_argv[2] = $4; 3157c478bd9Sstevel@tonic-gate $$->cmd_argv[3] = NULL; 3167c478bd9Sstevel@tonic-gate } 3177c478bd9Sstevel@tonic-gate 3187c478bd9Sstevel@tonic-gate commit_command: COMMIT 3197c478bd9Sstevel@tonic-gate { 3207c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 3217c478bd9Sstevel@tonic-gate YYERROR; 3227c478bd9Sstevel@tonic-gate cmd = $$; 3237c478bd9Sstevel@tonic-gate $$->cmd_handler = &commit_func; 3247c478bd9Sstevel@tonic-gate $$->cmd_argc = 0; 3257c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 3267c478bd9Sstevel@tonic-gate } 3277c478bd9Sstevel@tonic-gate | COMMIT TOKEN 3287c478bd9Sstevel@tonic-gate { 3297c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 3307c478bd9Sstevel@tonic-gate YYERROR; 3317c478bd9Sstevel@tonic-gate cmd = $$; 3327c478bd9Sstevel@tonic-gate $$->cmd_handler = &commit_func; 3337c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 3347c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 3357c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 3367c478bd9Sstevel@tonic-gate } 3377c478bd9Sstevel@tonic-gate 3387c478bd9Sstevel@tonic-gate delete_command: DELETE 3397c478bd9Sstevel@tonic-gate { 3407c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 3417c478bd9Sstevel@tonic-gate YYERROR; 3427c478bd9Sstevel@tonic-gate cmd = $$; 3437c478bd9Sstevel@tonic-gate $$->cmd_handler = &delete_func; 3447c478bd9Sstevel@tonic-gate $$->cmd_argc = 0; 3457c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 3467c478bd9Sstevel@tonic-gate } 3477c478bd9Sstevel@tonic-gate | DELETE TOKEN 3487c478bd9Sstevel@tonic-gate { 3497c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 3507c478bd9Sstevel@tonic-gate YYERROR; 3517c478bd9Sstevel@tonic-gate cmd = $$; 3527c478bd9Sstevel@tonic-gate $$->cmd_handler = &delete_func; 3537c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 3547c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 3557c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 3567c478bd9Sstevel@tonic-gate } 3577c478bd9Sstevel@tonic-gate 3587c478bd9Sstevel@tonic-gate end_command: END 3597c478bd9Sstevel@tonic-gate { 3607c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 3617c478bd9Sstevel@tonic-gate YYERROR; 3627c478bd9Sstevel@tonic-gate cmd = $$; 3637c478bd9Sstevel@tonic-gate $$->cmd_handler = &end_func; 3647c478bd9Sstevel@tonic-gate $$->cmd_argc = 0; 3657c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 3667c478bd9Sstevel@tonic-gate } 3677c478bd9Sstevel@tonic-gate | END TOKEN 3687c478bd9Sstevel@tonic-gate { 3697c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 3707c478bd9Sstevel@tonic-gate YYERROR; 3717c478bd9Sstevel@tonic-gate cmd = $$; 3727c478bd9Sstevel@tonic-gate $$->cmd_handler = &end_func; 3737c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 3747c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 3757c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 3767c478bd9Sstevel@tonic-gate } 3777c478bd9Sstevel@tonic-gate 3787c478bd9Sstevel@tonic-gate exit_command: EXIT 3797c478bd9Sstevel@tonic-gate { 3807c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 3817c478bd9Sstevel@tonic-gate YYERROR; 3827c478bd9Sstevel@tonic-gate cmd = $$; 3837c478bd9Sstevel@tonic-gate $$->cmd_handler = &exit_func; 3847c478bd9Sstevel@tonic-gate $$->cmd_argc = 0; 3857c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 3867c478bd9Sstevel@tonic-gate } 3877c478bd9Sstevel@tonic-gate | EXIT TOKEN 3887c478bd9Sstevel@tonic-gate { 3897c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 3907c478bd9Sstevel@tonic-gate YYERROR; 3917c478bd9Sstevel@tonic-gate cmd = $$; 3927c478bd9Sstevel@tonic-gate $$->cmd_handler = &exit_func; 3937c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 3947c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 3957c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 3967c478bd9Sstevel@tonic-gate } 3977c478bd9Sstevel@tonic-gate 3987c478bd9Sstevel@tonic-gate export_command: EXPORT 3997c478bd9Sstevel@tonic-gate { 4007c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 4017c478bd9Sstevel@tonic-gate YYERROR; 4027c478bd9Sstevel@tonic-gate cmd = $$; 4037c478bd9Sstevel@tonic-gate $$->cmd_handler = &export_func; 4047c478bd9Sstevel@tonic-gate $$->cmd_argc = 0; 4057c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 4067c478bd9Sstevel@tonic-gate } 4077c478bd9Sstevel@tonic-gate | EXPORT TOKEN 4087c478bd9Sstevel@tonic-gate { 4097c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 4107c478bd9Sstevel@tonic-gate YYERROR; 4117c478bd9Sstevel@tonic-gate cmd = $$; 4127c478bd9Sstevel@tonic-gate $$->cmd_handler = &export_func; 4137c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 4147c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 4157c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 4167c478bd9Sstevel@tonic-gate } 4177c478bd9Sstevel@tonic-gate | EXPORT TOKEN TOKEN 4187c478bd9Sstevel@tonic-gate { 4197c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 4207c478bd9Sstevel@tonic-gate YYERROR; 4217c478bd9Sstevel@tonic-gate cmd = $$; 4227c478bd9Sstevel@tonic-gate $$->cmd_handler = &export_func; 4237c478bd9Sstevel@tonic-gate $$->cmd_argc = 2; 4247c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 4257c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = $3; 4267c478bd9Sstevel@tonic-gate $$->cmd_argv[2] = NULL; 4277c478bd9Sstevel@tonic-gate } 4287c478bd9Sstevel@tonic-gate 4297c478bd9Sstevel@tonic-gate help_command: HELP 4307c478bd9Sstevel@tonic-gate { 4317c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 4327c478bd9Sstevel@tonic-gate YYERROR; 4337c478bd9Sstevel@tonic-gate cmd = $$; 4347c478bd9Sstevel@tonic-gate $$->cmd_handler = &help_func; 4357c478bd9Sstevel@tonic-gate $$->cmd_argc = 0; 4367c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 4377c478bd9Sstevel@tonic-gate } 4387c478bd9Sstevel@tonic-gate | HELP TOKEN 4397c478bd9Sstevel@tonic-gate { 4407c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 4417c478bd9Sstevel@tonic-gate YYERROR; 4427c478bd9Sstevel@tonic-gate cmd = $$; 4437c478bd9Sstevel@tonic-gate $$->cmd_handler = &help_func; 4447c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 4457c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 4467c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 4477c478bd9Sstevel@tonic-gate } 4487c478bd9Sstevel@tonic-gate 4497c478bd9Sstevel@tonic-gate info_command: INFO 4507c478bd9Sstevel@tonic-gate { 4517c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 4527c478bd9Sstevel@tonic-gate YYERROR; 4537c478bd9Sstevel@tonic-gate cmd = $$; 4547c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 4557c478bd9Sstevel@tonic-gate $$->cmd_res_type = RT_UNKNOWN; 4567c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 0; 4577c478bd9Sstevel@tonic-gate } 4587c478bd9Sstevel@tonic-gate | INFO TOKEN 4597c478bd9Sstevel@tonic-gate { 4607c478bd9Sstevel@tonic-gate short_usage(CMD_INFO); 4617c478bd9Sstevel@tonic-gate (void) fputs("\n", stderr); 462bbec428eSgjelinek usage(B_FALSE, HELP_RES_PROPS); 4637c478bd9Sstevel@tonic-gate free($2); 4647c478bd9Sstevel@tonic-gate YYERROR; 4657c478bd9Sstevel@tonic-gate } 4667c478bd9Sstevel@tonic-gate | INFO resource_type 4677c478bd9Sstevel@tonic-gate { 4687c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 4697c478bd9Sstevel@tonic-gate YYERROR; 4707c478bd9Sstevel@tonic-gate cmd = $$; 4717c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 4727c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 4737c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 0; 4747c478bd9Sstevel@tonic-gate } 475087719fdSdp | INFO ZONENAME 476087719fdSdp { 477087719fdSdp if (($$ = alloc_cmd()) == NULL) 478087719fdSdp YYERROR; 479087719fdSdp cmd = $$; 480087719fdSdp $$->cmd_handler = &info_func; 481087719fdSdp $$->cmd_res_type = RT_ZONENAME; 482087719fdSdp $$->cmd_prop_nv_pairs = 0; 483087719fdSdp } 4847c478bd9Sstevel@tonic-gate | INFO ZONEPATH 4857c478bd9Sstevel@tonic-gate { 4867c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 4877c478bd9Sstevel@tonic-gate YYERROR; 4887c478bd9Sstevel@tonic-gate cmd = $$; 4897c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 4907c478bd9Sstevel@tonic-gate $$->cmd_res_type = RT_ZONEPATH; 4917c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 0; 4927c478bd9Sstevel@tonic-gate } 4939acbbeafSnn | INFO BRAND 4949acbbeafSnn { 4959acbbeafSnn if (($$ = alloc_cmd()) == NULL) 4969acbbeafSnn YYERROR; 4979acbbeafSnn cmd = $$; 4989acbbeafSnn $$->cmd_handler = &info_func; 4999acbbeafSnn $$->cmd_res_type = RT_BRAND; 5009acbbeafSnn $$->cmd_prop_nv_pairs = 0; 5019acbbeafSnn } 5027c478bd9Sstevel@tonic-gate | INFO AUTOBOOT 5037c478bd9Sstevel@tonic-gate { 5047c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 5057c478bd9Sstevel@tonic-gate YYERROR; 5067c478bd9Sstevel@tonic-gate cmd = $$; 5077c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 5087c478bd9Sstevel@tonic-gate $$->cmd_res_type = RT_AUTOBOOT; 5097c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 0; 5107c478bd9Sstevel@tonic-gate } 511f4b3ec61Sdh | INFO IPTYPE 512f4b3ec61Sdh { 513f4b3ec61Sdh if (($$ = alloc_cmd()) == NULL) 514f4b3ec61Sdh YYERROR; 515f4b3ec61Sdh cmd = $$; 516f4b3ec61Sdh $$->cmd_handler = &info_func; 517f4b3ec61Sdh $$->cmd_res_type = RT_IPTYPE; 518f4b3ec61Sdh $$->cmd_prop_nv_pairs = 0; 519f4b3ec61Sdh } 5207c478bd9Sstevel@tonic-gate | INFO POOL 5217c478bd9Sstevel@tonic-gate { 5227c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 5237c478bd9Sstevel@tonic-gate YYERROR; 5247c478bd9Sstevel@tonic-gate cmd = $$; 5257c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 5267c478bd9Sstevel@tonic-gate $$->cmd_res_type = RT_POOL; 5277c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 0; 5287c478bd9Sstevel@tonic-gate } 529ffbafc53Scomay | INFO LIMITPRIV 530ffbafc53Scomay { 531ffbafc53Scomay if (($$ = alloc_cmd()) == NULL) 532ffbafc53Scomay YYERROR; 533ffbafc53Scomay cmd = $$; 534ffbafc53Scomay $$->cmd_handler = &info_func; 535ffbafc53Scomay $$->cmd_res_type = RT_LIMITPRIV; 536ffbafc53Scomay $$->cmd_prop_nv_pairs = 0; 537ffbafc53Scomay } 5383f2f09c1Sdp | INFO BOOTARGS 5393f2f09c1Sdp { 5403f2f09c1Sdp if (($$ = alloc_cmd()) == NULL) 5413f2f09c1Sdp YYERROR; 5423f2f09c1Sdp cmd = $$; 5433f2f09c1Sdp $$->cmd_handler = &info_func; 5443f2f09c1Sdp $$->cmd_res_type = RT_BOOTARGS; 5453f2f09c1Sdp $$->cmd_prop_nv_pairs = 0; 5463f2f09c1Sdp } 5470209230bSgjelinek | INFO SCHED 5480209230bSgjelinek { 5490209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 5500209230bSgjelinek YYERROR; 5510209230bSgjelinek cmd = $$; 5520209230bSgjelinek $$->cmd_handler = &info_func; 5530209230bSgjelinek $$->cmd_res_type = RT_SCHED; 5540209230bSgjelinek $$->cmd_prop_nv_pairs = 0; 5550209230bSgjelinek } 5560209230bSgjelinek | INFO SHARES 5570209230bSgjelinek { 5580209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 5590209230bSgjelinek YYERROR; 5600209230bSgjelinek cmd = $$; 5610209230bSgjelinek $$->cmd_handler = &info_func; 5620209230bSgjelinek $$->cmd_res_type = RT_SHARES; 5630209230bSgjelinek $$->cmd_prop_nv_pairs = 0; 5640209230bSgjelinek } 5650209230bSgjelinek | INFO MAXLWPS 5660209230bSgjelinek { 5670209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 5680209230bSgjelinek YYERROR; 5690209230bSgjelinek cmd = $$; 5700209230bSgjelinek $$->cmd_handler = &info_func; 5710209230bSgjelinek $$->cmd_res_type = RT_MAXLWPS; 5720209230bSgjelinek $$->cmd_prop_nv_pairs = 0; 5730209230bSgjelinek } 5740209230bSgjelinek | INFO MAXSHMMEM 5750209230bSgjelinek { 5760209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 5770209230bSgjelinek YYERROR; 5780209230bSgjelinek cmd = $$; 5790209230bSgjelinek $$->cmd_handler = &info_func; 5800209230bSgjelinek $$->cmd_res_type = RT_MAXSHMMEM; 5810209230bSgjelinek $$->cmd_prop_nv_pairs = 0; 5820209230bSgjelinek } 5830209230bSgjelinek | INFO MAXSHMIDS 5840209230bSgjelinek { 5850209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 5860209230bSgjelinek YYERROR; 5870209230bSgjelinek cmd = $$; 5880209230bSgjelinek $$->cmd_handler = &info_func; 5890209230bSgjelinek $$->cmd_res_type = RT_MAXSHMIDS; 5900209230bSgjelinek $$->cmd_prop_nv_pairs = 0; 5910209230bSgjelinek } 5920209230bSgjelinek | INFO MAXMSGIDS 5930209230bSgjelinek { 5940209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 5950209230bSgjelinek YYERROR; 5960209230bSgjelinek cmd = $$; 5970209230bSgjelinek $$->cmd_handler = &info_func; 5980209230bSgjelinek $$->cmd_res_type = RT_MAXMSGIDS; 5990209230bSgjelinek $$->cmd_prop_nv_pairs = 0; 6000209230bSgjelinek } 6010209230bSgjelinek | INFO MAXSEMIDS 6020209230bSgjelinek { 6030209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 6040209230bSgjelinek YYERROR; 6050209230bSgjelinek cmd = $$; 6060209230bSgjelinek $$->cmd_handler = &info_func; 6070209230bSgjelinek $$->cmd_res_type = RT_MAXSEMIDS; 6080209230bSgjelinek $$->cmd_prop_nv_pairs = 0; 6090209230bSgjelinek } 6105679c89fSjv | INFO HOSTID 6115679c89fSjv { 6125679c89fSjv if (($$ = alloc_cmd()) == NULL) 6135679c89fSjv YYERROR; 6145679c89fSjv cmd = $$; 6155679c89fSjv $$->cmd_handler = &info_func; 6165679c89fSjv $$->cmd_res_type = RT_HOSTID; 6175679c89fSjv $$->cmd_prop_nv_pairs = 0; 6185679c89fSjv } 6197c478bd9Sstevel@tonic-gate | INFO resource_type property_name EQUAL property_value 6207c478bd9Sstevel@tonic-gate { 6217c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 6227c478bd9Sstevel@tonic-gate YYERROR; 6237c478bd9Sstevel@tonic-gate cmd = $$; 6247c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 6257c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 6267c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 6277c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 6287c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 6297c478bd9Sstevel@tonic-gate } 6307c478bd9Sstevel@tonic-gate | INFO resource_type property_name EQUAL property_value property_name EQUAL property_value 6317c478bd9Sstevel@tonic-gate { 6327c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 6337c478bd9Sstevel@tonic-gate YYERROR; 6347c478bd9Sstevel@tonic-gate cmd = $$; 6357c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 6367c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 6377c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 2; 6387c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 6397c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 6407c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 6417c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 6427c478bd9Sstevel@tonic-gate } 6437c478bd9Sstevel@tonic-gate | INFO resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value 6447c478bd9Sstevel@tonic-gate { 6457c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 6467c478bd9Sstevel@tonic-gate YYERROR; 6477c478bd9Sstevel@tonic-gate cmd = $$; 6487c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 6497c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 6507c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 3; 6517c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 6527c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 6537c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 6547c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 6557c478bd9Sstevel@tonic-gate $$->cmd_prop_name[2] = $9; 6567c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[2] = &property[2]; 6577c478bd9Sstevel@tonic-gate } 6587c478bd9Sstevel@tonic-gate 6597c478bd9Sstevel@tonic-gate remove_command: REMOVE 6607c478bd9Sstevel@tonic-gate { 6617c478bd9Sstevel@tonic-gate short_usage(CMD_REMOVE); 6627c478bd9Sstevel@tonic-gate (void) fputs("\n", stderr); 663bbec428eSgjelinek usage(B_FALSE, HELP_RES_PROPS); 6647c478bd9Sstevel@tonic-gate YYERROR; 6657c478bd9Sstevel@tonic-gate } 6660209230bSgjelinek | REMOVE TOKEN 6677c478bd9Sstevel@tonic-gate { 6687c478bd9Sstevel@tonic-gate short_usage(CMD_REMOVE); 6690209230bSgjelinek (void) fputs("\n", stderr); 670bbec428eSgjelinek usage(B_FALSE, HELP_RES_PROPS); 6717c478bd9Sstevel@tonic-gate YYERROR; 6727c478bd9Sstevel@tonic-gate } 6730209230bSgjelinek | REMOVE resource_type 6740209230bSgjelinek { 6750209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 6760209230bSgjelinek YYERROR; 6770209230bSgjelinek cmd = $$; 6780209230bSgjelinek $$->cmd_handler = &remove_func; 6790209230bSgjelinek $$->cmd_res_type = $2; 6800209230bSgjelinek } 6810209230bSgjelinek | REMOVE TOKEN resource_type 6820209230bSgjelinek { 6830209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 6840209230bSgjelinek YYERROR; 6850209230bSgjelinek cmd = $$; 6860209230bSgjelinek $$->cmd_handler = &remove_func; 6870209230bSgjelinek $$->cmd_res_type = $3; 6880209230bSgjelinek $$->cmd_argc = 1; 6890209230bSgjelinek $$->cmd_argv[0] = $2; 6900209230bSgjelinek $$->cmd_argv[1] = NULL; 6910209230bSgjelinek } 6927c478bd9Sstevel@tonic-gate | REMOVE property_name property_value 6937c478bd9Sstevel@tonic-gate { 6947c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 6957c478bd9Sstevel@tonic-gate YYERROR; 6967c478bd9Sstevel@tonic-gate cmd = $$; 6977c478bd9Sstevel@tonic-gate $$->cmd_handler = &remove_func; 6987c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 6997c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $2; 7007c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 7017c478bd9Sstevel@tonic-gate } 7027c478bd9Sstevel@tonic-gate | REMOVE resource_type property_name EQUAL property_value 7037c478bd9Sstevel@tonic-gate { 7047c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7057c478bd9Sstevel@tonic-gate YYERROR; 7067c478bd9Sstevel@tonic-gate cmd = $$; 7077c478bd9Sstevel@tonic-gate $$->cmd_handler = &remove_func; 7087c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 7097c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 7107c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 7117c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 7127c478bd9Sstevel@tonic-gate } 7137c478bd9Sstevel@tonic-gate | REMOVE resource_type property_name EQUAL property_value property_name EQUAL property_value 7147c478bd9Sstevel@tonic-gate { 7157c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7167c478bd9Sstevel@tonic-gate YYERROR; 7177c478bd9Sstevel@tonic-gate cmd = $$; 7187c478bd9Sstevel@tonic-gate $$->cmd_handler = &remove_func; 7197c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 7207c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 2; 7217c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 7227c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 7237c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 7247c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 7257c478bd9Sstevel@tonic-gate } 7267c478bd9Sstevel@tonic-gate | REMOVE resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value 7277c478bd9Sstevel@tonic-gate { 7287c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7297c478bd9Sstevel@tonic-gate YYERROR; 7307c478bd9Sstevel@tonic-gate cmd = $$; 7317c478bd9Sstevel@tonic-gate $$->cmd_handler = &remove_func; 7327c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 7337c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 3; 7347c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 7357c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 7367c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 7377c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 7387c478bd9Sstevel@tonic-gate $$->cmd_prop_name[2] = $9; 7397c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[2] = &property[2]; 7407c478bd9Sstevel@tonic-gate } 7417c478bd9Sstevel@tonic-gate 7427c478bd9Sstevel@tonic-gate revert_command: REVERT 7437c478bd9Sstevel@tonic-gate { 7447c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7457c478bd9Sstevel@tonic-gate YYERROR; 7467c478bd9Sstevel@tonic-gate cmd = $$; 7477c478bd9Sstevel@tonic-gate $$->cmd_handler = &revert_func; 7487c478bd9Sstevel@tonic-gate $$->cmd_argc = 0; 7497c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 7507c478bd9Sstevel@tonic-gate } 7517c478bd9Sstevel@tonic-gate | REVERT TOKEN 7527c478bd9Sstevel@tonic-gate { 7537c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7547c478bd9Sstevel@tonic-gate YYERROR; 7557c478bd9Sstevel@tonic-gate cmd = $$; 7567c478bd9Sstevel@tonic-gate $$->cmd_handler = &revert_func; 7577c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 7587c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 7597c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 7607c478bd9Sstevel@tonic-gate } 7617c478bd9Sstevel@tonic-gate 7627c478bd9Sstevel@tonic-gate select_command: SELECT 7637c478bd9Sstevel@tonic-gate { 7647c478bd9Sstevel@tonic-gate short_usage(CMD_SELECT); 7657c478bd9Sstevel@tonic-gate (void) fputs("\n", stderr); 766bbec428eSgjelinek usage(B_FALSE, HELP_RES_PROPS); 7677c478bd9Sstevel@tonic-gate YYERROR; 7687c478bd9Sstevel@tonic-gate } 7690209230bSgjelinek | SELECT PSET 7700209230bSgjelinek { 7710209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 7720209230bSgjelinek YYERROR; 7730209230bSgjelinek cmd = $$; 7740209230bSgjelinek $$->cmd_handler = &select_func; 7750209230bSgjelinek $$->cmd_res_type = RT_DCPU; 7760209230bSgjelinek } 777c97ad5cdSakolb | SELECT PCAP 778c97ad5cdSakolb { 779c97ad5cdSakolb if (($$ = alloc_cmd()) == NULL) 780c97ad5cdSakolb YYERROR; 781c97ad5cdSakolb cmd = $$; 782c97ad5cdSakolb $$->cmd_handler = &select_func; 783c97ad5cdSakolb $$->cmd_res_type = RT_PCAP; 784c97ad5cdSakolb } 7850209230bSgjelinek | SELECT MCAP 7860209230bSgjelinek { 7870209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 7880209230bSgjelinek YYERROR; 7890209230bSgjelinek cmd = $$; 7900209230bSgjelinek $$->cmd_handler = &select_func; 7910209230bSgjelinek $$->cmd_res_type = RT_MCAP; 7920209230bSgjelinek } 7937c478bd9Sstevel@tonic-gate | SELECT resource_type 7947c478bd9Sstevel@tonic-gate { 7957c478bd9Sstevel@tonic-gate short_usage(CMD_SELECT); 7967c478bd9Sstevel@tonic-gate YYERROR; 7977c478bd9Sstevel@tonic-gate } 7987c478bd9Sstevel@tonic-gate | SELECT resource_type property_name EQUAL property_value 7997c478bd9Sstevel@tonic-gate { 8007c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8017c478bd9Sstevel@tonic-gate YYERROR; 8027c478bd9Sstevel@tonic-gate cmd = $$; 8037c478bd9Sstevel@tonic-gate $$->cmd_handler = &select_func; 8047c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 8057c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 8067c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 8077c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8087c478bd9Sstevel@tonic-gate } 8097c478bd9Sstevel@tonic-gate | SELECT resource_type property_name EQUAL property_value property_name EQUAL property_value 8107c478bd9Sstevel@tonic-gate { 8117c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8127c478bd9Sstevel@tonic-gate YYERROR; 8137c478bd9Sstevel@tonic-gate cmd = $$; 8147c478bd9Sstevel@tonic-gate $$->cmd_handler = &select_func; 8157c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 8167c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 2; 8177c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 8187c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8197c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 8207c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 8217c478bd9Sstevel@tonic-gate } 8227c478bd9Sstevel@tonic-gate | SELECT resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value 8237c478bd9Sstevel@tonic-gate { 8247c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8257c478bd9Sstevel@tonic-gate YYERROR; 8267c478bd9Sstevel@tonic-gate cmd = $$; 8277c478bd9Sstevel@tonic-gate $$->cmd_handler = &select_func; 8287c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 8297c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 3; 8307c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 8317c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8327c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 8337c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 8347c478bd9Sstevel@tonic-gate $$->cmd_prop_name[2] = $9; 8357c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[2] = &property[2]; 8367c478bd9Sstevel@tonic-gate } 8377c478bd9Sstevel@tonic-gate 8387c478bd9Sstevel@tonic-gate set_command: SET 8397c478bd9Sstevel@tonic-gate { 8407c478bd9Sstevel@tonic-gate short_usage(CMD_SET); 8417c478bd9Sstevel@tonic-gate (void) fputs("\n", stderr); 842bbec428eSgjelinek usage(B_FALSE, HELP_PROPS); 8437c478bd9Sstevel@tonic-gate YYERROR; 8447c478bd9Sstevel@tonic-gate } 8457c478bd9Sstevel@tonic-gate | SET property_name EQUAL OPEN_SQ_BRACKET CLOSE_SQ_BRACKET 8467c478bd9Sstevel@tonic-gate { 8477c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8487c478bd9Sstevel@tonic-gate YYERROR; 8497c478bd9Sstevel@tonic-gate cmd = $$; 8507c478bd9Sstevel@tonic-gate $$->cmd_handler = &set_func; 8517c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 0; 8527c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $2; 8537c478bd9Sstevel@tonic-gate property[0].pv_type = PROP_VAL_LIST; 8547c478bd9Sstevel@tonic-gate property[0].pv_list = NULL; 8557c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8567c478bd9Sstevel@tonic-gate } 8577c478bd9Sstevel@tonic-gate | SET property_name EQUAL property_value 8587c478bd9Sstevel@tonic-gate { 8597c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8607c478bd9Sstevel@tonic-gate YYERROR; 8617c478bd9Sstevel@tonic-gate cmd = $$; 8627c478bd9Sstevel@tonic-gate $$->cmd_handler = &set_func; 8637c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 8647c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $2; 8657c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8667c478bd9Sstevel@tonic-gate } 867555afedfScarlsonj | SET TOKEN ZONEPATH EQUAL property_value 868555afedfScarlsonj { 869555afedfScarlsonj if (($$ = alloc_cmd()) == NULL) 870555afedfScarlsonj YYERROR; 871555afedfScarlsonj cmd = $$; 872555afedfScarlsonj $$->cmd_argc = 1; 873555afedfScarlsonj $$->cmd_argv[0] = $2; 874555afedfScarlsonj $$->cmd_argv[1] = NULL; 875555afedfScarlsonj $$->cmd_handler = &set_func; 876555afedfScarlsonj $$->cmd_prop_nv_pairs = 1; 877555afedfScarlsonj $$->cmd_prop_name[0] = PT_ZONEPATH; 878555afedfScarlsonj $$->cmd_property_ptr[0] = &property[0]; 879555afedfScarlsonj } 8807c478bd9Sstevel@tonic-gate 8810209230bSgjelinek clear_command: CLEAR 8820209230bSgjelinek { 8830209230bSgjelinek short_usage(CMD_CLEAR); 8840209230bSgjelinek (void) fputs("\n", stderr); 885bbec428eSgjelinek usage(B_FALSE, HELP_PROPS); 8860209230bSgjelinek YYERROR; 8870209230bSgjelinek } 8880209230bSgjelinek | CLEAR property_name 8890209230bSgjelinek { 8900209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 8910209230bSgjelinek YYERROR; 8920209230bSgjelinek cmd = $$; 8930209230bSgjelinek $$->cmd_handler = &clear_func; 8940209230bSgjelinek $$->cmd_res_type = $2; 8950209230bSgjelinek } 8960209230bSgjelinek 8977c478bd9Sstevel@tonic-gate verify_command: VERIFY 8987c478bd9Sstevel@tonic-gate { 8997c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 9007c478bd9Sstevel@tonic-gate YYERROR; 9017c478bd9Sstevel@tonic-gate cmd = $$; 9027c478bd9Sstevel@tonic-gate $$->cmd_handler = &verify_func; 9037c478bd9Sstevel@tonic-gate $$->cmd_argc = 0; 9047c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 9057c478bd9Sstevel@tonic-gate } 9067c478bd9Sstevel@tonic-gate | VERIFY TOKEN 9077c478bd9Sstevel@tonic-gate { 9087c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 9097c478bd9Sstevel@tonic-gate YYERROR; 9107c478bd9Sstevel@tonic-gate cmd = $$; 9117c478bd9Sstevel@tonic-gate $$->cmd_handler = &verify_func; 9127c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 9137c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 9147c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 9157c478bd9Sstevel@tonic-gate } 9167c478bd9Sstevel@tonic-gate 9177c478bd9Sstevel@tonic-gate resource_type: NET { $$ = RT_NET; } 9187c478bd9Sstevel@tonic-gate | FS { $$ = RT_FS; } 9197c478bd9Sstevel@tonic-gate | IPD { $$ = RT_IPD; } 9207c478bd9Sstevel@tonic-gate | DEVICE { $$ = RT_DEVICE; } 9217c478bd9Sstevel@tonic-gate | RCTL { $$ = RT_RCTL; } 9227c478bd9Sstevel@tonic-gate | ATTR { $$ = RT_ATTR; } 923fa9e4066Sahrens | DATASET { $$ = RT_DATASET; } 9240209230bSgjelinek | PSET { $$ = RT_DCPU; } 925c97ad5cdSakolb | PCAP { $$ = RT_PCAP; } 9260209230bSgjelinek | MCAP { $$ = RT_MCAP; } 927cb8a054bSGlenn Faden | ADMIN { $$ = RT_ADMIN; } 9287c478bd9Sstevel@tonic-gate 9297c478bd9Sstevel@tonic-gate property_name: SPECIAL { $$ = PT_SPECIAL; } 9307c478bd9Sstevel@tonic-gate | RAW { $$ = PT_RAW; } 9317c478bd9Sstevel@tonic-gate | DIR { $$ = PT_DIR; } 9327c478bd9Sstevel@tonic-gate | TYPE { $$ = PT_TYPE; } 9337c478bd9Sstevel@tonic-gate | OPTIONS { $$ = PT_OPTIONS; } 934087719fdSdp | ZONENAME { $$ = PT_ZONENAME; } 9357c478bd9Sstevel@tonic-gate | ZONEPATH { $$ = PT_ZONEPATH; } 9367c478bd9Sstevel@tonic-gate | AUTOBOOT { $$ = PT_AUTOBOOT; } 937f4b3ec61Sdh | IPTYPE { $$ = PT_IPTYPE; } 9387c478bd9Sstevel@tonic-gate | POOL { $$ = PT_POOL; } 939ffbafc53Scomay | LIMITPRIV { $$ = PT_LIMITPRIV; } 9403f2f09c1Sdp | BOOTARGS { $$ = PT_BOOTARGS; } 9417c478bd9Sstevel@tonic-gate | ADDRESS { $$ = PT_ADDRESS; } 9427c478bd9Sstevel@tonic-gate | PHYSICAL { $$ = PT_PHYSICAL; } 943de860bd9Sgfaden | DEFROUTER { $$ = PT_DEFROUTER; } 9447c478bd9Sstevel@tonic-gate | NAME { $$ = PT_NAME; } 9457c478bd9Sstevel@tonic-gate | VALUE { $$ = PT_VALUE; } 9467c478bd9Sstevel@tonic-gate | MATCH { $$ = PT_MATCH; } 9477c478bd9Sstevel@tonic-gate | PRIV { $$ = PT_PRIV; } 9487c478bd9Sstevel@tonic-gate | LIMIT { $$ = PT_LIMIT; } 9497c478bd9Sstevel@tonic-gate | ACTION { $$ = PT_ACTION; } 9509acbbeafSnn | BRAND { $$ = PT_BRAND; } 9510209230bSgjelinek | NCPUS { $$ = PT_NCPUS; } 9520209230bSgjelinek | LOCKED { $$ = PT_LOCKED; } 9530209230bSgjelinek | SWAP { $$ = PT_SWAP; } 9540209230bSgjelinek | IMPORTANCE { $$ = PT_IMPORTANCE; } 9550209230bSgjelinek | SHARES { $$ = PT_SHARES; } 9560209230bSgjelinek | MAXLWPS { $$ = PT_MAXLWPS; } 9570209230bSgjelinek | MAXSHMMEM { $$ = PT_MAXSHMMEM; } 9580209230bSgjelinek | MAXSHMIDS { $$ = PT_MAXSHMIDS; } 9590209230bSgjelinek | MAXMSGIDS { $$ = PT_MAXMSGIDS; } 9600209230bSgjelinek | MAXSEMIDS { $$ = PT_MAXSEMIDS; } 9610209230bSgjelinek | SCHED { $$ = PT_SCHED; } 9625679c89fSjv | HOSTID { $$ = PT_HOSTID; } 963cb8a054bSGlenn Faden | USER { $$ = PT_USER; } 964cb8a054bSGlenn Faden | AUTHS { $$ = PT_AUTHS; } 9657c478bd9Sstevel@tonic-gate 9667c478bd9Sstevel@tonic-gate /* 9677c478bd9Sstevel@tonic-gate * The grammar builds data structures from the bottom up. Thus various 9687c478bd9Sstevel@tonic-gate * strings are lexed into TOKENs or commands or resource or property values. 9697c478bd9Sstevel@tonic-gate * Below is where the resource and property values are built up into more 9707c478bd9Sstevel@tonic-gate * complex data structures. 9717c478bd9Sstevel@tonic-gate * 9727c478bd9Sstevel@tonic-gate * There are three kinds of properties: simple (single valued), complex 9737c478bd9Sstevel@tonic-gate * (one or more name=value pairs) and list (concatenation of one or more 9747c478bd9Sstevel@tonic-gate * simple or complex properties). 9757c478bd9Sstevel@tonic-gate * 9767c478bd9Sstevel@tonic-gate * So the property structure has a type which is one of these, and the 9777c478bd9Sstevel@tonic-gate * corresponding _simple, _complex or _list is set to the corresponding 9787c478bd9Sstevel@tonic-gate * lower-level data structure. 9797c478bd9Sstevel@tonic-gate */ 9807c478bd9Sstevel@tonic-gate 9817c478bd9Sstevel@tonic-gate property_value: simple_prop_val 9827c478bd9Sstevel@tonic-gate { 9837c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_type = PROP_VAL_SIMPLE; 9847c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_simple = $1; 9857c478bd9Sstevel@tonic-gate if (list[num_prop_vals] != NULL) { 9867c478bd9Sstevel@tonic-gate free_outer_list(list[num_prop_vals]); 9877c478bd9Sstevel@tonic-gate list[num_prop_vals] = NULL; 9887c478bd9Sstevel@tonic-gate } 9897c478bd9Sstevel@tonic-gate num_prop_vals++; 9907c478bd9Sstevel@tonic-gate } 9917c478bd9Sstevel@tonic-gate | complex_prop_val 9927c478bd9Sstevel@tonic-gate { 9937c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_type = PROP_VAL_COMPLEX; 9947c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_complex = complex; 9957c478bd9Sstevel@tonic-gate if (list[num_prop_vals] != NULL) { 9967c478bd9Sstevel@tonic-gate free_outer_list(list[num_prop_vals]); 9977c478bd9Sstevel@tonic-gate list[num_prop_vals] = NULL; 9987c478bd9Sstevel@tonic-gate } 9997c478bd9Sstevel@tonic-gate num_prop_vals++; 10007c478bd9Sstevel@tonic-gate } 10017c478bd9Sstevel@tonic-gate | list_prop_val 10027c478bd9Sstevel@tonic-gate { 10037c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_type = PROP_VAL_LIST; 10047c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_list = list[num_prop_vals]; 10057c478bd9Sstevel@tonic-gate num_prop_vals++; 10067c478bd9Sstevel@tonic-gate } 10077c478bd9Sstevel@tonic-gate 10087c478bd9Sstevel@tonic-gate /* 10097c478bd9Sstevel@tonic-gate * One level lower, lists are made up of simple or complex values, so 10107c478bd9Sstevel@tonic-gate * simple_prop_val and complex_prop_val fill in a list structure and 10117c478bd9Sstevel@tonic-gate * insert it into the linked list which is built up. And because 10127c478bd9Sstevel@tonic-gate * complex properties can have multiple name=value pairs, we keep 10137c478bd9Sstevel@tonic-gate * track of them in another linked list. 10147c478bd9Sstevel@tonic-gate * 10157c478bd9Sstevel@tonic-gate * The complex and list structures for the linked lists are allocated 10167c478bd9Sstevel@tonic-gate * below, and freed by recursive functions which are ultimately called 10177c478bd9Sstevel@tonic-gate * by free_cmd(), which is called from the top-most "commands" part of 10187c478bd9Sstevel@tonic-gate * the grammar. 1019c94c1ef0Sjv * 1020c94c1ef0Sjv * NOTE: simple_prop_val and complex_piece need reduction rules for 1021c94c1ef0Sjv * property_name and resource_type so that the parser will accept property names 1022c94c1ef0Sjv * and resource type names as property values. 10237c478bd9Sstevel@tonic-gate */ 10247c478bd9Sstevel@tonic-gate 10257c478bd9Sstevel@tonic-gate simple_prop_val: TOKEN 10267c478bd9Sstevel@tonic-gate { 1027c94c1ef0Sjv $$ = simple_prop_val_func($1); 1028c94c1ef0Sjv free($1); 1029c94c1ef0Sjv if ($$ == NULL) 1030c94c1ef0Sjv YYERROR; 1031c94c1ef0Sjv } 1032c94c1ef0Sjv | resource_type 1033c94c1ef0Sjv { 1034c94c1ef0Sjv if (($$ = simple_prop_val_func(res_types[$1])) == NULL) 1035c94c1ef0Sjv YYERROR; 1036c94c1ef0Sjv } 1037c94c1ef0Sjv | property_name 1038c94c1ef0Sjv { 1039c94c1ef0Sjv if (($$ = simple_prop_val_func(prop_types[$1])) == NULL) 10407c478bd9Sstevel@tonic-gate YYERROR; 10417c478bd9Sstevel@tonic-gate } 10427c478bd9Sstevel@tonic-gate 10437c478bd9Sstevel@tonic-gate complex_prop_val: OPEN_PAREN complex_piece CLOSE_PAREN 10447c478bd9Sstevel@tonic-gate { 10457c478bd9Sstevel@tonic-gate if ((new_list = alloc_list()) == NULL) 10467c478bd9Sstevel@tonic-gate YYERROR; 10477c478bd9Sstevel@tonic-gate new_list->lp_simple = NULL; 10487c478bd9Sstevel@tonic-gate new_list->lp_complex = complex; 10497c478bd9Sstevel@tonic-gate new_list->lp_next = NULL; 10507c478bd9Sstevel@tonic-gate if (list[num_prop_vals] == NULL) { 10517c478bd9Sstevel@tonic-gate list[num_prop_vals] = new_list; 10527c478bd9Sstevel@tonic-gate } else { 10537c478bd9Sstevel@tonic-gate for (tmp_list = list[num_prop_vals]; tmp_list != NULL; 10547c478bd9Sstevel@tonic-gate tmp_list = tmp_list->lp_next) 10557c478bd9Sstevel@tonic-gate last = tmp_list; 10567c478bd9Sstevel@tonic-gate last->lp_next = new_list; 10577c478bd9Sstevel@tonic-gate } 10587c478bd9Sstevel@tonic-gate } 10597c478bd9Sstevel@tonic-gate 10607c478bd9Sstevel@tonic-gate complex_piece: property_name EQUAL TOKEN 10617c478bd9Sstevel@tonic-gate { 1062c94c1ef0Sjv $$ = complex_piece_func($1, $3, NULL); 1063c94c1ef0Sjv free($3); 1064c94c1ef0Sjv if ($$ == NULL) 1065c94c1ef0Sjv YYERROR; 1066c94c1ef0Sjv } 1067c94c1ef0Sjv | property_name EQUAL resource_type 1068c94c1ef0Sjv { 1069c94c1ef0Sjv if (($$ = complex_piece_func($1, res_types[$3], NULL)) == NULL) 1070c94c1ef0Sjv YYERROR; 1071c94c1ef0Sjv } 1072c94c1ef0Sjv | property_name EQUAL property_name 1073c94c1ef0Sjv { 1074c94c1ef0Sjv if (($$ = complex_piece_func($1, prop_types[$3], NULL)) == NULL) 10757c478bd9Sstevel@tonic-gate YYERROR; 10767c478bd9Sstevel@tonic-gate } 10777c478bd9Sstevel@tonic-gate | property_name EQUAL TOKEN COMMA complex_piece 10787c478bd9Sstevel@tonic-gate { 1079c94c1ef0Sjv $$ = complex_piece_func($1, $3, complex); 1080c94c1ef0Sjv free($3); 1081c94c1ef0Sjv if ($$ == NULL) 1082c94c1ef0Sjv YYERROR; 1083c94c1ef0Sjv } 1084c94c1ef0Sjv | property_name EQUAL resource_type COMMA complex_piece 1085c94c1ef0Sjv { 1086c94c1ef0Sjv if (($$ = complex_piece_func($1, res_types[$3], complex)) == 1087c94c1ef0Sjv NULL) 1088c94c1ef0Sjv YYERROR; 1089c94c1ef0Sjv } 1090c94c1ef0Sjv | property_name EQUAL property_name COMMA complex_piece 1091c94c1ef0Sjv { 1092c94c1ef0Sjv if (($$ = complex_piece_func($1, prop_types[$3], complex)) == 1093c94c1ef0Sjv NULL) 10947c478bd9Sstevel@tonic-gate YYERROR; 10957c478bd9Sstevel@tonic-gate } 10967c478bd9Sstevel@tonic-gate 10977c478bd9Sstevel@tonic-gate list_piece: simple_prop_val 10987c478bd9Sstevel@tonic-gate | complex_prop_val 10997c478bd9Sstevel@tonic-gate | simple_prop_val COMMA list_piece 11007c478bd9Sstevel@tonic-gate | complex_prop_val COMMA list_piece 11017c478bd9Sstevel@tonic-gate 11027c478bd9Sstevel@tonic-gate list_prop_val: OPEN_SQ_BRACKET list_piece CLOSE_SQ_BRACKET 11037c478bd9Sstevel@tonic-gate %% 1104