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 
273869a938Sjv /*
28*bbf21555SRichard Lowe  * This file defines zonecfg(8)'s grammar.
293869a938Sjv  *
303869a938Sjv  * Reduction rules that consume TOKENs must invoke claim_token() immediately
313869a938Sjv  * before freeing the TOKENs or adding them to data structures (e.g., cmd) that
323869a938Sjv  * will be cleaned up when the parser finishes or encounters errors.
333869a938Sjv  */
343869a938Sjv 
357c478bd9Sstevel@tonic-gate #include <stdio.h>
36c94c1ef0Sjv #include <strings.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #include "zonecfg.h"
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate static cmd_t *cmd = NULL;		/* Command being processed */
417c478bd9Sstevel@tonic-gate static complex_property_ptr_t complex = NULL;
427c478bd9Sstevel@tonic-gate static list_property_ptr_t new_list = NULL, tmp_list, last,
437c478bd9Sstevel@tonic-gate     list[MAX_EQ_PROP_PAIRS];
447c478bd9Sstevel@tonic-gate static property_value_t property[MAX_EQ_PROP_PAIRS];
457c478bd9Sstevel@tonic-gate 
46bbec428eSgjelinek extern boolean_t newline_terminated;
477c478bd9Sstevel@tonic-gate extern int num_prop_vals;		/* # of property values */
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /* yacc externals */
507c478bd9Sstevel@tonic-gate extern int yydebug;
517c478bd9Sstevel@tonic-gate extern void yyerror(char *s);
527c478bd9Sstevel@tonic-gate 
53c94c1ef0Sjv /*
54c94c1ef0Sjv  * This function is used by the simple_prop_val reduction rules to set up
55c94c1ef0Sjv  * a list_property_ptr_t and adjust the above global variables appropriately.
56c94c1ef0Sjv  * Note that this function duplicates the specified string and makes
57c94c1ef0Sjv  * the new list's lp_simple field point to the duplicate.  This function does
58c94c1ef0Sjv  * not free the original string.
59c94c1ef0Sjv  *
60c94c1ef0Sjv  * This function returns a pointer to the duplicated string or NULL if an error
61c94c1ef0Sjv  * occurred.  The simple_prop_val reduction rules that invoke this function
62c94c1ef0Sjv  * should set $$ to the returned pointer.
63c94c1ef0Sjv  */
64c94c1ef0Sjv static char *
simple_prop_val_func(const char * str)65c94c1ef0Sjv simple_prop_val_func(const char *str)
66c94c1ef0Sjv {
67c94c1ef0Sjv 	char *retstr;
68c94c1ef0Sjv 
69c94c1ef0Sjv 	if ((new_list = alloc_list()) == NULL)
70c94c1ef0Sjv 		return (NULL);
71c94c1ef0Sjv 	if ((retstr = strdup(str)) == NULL) {
72c94c1ef0Sjv 		free_list(new_list);
73c94c1ef0Sjv 		return (NULL);
74c94c1ef0Sjv 	}
75c94c1ef0Sjv 	new_list->lp_simple = retstr;
76c94c1ef0Sjv 	new_list->lp_complex = NULL;
77c94c1ef0Sjv 	new_list->lp_next = NULL;
78c94c1ef0Sjv 	if (list[num_prop_vals] == NULL) {
79c94c1ef0Sjv 		list[num_prop_vals] = new_list;
80c94c1ef0Sjv 	} else {
81c94c1ef0Sjv 		for (tmp_list = list[num_prop_vals]; tmp_list != NULL;
82c94c1ef0Sjv 		    tmp_list = tmp_list->lp_next)
83c94c1ef0Sjv 			last = tmp_list;
84c94c1ef0Sjv 		last->lp_next = new_list;
85c94c1ef0Sjv 	}
86c94c1ef0Sjv 	return (retstr);
87c94c1ef0Sjv }
88c94c1ef0Sjv 
89c94c1ef0Sjv /*
90c94c1ef0Sjv  * This function is used by the complex_piece reduction rules to set up a
91c94c1ef0Sjv  * complex_property_prt_t and adjust the above global variables appropriately.
92c94c1ef0Sjv  * Note that this function duplicates the specified string and makes the new
93c94c1ef0Sjv  * complex_property_ptr_t's cp_value field point to the duplicate.  It also sets
94c94c1ef0Sjv  * the complex_property_ptr_t's cp_type field to cp_type and its cp_next field
95c94c1ef0Sjv  * to cp_next.  This function does not free the original string.
96c94c1ef0Sjv  *
97c94c1ef0Sjv  * This function returns a pointer to the complex_property_t created for the
98c94c1ef0Sjv  * complex_piece or NULL if an error occurred.  The complex_piece reduction
99c94c1ef0Sjv  * rules that invoke this function should set $$ to the returned pointer.
100c94c1ef0Sjv  */
101c94c1ef0Sjv static complex_property_ptr_t
complex_piece_func(int cp_type,const char * str,complex_property_ptr_t cp_next)102c94c1ef0Sjv complex_piece_func(int cp_type, const char *str, complex_property_ptr_t cp_next)
103c94c1ef0Sjv {
104c94c1ef0Sjv 	complex_property_ptr_t retval;
105c94c1ef0Sjv 
106c94c1ef0Sjv 	if ((retval = alloc_complex()) == NULL)
107c94c1ef0Sjv 		return (NULL);
108c94c1ef0Sjv 	if ((retval->cp_value = strdup(str)) == NULL) {
109c94c1ef0Sjv 		free_complex(retval);
110c94c1ef0Sjv 		return (NULL);
111c94c1ef0Sjv 	}
112c94c1ef0Sjv 	retval->cp_type = cp_type;
113c94c1ef0Sjv 	retval->cp_next = cp_next;
114c94c1ef0Sjv 	complex = retval;
115c94c1ef0Sjv 	return (retval);
116c94c1ef0Sjv }
117c94c1ef0Sjv 
118c94c1ef0Sjv 
1197c478bd9Sstevel@tonic-gate %}
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate %union {
1227c478bd9Sstevel@tonic-gate 	int ival;
1237c478bd9Sstevel@tonic-gate 	char *strval;
1247c478bd9Sstevel@tonic-gate 	cmd_t *cmd;
1257c478bd9Sstevel@tonic-gate 	complex_property_ptr_t complex;
1267c478bd9Sstevel@tonic-gate 	list_property_ptr_t list;
1277c478bd9Sstevel@tonic-gate }
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate %start commands
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate %token HELP CREATE EXPORT ADD DELETE REMOVE SELECT SET INFO CANCEL END VERIFY
132087719fdSdp %token COMMIT REVERT EXIT SEMICOLON TOKEN ZONENAME ZONEPATH AUTOBOOT POOL NET
1336e1ae2a3SGary Pennington %token FS ATTR DEVICE RCTL SPECIAL RAW DIR OPTIONS TYPE ADDRESS PHYSICAL
134550b6e40SSowmini Varadhan %token IPTYPE HOSTID FS_ALLOWED ALLOWED_ADDRESS
135087719fdSdp %token NAME MATCH PRIV LIMIT ACTION VALUE EQUAL OPEN_SQ_BRACKET CLOSE_SQ_BRACKET
136c97ad5cdSakolb %token OPEN_PAREN CLOSE_PAREN COMMA DATASET LIMITPRIV BOOTARGS BRAND PSET PCAP
1370209230bSgjelinek %token MCAP NCPUS IMPORTANCE SHARES MAXLWPS MAXSHMMEM MAXSHMIDS MAXMSGIDS
138d2a70789SRichard Lowe %token MAXSEMIDS LOCKED SWAP SCHED CLEAR DEFROUTER ADMIN SECFLAGS USER AUTHS MAXPROCS
139d2a70789SRichard Lowe %token DEFAULT UPPER LOWER
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate %type <strval> TOKEN EQUAL OPEN_SQ_BRACKET CLOSE_SQ_BRACKET
1427c478bd9Sstevel@tonic-gate     property_value OPEN_PAREN CLOSE_PAREN COMMA simple_prop_val
1437c478bd9Sstevel@tonic-gate %type <complex> complex_piece complex_prop_val
1446e1ae2a3SGary Pennington %type <ival> resource_type NET FS DEVICE RCTL ATTR DATASET PSET PCAP MCAP
145d2a70789SRichard Lowe     ADMIN SECFLAGS
1467c478bd9Sstevel@tonic-gate %type <ival> property_name SPECIAL RAW DIR OPTIONS TYPE ADDRESS PHYSICAL NAME
1473f2f09c1Sdp     MATCH ZONENAME ZONEPATH AUTOBOOT POOL LIMITPRIV BOOTARGS VALUE PRIV LIMIT
1480fbb751dSJohn Levon     ACTION BRAND SCHED IPTYPE DEFROUTER HOSTID USER AUTHS FS_ALLOWED
149d2a70789SRichard Lowe     ALLOWED_ADDRESS DEFAULT UPPER LOWER
1507c478bd9Sstevel@tonic-gate %type <cmd> command
1517c478bd9Sstevel@tonic-gate %type <cmd> add_command ADD
1527c478bd9Sstevel@tonic-gate %type <cmd> cancel_command CANCEL
1537c478bd9Sstevel@tonic-gate %type <cmd> commit_command COMMIT
1547c478bd9Sstevel@tonic-gate %type <cmd> create_command CREATE
1557c478bd9Sstevel@tonic-gate %type <cmd> delete_command DELETE
1567c478bd9Sstevel@tonic-gate %type <cmd> end_command END
1577c478bd9Sstevel@tonic-gate %type <cmd> exit_command EXIT
1587c478bd9Sstevel@tonic-gate %type <cmd> export_command EXPORT
1597c478bd9Sstevel@tonic-gate %type <cmd> help_command HELP
1607c478bd9Sstevel@tonic-gate %type <cmd> info_command INFO
1617c478bd9Sstevel@tonic-gate %type <cmd> remove_command REMOVE
1627c478bd9Sstevel@tonic-gate %type <cmd> revert_command REVERT
1637c478bd9Sstevel@tonic-gate %type <cmd> select_command SELECT
1647c478bd9Sstevel@tonic-gate %type <cmd> set_command SET
1650209230bSgjelinek %type <cmd> clear_command CLEAR
1667c478bd9Sstevel@tonic-gate %type <cmd> verify_command VERIFY
1677c478bd9Sstevel@tonic-gate %type <cmd> terminator
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate %%
1707c478bd9Sstevel@tonic-gate 
1713869a938Sjv /*
1723869a938Sjv  * NOTE: Each commands reduction rule must invoke assert_no_unclaimed_tokens()
1733869a938Sjv  * before it completes if it isn't processing an error.  This ensures that
1743869a938Sjv  * reduction rules properly consume TOKENs.
1753869a938Sjv  */
1767c478bd9Sstevel@tonic-gate commands: command terminator
1777c478bd9Sstevel@tonic-gate 	{
1787c478bd9Sstevel@tonic-gate 		if ($1 != NULL) {
1797c478bd9Sstevel@tonic-gate 			if ($1->cmd_handler != NULL)
1807c478bd9Sstevel@tonic-gate 				$1->cmd_handler($1);
1817c478bd9Sstevel@tonic-gate 			free_cmd($1);
1827c478bd9Sstevel@tonic-gate 			bzero(list, sizeof (list_property_t));
1837c478bd9Sstevel@tonic-gate 			num_prop_vals = 0;
1847c478bd9Sstevel@tonic-gate 		}
1853869a938Sjv 		assert_no_unclaimed_tokens();
1867c478bd9Sstevel@tonic-gate 		return (0);
1877c478bd9Sstevel@tonic-gate 	}
1887c478bd9Sstevel@tonic-gate 	| command error terminator
1897c478bd9Sstevel@tonic-gate 	{
1907c478bd9Sstevel@tonic-gate 		if ($1 != NULL) {
1917c478bd9Sstevel@tonic-gate 			free_cmd($1);
1927c478bd9Sstevel@tonic-gate 			bzero(list, sizeof (list_property_t));
1937c478bd9Sstevel@tonic-gate 			num_prop_vals = 0;
1947c478bd9Sstevel@tonic-gate 		}
1957c478bd9Sstevel@tonic-gate 		if (YYRECOVERING())
1967e362f58Scomay 			YYABORT;
1977c478bd9Sstevel@tonic-gate 		yyclearin;
1987c478bd9Sstevel@tonic-gate 		yyerrok;
1997c478bd9Sstevel@tonic-gate 	}
2007c478bd9Sstevel@tonic-gate 	| error terminator
2017c478bd9Sstevel@tonic-gate 	{
2027c478bd9Sstevel@tonic-gate 		if (YYRECOVERING())
2037e362f58Scomay 			YYABORT;
2047c478bd9Sstevel@tonic-gate 		yyclearin;
2057c478bd9Sstevel@tonic-gate 		yyerrok;
2067c478bd9Sstevel@tonic-gate 	}
2077c478bd9Sstevel@tonic-gate 	| terminator
2087c478bd9Sstevel@tonic-gate 	{
2093869a938Sjv 		assert_no_unclaimed_tokens();
2107c478bd9Sstevel@tonic-gate 		return (0);
2117c478bd9Sstevel@tonic-gate 	}
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate command: add_command
2147c478bd9Sstevel@tonic-gate 	| cancel_command
2150209230bSgjelinek 	| clear_command
2167c478bd9Sstevel@tonic-gate 	| create_command
2177c478bd9Sstevel@tonic-gate 	| commit_command
2187c478bd9Sstevel@tonic-gate 	| delete_command
2197c478bd9Sstevel@tonic-gate 	| end_command
2207c478bd9Sstevel@tonic-gate 	| exit_command
2217c478bd9Sstevel@tonic-gate 	| export_command
2227c478bd9Sstevel@tonic-gate 	| help_command
2237c478bd9Sstevel@tonic-gate 	| info_command
2247c478bd9Sstevel@tonic-gate 	| remove_command
2257c478bd9Sstevel@tonic-gate 	| revert_command
2267c478bd9Sstevel@tonic-gate 	| select_command
2277c478bd9Sstevel@tonic-gate 	| set_command
2287c478bd9Sstevel@tonic-gate 	| verify_command
2297c478bd9Sstevel@tonic-gate 
230bbec428eSgjelinek terminator:	'\n'	{ newline_terminated = B_TRUE; }
231bbec428eSgjelinek 	|	';'	{ newline_terminated = B_FALSE; }
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate add_command: ADD
2347c478bd9Sstevel@tonic-gate 	{
2357c478bd9Sstevel@tonic-gate 		short_usage(CMD_ADD);
2367c478bd9Sstevel@tonic-gate 		(void) fputs("\n", stderr);
237bbec428eSgjelinek 		usage(B_FALSE, HELP_RES_PROPS);
2387c478bd9Sstevel@tonic-gate 		YYERROR;
2397c478bd9Sstevel@tonic-gate 	}
2407c478bd9Sstevel@tonic-gate 	| ADD TOKEN
2417c478bd9Sstevel@tonic-gate 	{
2427c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2437c478bd9Sstevel@tonic-gate 			YYERROR;
2447c478bd9Sstevel@tonic-gate 		cmd = $$;
2457c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &add_func;
2467c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
2473869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
2487c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
2497c478bd9Sstevel@tonic-gate 	}
2507c478bd9Sstevel@tonic-gate 	| ADD resource_type
2517c478bd9Sstevel@tonic-gate 	{
2527c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2537c478bd9Sstevel@tonic-gate 			YYERROR;
2547c478bd9Sstevel@tonic-gate 		cmd = $$;
2557c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &add_func;
2567c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
2577c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
2587c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
2597c478bd9Sstevel@tonic-gate 	}
2607c478bd9Sstevel@tonic-gate 	| ADD property_name property_value
2617c478bd9Sstevel@tonic-gate 	{
2627c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2637c478bd9Sstevel@tonic-gate 			YYERROR;
2647c478bd9Sstevel@tonic-gate 		cmd = $$;
2657c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &add_func;
2667c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
2677c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 1;
2687c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $2;
2697c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
2707c478bd9Sstevel@tonic-gate 	}
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate cancel_command: CANCEL
2737c478bd9Sstevel@tonic-gate 	{
2747c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2757c478bd9Sstevel@tonic-gate 			YYERROR;
2767c478bd9Sstevel@tonic-gate 		cmd = $$;
2777c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &cancel_func;
2787c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
2797c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
2807c478bd9Sstevel@tonic-gate 	}
2817c478bd9Sstevel@tonic-gate 	| CANCEL TOKEN
2827c478bd9Sstevel@tonic-gate 	{
2837c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2847c478bd9Sstevel@tonic-gate 			YYERROR;
2857c478bd9Sstevel@tonic-gate 		cmd = $$;
2867c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &cancel_func;
2877c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
2883869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
2897c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
2907c478bd9Sstevel@tonic-gate 	}
2917c478bd9Sstevel@tonic-gate 
2927c478bd9Sstevel@tonic-gate create_command: CREATE
2937c478bd9Sstevel@tonic-gate 	{
2947c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2957c478bd9Sstevel@tonic-gate 			YYERROR;
2967c478bd9Sstevel@tonic-gate 		cmd = $$;
2977c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &create_func;
2987c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
2997c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
3007c478bd9Sstevel@tonic-gate 	}
3017c478bd9Sstevel@tonic-gate 	| CREATE TOKEN
3027c478bd9Sstevel@tonic-gate 	{
3037c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3047c478bd9Sstevel@tonic-gate 			YYERROR;
3057c478bd9Sstevel@tonic-gate 		cmd = $$;
3067c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &create_func;
3077c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
3083869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
3097c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
3107c478bd9Sstevel@tonic-gate 	}
3117c478bd9Sstevel@tonic-gate 	| CREATE TOKEN TOKEN
3127c478bd9Sstevel@tonic-gate 	{
3137c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3147c478bd9Sstevel@tonic-gate 			YYERROR;
3157c478bd9Sstevel@tonic-gate 		cmd = $$;
3167c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &create_func;
3177c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 2;
3183869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
3193869a938Sjv 		$$->cmd_argv[1] = claim_token($3);
3207c478bd9Sstevel@tonic-gate 		$$->cmd_argv[2] = NULL;
3217c478bd9Sstevel@tonic-gate 	}
3227c478bd9Sstevel@tonic-gate 	| CREATE TOKEN TOKEN TOKEN
3237c478bd9Sstevel@tonic-gate 	{
3247c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3257c478bd9Sstevel@tonic-gate 			YYERROR;
3267c478bd9Sstevel@tonic-gate 		cmd = $$;
3277c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &create_func;
3287c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 3;
3293869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
3303869a938Sjv 		$$->cmd_argv[1] = claim_token($3);
3313869a938Sjv 		$$->cmd_argv[2] = claim_token($4);
3327c478bd9Sstevel@tonic-gate 		$$->cmd_argv[3] = NULL;
3337c478bd9Sstevel@tonic-gate 	}
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate commit_command: COMMIT
3367c478bd9Sstevel@tonic-gate 	{
3377c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3387c478bd9Sstevel@tonic-gate 			YYERROR;
3397c478bd9Sstevel@tonic-gate 		cmd = $$;
3407c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &commit_func;
3417c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
3427c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
3437c478bd9Sstevel@tonic-gate 	}
3447c478bd9Sstevel@tonic-gate 	| COMMIT TOKEN
3457c478bd9Sstevel@tonic-gate 	{
3467c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3477c478bd9Sstevel@tonic-gate 			YYERROR;
3487c478bd9Sstevel@tonic-gate 		cmd = $$;
3497c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &commit_func;
3507c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
3513869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
3527c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
3537c478bd9Sstevel@tonic-gate 	}
3547c478bd9Sstevel@tonic-gate 
3557c478bd9Sstevel@tonic-gate delete_command: DELETE
3567c478bd9Sstevel@tonic-gate 	{
3577c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3587c478bd9Sstevel@tonic-gate 			YYERROR;
3597c478bd9Sstevel@tonic-gate 		cmd = $$;
3607c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &delete_func;
3617c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
3627c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
3637c478bd9Sstevel@tonic-gate 	}
3647c478bd9Sstevel@tonic-gate 	|	DELETE TOKEN
3657c478bd9Sstevel@tonic-gate 	{
3667c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3677c478bd9Sstevel@tonic-gate 			YYERROR;
3687c478bd9Sstevel@tonic-gate 		cmd = $$;
3697c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &delete_func;
3707c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
3713869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
3727c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
3737c478bd9Sstevel@tonic-gate 	}
3747c478bd9Sstevel@tonic-gate 
3757c478bd9Sstevel@tonic-gate end_command: END
3767c478bd9Sstevel@tonic-gate 	{
3777c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3787c478bd9Sstevel@tonic-gate 			YYERROR;
3797c478bd9Sstevel@tonic-gate 		cmd = $$;
3807c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &end_func;
3817c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
3827c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
3837c478bd9Sstevel@tonic-gate 	}
3847c478bd9Sstevel@tonic-gate 	| END TOKEN
3857c478bd9Sstevel@tonic-gate 	{
3867c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3877c478bd9Sstevel@tonic-gate 			YYERROR;
3887c478bd9Sstevel@tonic-gate 		cmd = $$;
3897c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &end_func;
3907c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
3913869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
3927c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
3937c478bd9Sstevel@tonic-gate 	}
3947c478bd9Sstevel@tonic-gate 
3957c478bd9Sstevel@tonic-gate exit_command: EXIT
3967c478bd9Sstevel@tonic-gate 	{
3977c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3987c478bd9Sstevel@tonic-gate 			YYERROR;
3997c478bd9Sstevel@tonic-gate 		cmd = $$;
4007c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &exit_func;
4017c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
4027c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
4037c478bd9Sstevel@tonic-gate 	}
4047c478bd9Sstevel@tonic-gate 	| EXIT TOKEN
4057c478bd9Sstevel@tonic-gate 	{
4067c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4077c478bd9Sstevel@tonic-gate 			YYERROR;
4087c478bd9Sstevel@tonic-gate 		cmd = $$;
4097c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &exit_func;
4107c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
4113869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
4127c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
4137c478bd9Sstevel@tonic-gate 	}
4147c478bd9Sstevel@tonic-gate 
4157c478bd9Sstevel@tonic-gate export_command: EXPORT
4167c478bd9Sstevel@tonic-gate 	{
4177c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4187c478bd9Sstevel@tonic-gate 			YYERROR;
4197c478bd9Sstevel@tonic-gate 		cmd = $$;
4207c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &export_func;
4217c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
4227c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
4237c478bd9Sstevel@tonic-gate 	}
4247c478bd9Sstevel@tonic-gate 	| EXPORT TOKEN
4257c478bd9Sstevel@tonic-gate 	{
4267c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4277c478bd9Sstevel@tonic-gate 			YYERROR;
4287c478bd9Sstevel@tonic-gate 		cmd = $$;
4297c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &export_func;
4307c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
4313869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
4327c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
4337c478bd9Sstevel@tonic-gate 	}
4347c478bd9Sstevel@tonic-gate 	| EXPORT TOKEN TOKEN
4357c478bd9Sstevel@tonic-gate 	{
4367c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4377c478bd9Sstevel@tonic-gate 			YYERROR;
4387c478bd9Sstevel@tonic-gate 		cmd = $$;
4397c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &export_func;
4407c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 2;
4413869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
4423869a938Sjv 		$$->cmd_argv[1] = claim_token($3);
4437c478bd9Sstevel@tonic-gate 		$$->cmd_argv[2] = NULL;
4447c478bd9Sstevel@tonic-gate 	}
4457c478bd9Sstevel@tonic-gate 
4467c478bd9Sstevel@tonic-gate help_command:	HELP
4477c478bd9Sstevel@tonic-gate 	{
4487c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4497c478bd9Sstevel@tonic-gate 			YYERROR;
4507c478bd9Sstevel@tonic-gate 		cmd = $$;
4517c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &help_func;
4527c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
4537c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
4547c478bd9Sstevel@tonic-gate 	}
4557c478bd9Sstevel@tonic-gate 	|	HELP TOKEN
4567c478bd9Sstevel@tonic-gate 	{
4577c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4587c478bd9Sstevel@tonic-gate 			YYERROR;
4597c478bd9Sstevel@tonic-gate 		cmd = $$;
4607c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &help_func;
4617c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
4623869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
4637c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
4647c478bd9Sstevel@tonic-gate 	}
4657c478bd9Sstevel@tonic-gate 
4667c478bd9Sstevel@tonic-gate info_command:	INFO
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 = RT_UNKNOWN;
4737c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
4747c478bd9Sstevel@tonic-gate 	}
4757c478bd9Sstevel@tonic-gate 	|	INFO TOKEN
4767c478bd9Sstevel@tonic-gate 	{
4777c478bd9Sstevel@tonic-gate 		short_usage(CMD_INFO);
4787c478bd9Sstevel@tonic-gate 		(void) fputs("\n", stderr);
479bbec428eSgjelinek 		usage(B_FALSE, HELP_RES_PROPS);
4803869a938Sjv 		free(claim_token($2));
4817c478bd9Sstevel@tonic-gate 		YYERROR;
4827c478bd9Sstevel@tonic-gate 	}
4837c478bd9Sstevel@tonic-gate 	|	INFO resource_type
4847c478bd9Sstevel@tonic-gate 	{
4857c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4867c478bd9Sstevel@tonic-gate 			YYERROR;
4877c478bd9Sstevel@tonic-gate 		cmd = $$;
4887c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
4897c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
4907c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
4917c478bd9Sstevel@tonic-gate 	}
492087719fdSdp 	|	INFO ZONENAME
493087719fdSdp 	{
494087719fdSdp 		if (($$ = alloc_cmd()) == NULL)
495087719fdSdp 			YYERROR;
496087719fdSdp 		cmd = $$;
497087719fdSdp 		$$->cmd_handler = &info_func;
498087719fdSdp 		$$->cmd_res_type = RT_ZONENAME;
499087719fdSdp 		$$->cmd_prop_nv_pairs = 0;
500087719fdSdp 	}
5017c478bd9Sstevel@tonic-gate 	|	INFO ZONEPATH
5027c478bd9Sstevel@tonic-gate 	{
5037c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
5047c478bd9Sstevel@tonic-gate 			YYERROR;
5057c478bd9Sstevel@tonic-gate 		cmd = $$;
5067c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
5077c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = RT_ZONEPATH;
5087c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
5097c478bd9Sstevel@tonic-gate 	}
5109acbbeafSnn 	|	INFO BRAND
5119acbbeafSnn 	{
5129acbbeafSnn 		if (($$ = alloc_cmd()) == NULL)
5139acbbeafSnn 			YYERROR;
5149acbbeafSnn 		cmd = $$;
5159acbbeafSnn 		$$->cmd_handler = &info_func;
5169acbbeafSnn 		$$->cmd_res_type = RT_BRAND;
5179acbbeafSnn 		$$->cmd_prop_nv_pairs = 0;
5189acbbeafSnn 	}
5197c478bd9Sstevel@tonic-gate 	|	INFO AUTOBOOT
5207c478bd9Sstevel@tonic-gate 	{
5217c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
5227c478bd9Sstevel@tonic-gate 			YYERROR;
5237c478bd9Sstevel@tonic-gate 		cmd = $$;
5247c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
5257c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = RT_AUTOBOOT;
5267c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
5277c478bd9Sstevel@tonic-gate 	}
528f4b3ec61Sdh 	|	INFO IPTYPE
529f4b3ec61Sdh 	{
530f4b3ec61Sdh 		if (($$ = alloc_cmd()) == NULL)
531f4b3ec61Sdh 			YYERROR;
532f4b3ec61Sdh 		cmd = $$;
533f4b3ec61Sdh 		$$->cmd_handler = &info_func;
534f4b3ec61Sdh 		$$->cmd_res_type = RT_IPTYPE;
535f4b3ec61Sdh 		$$->cmd_prop_nv_pairs = 0;
536f4b3ec61Sdh 	}
5377c478bd9Sstevel@tonic-gate 	|	INFO POOL
5387c478bd9Sstevel@tonic-gate 	{
5397c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
5407c478bd9Sstevel@tonic-gate 			YYERROR;
5417c478bd9Sstevel@tonic-gate 		cmd = $$;
5427c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
5437c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = RT_POOL;
5447c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
5457c478bd9Sstevel@tonic-gate 	}
546ffbafc53Scomay 	|	INFO LIMITPRIV
547ffbafc53Scomay 	{
548ffbafc53Scomay 		if (($$ = alloc_cmd()) == NULL)
549ffbafc53Scomay 			YYERROR;
550ffbafc53Scomay 		cmd = $$;
551ffbafc53Scomay 		$$->cmd_handler = &info_func;
552ffbafc53Scomay 		$$->cmd_res_type = RT_LIMITPRIV;
553ffbafc53Scomay 		$$->cmd_prop_nv_pairs = 0;
554ffbafc53Scomay 	}
5553f2f09c1Sdp 	|	INFO BOOTARGS
5563f2f09c1Sdp 	{
5573f2f09c1Sdp 		if (($$ = alloc_cmd()) == NULL)
5583f2f09c1Sdp 			YYERROR;
5593f2f09c1Sdp 		cmd = $$;
5603f2f09c1Sdp 		$$->cmd_handler = &info_func;
5613f2f09c1Sdp 		$$->cmd_res_type = RT_BOOTARGS;
5623f2f09c1Sdp 		$$->cmd_prop_nv_pairs = 0;
5633f2f09c1Sdp 	}
5640209230bSgjelinek 	|	INFO SCHED
5650209230bSgjelinek 	{
5660209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
5670209230bSgjelinek 			YYERROR;
5680209230bSgjelinek 		cmd = $$;
5690209230bSgjelinek 		$$->cmd_handler = &info_func;
5700209230bSgjelinek 		$$->cmd_res_type = RT_SCHED;
5710209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
5720209230bSgjelinek 	}
5730209230bSgjelinek 	|	INFO SHARES
5740209230bSgjelinek 	{
5750209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
5760209230bSgjelinek 			YYERROR;
5770209230bSgjelinek 		cmd = $$;
5780209230bSgjelinek 		$$->cmd_handler = &info_func;
5790209230bSgjelinek 		$$->cmd_res_type = RT_SHARES;
5800209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
5810209230bSgjelinek 	}
5820209230bSgjelinek 	|	INFO MAXLWPS
5830209230bSgjelinek 	{
5840209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
5850209230bSgjelinek 			YYERROR;
5860209230bSgjelinek 		cmd = $$;
5870209230bSgjelinek 		$$->cmd_handler = &info_func;
5880209230bSgjelinek 		$$->cmd_res_type = RT_MAXLWPS;
5890209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
5900209230bSgjelinek 	}
591ff19e029SMenno Lageman 	|	INFO MAXPROCS
592ff19e029SMenno Lageman 	{
593ff19e029SMenno Lageman 		if (($$ = alloc_cmd()) == NULL)
594ff19e029SMenno Lageman 			YYERROR;
595ff19e029SMenno Lageman 		cmd = $$;
596ff19e029SMenno Lageman 		$$->cmd_handler = &info_func;
597ff19e029SMenno Lageman 		$$->cmd_res_type = RT_MAXPROCS;
598ff19e029SMenno Lageman 		$$->cmd_prop_nv_pairs = 0;
599ff19e029SMenno Lageman 	}
6000209230bSgjelinek 	|	INFO MAXSHMMEM
6010209230bSgjelinek 	{
6020209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
6030209230bSgjelinek 			YYERROR;
6040209230bSgjelinek 		cmd = $$;
6050209230bSgjelinek 		$$->cmd_handler = &info_func;
6060209230bSgjelinek 		$$->cmd_res_type = RT_MAXSHMMEM;
6070209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
6080209230bSgjelinek 	}
6090209230bSgjelinek 	|	INFO MAXSHMIDS
6100209230bSgjelinek 	{
6110209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
6120209230bSgjelinek 			YYERROR;
6130209230bSgjelinek 		cmd = $$;
6140209230bSgjelinek 		$$->cmd_handler = &info_func;
6150209230bSgjelinek 		$$->cmd_res_type = RT_MAXSHMIDS;
6160209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
6170209230bSgjelinek 	}
6180209230bSgjelinek 	|	INFO MAXMSGIDS
6190209230bSgjelinek 	{
6200209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
6210209230bSgjelinek 			YYERROR;
6220209230bSgjelinek 		cmd = $$;
6230209230bSgjelinek 		$$->cmd_handler = &info_func;
6240209230bSgjelinek 		$$->cmd_res_type = RT_MAXMSGIDS;
6250209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
6260209230bSgjelinek 	}
6270209230bSgjelinek 	|	INFO MAXSEMIDS
6280209230bSgjelinek 	{
6290209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
6300209230bSgjelinek 			YYERROR;
6310209230bSgjelinek 		cmd = $$;
6320209230bSgjelinek 		$$->cmd_handler = &info_func;
6330209230bSgjelinek 		$$->cmd_res_type = RT_MAXSEMIDS;
6340209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
6350209230bSgjelinek 	}
6365679c89fSjv 	|	INFO HOSTID
6375679c89fSjv 	{
6385679c89fSjv 		if (($$ = alloc_cmd()) == NULL)
6395679c89fSjv 			YYERROR;
6405679c89fSjv 		cmd = $$;
6415679c89fSjv 		$$->cmd_handler = &info_func;
6425679c89fSjv 		$$->cmd_res_type = RT_HOSTID;
6435679c89fSjv 		$$->cmd_prop_nv_pairs = 0;
6445679c89fSjv 	}
6450fbb751dSJohn Levon 	|	INFO FS_ALLOWED
6460fbb751dSJohn Levon 	{
6470fbb751dSJohn Levon 		if (($$ = alloc_cmd()) == NULL)
6480fbb751dSJohn Levon 			YYERROR;
6490fbb751dSJohn Levon 		cmd = $$;
6500fbb751dSJohn Levon 		$$->cmd_handler = &info_func;
6510fbb751dSJohn Levon 		$$->cmd_res_type = RT_FS_ALLOWED;
6520fbb751dSJohn Levon 		$$->cmd_prop_nv_pairs = 0;
6530fbb751dSJohn Levon 	}
6547c478bd9Sstevel@tonic-gate 	|	INFO resource_type property_name EQUAL property_value
6557c478bd9Sstevel@tonic-gate 	{
6567c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
6577c478bd9Sstevel@tonic-gate 			YYERROR;
6587c478bd9Sstevel@tonic-gate 		cmd = $$;
6597c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
6607c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
6617c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 1;
6627c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
6637c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
6647c478bd9Sstevel@tonic-gate 	}
6657c478bd9Sstevel@tonic-gate 	|	INFO resource_type property_name EQUAL property_value property_name EQUAL property_value
6667c478bd9Sstevel@tonic-gate 	{
6677c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
6687c478bd9Sstevel@tonic-gate 			YYERROR;
6697c478bd9Sstevel@tonic-gate 		cmd = $$;
6707c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
6717c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
6727c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 2;
6737c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
6747c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
6757c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[1] = $6;
6767c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[1] = &property[1];
6777c478bd9Sstevel@tonic-gate 	}
6787c478bd9Sstevel@tonic-gate 	|	INFO resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value
6797c478bd9Sstevel@tonic-gate 	{
6807c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
6817c478bd9Sstevel@tonic-gate 			YYERROR;
6827c478bd9Sstevel@tonic-gate 		cmd = $$;
6837c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
6847c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
6857c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 3;
6867c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
6877c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
6887c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[1] = $6;
6897c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[1] = &property[1];
6907c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[2] = $9;
6917c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[2] = &property[2];
6927c478bd9Sstevel@tonic-gate 	}
6937c478bd9Sstevel@tonic-gate 
6947c478bd9Sstevel@tonic-gate remove_command: REMOVE
6957c478bd9Sstevel@tonic-gate 	{
6967c478bd9Sstevel@tonic-gate 		short_usage(CMD_REMOVE);
6977c478bd9Sstevel@tonic-gate 		(void) fputs("\n", stderr);
698bbec428eSgjelinek 		usage(B_FALSE, HELP_RES_PROPS);
6997c478bd9Sstevel@tonic-gate 		YYERROR;
7007c478bd9Sstevel@tonic-gate 	}
7010209230bSgjelinek 	| REMOVE TOKEN
7027c478bd9Sstevel@tonic-gate 	{
7037c478bd9Sstevel@tonic-gate 		short_usage(CMD_REMOVE);
7040209230bSgjelinek 		(void) fputs("\n", stderr);
705bbec428eSgjelinek 		usage(B_FALSE, HELP_RES_PROPS);
7063869a938Sjv 		free(claim_token($2));
7077c478bd9Sstevel@tonic-gate 		YYERROR;
7087c478bd9Sstevel@tonic-gate 	}
7090209230bSgjelinek 	| REMOVE resource_type
7100209230bSgjelinek 	{
7110209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
7120209230bSgjelinek 			YYERROR;
7130209230bSgjelinek 		cmd = $$;
7140209230bSgjelinek 		$$->cmd_handler = &remove_func;
7150209230bSgjelinek 		$$->cmd_res_type = $2;
7160209230bSgjelinek 	}
7170209230bSgjelinek 	| REMOVE TOKEN resource_type
7180209230bSgjelinek 	{
7190209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
7200209230bSgjelinek 			YYERROR;
7210209230bSgjelinek 		cmd = $$;
7220209230bSgjelinek 		$$->cmd_handler = &remove_func;
7230209230bSgjelinek 		$$->cmd_res_type = $3;
7240209230bSgjelinek 		$$->cmd_argc = 1;
7253869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
7260209230bSgjelinek 		$$->cmd_argv[1] = NULL;
7270209230bSgjelinek 	}
7287c478bd9Sstevel@tonic-gate 	| REMOVE property_name property_value
7297c478bd9Sstevel@tonic-gate 	{
7307c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
7317c478bd9Sstevel@tonic-gate 			YYERROR;
7327c478bd9Sstevel@tonic-gate 		cmd = $$;
7337c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &remove_func;
7347c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 1;
7357c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $2;
7367c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
7377c478bd9Sstevel@tonic-gate 	}
7387c478bd9Sstevel@tonic-gate 	| REMOVE resource_type property_name EQUAL property_value
7397c478bd9Sstevel@tonic-gate 	{
7407c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
7417c478bd9Sstevel@tonic-gate 			YYERROR;
7427c478bd9Sstevel@tonic-gate 		cmd = $$;
7437c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &remove_func;
7447c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
7457c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 1;
7467c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
7477c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
7487c478bd9Sstevel@tonic-gate 	}
7497c478bd9Sstevel@tonic-gate 	| REMOVE resource_type property_name EQUAL property_value property_name EQUAL property_value
7507c478bd9Sstevel@tonic-gate 	{
7517c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
7527c478bd9Sstevel@tonic-gate 			YYERROR;
7537c478bd9Sstevel@tonic-gate 		cmd = $$;
7547c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &remove_func;
7557c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
7567c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 2;
7577c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
7587c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
7597c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[1] = $6;
7607c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[1] = &property[1];
7617c478bd9Sstevel@tonic-gate 	}
7627c478bd9Sstevel@tonic-gate 	| REMOVE resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value
7637c478bd9Sstevel@tonic-gate 	{
7647c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
7657c478bd9Sstevel@tonic-gate 			YYERROR;
7667c478bd9Sstevel@tonic-gate 		cmd = $$;
7677c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &remove_func;
7687c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
7697c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 3;
7707c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
7717c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
7727c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[1] = $6;
7737c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[1] = &property[1];
7747c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[2] = $9;
7757c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[2] = &property[2];
7767c478bd9Sstevel@tonic-gate 	}
7777c478bd9Sstevel@tonic-gate 
7787c478bd9Sstevel@tonic-gate revert_command: REVERT
7797c478bd9Sstevel@tonic-gate 	{
7807c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
7817c478bd9Sstevel@tonic-gate 			YYERROR;
7827c478bd9Sstevel@tonic-gate 		cmd = $$;
7837c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &revert_func;
7847c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
7857c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
7867c478bd9Sstevel@tonic-gate 	}
7877c478bd9Sstevel@tonic-gate 	| REVERT TOKEN
7887c478bd9Sstevel@tonic-gate 	{
7897c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
7907c478bd9Sstevel@tonic-gate 			YYERROR;
7917c478bd9Sstevel@tonic-gate 		cmd = $$;
7927c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &revert_func;
7937c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
7943869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
7957c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
7967c478bd9Sstevel@tonic-gate 	}
7977c478bd9Sstevel@tonic-gate 
7987c478bd9Sstevel@tonic-gate select_command: SELECT
7997c478bd9Sstevel@tonic-gate 	{
8007c478bd9Sstevel@tonic-gate 		short_usage(CMD_SELECT);
8017c478bd9Sstevel@tonic-gate 		(void) fputs("\n", stderr);
802bbec428eSgjelinek 		usage(B_FALSE, HELP_RES_PROPS);
8037c478bd9Sstevel@tonic-gate 		YYERROR;
8047c478bd9Sstevel@tonic-gate 	}
8050209230bSgjelinek 	| SELECT PSET
8060209230bSgjelinek 	{
8070209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
8080209230bSgjelinek 			YYERROR;
8090209230bSgjelinek 		cmd = $$;
8100209230bSgjelinek 		$$->cmd_handler = &select_func;
8110209230bSgjelinek 		$$->cmd_res_type = RT_DCPU;
8120209230bSgjelinek 	}
813c97ad5cdSakolb 	| SELECT PCAP
814c97ad5cdSakolb 	{
815c97ad5cdSakolb 		if (($$ = alloc_cmd()) == NULL)
816c97ad5cdSakolb 			YYERROR;
817c97ad5cdSakolb 		cmd = $$;
818c97ad5cdSakolb 		$$->cmd_handler = &select_func;
819c97ad5cdSakolb 		$$->cmd_res_type = RT_PCAP;
820c97ad5cdSakolb 	}
8210209230bSgjelinek 	| SELECT MCAP
8220209230bSgjelinek 	{
8230209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
8240209230bSgjelinek 			YYERROR;
8250209230bSgjelinek 		cmd = $$;
8260209230bSgjelinek 		$$->cmd_handler = &select_func;
8270209230bSgjelinek 		$$->cmd_res_type = RT_MCAP;
8280209230bSgjelinek 	}
8297c478bd9Sstevel@tonic-gate 	| SELECT resource_type
8307c478bd9Sstevel@tonic-gate 	{
8317c478bd9Sstevel@tonic-gate 		short_usage(CMD_SELECT);
8327c478bd9Sstevel@tonic-gate 		YYERROR;
8337c478bd9Sstevel@tonic-gate 	}
8347c478bd9Sstevel@tonic-gate 	| SELECT resource_type property_name EQUAL property_value
8357c478bd9Sstevel@tonic-gate 	{
8367c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
8377c478bd9Sstevel@tonic-gate 			YYERROR;
8387c478bd9Sstevel@tonic-gate 		cmd = $$;
8397c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &select_func;
8407c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
8417c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 1;
8427c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
8437c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
8447c478bd9Sstevel@tonic-gate 	}
8457c478bd9Sstevel@tonic-gate 	| SELECT resource_type property_name EQUAL property_value property_name EQUAL property_value
8467c478bd9Sstevel@tonic-gate 	{
8477c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
8487c478bd9Sstevel@tonic-gate 			YYERROR;
8497c478bd9Sstevel@tonic-gate 		cmd = $$;
8507c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &select_func;
8517c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
8527c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 2;
8537c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
8547c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
8557c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[1] = $6;
8567c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[1] = &property[1];
8577c478bd9Sstevel@tonic-gate 	}
8587c478bd9Sstevel@tonic-gate 	| SELECT resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value
8597c478bd9Sstevel@tonic-gate 	{
8607c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
8617c478bd9Sstevel@tonic-gate 			YYERROR;
8627c478bd9Sstevel@tonic-gate 		cmd = $$;
8637c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &select_func;
8647c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
8657c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 3;
8667c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
8677c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
8687c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[1] = $6;
8697c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[1] = &property[1];
8707c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[2] = $9;
8717c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[2] = &property[2];
8727c478bd9Sstevel@tonic-gate 	}
8737c478bd9Sstevel@tonic-gate 
8747c478bd9Sstevel@tonic-gate set_command: SET
8757c478bd9Sstevel@tonic-gate 	{
8767c478bd9Sstevel@tonic-gate 		short_usage(CMD_SET);
8777c478bd9Sstevel@tonic-gate 		(void) fputs("\n", stderr);
878bbec428eSgjelinek 		usage(B_FALSE, HELP_PROPS);
8797c478bd9Sstevel@tonic-gate 		YYERROR;
8807c478bd9Sstevel@tonic-gate 	}
8817c478bd9Sstevel@tonic-gate 	| SET property_name EQUAL OPEN_SQ_BRACKET CLOSE_SQ_BRACKET
8827c478bd9Sstevel@tonic-gate 	{
8837c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
8847c478bd9Sstevel@tonic-gate 			YYERROR;
8857c478bd9Sstevel@tonic-gate 		cmd = $$;
8867c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &set_func;
8877c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
8887c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $2;
8897c478bd9Sstevel@tonic-gate 		property[0].pv_type = PROP_VAL_LIST;
8907c478bd9Sstevel@tonic-gate 		property[0].pv_list = NULL;
8917c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
8927c478bd9Sstevel@tonic-gate 	}
8937c478bd9Sstevel@tonic-gate 	| SET property_name EQUAL property_value
8947c478bd9Sstevel@tonic-gate 	{
8957c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
8967c478bd9Sstevel@tonic-gate 			YYERROR;
8977c478bd9Sstevel@tonic-gate 		cmd = $$;
8987c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &set_func;
8997c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 1;
9007c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $2;
9017c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
9027c478bd9Sstevel@tonic-gate 	}
903555afedfScarlsonj 	| SET TOKEN ZONEPATH EQUAL property_value
904555afedfScarlsonj 	{
905555afedfScarlsonj 		if (($$ = alloc_cmd()) == NULL)
906555afedfScarlsonj 			YYERROR;
907555afedfScarlsonj 		cmd = $$;
908555afedfScarlsonj 		$$->cmd_argc = 1;
9093869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
910555afedfScarlsonj 		$$->cmd_argv[1] = NULL;
911555afedfScarlsonj 		$$->cmd_handler = &set_func;
912555afedfScarlsonj 		$$->cmd_prop_nv_pairs = 1;
913555afedfScarlsonj 		$$->cmd_prop_name[0] = PT_ZONEPATH;
914555afedfScarlsonj 		$$->cmd_property_ptr[0] = &property[0];
915555afedfScarlsonj 	}
9167c478bd9Sstevel@tonic-gate 
9170209230bSgjelinek clear_command: CLEAR
9180209230bSgjelinek 	{
9190209230bSgjelinek 		short_usage(CMD_CLEAR);
9200209230bSgjelinek 		(void) fputs("\n", stderr);
921bbec428eSgjelinek 		usage(B_FALSE, HELP_PROPS);
9220209230bSgjelinek 		YYERROR;
9230209230bSgjelinek 	}
9240209230bSgjelinek 	| CLEAR property_name
9250209230bSgjelinek 	{
9260209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
9270209230bSgjelinek 			YYERROR;
9280209230bSgjelinek 		cmd = $$;
9290209230bSgjelinek 		$$->cmd_handler = &clear_func;
9300209230bSgjelinek 		$$->cmd_res_type = $2;
9310209230bSgjelinek 	}
9320209230bSgjelinek 
9337c478bd9Sstevel@tonic-gate verify_command: VERIFY
9347c478bd9Sstevel@tonic-gate 	{
9357c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
9367c478bd9Sstevel@tonic-gate 			YYERROR;
9377c478bd9Sstevel@tonic-gate 		cmd = $$;
9387c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &verify_func;
9397c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
9407c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
9417c478bd9Sstevel@tonic-gate 	}
9427c478bd9Sstevel@tonic-gate 	| VERIFY TOKEN
9437c478bd9Sstevel@tonic-gate 	{
9447c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
9457c478bd9Sstevel@tonic-gate 			YYERROR;
9467c478bd9Sstevel@tonic-gate 		cmd = $$;
9477c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &verify_func;
9487c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
9493869a938Sjv 		$$->cmd_argv[0] = claim_token($2);
9507c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
9517c478bd9Sstevel@tonic-gate 	}
9527c478bd9Sstevel@tonic-gate 
9537c478bd9Sstevel@tonic-gate resource_type: NET	{ $$ = RT_NET; }
9547c478bd9Sstevel@tonic-gate 	| FS		{ $$ = RT_FS; }
9557c478bd9Sstevel@tonic-gate 	| DEVICE	{ $$ = RT_DEVICE; }
9567c478bd9Sstevel@tonic-gate 	| RCTL		{ $$ = RT_RCTL; }
9577c478bd9Sstevel@tonic-gate 	| ATTR		{ $$ = RT_ATTR; }
958fa9e4066Sahrens 	| DATASET	{ $$ = RT_DATASET; }
9590209230bSgjelinek 	| PSET		{ $$ = RT_DCPU; }
960c97ad5cdSakolb 	| PCAP		{ $$ = RT_PCAP; }
9610209230bSgjelinek 	| MCAP		{ $$ = RT_MCAP; }
962cb8a054bSGlenn Faden 	| ADMIN		{ $$ = RT_ADMIN; }
963d2a70789SRichard Lowe 	| SECFLAGS	{ $$ = RT_SECFLAGS; }
9647c478bd9Sstevel@tonic-gate 
9657c478bd9Sstevel@tonic-gate property_name: SPECIAL	{ $$ = PT_SPECIAL; }
9667c478bd9Sstevel@tonic-gate 	| RAW		{ $$ = PT_RAW; }
9677c478bd9Sstevel@tonic-gate 	| DIR		{ $$ = PT_DIR; }
9687c478bd9Sstevel@tonic-gate 	| TYPE		{ $$ = PT_TYPE; }
9697c478bd9Sstevel@tonic-gate 	| OPTIONS	{ $$ = PT_OPTIONS; }
970087719fdSdp 	| ZONENAME	{ $$ = PT_ZONENAME; }
9717c478bd9Sstevel@tonic-gate 	| ZONEPATH	{ $$ = PT_ZONEPATH; }
9727c478bd9Sstevel@tonic-gate 	| AUTOBOOT	{ $$ = PT_AUTOBOOT; }
973f4b3ec61Sdh 	| IPTYPE	{ $$ = PT_IPTYPE; }
9747c478bd9Sstevel@tonic-gate 	| POOL		{ $$ = PT_POOL; }
975ffbafc53Scomay 	| LIMITPRIV	{ $$ = PT_LIMITPRIV; }
9763f2f09c1Sdp 	| BOOTARGS	{ $$ = PT_BOOTARGS; }
9777c478bd9Sstevel@tonic-gate 	| ADDRESS	{ $$ = PT_ADDRESS; }
978550b6e40SSowmini Varadhan 	| ALLOWED_ADDRESS	{ $$ = PT_ALLOWED_ADDRESS; }
9797c478bd9Sstevel@tonic-gate 	| PHYSICAL	{ $$ = PT_PHYSICAL; }
980de860bd9Sgfaden 	| DEFROUTER	{ $$ = PT_DEFROUTER; }
9817c478bd9Sstevel@tonic-gate 	| NAME		{ $$ = PT_NAME; }
9827c478bd9Sstevel@tonic-gate 	| VALUE		{ $$ = PT_VALUE; }
9837c478bd9Sstevel@tonic-gate 	| MATCH		{ $$ = PT_MATCH; }
9847c478bd9Sstevel@tonic-gate 	| PRIV		{ $$ = PT_PRIV; }
9857c478bd9Sstevel@tonic-gate 	| LIMIT		{ $$ = PT_LIMIT; }
9867c478bd9Sstevel@tonic-gate 	| ACTION	{ $$ = PT_ACTION; }
9879acbbeafSnn 	| BRAND		{ $$ = PT_BRAND; }
9880209230bSgjelinek 	| NCPUS		{ $$ = PT_NCPUS; }
9890209230bSgjelinek 	| LOCKED	{ $$ = PT_LOCKED; }
9900209230bSgjelinek 	| SWAP		{ $$ = PT_SWAP; }
9910209230bSgjelinek 	| IMPORTANCE	{ $$ = PT_IMPORTANCE; }
9920209230bSgjelinek 	| SHARES	{ $$ = PT_SHARES; }
9930209230bSgjelinek 	| MAXLWPS	{ $$ = PT_MAXLWPS; }
994ff19e029SMenno Lageman 	| MAXPROCS	{ $$ = PT_MAXPROCS; }
9950209230bSgjelinek 	| MAXSHMMEM	{ $$ = PT_MAXSHMMEM; }
9960209230bSgjelinek 	| MAXSHMIDS	{ $$ = PT_MAXSHMIDS; }
9970209230bSgjelinek 	| MAXMSGIDS	{ $$ = PT_MAXMSGIDS; }
9980209230bSgjelinek 	| MAXSEMIDS	{ $$ = PT_MAXSEMIDS; }
9990209230bSgjelinek 	| SCHED		{ $$ = PT_SCHED; }
10005679c89fSjv 	| HOSTID	{ $$ = PT_HOSTID; }
1001cb8a054bSGlenn Faden 	| USER		{ $$ = PT_USER; }
1002cb8a054bSGlenn Faden 	| AUTHS 	{ $$ = PT_AUTHS; }
10030fbb751dSJohn Levon 	| FS_ALLOWED	{ $$ = PT_FS_ALLOWED; }
1004d2a70789SRichard Lowe 	| DEFAULT	{ $$ = PT_DEFAULT; }
1005d2a70789SRichard Lowe 	| UPPER		{ $$ = PT_UPPER; }
1006d2a70789SRichard Lowe 	| LOWER		{ $$ = PT_LOWER; }
10077c478bd9Sstevel@tonic-gate 
10087c478bd9Sstevel@tonic-gate /*
10097c478bd9Sstevel@tonic-gate  * The grammar builds data structures from the bottom up.  Thus various
10107c478bd9Sstevel@tonic-gate  * strings are lexed into TOKENs or commands or resource or property values.
10117c478bd9Sstevel@tonic-gate  * Below is where the resource and property values are built up into more
10127c478bd9Sstevel@tonic-gate  * complex data structures.
10137c478bd9Sstevel@tonic-gate  *
10147c478bd9Sstevel@tonic-gate  * There are three kinds of properties: simple (single valued), complex
10157c478bd9Sstevel@tonic-gate  * (one or more name=value pairs) and list (concatenation of one or more
10167c478bd9Sstevel@tonic-gate  * simple or complex properties).
10177c478bd9Sstevel@tonic-gate  *
10187c478bd9Sstevel@tonic-gate  * So the property structure has a type which is one of these, and the
10197c478bd9Sstevel@tonic-gate  * corresponding _simple, _complex or _list is set to the corresponding
10207c478bd9Sstevel@tonic-gate  * lower-level data structure.
10217c478bd9Sstevel@tonic-gate  */
10227c478bd9Sstevel@tonic-gate 
10237c478bd9Sstevel@tonic-gate property_value: simple_prop_val
10247c478bd9Sstevel@tonic-gate 	{
10257c478bd9Sstevel@tonic-gate 		property[num_prop_vals].pv_type = PROP_VAL_SIMPLE;
10267c478bd9Sstevel@tonic-gate 		property[num_prop_vals].pv_simple = $1;
10277c478bd9Sstevel@tonic-gate 		if (list[num_prop_vals] != NULL) {
10287c478bd9Sstevel@tonic-gate 			free_outer_list(list[num_prop_vals]);
10297c478bd9Sstevel@tonic-gate 			list[num_prop_vals] = NULL;
10307c478bd9Sstevel@tonic-gate 		}
10317c478bd9Sstevel@tonic-gate 		num_prop_vals++;
10327c478bd9Sstevel@tonic-gate 	}
10337c478bd9Sstevel@tonic-gate 	| complex_prop_val
10347c478bd9Sstevel@tonic-gate 	{
10357c478bd9Sstevel@tonic-gate 		property[num_prop_vals].pv_type = PROP_VAL_COMPLEX;
10367c478bd9Sstevel@tonic-gate 		property[num_prop_vals].pv_complex = complex;
10377c478bd9Sstevel@tonic-gate 		if (list[num_prop_vals] != NULL) {
10387c478bd9Sstevel@tonic-gate 			free_outer_list(list[num_prop_vals]);
10397c478bd9Sstevel@tonic-gate 			list[num_prop_vals] = NULL;
10407c478bd9Sstevel@tonic-gate 		}
10417c478bd9Sstevel@tonic-gate 		num_prop_vals++;
10427c478bd9Sstevel@tonic-gate 	}
10437c478bd9Sstevel@tonic-gate 	| list_prop_val
10447c478bd9Sstevel@tonic-gate 	{
10457c478bd9Sstevel@tonic-gate 		property[num_prop_vals].pv_type = PROP_VAL_LIST;
10467c478bd9Sstevel@tonic-gate 		property[num_prop_vals].pv_list = list[num_prop_vals];
10477c478bd9Sstevel@tonic-gate 		num_prop_vals++;
10487c478bd9Sstevel@tonic-gate 	}
10497c478bd9Sstevel@tonic-gate 
10507c478bd9Sstevel@tonic-gate /*
10517c478bd9Sstevel@tonic-gate  * One level lower, lists are made up of simple or complex values, so
10527c478bd9Sstevel@tonic-gate  * simple_prop_val and complex_prop_val fill in a list structure and
10537c478bd9Sstevel@tonic-gate  * insert it into the linked list which is built up.  And because
10547c478bd9Sstevel@tonic-gate  * complex properties can have multiple name=value pairs, we keep
10557c478bd9Sstevel@tonic-gate  * track of them in another linked list.
10567c478bd9Sstevel@tonic-gate  *
10577c478bd9Sstevel@tonic-gate  * The complex and list structures for the linked lists are allocated
10587c478bd9Sstevel@tonic-gate  * below, and freed by recursive functions which are ultimately called
10597c478bd9Sstevel@tonic-gate  * by free_cmd(), which is called from the top-most "commands" part of
10607c478bd9Sstevel@tonic-gate  * the grammar.
1061c94c1ef0Sjv  *
1062c94c1ef0Sjv  * NOTE: simple_prop_val and complex_piece need reduction rules for
1063c94c1ef0Sjv  * property_name and resource_type so that the parser will accept property names
1064c94c1ef0Sjv  * and resource type names as property values.
10657c478bd9Sstevel@tonic-gate  */
10667c478bd9Sstevel@tonic-gate 
10677c478bd9Sstevel@tonic-gate simple_prop_val: TOKEN
10687c478bd9Sstevel@tonic-gate 	{
1069c94c1ef0Sjv 		$$ = simple_prop_val_func($1);
10703869a938Sjv 		free(claim_token($1));
1071c94c1ef0Sjv 		if ($$ == NULL)
1072c94c1ef0Sjv 			YYERROR;
1073c94c1ef0Sjv 	}
1074c94c1ef0Sjv 	| resource_type
1075c94c1ef0Sjv 	{
1076c94c1ef0Sjv 		if (($$ = simple_prop_val_func(res_types[$1])) == NULL)
1077c94c1ef0Sjv 			YYERROR;
1078c94c1ef0Sjv 	}
1079c94c1ef0Sjv 	| property_name
1080c94c1ef0Sjv 	{
1081c94c1ef0Sjv 		if (($$ = simple_prop_val_func(prop_types[$1])) == NULL)
10827c478bd9Sstevel@tonic-gate 			YYERROR;
10837c478bd9Sstevel@tonic-gate 	}
10847c478bd9Sstevel@tonic-gate 
10857c478bd9Sstevel@tonic-gate complex_prop_val: OPEN_PAREN complex_piece CLOSE_PAREN
10867c478bd9Sstevel@tonic-gate 	{
10877c478bd9Sstevel@tonic-gate 		if ((new_list = alloc_list()) == NULL)
10887c478bd9Sstevel@tonic-gate 			YYERROR;
10897c478bd9Sstevel@tonic-gate 		new_list->lp_simple = NULL;
10907c478bd9Sstevel@tonic-gate 		new_list->lp_complex = complex;
10917c478bd9Sstevel@tonic-gate 		new_list->lp_next = NULL;
10927c478bd9Sstevel@tonic-gate 		if (list[num_prop_vals] == NULL) {
10937c478bd9Sstevel@tonic-gate 			list[num_prop_vals] = new_list;
10947c478bd9Sstevel@tonic-gate 		} else {
10957c478bd9Sstevel@tonic-gate 			for (tmp_list = list[num_prop_vals]; tmp_list != NULL;
10967c478bd9Sstevel@tonic-gate 			    tmp_list = tmp_list->lp_next)
10977c478bd9Sstevel@tonic-gate 				last = tmp_list;
10987c478bd9Sstevel@tonic-gate 			last->lp_next = new_list;
10997c478bd9Sstevel@tonic-gate 		}
11007c478bd9Sstevel@tonic-gate 	}
11017c478bd9Sstevel@tonic-gate 
11027c478bd9Sstevel@tonic-gate complex_piece: property_name EQUAL TOKEN
11037c478bd9Sstevel@tonic-gate 	{
1104c94c1ef0Sjv 		$$ = complex_piece_func($1, $3, NULL);
11053869a938Sjv 		free(claim_token($3));
1106c94c1ef0Sjv 		if ($$ == NULL)
1107c94c1ef0Sjv 			YYERROR;
1108c94c1ef0Sjv 	}
1109c94c1ef0Sjv 	| property_name EQUAL resource_type
1110c94c1ef0Sjv 	{
1111c94c1ef0Sjv 		if (($$ = complex_piece_func($1, res_types[$3], NULL)) == NULL)
1112c94c1ef0Sjv 			YYERROR;
1113c94c1ef0Sjv 	}
1114c94c1ef0Sjv 	| property_name EQUAL property_name
1115c94c1ef0Sjv 	{
1116c94c1ef0Sjv 		if (($$ = complex_piece_func($1, prop_types[$3], NULL)) == NULL)
11177c478bd9Sstevel@tonic-gate 			YYERROR;
11187c478bd9Sstevel@tonic-gate 	}
1119d2a70789SRichard Lowe 	| property_name EQUAL TOKEN COMMA complex_piece
11207c478bd9Sstevel@tonic-gate 	{
1121c94c1ef0Sjv 		$$ = complex_piece_func($1, $3, complex);
11223869a938Sjv 		free(claim_token($3));
1123c94c1ef0Sjv 		if ($$ == NULL)
1124c94c1ef0Sjv 			YYERROR;
1125c94c1ef0Sjv 	}
1126d2a70789SRichard Lowe 	| property_name EQUAL resource_type COMMA complex_piece
1127c94c1ef0Sjv 	{
1128c94c1ef0Sjv 		if (($$ = complex_piece_func($1, res_types[$3], complex)) ==
1129c94c1ef0Sjv 		    NULL)
1130c94c1ef0Sjv 			YYERROR;
1131c94c1ef0Sjv 	}
1132d2a70789SRichard Lowe 	| property_name EQUAL property_name COMMA complex_piece
1133c94c1ef0Sjv 	{
1134c94c1ef0Sjv 		if (($$ = complex_piece_func($1, prop_types[$3], complex)) ==
1135c94c1ef0Sjv 		    NULL)
11367c478bd9Sstevel@tonic-gate 			YYERROR;
11377c478bd9Sstevel@tonic-gate 	}
11387c478bd9Sstevel@tonic-gate 
11397c478bd9Sstevel@tonic-gate list_piece: simple_prop_val
11407c478bd9Sstevel@tonic-gate 	| complex_prop_val
11417c478bd9Sstevel@tonic-gate 	| simple_prop_val COMMA list_piece
11427c478bd9Sstevel@tonic-gate 	| complex_prop_val COMMA list_piece
11437c478bd9Sstevel@tonic-gate 
11447c478bd9Sstevel@tonic-gate list_prop_val: OPEN_SQ_BRACKET list_piece CLOSE_SQ_BRACKET
11457c478bd9Sstevel@tonic-gate %%
1146