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> 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 1260fbb751dSJohn 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 130*ff19e029SMenno Lageman %token MAXSEMIDS LOCKED SWAP SCHED CLEAR DEFROUTER ADMIN USER AUTHS MAXPROCS 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 1390fbb751dSJohn 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 } 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 } 574*ff19e029SMenno Lageman | INFO MAXPROCS 575*ff19e029SMenno Lageman { 576*ff19e029SMenno Lageman if (($$ = alloc_cmd()) == NULL) 577*ff19e029SMenno Lageman YYERROR; 578*ff19e029SMenno Lageman cmd = $$; 579*ff19e029SMenno Lageman $$->cmd_handler = &info_func; 580*ff19e029SMenno Lageman $$->cmd_res_type = RT_MAXPROCS; 581*ff19e029SMenno Lageman $$->cmd_prop_nv_pairs = 0; 582*ff19e029SMenno Lageman } 5830209230bSgjelinek | INFO MAXSHMMEM 5840209230bSgjelinek { 5850209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 5860209230bSgjelinek YYERROR; 5870209230bSgjelinek cmd = $$; 5880209230bSgjelinek $$->cmd_handler = &info_func; 5890209230bSgjelinek $$->cmd_res_type = RT_MAXSHMMEM; 5900209230bSgjelinek $$->cmd_prop_nv_pairs = 0; 5910209230bSgjelinek } 5920209230bSgjelinek | INFO MAXSHMIDS 5930209230bSgjelinek { 5940209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 5950209230bSgjelinek YYERROR; 5960209230bSgjelinek cmd = $$; 5970209230bSgjelinek $$->cmd_handler = &info_func; 5980209230bSgjelinek $$->cmd_res_type = RT_MAXSHMIDS; 5990209230bSgjelinek $$->cmd_prop_nv_pairs = 0; 6000209230bSgjelinek } 6010209230bSgjelinek | INFO MAXMSGIDS 6020209230bSgjelinek { 6030209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 6040209230bSgjelinek YYERROR; 6050209230bSgjelinek cmd = $$; 6060209230bSgjelinek $$->cmd_handler = &info_func; 6070209230bSgjelinek $$->cmd_res_type = RT_MAXMSGIDS; 6080209230bSgjelinek $$->cmd_prop_nv_pairs = 0; 6090209230bSgjelinek } 6100209230bSgjelinek | INFO MAXSEMIDS 6110209230bSgjelinek { 6120209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 6130209230bSgjelinek YYERROR; 6140209230bSgjelinek cmd = $$; 6150209230bSgjelinek $$->cmd_handler = &info_func; 6160209230bSgjelinek $$->cmd_res_type = RT_MAXSEMIDS; 6170209230bSgjelinek $$->cmd_prop_nv_pairs = 0; 6180209230bSgjelinek } 6195679c89fSjv | INFO HOSTID 6205679c89fSjv { 6215679c89fSjv if (($$ = alloc_cmd()) == NULL) 6225679c89fSjv YYERROR; 6235679c89fSjv cmd = $$; 6245679c89fSjv $$->cmd_handler = &info_func; 6255679c89fSjv $$->cmd_res_type = RT_HOSTID; 6265679c89fSjv $$->cmd_prop_nv_pairs = 0; 6275679c89fSjv } 6280fbb751dSJohn Levon | INFO FS_ALLOWED 6290fbb751dSJohn Levon { 6300fbb751dSJohn Levon if (($$ = alloc_cmd()) == NULL) 6310fbb751dSJohn Levon YYERROR; 6320fbb751dSJohn Levon cmd = $$; 6330fbb751dSJohn Levon $$->cmd_handler = &info_func; 6340fbb751dSJohn Levon $$->cmd_res_type = RT_FS_ALLOWED; 6350fbb751dSJohn Levon $$->cmd_prop_nv_pairs = 0; 6360fbb751dSJohn Levon } 6377c478bd9Sstevel@tonic-gate | INFO resource_type property_name EQUAL property_value 6387c478bd9Sstevel@tonic-gate { 6397c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 6407c478bd9Sstevel@tonic-gate YYERROR; 6417c478bd9Sstevel@tonic-gate cmd = $$; 6427c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 6437c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 6447c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 6457c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 6467c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 6477c478bd9Sstevel@tonic-gate } 6487c478bd9Sstevel@tonic-gate | INFO resource_type property_name EQUAL property_value property_name EQUAL property_value 6497c478bd9Sstevel@tonic-gate { 6507c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 6517c478bd9Sstevel@tonic-gate YYERROR; 6527c478bd9Sstevel@tonic-gate cmd = $$; 6537c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 6547c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 6557c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 2; 6567c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 6577c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 6587c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 6597c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 6607c478bd9Sstevel@tonic-gate } 6617c478bd9Sstevel@tonic-gate | INFO resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value 6627c478bd9Sstevel@tonic-gate { 6637c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 6647c478bd9Sstevel@tonic-gate YYERROR; 6657c478bd9Sstevel@tonic-gate cmd = $$; 6667c478bd9Sstevel@tonic-gate $$->cmd_handler = &info_func; 6677c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 6687c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 3; 6697c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 6707c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 6717c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 6727c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 6737c478bd9Sstevel@tonic-gate $$->cmd_prop_name[2] = $9; 6747c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[2] = &property[2]; 6757c478bd9Sstevel@tonic-gate } 6767c478bd9Sstevel@tonic-gate 6777c478bd9Sstevel@tonic-gate remove_command: REMOVE 6787c478bd9Sstevel@tonic-gate { 6797c478bd9Sstevel@tonic-gate short_usage(CMD_REMOVE); 6807c478bd9Sstevel@tonic-gate (void) fputs("\n", stderr); 681bbec428eSgjelinek usage(B_FALSE, HELP_RES_PROPS); 6827c478bd9Sstevel@tonic-gate YYERROR; 6837c478bd9Sstevel@tonic-gate } 6840209230bSgjelinek | REMOVE TOKEN 6857c478bd9Sstevel@tonic-gate { 6867c478bd9Sstevel@tonic-gate short_usage(CMD_REMOVE); 6870209230bSgjelinek (void) fputs("\n", stderr); 688bbec428eSgjelinek usage(B_FALSE, HELP_RES_PROPS); 6897c478bd9Sstevel@tonic-gate YYERROR; 6907c478bd9Sstevel@tonic-gate } 6910209230bSgjelinek | REMOVE resource_type 6920209230bSgjelinek { 6930209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 6940209230bSgjelinek YYERROR; 6950209230bSgjelinek cmd = $$; 6960209230bSgjelinek $$->cmd_handler = &remove_func; 6970209230bSgjelinek $$->cmd_res_type = $2; 6980209230bSgjelinek } 6990209230bSgjelinek | REMOVE TOKEN resource_type 7000209230bSgjelinek { 7010209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 7020209230bSgjelinek YYERROR; 7030209230bSgjelinek cmd = $$; 7040209230bSgjelinek $$->cmd_handler = &remove_func; 7050209230bSgjelinek $$->cmd_res_type = $3; 7060209230bSgjelinek $$->cmd_argc = 1; 7070209230bSgjelinek $$->cmd_argv[0] = $2; 7080209230bSgjelinek $$->cmd_argv[1] = NULL; 7090209230bSgjelinek } 7107c478bd9Sstevel@tonic-gate | REMOVE property_name property_value 7117c478bd9Sstevel@tonic-gate { 7127c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7137c478bd9Sstevel@tonic-gate YYERROR; 7147c478bd9Sstevel@tonic-gate cmd = $$; 7157c478bd9Sstevel@tonic-gate $$->cmd_handler = &remove_func; 7167c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 7177c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $2; 7187c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 7197c478bd9Sstevel@tonic-gate } 7207c478bd9Sstevel@tonic-gate | REMOVE resource_type property_name EQUAL property_value 7217c478bd9Sstevel@tonic-gate { 7227c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7237c478bd9Sstevel@tonic-gate YYERROR; 7247c478bd9Sstevel@tonic-gate cmd = $$; 7257c478bd9Sstevel@tonic-gate $$->cmd_handler = &remove_func; 7267c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 7277c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 7287c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 7297c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 7307c478bd9Sstevel@tonic-gate } 7317c478bd9Sstevel@tonic-gate | REMOVE resource_type property_name EQUAL property_value property_name EQUAL property_value 7327c478bd9Sstevel@tonic-gate { 7337c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7347c478bd9Sstevel@tonic-gate YYERROR; 7357c478bd9Sstevel@tonic-gate cmd = $$; 7367c478bd9Sstevel@tonic-gate $$->cmd_handler = &remove_func; 7377c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 7387c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 2; 7397c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 7407c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 7417c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 7427c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 7437c478bd9Sstevel@tonic-gate } 7447c478bd9Sstevel@tonic-gate | REMOVE resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value 7457c478bd9Sstevel@tonic-gate { 7467c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7477c478bd9Sstevel@tonic-gate YYERROR; 7487c478bd9Sstevel@tonic-gate cmd = $$; 7497c478bd9Sstevel@tonic-gate $$->cmd_handler = &remove_func; 7507c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 7517c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 3; 7527c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 7537c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 7547c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 7557c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 7567c478bd9Sstevel@tonic-gate $$->cmd_prop_name[2] = $9; 7577c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[2] = &property[2]; 7587c478bd9Sstevel@tonic-gate } 7597c478bd9Sstevel@tonic-gate 7607c478bd9Sstevel@tonic-gate revert_command: REVERT 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 = 0; 7677c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 7687c478bd9Sstevel@tonic-gate } 7697c478bd9Sstevel@tonic-gate | REVERT TOKEN 7707c478bd9Sstevel@tonic-gate { 7717c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 7727c478bd9Sstevel@tonic-gate YYERROR; 7737c478bd9Sstevel@tonic-gate cmd = $$; 7747c478bd9Sstevel@tonic-gate $$->cmd_handler = &revert_func; 7757c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 7767c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 7777c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 7787c478bd9Sstevel@tonic-gate } 7797c478bd9Sstevel@tonic-gate 7807c478bd9Sstevel@tonic-gate select_command: SELECT 7817c478bd9Sstevel@tonic-gate { 7827c478bd9Sstevel@tonic-gate short_usage(CMD_SELECT); 7837c478bd9Sstevel@tonic-gate (void) fputs("\n", stderr); 784bbec428eSgjelinek usage(B_FALSE, HELP_RES_PROPS); 7857c478bd9Sstevel@tonic-gate YYERROR; 7867c478bd9Sstevel@tonic-gate } 7870209230bSgjelinek | SELECT PSET 7880209230bSgjelinek { 7890209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 7900209230bSgjelinek YYERROR; 7910209230bSgjelinek cmd = $$; 7920209230bSgjelinek $$->cmd_handler = &select_func; 7930209230bSgjelinek $$->cmd_res_type = RT_DCPU; 7940209230bSgjelinek } 795c97ad5cdSakolb | SELECT PCAP 796c97ad5cdSakolb { 797c97ad5cdSakolb if (($$ = alloc_cmd()) == NULL) 798c97ad5cdSakolb YYERROR; 799c97ad5cdSakolb cmd = $$; 800c97ad5cdSakolb $$->cmd_handler = &select_func; 801c97ad5cdSakolb $$->cmd_res_type = RT_PCAP; 802c97ad5cdSakolb } 8030209230bSgjelinek | SELECT MCAP 8040209230bSgjelinek { 8050209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 8060209230bSgjelinek YYERROR; 8070209230bSgjelinek cmd = $$; 8080209230bSgjelinek $$->cmd_handler = &select_func; 8090209230bSgjelinek $$->cmd_res_type = RT_MCAP; 8100209230bSgjelinek } 8117c478bd9Sstevel@tonic-gate | SELECT resource_type 8127c478bd9Sstevel@tonic-gate { 8137c478bd9Sstevel@tonic-gate short_usage(CMD_SELECT); 8147c478bd9Sstevel@tonic-gate YYERROR; 8157c478bd9Sstevel@tonic-gate } 8167c478bd9Sstevel@tonic-gate | SELECT resource_type property_name EQUAL property_value 8177c478bd9Sstevel@tonic-gate { 8187c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8197c478bd9Sstevel@tonic-gate YYERROR; 8207c478bd9Sstevel@tonic-gate cmd = $$; 8217c478bd9Sstevel@tonic-gate $$->cmd_handler = &select_func; 8227c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 8237c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 8247c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 8257c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8267c478bd9Sstevel@tonic-gate } 8277c478bd9Sstevel@tonic-gate | SELECT resource_type property_name EQUAL property_value property_name EQUAL property_value 8287c478bd9Sstevel@tonic-gate { 8297c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8307c478bd9Sstevel@tonic-gate YYERROR; 8317c478bd9Sstevel@tonic-gate cmd = $$; 8327c478bd9Sstevel@tonic-gate $$->cmd_handler = &select_func; 8337c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 8347c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 2; 8357c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 8367c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8377c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 8387c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 8397c478bd9Sstevel@tonic-gate } 8407c478bd9Sstevel@tonic-gate | SELECT resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value 8417c478bd9Sstevel@tonic-gate { 8427c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8437c478bd9Sstevel@tonic-gate YYERROR; 8447c478bd9Sstevel@tonic-gate cmd = $$; 8457c478bd9Sstevel@tonic-gate $$->cmd_handler = &select_func; 8467c478bd9Sstevel@tonic-gate $$->cmd_res_type = $2; 8477c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 3; 8487c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $3; 8497c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8507c478bd9Sstevel@tonic-gate $$->cmd_prop_name[1] = $6; 8517c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[1] = &property[1]; 8527c478bd9Sstevel@tonic-gate $$->cmd_prop_name[2] = $9; 8537c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[2] = &property[2]; 8547c478bd9Sstevel@tonic-gate } 8557c478bd9Sstevel@tonic-gate 8567c478bd9Sstevel@tonic-gate set_command: SET 8577c478bd9Sstevel@tonic-gate { 8587c478bd9Sstevel@tonic-gate short_usage(CMD_SET); 8597c478bd9Sstevel@tonic-gate (void) fputs("\n", stderr); 860bbec428eSgjelinek usage(B_FALSE, HELP_PROPS); 8617c478bd9Sstevel@tonic-gate YYERROR; 8627c478bd9Sstevel@tonic-gate } 8637c478bd9Sstevel@tonic-gate | SET property_name EQUAL OPEN_SQ_BRACKET CLOSE_SQ_BRACKET 8647c478bd9Sstevel@tonic-gate { 8657c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8667c478bd9Sstevel@tonic-gate YYERROR; 8677c478bd9Sstevel@tonic-gate cmd = $$; 8687c478bd9Sstevel@tonic-gate $$->cmd_handler = &set_func; 8697c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 0; 8707c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $2; 8717c478bd9Sstevel@tonic-gate property[0].pv_type = PROP_VAL_LIST; 8727c478bd9Sstevel@tonic-gate property[0].pv_list = NULL; 8737c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8747c478bd9Sstevel@tonic-gate } 8757c478bd9Sstevel@tonic-gate | SET property_name EQUAL property_value 8767c478bd9Sstevel@tonic-gate { 8777c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 8787c478bd9Sstevel@tonic-gate YYERROR; 8797c478bd9Sstevel@tonic-gate cmd = $$; 8807c478bd9Sstevel@tonic-gate $$->cmd_handler = &set_func; 8817c478bd9Sstevel@tonic-gate $$->cmd_prop_nv_pairs = 1; 8827c478bd9Sstevel@tonic-gate $$->cmd_prop_name[0] = $2; 8837c478bd9Sstevel@tonic-gate $$->cmd_property_ptr[0] = &property[0]; 8847c478bd9Sstevel@tonic-gate } 885555afedfScarlsonj | SET TOKEN ZONEPATH EQUAL property_value 886555afedfScarlsonj { 887555afedfScarlsonj if (($$ = alloc_cmd()) == NULL) 888555afedfScarlsonj YYERROR; 889555afedfScarlsonj cmd = $$; 890555afedfScarlsonj $$->cmd_argc = 1; 891555afedfScarlsonj $$->cmd_argv[0] = $2; 892555afedfScarlsonj $$->cmd_argv[1] = NULL; 893555afedfScarlsonj $$->cmd_handler = &set_func; 894555afedfScarlsonj $$->cmd_prop_nv_pairs = 1; 895555afedfScarlsonj $$->cmd_prop_name[0] = PT_ZONEPATH; 896555afedfScarlsonj $$->cmd_property_ptr[0] = &property[0]; 897555afedfScarlsonj } 8987c478bd9Sstevel@tonic-gate 8990209230bSgjelinek clear_command: CLEAR 9000209230bSgjelinek { 9010209230bSgjelinek short_usage(CMD_CLEAR); 9020209230bSgjelinek (void) fputs("\n", stderr); 903bbec428eSgjelinek usage(B_FALSE, HELP_PROPS); 9040209230bSgjelinek YYERROR; 9050209230bSgjelinek } 9060209230bSgjelinek | CLEAR property_name 9070209230bSgjelinek { 9080209230bSgjelinek if (($$ = alloc_cmd()) == NULL) 9090209230bSgjelinek YYERROR; 9100209230bSgjelinek cmd = $$; 9110209230bSgjelinek $$->cmd_handler = &clear_func; 9120209230bSgjelinek $$->cmd_res_type = $2; 9130209230bSgjelinek } 9140209230bSgjelinek 9157c478bd9Sstevel@tonic-gate verify_command: VERIFY 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 = 0; 9227c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = NULL; 9237c478bd9Sstevel@tonic-gate } 9247c478bd9Sstevel@tonic-gate | VERIFY TOKEN 9257c478bd9Sstevel@tonic-gate { 9267c478bd9Sstevel@tonic-gate if (($$ = alloc_cmd()) == NULL) 9277c478bd9Sstevel@tonic-gate YYERROR; 9287c478bd9Sstevel@tonic-gate cmd = $$; 9297c478bd9Sstevel@tonic-gate $$->cmd_handler = &verify_func; 9307c478bd9Sstevel@tonic-gate $$->cmd_argc = 1; 9317c478bd9Sstevel@tonic-gate $$->cmd_argv[0] = $2; 9327c478bd9Sstevel@tonic-gate $$->cmd_argv[1] = NULL; 9337c478bd9Sstevel@tonic-gate } 9347c478bd9Sstevel@tonic-gate 9357c478bd9Sstevel@tonic-gate resource_type: NET { $$ = RT_NET; } 9367c478bd9Sstevel@tonic-gate | FS { $$ = RT_FS; } 9377c478bd9Sstevel@tonic-gate | IPD { $$ = RT_IPD; } 9387c478bd9Sstevel@tonic-gate | DEVICE { $$ = RT_DEVICE; } 9397c478bd9Sstevel@tonic-gate | RCTL { $$ = RT_RCTL; } 9407c478bd9Sstevel@tonic-gate | ATTR { $$ = RT_ATTR; } 941fa9e4066Sahrens | DATASET { $$ = RT_DATASET; } 9420209230bSgjelinek | PSET { $$ = RT_DCPU; } 943c97ad5cdSakolb | PCAP { $$ = RT_PCAP; } 9440209230bSgjelinek | MCAP { $$ = RT_MCAP; } 945cb8a054bSGlenn Faden | ADMIN { $$ = RT_ADMIN; } 9467c478bd9Sstevel@tonic-gate 9477c478bd9Sstevel@tonic-gate property_name: SPECIAL { $$ = PT_SPECIAL; } 9487c478bd9Sstevel@tonic-gate | RAW { $$ = PT_RAW; } 9497c478bd9Sstevel@tonic-gate | DIR { $$ = PT_DIR; } 9507c478bd9Sstevel@tonic-gate | TYPE { $$ = PT_TYPE; } 9517c478bd9Sstevel@tonic-gate | OPTIONS { $$ = PT_OPTIONS; } 952087719fdSdp | ZONENAME { $$ = PT_ZONENAME; } 9537c478bd9Sstevel@tonic-gate | ZONEPATH { $$ = PT_ZONEPATH; } 9547c478bd9Sstevel@tonic-gate | AUTOBOOT { $$ = PT_AUTOBOOT; } 955f4b3ec61Sdh | IPTYPE { $$ = PT_IPTYPE; } 9567c478bd9Sstevel@tonic-gate | POOL { $$ = PT_POOL; } 957ffbafc53Scomay | LIMITPRIV { $$ = PT_LIMITPRIV; } 9583f2f09c1Sdp | BOOTARGS { $$ = PT_BOOTARGS; } 9597c478bd9Sstevel@tonic-gate | ADDRESS { $$ = PT_ADDRESS; } 9607c478bd9Sstevel@tonic-gate | PHYSICAL { $$ = PT_PHYSICAL; } 961de860bd9Sgfaden | DEFROUTER { $$ = PT_DEFROUTER; } 9627c478bd9Sstevel@tonic-gate | NAME { $$ = PT_NAME; } 9637c478bd9Sstevel@tonic-gate | VALUE { $$ = PT_VALUE; } 9647c478bd9Sstevel@tonic-gate | MATCH { $$ = PT_MATCH; } 9657c478bd9Sstevel@tonic-gate | PRIV { $$ = PT_PRIV; } 9667c478bd9Sstevel@tonic-gate | LIMIT { $$ = PT_LIMIT; } 9677c478bd9Sstevel@tonic-gate | ACTION { $$ = PT_ACTION; } 9689acbbeafSnn | BRAND { $$ = PT_BRAND; } 9690209230bSgjelinek | NCPUS { $$ = PT_NCPUS; } 9700209230bSgjelinek | LOCKED { $$ = PT_LOCKED; } 9710209230bSgjelinek | SWAP { $$ = PT_SWAP; } 9720209230bSgjelinek | IMPORTANCE { $$ = PT_IMPORTANCE; } 9730209230bSgjelinek | SHARES { $$ = PT_SHARES; } 9740209230bSgjelinek | MAXLWPS { $$ = PT_MAXLWPS; } 975*ff19e029SMenno Lageman | MAXPROCS { $$ = PT_MAXPROCS; } 9760209230bSgjelinek | MAXSHMMEM { $$ = PT_MAXSHMMEM; } 9770209230bSgjelinek | MAXSHMIDS { $$ = PT_MAXSHMIDS; } 9780209230bSgjelinek | MAXMSGIDS { $$ = PT_MAXMSGIDS; } 9790209230bSgjelinek | MAXSEMIDS { $$ = PT_MAXSEMIDS; } 9800209230bSgjelinek | SCHED { $$ = PT_SCHED; } 9815679c89fSjv | HOSTID { $$ = PT_HOSTID; } 982cb8a054bSGlenn Faden | USER { $$ = PT_USER; } 983cb8a054bSGlenn Faden | AUTHS { $$ = PT_AUTHS; } 9840fbb751dSJohn Levon | FS_ALLOWED { $$ = PT_FS_ALLOWED; } 9857c478bd9Sstevel@tonic-gate 9867c478bd9Sstevel@tonic-gate /* 9877c478bd9Sstevel@tonic-gate * The grammar builds data structures from the bottom up. Thus various 9887c478bd9Sstevel@tonic-gate * strings are lexed into TOKENs or commands or resource or property values. 9897c478bd9Sstevel@tonic-gate * Below is where the resource and property values are built up into more 9907c478bd9Sstevel@tonic-gate * complex data structures. 9917c478bd9Sstevel@tonic-gate * 9927c478bd9Sstevel@tonic-gate * There are three kinds of properties: simple (single valued), complex 9937c478bd9Sstevel@tonic-gate * (one or more name=value pairs) and list (concatenation of one or more 9947c478bd9Sstevel@tonic-gate * simple or complex properties). 9957c478bd9Sstevel@tonic-gate * 9967c478bd9Sstevel@tonic-gate * So the property structure has a type which is one of these, and the 9977c478bd9Sstevel@tonic-gate * corresponding _simple, _complex or _list is set to the corresponding 9987c478bd9Sstevel@tonic-gate * lower-level data structure. 9997c478bd9Sstevel@tonic-gate */ 10007c478bd9Sstevel@tonic-gate 10017c478bd9Sstevel@tonic-gate property_value: simple_prop_val 10027c478bd9Sstevel@tonic-gate { 10037c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_type = PROP_VAL_SIMPLE; 10047c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_simple = $1; 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 | complex_prop_val 10127c478bd9Sstevel@tonic-gate { 10137c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_type = PROP_VAL_COMPLEX; 10147c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_complex = complex; 10157c478bd9Sstevel@tonic-gate if (list[num_prop_vals] != NULL) { 10167c478bd9Sstevel@tonic-gate free_outer_list(list[num_prop_vals]); 10177c478bd9Sstevel@tonic-gate list[num_prop_vals] = NULL; 10187c478bd9Sstevel@tonic-gate } 10197c478bd9Sstevel@tonic-gate num_prop_vals++; 10207c478bd9Sstevel@tonic-gate } 10217c478bd9Sstevel@tonic-gate | list_prop_val 10227c478bd9Sstevel@tonic-gate { 10237c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_type = PROP_VAL_LIST; 10247c478bd9Sstevel@tonic-gate property[num_prop_vals].pv_list = list[num_prop_vals]; 10257c478bd9Sstevel@tonic-gate num_prop_vals++; 10267c478bd9Sstevel@tonic-gate } 10277c478bd9Sstevel@tonic-gate 10287c478bd9Sstevel@tonic-gate /* 10297c478bd9Sstevel@tonic-gate * One level lower, lists are made up of simple or complex values, so 10307c478bd9Sstevel@tonic-gate * simple_prop_val and complex_prop_val fill in a list structure and 10317c478bd9Sstevel@tonic-gate * insert it into the linked list which is built up. And because 10327c478bd9Sstevel@tonic-gate * complex properties can have multiple name=value pairs, we keep 10337c478bd9Sstevel@tonic-gate * track of them in another linked list. 10347c478bd9Sstevel@tonic-gate * 10357c478bd9Sstevel@tonic-gate * The complex and list structures for the linked lists are allocated 10367c478bd9Sstevel@tonic-gate * below, and freed by recursive functions which are ultimately called 10377c478bd9Sstevel@tonic-gate * by free_cmd(), which is called from the top-most "commands" part of 10387c478bd9Sstevel@tonic-gate * the grammar. 1039c94c1ef0Sjv * 1040c94c1ef0Sjv * NOTE: simple_prop_val and complex_piece need reduction rules for 1041c94c1ef0Sjv * property_name and resource_type so that the parser will accept property names 1042c94c1ef0Sjv * and resource type names as property values. 10437c478bd9Sstevel@tonic-gate */ 10447c478bd9Sstevel@tonic-gate 10457c478bd9Sstevel@tonic-gate simple_prop_val: TOKEN 10467c478bd9Sstevel@tonic-gate { 1047c94c1ef0Sjv $$ = simple_prop_val_func($1); 1048c94c1ef0Sjv free($1); 1049c94c1ef0Sjv if ($$ == NULL) 1050c94c1ef0Sjv YYERROR; 1051c94c1ef0Sjv } 1052c94c1ef0Sjv | resource_type 1053c94c1ef0Sjv { 1054c94c1ef0Sjv if (($$ = simple_prop_val_func(res_types[$1])) == NULL) 1055c94c1ef0Sjv YYERROR; 1056c94c1ef0Sjv } 1057c94c1ef0Sjv | property_name 1058c94c1ef0Sjv { 1059c94c1ef0Sjv if (($$ = simple_prop_val_func(prop_types[$1])) == NULL) 10607c478bd9Sstevel@tonic-gate YYERROR; 10617c478bd9Sstevel@tonic-gate } 10627c478bd9Sstevel@tonic-gate 10637c478bd9Sstevel@tonic-gate complex_prop_val: OPEN_PAREN complex_piece CLOSE_PAREN 10647c478bd9Sstevel@tonic-gate { 10657c478bd9Sstevel@tonic-gate if ((new_list = alloc_list()) == NULL) 10667c478bd9Sstevel@tonic-gate YYERROR; 10677c478bd9Sstevel@tonic-gate new_list->lp_simple = NULL; 10687c478bd9Sstevel@tonic-gate new_list->lp_complex = complex; 10697c478bd9Sstevel@tonic-gate new_list->lp_next = NULL; 10707c478bd9Sstevel@tonic-gate if (list[num_prop_vals] == NULL) { 10717c478bd9Sstevel@tonic-gate list[num_prop_vals] = new_list; 10727c478bd9Sstevel@tonic-gate } else { 10737c478bd9Sstevel@tonic-gate for (tmp_list = list[num_prop_vals]; tmp_list != NULL; 10747c478bd9Sstevel@tonic-gate tmp_list = tmp_list->lp_next) 10757c478bd9Sstevel@tonic-gate last = tmp_list; 10767c478bd9Sstevel@tonic-gate last->lp_next = new_list; 10777c478bd9Sstevel@tonic-gate } 10787c478bd9Sstevel@tonic-gate } 10797c478bd9Sstevel@tonic-gate 10807c478bd9Sstevel@tonic-gate complex_piece: property_name EQUAL TOKEN 10817c478bd9Sstevel@tonic-gate { 1082c94c1ef0Sjv $$ = complex_piece_func($1, $3, NULL); 1083c94c1ef0Sjv free($3); 1084c94c1ef0Sjv if ($$ == NULL) 1085c94c1ef0Sjv YYERROR; 1086c94c1ef0Sjv } 1087c94c1ef0Sjv | property_name EQUAL resource_type 1088c94c1ef0Sjv { 1089c94c1ef0Sjv if (($$ = complex_piece_func($1, res_types[$3], NULL)) == NULL) 1090c94c1ef0Sjv YYERROR; 1091c94c1ef0Sjv } 1092c94c1ef0Sjv | property_name EQUAL property_name 1093c94c1ef0Sjv { 1094c94c1ef0Sjv if (($$ = complex_piece_func($1, prop_types[$3], NULL)) == NULL) 10957c478bd9Sstevel@tonic-gate YYERROR; 10967c478bd9Sstevel@tonic-gate } 10977c478bd9Sstevel@tonic-gate | property_name EQUAL TOKEN COMMA complex_piece 10987c478bd9Sstevel@tonic-gate { 1099c94c1ef0Sjv $$ = complex_piece_func($1, $3, complex); 1100c94c1ef0Sjv free($3); 1101c94c1ef0Sjv if ($$ == NULL) 1102c94c1ef0Sjv YYERROR; 1103c94c1ef0Sjv } 1104c94c1ef0Sjv | property_name EQUAL resource_type COMMA complex_piece 1105c94c1ef0Sjv { 1106c94c1ef0Sjv if (($$ = complex_piece_func($1, res_types[$3], complex)) == 1107c94c1ef0Sjv NULL) 1108c94c1ef0Sjv YYERROR; 1109c94c1ef0Sjv } 1110c94c1ef0Sjv | property_name EQUAL property_name COMMA complex_piece 1111c94c1ef0Sjv { 1112c94c1ef0Sjv if (($$ = complex_piece_func($1, prop_types[$3], complex)) == 1113c94c1ef0Sjv NULL) 11147c478bd9Sstevel@tonic-gate YYERROR; 11157c478bd9Sstevel@tonic-gate } 11167c478bd9Sstevel@tonic-gate 11177c478bd9Sstevel@tonic-gate list_piece: simple_prop_val 11187c478bd9Sstevel@tonic-gate | complex_prop_val 11197c478bd9Sstevel@tonic-gate | simple_prop_val COMMA list_piece 11207c478bd9Sstevel@tonic-gate | complex_prop_val COMMA list_piece 11217c478bd9Sstevel@tonic-gate 11227c478bd9Sstevel@tonic-gate list_prop_val: OPEN_SQ_BRACKET list_piece CLOSE_SQ_BRACKET 11237c478bd9Sstevel@tonic-gate %% 1124