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 /* 24a20ee416SGlenn 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> 28c94c1ef0Sjv227347 #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 45c94c1ef0Sjv227347 /* 46c94c1ef0Sjv227347 * This function is used by the simple_prop_val reduction rules to set up 47c94c1ef0Sjv227347 * a list_property_ptr_t and adjust the above global variables appropriately. 48c94c1ef0Sjv227347 * Note that this function duplicates the specified string and makes 49c94c1ef0Sjv227347 * the new list's lp_simple field point to the duplicate. This function does 50c94c1ef0Sjv227347 * not free the original string. 51c94c1ef0Sjv227347 * 52c94c1ef0Sjv227347 * This function returns a pointer to the duplicated string or NULL if an error 53c94c1ef0Sjv227347 * occurred. The simple_prop_val reduction rules that invoke this function 54c94c1ef0Sjv227347 * should set $$ to the returned pointer. 55c94c1ef0Sjv227347 */ 56c94c1ef0Sjv227347 static char * 57c94c1ef0Sjv227347 simple_prop_val_func(const char *str) 58c94c1ef0Sjv227347 { 59c94c1ef0Sjv227347 char *retstr; 60c94c1ef0Sjv227347 61c94c1ef0Sjv227347 if ((new_list = alloc_list()) == NULL) 62c94c1ef0Sjv227347 return (NULL); 63c94c1ef0Sjv227347 if ((retstr = strdup(str)) == NULL) { 64c94c1ef0Sjv227347 free_list(new_list); 65c94c1ef0Sjv227347 return (NULL); 66c94c1ef0Sjv227347 } 67c94c1ef0Sjv227347 new_list->lp_simple = retstr; 68c94c1ef0Sjv227347 new_list->lp_complex = NULL; 69c94c1ef0Sjv227347 new_list->lp_next = NULL; 70c94c1ef0Sjv227347 if (list[num_prop_vals] == NULL) { 71c94c1ef0Sjv227347 list[num_prop_vals] = new_list; 72c94c1ef0Sjv227347 } else { 73c94c1ef0Sjv227347 for (tmp_list = list[num_prop_vals]; tmp_list != NULL; 74c94c1ef0Sjv227347 tmp_list = tmp_list->lp_next) 75c94c1ef0Sjv227347 last = tmp_list; 76c94c1ef0Sjv227347 last->lp_next = new_list; 77c94c1ef0Sjv227347 } 78c94c1ef0Sjv227347 return (retstr); 79c94c1ef0Sjv227347 } 80c94c1ef0Sjv227347 81c94c1ef0Sjv227347 /* 82c94c1ef0Sjv227347 * This function is used by the complex_piece reduction rules to set up a 83c94c1ef0Sjv227347 * complex_property_prt_t and adjust the above global variables appropriately. 84c94c1ef0Sjv227347 * Note that this function duplicates the specified string and makes the new 85c94c1ef0Sjv227347 * complex_property_ptr_t's cp_value field point to the duplicate. It also sets 86c94c1ef0Sjv227347 * the complex_property_ptr_t's cp_type field to cp_type and its cp_next field 87c94c1ef0Sjv227347 * to cp_next. This function does not free the original string. 88c94c1ef0Sjv227347 * 89c94c1ef0Sjv227347 * This function returns a pointer to the complex_property_t created for the 90c94c1ef0Sjv227347 * complex_piece or NULL if an error occurred. The complex_piece reduction 91c94c1ef0Sjv227347 * rules that invoke this function should set $$ to the returned pointer. 92c94c1ef0Sjv227347 */ 93c94c1ef0Sjv227347 static complex_property_ptr_t 94c94c1ef0Sjv227347 complex_piece_func(int cp_type, const char *str, complex_property_ptr_t cp_next) 95c94c1ef0Sjv227347 { 96c94c1ef0Sjv227347 complex_property_ptr_t retval; 97c94c1ef0Sjv227347 98c94c1ef0Sjv227347 if ((retval = alloc_complex()) == NULL) 99c94c1ef0Sjv227347 return (NULL); 100c94c1ef0Sjv227347 if ((retval->cp_value = strdup(str)) == NULL) { 101c94c1ef0Sjv227347 free_complex(retval); 102c94c1ef0Sjv227347 return (NULL); 103c94c1ef0Sjv227347 } 104c94c1ef0Sjv227347 retval->cp_type = cp_type; 105c94c1ef0Sjv227347 retval->cp_next = cp_next; 106c94c1ef0Sjv227347 complex = retval; 107c94c1ef0Sjv227347 return (retval); 108c94c1ef0Sjv227347 } 109c94c1ef0Sjv227347 110c94c1ef0Sjv227347 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 126*0fbb751dSJohn Levon %token IPTYPE HOSTID FS_ALLOWED 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 139*0fbb751dSJohn Levon ACTION BRAND SCHED IPTYPE DEFROUTER HOSTID USER AUTHS FS_ALLOWED 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 } 4939acbbeafSnn35248 | INFO BRAND 4949acbbeafSnn35248 { 4959acbbeafSnn35248 if (($$ = alloc_cmd()) == NULL) 4969acbbeafSnn35248 YYERROR; 4979acbbeafSnn35248 cmd = $$; 4989acbbeafSnn35248 $$->cmd_handler = &info_func; 4999acbbeafSnn35248 $$->cmd_res_type = RT_BRAND; 5009acbbeafSnn35248 $$->cmd_prop_nv_pairs = 0; 5019acbbeafSnn35248 } 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 } 511f4b3ec61Sdh155122 | INFO IPTYPE 512f4b3ec61Sdh155122 { 513f4b3ec61Sdh155122 if (($$ = alloc_cmd()) == NULL) 514f4b3ec61Sdh155122 YYERROR; 515f4b3ec61Sdh155122 cmd = $$; 516f4b3ec61Sdh155122 $$->cmd_handler = &info_func; 517f4b3ec61Sdh155122 $$->cmd_res_type = RT_IPTYPE; 518f4b3ec61Sdh155122 $$->cmd_prop_nv_pairs = 0; 519f4b3ec61Sdh155122 } 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 } 6105679c89fSjv227347 | INFO HOSTID 6115679c89fSjv227347 { 6125679c89fSjv227347 if (($$ = alloc_cmd()) == NULL) 6135679c89fSjv227347 YYERROR; 6145679c89fSjv227347 cmd = $$; 6155679c89fSjv227347 $$->cmd_handler = &info_func; 6165679c89fSjv227347 $$->cmd_res_type = RT_HOSTID; 6175679c89fSjv227347 $$->cmd_prop_nv_pairs = 0; 6185679c89fSjv227347 } 619*0fbb751dSJohn Levon | INFO FS_ALLOWED 620*0fbb751dSJohn Levon { 621*0fbb751dSJohn Levon if (($$ = alloc_cmd()) == NULL) 622*0fbb751dSJohn Levon YYERROR; 623*0fbb751dSJohn Levon cmd = $$; 624*0fbb751dSJohn Levon $$->cmd_handler = &info_func; 625*0fbb751dSJohn Levon $$->cmd_res_type = RT_FS_ALLOWED; 626*0fbb751dSJohn Levon $$->cmd_prop_nv_pairs = 0; 627*0fbb751dSJohn Levon } 6287c478bd9Sstevel@tonic-gate | INFO resource_type property_name EQUAL property_value 6297c478bd9Sstevel@tonic-gate { 6307c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 6317c478bd9Sstevel@tonic-gate YYERROR; 6327c478bd9Sstevel@tonic-gate cmd = $$; 6337c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 6347c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 6357c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 6367c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 6377c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 6387c478bd9Sstevel@tonic-gate } 6397c478bd9Sstevel@tonic-gate | INFO resource_type property_name EQUAL property_value property_name EQUAL property_value 6407c478bd9Sstevel@tonic-gate { 6417c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 6427c478bd9Sstevel@tonic-gate YYERROR; 6437c478bd9Sstevel@tonic-gate cmd = $$; 6447c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 6457c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 6467c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 2; 6477c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 6487c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 6497c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 6507c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 6517c478bd9Sstevel@tonic-gate } 6527c478bd9Sstevel@tonic-gate | INFO resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value 6537c478bd9Sstevel@tonic-gate { 6547c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 6557c478bd9Sstevel@tonic-gate YYERROR; 6567c478bd9Sstevel@tonic-gate cmd = $$; 6577c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 6587c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 6597c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 3; 6607c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 6617c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 6627c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 6637c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 6647c478bd9Sstevel@tonic-gate $$->cmd_prop_name[2] = $9; 6657c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[2] = &property[2]; 6667c478bd9Sstevel@tonic-gate } 6677c478bd9Sstevel@tonic-gate 6687c478bd9Sstevel@tonic-gate remove_command: REMOVE 6697c478bd9Sstevel@tonic-gate { 6707c478bd9Sstevel@tonic-gate short_usage(CMD_REMOVE); 6717c478bd9Sstevel@tonic-gate (void) fputs("\n", stderr); 672bbec428eSgjelinek usage(B_FALSE, HELP_RES_PROPS); 6737c478bd9Sstevel@tonic-gate YYERROR; 6747c478bd9Sstevel@tonic-gate } 6750209230bSgjelinek | REMOVE TOKEN 6767c478bd9Sstevel@tonic-gate { 6777c478bd9Sstevel@tonic-gate short_usage(CMD_REMOVE); 6780209230bSgjelinek (void) fputs("\n", stderr); 679bbec428eSgjelinek usage(B_FALSE, HELP_RES_PROPS); 6807c478bd9Sstevel@tonic-gate YYERROR; 6817c478bd9Sstevel@tonic-gate } 6820209230bSgjelinek | REMOVE resource_type 6830209230bSgjelinek { 6840209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 6850209230bSgjelinek YYERROR; 6860209230bSgjelinek cmd = $$; 6870209230bSgjelinek $$->cmd_handler = &remove_func; 6880209230bSgjelinek $$->cmd_res_type = $2; 6890209230bSgjelinek } 6900209230bSgjelinek | REMOVE TOKEN resource_type 6910209230bSgjelinek { 6920209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 6930209230bSgjelinek YYERROR; 6940209230bSgjelinek cmd = $$; 6950209230bSgjelinek $$->cmd_handler = &remove_func; 6960209230bSgjelinek $$->cmd_res_type = $3; 6970209230bSgjelinek $$->cmd_argc = 1; 6980209230bSgjelinek $$->cmd_argv[0] = $2; 6990209230bSgjelinek $$->cmd_argv[1] = NULL; 7000209230bSgjelinek } 7017c478bd9Sstevel@tonic-gate | REMOVE property_name property_value 7027c478bd9Sstevel@tonic-gate { 7037c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7047c478bd9Sstevel@tonic-gate YYERROR; 7057c478bd9Sstevel@tonic-gate cmd = $$; 7067c478bd9Sstevel@tonic-gate $$->cmd_handler = &remove_func; 7077c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 7087c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $2; 7097c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 7107c478bd9Sstevel@tonic-gate } 7117c478bd9Sstevel@tonic-gate | REMOVE resource_type property_name EQUAL property_value 7127c478bd9Sstevel@tonic-gate { 7137c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7147c478bd9Sstevel@tonic-gate YYERROR; 7157c478bd9Sstevel@tonic-gate cmd = $$; 7167c478bd9Sstevel@tonic-gate $$->cmd_handler = &remove_func; 7177c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 7187c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 7197c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 7207c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 7217c478bd9Sstevel@tonic-gate } 7227c478bd9Sstevel@tonic-gate | REMOVE resource_type property_name EQUAL property_value property_name EQUAL property_value 7237c478bd9Sstevel@tonic-gate { 7247c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7257c478bd9Sstevel@tonic-gate YYERROR; 7267c478bd9Sstevel@tonic-gate cmd = $$; 7277c478bd9Sstevel@tonic-gate $$->cmd_handler = &remove_func; 7287c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 7297c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 2; 7307c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 7317c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 7327c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 7337c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 7347c478bd9Sstevel@tonic-gate } 7357c478bd9Sstevel@tonic-gate | REMOVE resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value 7367c478bd9Sstevel@tonic-gate { 7377c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7387c478bd9Sstevel@tonic-gate YYERROR; 7397c478bd9Sstevel@tonic-gate cmd = $$; 7407c478bd9Sstevel@tonic-gate $$->cmd_handler = &remove_func; 7417c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 7427c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 3; 7437c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 7447c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 7457c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 7467c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 7477c478bd9Sstevel@tonic-gate $$->cmd_prop_name[2] = $9; 7487c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[2] = &property[2]; 7497c478bd9Sstevel@tonic-gate } 7507c478bd9Sstevel@tonic-gate 7517c478bd9Sstevel@tonic-gate revert_command: REVERT 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 = 0; 7587c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 7597c478bd9Sstevel@tonic-gate } 7607c478bd9Sstevel@tonic-gate | REVERT TOKEN 7617c478bd9Sstevel@tonic-gate { 7627c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7637c478bd9Sstevel@tonic-gate YYERROR; 7647c478bd9Sstevel@tonic-gate cmd = $$; 7657c478bd9Sstevel@tonic-gate $$->cmd_handler = &revert_func; 7667c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 7677c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 7687c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 7697c478bd9Sstevel@tonic-gate } 7707c478bd9Sstevel@tonic-gate 7717c478bd9Sstevel@tonic-gate select_command: SELECT 7727c478bd9Sstevel@tonic-gate { 7737c478bd9Sstevel@tonic-gate short_usage(CMD_SELECT); 7747c478bd9Sstevel@tonic-gate (void) fputs("\n", stderr); 775bbec428eSgjelinek usage(B_FALSE, HELP_RES_PROPS); 7767c478bd9Sstevel@tonic-gate YYERROR; 7777c478bd9Sstevel@tonic-gate } 7780209230bSgjelinek | SELECT PSET 7790209230bSgjelinek { 7800209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 7810209230bSgjelinek YYERROR; 7820209230bSgjelinek cmd = $$; 7830209230bSgjelinek $$->cmd_handler = &select_func; 7840209230bSgjelinek $$->cmd_res_type = RT_DCPU; 7850209230bSgjelinek } 786c97ad5cdSakolb | SELECT PCAP 787c97ad5cdSakolb { 788c97ad5cdSakolb if (($$ = alloc_cmd()) == NULL) 789c97ad5cdSakolb YYERROR; 790c97ad5cdSakolb cmd = $$; 791c97ad5cdSakolb $$->cmd_handler = &select_func; 792c97ad5cdSakolb $$->cmd_res_type = RT_PCAP; 793c97ad5cdSakolb } 7940209230bSgjelinek | SELECT MCAP 7950209230bSgjelinek { 7960209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 7970209230bSgjelinek YYERROR; 7980209230bSgjelinek cmd = $$; 7990209230bSgjelinek $$->cmd_handler = &select_func; 8000209230bSgjelinek $$->cmd_res_type = RT_MCAP; 8010209230bSgjelinek } 8027c478bd9Sstevel@tonic-gate | SELECT resource_type 8037c478bd9Sstevel@tonic-gate { 8047c478bd9Sstevel@tonic-gate short_usage(CMD_SELECT); 8057c478bd9Sstevel@tonic-gate YYERROR; 8067c478bd9Sstevel@tonic-gate } 8077c478bd9Sstevel@tonic-gate | SELECT resource_type property_name EQUAL property_value 8087c478bd9Sstevel@tonic-gate { 8097c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8107c478bd9Sstevel@tonic-gate YYERROR; 8117c478bd9Sstevel@tonic-gate cmd = $$; 8127c478bd9Sstevel@tonic-gate $$->cmd_handler = &select_func; 8137c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 8147c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 8157c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 8167c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8177c478bd9Sstevel@tonic-gate } 8187c478bd9Sstevel@tonic-gate | SELECT resource_type property_name EQUAL property_value property_name EQUAL property_value 8197c478bd9Sstevel@tonic-gate { 8207c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8217c478bd9Sstevel@tonic-gate YYERROR; 8227c478bd9Sstevel@tonic-gate cmd = $$; 8237c478bd9Sstevel@tonic-gate $$->cmd_handler = &select_func; 8247c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 8257c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 2; 8267c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 8277c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8287c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 8297c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 8307c478bd9Sstevel@tonic-gate } 8317c478bd9Sstevel@tonic-gate | SELECT resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value 8327c478bd9Sstevel@tonic-gate { 8337c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8347c478bd9Sstevel@tonic-gate YYERROR; 8357c478bd9Sstevel@tonic-gate cmd = $$; 8367c478bd9Sstevel@tonic-gate $$->cmd_handler = &select_func; 8377c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 8387c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 3; 8397c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 8407c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8417c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 8427c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 8437c478bd9Sstevel@tonic-gate $$->cmd_prop_name[2] = $9; 8447c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[2] = &property[2]; 8457c478bd9Sstevel@tonic-gate } 8467c478bd9Sstevel@tonic-gate 8477c478bd9Sstevel@tonic-gate set_command: SET 8487c478bd9Sstevel@tonic-gate { 8497c478bd9Sstevel@tonic-gate short_usage(CMD_SET); 8507c478bd9Sstevel@tonic-gate (void) fputs("\n", stderr); 851bbec428eSgjelinek usage(B_FALSE, HELP_PROPS); 8527c478bd9Sstevel@tonic-gate YYERROR; 8537c478bd9Sstevel@tonic-gate } 8547c478bd9Sstevel@tonic-gate | SET property_name EQUAL OPEN_SQ_BRACKET CLOSE_SQ_BRACKET 8557c478bd9Sstevel@tonic-gate { 8567c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8577c478bd9Sstevel@tonic-gate YYERROR; 8587c478bd9Sstevel@tonic-gate cmd = $$; 8597c478bd9Sstevel@tonic-gate $$->cmd_handler = &set_func; 8607c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 0; 8617c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $2; 8627c478bd9Sstevel@tonic-gate property[0].pv_type = PROP_VAL_LIST; 8637c478bd9Sstevel@tonic-gate property[0].pv_list = NULL; 8647c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8657c478bd9Sstevel@tonic-gate } 8667c478bd9Sstevel@tonic-gate | SET property_name EQUAL property_value 8677c478bd9Sstevel@tonic-gate { 8687c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8697c478bd9Sstevel@tonic-gate YYERROR; 8707c478bd9Sstevel@tonic-gate cmd = $$; 8717c478bd9Sstevel@tonic-gate $$->cmd_handler = &set_func; 8727c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 8737c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $2; 8747c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8757c478bd9Sstevel@tonic-gate } 876555afedfScarlsonj | SET TOKEN ZONEPATH EQUAL property_value 877555afedfScarlsonj { 878555afedfScarlsonj if (($$ = alloc_cmd()) == NULL) 879555afedfScarlsonj YYERROR; 880555afedfScarlsonj cmd = $$; 881555afedfScarlsonj $$->cmd_argc = 1; 882555afedfScarlsonj $$->cmd_argv[0] = $2; 883555afedfScarlsonj $$->cmd_argv[1] = NULL; 884555afedfScarlsonj $$->cmd_handler = &set_func; 885555afedfScarlsonj $$->cmd_prop_nv_pairs = 1; 886555afedfScarlsonj $$->cmd_prop_name[0] = PT_ZONEPATH; 887555afedfScarlsonj $$->cmd_property_ptr[0] = &property[0]; 888555afedfScarlsonj } 8897c478bd9Sstevel@tonic-gate 8900209230bSgjelinek clear_command: CLEAR 8910209230bSgjelinek { 8920209230bSgjelinek short_usage(CMD_CLEAR); 8930209230bSgjelinek (void) fputs("\n", stderr); 894bbec428eSgjelinek usage(B_FALSE, HELP_PROPS); 8950209230bSgjelinek YYERROR; 8960209230bSgjelinek } 8970209230bSgjelinek | CLEAR property_name 8980209230bSgjelinek { 8990209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 9000209230bSgjelinek YYERROR; 9010209230bSgjelinek cmd = $$; 9020209230bSgjelinek $$->cmd_handler = &clear_func; 9030209230bSgjelinek $$->cmd_res_type = $2; 9040209230bSgjelinek } 9050209230bSgjelinek 9067c478bd9Sstevel@tonic-gate verify_command: VERIFY 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 = 0; 9137c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 9147c478bd9Sstevel@tonic-gate } 9157c478bd9Sstevel@tonic-gate | VERIFY TOKEN 9167c478bd9Sstevel@tonic-gate { 9177c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 9187c478bd9Sstevel@tonic-gate YYERROR; 9197c478bd9Sstevel@tonic-gate cmd = $$; 9207c478bd9Sstevel@tonic-gate $$->cmd_handler = &verify_func; 9217c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 9227c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 9237c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 9247c478bd9Sstevel@tonic-gate } 9257c478bd9Sstevel@tonic-gate 9267c478bd9Sstevel@tonic-gate resource_type: NET { $$ = RT_NET; } 9277c478bd9Sstevel@tonic-gate | FS { $$ = RT_FS; } 9287c478bd9Sstevel@tonic-gate | IPD { $$ = RT_IPD; } 9297c478bd9Sstevel@tonic-gate | DEVICE { $$ = RT_DEVICE; } 9307c478bd9Sstevel@tonic-gate | RCTL { $$ = RT_RCTL; } 9317c478bd9Sstevel@tonic-gate | ATTR { $$ = RT_ATTR; } 932fa9e4066Sahrens | DATASET { $$ = RT_DATASET; } 9330209230bSgjelinek | PSET { $$ = RT_DCPU; } 934c97ad5cdSakolb | PCAP { $$ = RT_PCAP; } 9350209230bSgjelinek | MCAP { $$ = RT_MCAP; } 936cb8a054bSGlenn Faden | ADMIN { $$ = RT_ADMIN; } 9377c478bd9Sstevel@tonic-gate 9387c478bd9Sstevel@tonic-gate property_name: SPECIAL { $$ = PT_SPECIAL; } 9397c478bd9Sstevel@tonic-gate | RAW { $$ = PT_RAW; } 9407c478bd9Sstevel@tonic-gate | DIR { $$ = PT_DIR; } 9417c478bd9Sstevel@tonic-gate | TYPE { $$ = PT_TYPE; } 9427c478bd9Sstevel@tonic-gate | OPTIONS { $$ = PT_OPTIONS; } 943087719fdSdp | ZONENAME { $$ = PT_ZONENAME; } 9447c478bd9Sstevel@tonic-gate | ZONEPATH { $$ = PT_ZONEPATH; } 9457c478bd9Sstevel@tonic-gate | AUTOBOOT { $$ = PT_AUTOBOOT; } 946f4b3ec61Sdh155122 | IPTYPE { $$ = PT_IPTYPE; } 9477c478bd9Sstevel@tonic-gate | POOL { $$ = PT_POOL; } 948ffbafc53Scomay | LIMITPRIV { $$ = PT_LIMITPRIV; } 9493f2f09c1Sdp | BOOTARGS { $$ = PT_BOOTARGS; } 9507c478bd9Sstevel@tonic-gate | ADDRESS { $$ = PT_ADDRESS; } 9517c478bd9Sstevel@tonic-gate | PHYSICAL { $$ = PT_PHYSICAL; } 952de860bd9Sgfaden | DEFROUTER { $$ = PT_DEFROUTER; } 9537c478bd9Sstevel@tonic-gate | NAME { $$ = PT_NAME; } 9547c478bd9Sstevel@tonic-gate | VALUE { $$ = PT_VALUE; } 9557c478bd9Sstevel@tonic-gate | MATCH { $$ = PT_MATCH; } 9567c478bd9Sstevel@tonic-gate | PRIV { $$ = PT_PRIV; } 9577c478bd9Sstevel@tonic-gate | LIMIT { $$ = PT_LIMIT; } 9587c478bd9Sstevel@tonic-gate | ACTION { $$ = PT_ACTION; } 9599acbbeafSnn35248 | BRAND { $$ = PT_BRAND; } 9600209230bSgjelinek | NCPUS { $$ = PT_NCPUS; } 9610209230bSgjelinek | LOCKED { $$ = PT_LOCKED; } 9620209230bSgjelinek | SWAP { $$ = PT_SWAP; } 9630209230bSgjelinek | IMPORTANCE { $$ = PT_IMPORTANCE; } 9640209230bSgjelinek | SHARES { $$ = PT_SHARES; } 9650209230bSgjelinek | MAXLWPS { $$ = PT_MAXLWPS; } 9660209230bSgjelinek | MAXSHMMEM { $$ = PT_MAXSHMMEM; } 9670209230bSgjelinek | MAXSHMIDS { $$ = PT_MAXSHMIDS; } 9680209230bSgjelinek | MAXMSGIDS { $$ = PT_MAXMSGIDS; } 9690209230bSgjelinek | MAXSEMIDS { $$ = PT_MAXSEMIDS; } 9700209230bSgjelinek | SCHED { $$ = PT_SCHED; } 9715679c89fSjv227347 | HOSTID { $$ = PT_HOSTID; } 972cb8a054bSGlenn Faden | USER { $$ = PT_USER; } 973cb8a054bSGlenn Faden | AUTHS { $$ = PT_AUTHS; } 974*0fbb751dSJohn Levon | FS_ALLOWED { $$ = PT_FS_ALLOWED; } 9757c478bd9Sstevel@tonic-gate 9767c478bd9Sstevel@tonic-gate /* 9777c478bd9Sstevel@tonic-gate * The grammar builds data structures from the bottom up. Thus various 9787c478bd9Sstevel@tonic-gate * strings are lexed into TOKENs or commands or resource or property values. 9797c478bd9Sstevel@tonic-gate * Below is where the resource and property values are built up into more 9807c478bd9Sstevel@tonic-gate * complex data structures. 9817c478bd9Sstevel@tonic-gate * 9827c478bd9Sstevel@tonic-gate * There are three kinds of properties: simple (single valued), complex 9837c478bd9Sstevel@tonic-gate * (one or more name=value pairs) and list (concatenation of one or more 9847c478bd9Sstevel@tonic-gate * simple or complex properties). 9857c478bd9Sstevel@tonic-gate * 9867c478bd9Sstevel@tonic-gate * So the property structure has a type which is one of these, and the 9877c478bd9Sstevel@tonic-gate * corresponding _simple, _complex or _list is set to the corresponding 9887c478bd9Sstevel@tonic-gate * lower-level data structure. 9897c478bd9Sstevel@tonic-gate */ 9907c478bd9Sstevel@tonic-gate 9917c478bd9Sstevel@tonic-gate property_value: simple_prop_val 9927c478bd9Sstevel@tonic-gate { 9937c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_type = PROP_VAL_SIMPLE; 9947c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_simple = $1; 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 | complex_prop_val 10027c478bd9Sstevel@tonic-gate { 10037c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_type = PROP_VAL_COMPLEX; 10047c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_complex = complex; 10057c478bd9Sstevel@tonic-gate if (list[num_prop_vals] != NULL) { 10067c478bd9Sstevel@tonic-gate free_outer_list(list[num_prop_vals]); 10077c478bd9Sstevel@tonic-gate list[num_prop_vals] = NULL; 10087c478bd9Sstevel@tonic-gate } 10097c478bd9Sstevel@tonic-gate num_prop_vals++; 10107c478bd9Sstevel@tonic-gate } 10117c478bd9Sstevel@tonic-gate | list_prop_val 10127c478bd9Sstevel@tonic-gate { 10137c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_type = PROP_VAL_LIST; 10147c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_list = list[num_prop_vals]; 10157c478bd9Sstevel@tonic-gate num_prop_vals++; 10167c478bd9Sstevel@tonic-gate } 10177c478bd9Sstevel@tonic-gate 10187c478bd9Sstevel@tonic-gate /* 10197c478bd9Sstevel@tonic-gate * One level lower, lists are made up of simple or complex values, so 10207c478bd9Sstevel@tonic-gate * simple_prop_val and complex_prop_val fill in a list structure and 10217c478bd9Sstevel@tonic-gate * insert it into the linked list which is built up. And because 10227c478bd9Sstevel@tonic-gate * complex properties can have multiple name=value pairs, we keep 10237c478bd9Sstevel@tonic-gate * track of them in another linked list. 10247c478bd9Sstevel@tonic-gate * 10257c478bd9Sstevel@tonic-gate * The complex and list structures for the linked lists are allocated 10267c478bd9Sstevel@tonic-gate * below, and freed by recursive functions which are ultimately called 10277c478bd9Sstevel@tonic-gate * by free_cmd(), which is called from the top-most "commands" part of 10287c478bd9Sstevel@tonic-gate * the grammar. 1029c94c1ef0Sjv227347 * 1030c94c1ef0Sjv227347 * NOTE: simple_prop_val and complex_piece need reduction rules for 1031c94c1ef0Sjv227347 * property_name and resource_type so that the parser will accept property names 1032c94c1ef0Sjv227347 * and resource type names as property values. 10337c478bd9Sstevel@tonic-gate */ 10347c478bd9Sstevel@tonic-gate 10357c478bd9Sstevel@tonic-gate simple_prop_val: TOKEN 10367c478bd9Sstevel@tonic-gate { 1037c94c1ef0Sjv227347 $$ = simple_prop_val_func($1); 1038c94c1ef0Sjv227347 free($1); 1039c94c1ef0Sjv227347 if ($$ == NULL) 10407c478bd9Sstevel@tonic-gate YYERROR; 10417c478bd9Sstevel@tonic-gate } 1042c94c1ef0Sjv227347 | resource_type 1043c94c1ef0Sjv227347 { 1044c94c1ef0Sjv227347 if (($$ = simple_prop_val_func(res_types[$1])) == NULL) 1045c94c1ef0Sjv227347 YYERROR; 1046c94c1ef0Sjv227347 } 1047c94c1ef0Sjv227347 | property_name 1048c94c1ef0Sjv227347 { 1049c94c1ef0Sjv227347 if (($$ = simple_prop_val_func(prop_types[$1])) == NULL) 1050c94c1ef0Sjv227347 YYERROR; 10517c478bd9Sstevel@tonic-gate } 10527c478bd9Sstevel@tonic-gate 10537c478bd9Sstevel@tonic-gate complex_prop_val: OPEN_PAREN complex_piece CLOSE_PAREN 10547c478bd9Sstevel@tonic-gate { 10557c478bd9Sstevel@tonic-gate if ((new_list = alloc_list()) == NULL) 10567c478bd9Sstevel@tonic-gate YYERROR; 10577c478bd9Sstevel@tonic-gate new_list->lp_simple = NULL; 10587c478bd9Sstevel@tonic-gate new_list->lp_complex = complex; 10597c478bd9Sstevel@tonic-gate new_list->lp_next = NULL; 10607c478bd9Sstevel@tonic-gate if (list[num_prop_vals] == NULL) { 10617c478bd9Sstevel@tonic-gate list[num_prop_vals] = new_list; 10627c478bd9Sstevel@tonic-gate } else { 10637c478bd9Sstevel@tonic-gate for (tmp_list = list[num_prop_vals]; tmp_list != NULL; 10647c478bd9Sstevel@tonic-gate tmp_list = tmp_list->lp_next) 10657c478bd9Sstevel@tonic-gate last = tmp_list; 10667c478bd9Sstevel@tonic-gate last->lp_next = new_list; 10677c478bd9Sstevel@tonic-gate } 10687c478bd9Sstevel@tonic-gate } 10697c478bd9Sstevel@tonic-gate 10707c478bd9Sstevel@tonic-gate complex_piece: property_name EQUAL TOKEN 10717c478bd9Sstevel@tonic-gate { 1072c94c1ef0Sjv227347 $$ = complex_piece_func($1, $3, NULL); 1073c94c1ef0Sjv227347 free($3); 1074c94c1ef0Sjv227347 if ($$ == NULL) 10757c478bd9Sstevel@tonic-gate YYERROR; 1076c94c1ef0Sjv227347 } 1077c94c1ef0Sjv227347 | property_name EQUAL resource_type 1078c94c1ef0Sjv227347 { 1079c94c1ef0Sjv227347 if (($$ = complex_piece_func($1, res_types[$3], NULL)) == NULL) 1080c94c1ef0Sjv227347 YYERROR; 1081c94c1ef0Sjv227347 } 1082c94c1ef0Sjv227347 | property_name EQUAL property_name 1083c94c1ef0Sjv227347 { 1084c94c1ef0Sjv227347 if (($$ = complex_piece_func($1, prop_types[$3], NULL)) == NULL) 1085c94c1ef0Sjv227347 YYERROR; 10867c478bd9Sstevel@tonic-gate } 10877c478bd9Sstevel@tonic-gate | property_name EQUAL TOKEN COMMA complex_piece 10887c478bd9Sstevel@tonic-gate { 1089c94c1ef0Sjv227347 $$ = complex_piece_func($1, $3, complex); 1090c94c1ef0Sjv227347 free($3); 1091c94c1ef0Sjv227347 if ($$ == NULL) 10927c478bd9Sstevel@tonic-gate YYERROR; 1093c94c1ef0Sjv227347 } 1094c94c1ef0Sjv227347 | property_name EQUAL resource_type COMMA complex_piece 1095c94c1ef0Sjv227347 { 1096c94c1ef0Sjv227347 if (($$ = complex_piece_func($1, res_types[$3], complex)) == 1097c94c1ef0Sjv227347 NULL) 1098c94c1ef0Sjv227347 YYERROR; 1099c94c1ef0Sjv227347 } 1100c94c1ef0Sjv227347 | property_name EQUAL property_name COMMA complex_piece 1101c94c1ef0Sjv227347 { 1102c94c1ef0Sjv227347 if (($$ = complex_piece_func($1, prop_types[$3], complex)) == 1103c94c1ef0Sjv227347 NULL) 1104c94c1ef0Sjv227347 YYERROR; 11057c478bd9Sstevel@tonic-gate } 11067c478bd9Sstevel@tonic-gate 11077c478bd9Sstevel@tonic-gate list_piece: simple_prop_val 11087c478bd9Sstevel@tonic-gate | complex_prop_val 11097c478bd9Sstevel@tonic-gate | simple_prop_val COMMA list_piece 11107c478bd9Sstevel@tonic-gate | complex_prop_val COMMA list_piece 11117c478bd9Sstevel@tonic-gate 11127c478bd9Sstevel@tonic-gate list_prop_val: OPEN_SQ_BRACKET list_piece CLOSE_SQ_BRACKET 11137c478bd9Sstevel@tonic-gate %% 1114