xref: /illumos-gate/usr/src/cmd/zonecfg/zonecfg_grammar.y (revision 550b6e4083768ca350e9e7c3a1ebbf720b23dcad)
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
1256e1ae2a3SGary Pennington %token FS ATTR DEVICE RCTL SPECIAL RAW DIR OPTIONS TYPE ADDRESS PHYSICAL
126*550b6e40SSowmini Varadhan %token IPTYPE HOSTID FS_ALLOWED ALLOWED_ADDRESS
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
130ff19e029SMenno 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
1356e1ae2a3SGary Pennington %type <ival> resource_type NET FS 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
140*550b6e40SSowmini Varadhan     ALLOWED_ADDRESS
1417c478bd9Sstevel@tonic-gate %type <cmd> command
1427c478bd9Sstevel@tonic-gate %type <cmd> add_command ADD
1437c478bd9Sstevel@tonic-gate %type <cmd> cancel_command CANCEL
1447c478bd9Sstevel@tonic-gate %type <cmd> commit_command COMMIT
1457c478bd9Sstevel@tonic-gate %type <cmd> create_command CREATE
1467c478bd9Sstevel@tonic-gate %type <cmd> delete_command DELETE
1477c478bd9Sstevel@tonic-gate %type <cmd> end_command END
1487c478bd9Sstevel@tonic-gate %type <cmd> exit_command EXIT
1497c478bd9Sstevel@tonic-gate %type <cmd> export_command EXPORT
1507c478bd9Sstevel@tonic-gate %type <cmd> help_command HELP
1517c478bd9Sstevel@tonic-gate %type <cmd> info_command INFO
1527c478bd9Sstevel@tonic-gate %type <cmd> remove_command REMOVE
1537c478bd9Sstevel@tonic-gate %type <cmd> revert_command REVERT
1547c478bd9Sstevel@tonic-gate %type <cmd> select_command SELECT
1557c478bd9Sstevel@tonic-gate %type <cmd> set_command SET
1560209230bSgjelinek %type <cmd> clear_command CLEAR
1577c478bd9Sstevel@tonic-gate %type <cmd> verify_command VERIFY
1587c478bd9Sstevel@tonic-gate %type <cmd> terminator
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate %%
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate commands: command terminator
1637c478bd9Sstevel@tonic-gate 	{
1647c478bd9Sstevel@tonic-gate 		if ($1 != NULL) {
1657c478bd9Sstevel@tonic-gate 			if ($1->cmd_handler != NULL)
1667c478bd9Sstevel@tonic-gate 				$1->cmd_handler($1);
1677c478bd9Sstevel@tonic-gate 			free_cmd($1);
1687c478bd9Sstevel@tonic-gate 			bzero(list, sizeof (list_property_t));
1697c478bd9Sstevel@tonic-gate 			num_prop_vals = 0;
1707c478bd9Sstevel@tonic-gate 		}
1717c478bd9Sstevel@tonic-gate 		return (0);
1727c478bd9Sstevel@tonic-gate 	}
1737c478bd9Sstevel@tonic-gate 	| command error terminator
1747c478bd9Sstevel@tonic-gate 	{
1757c478bd9Sstevel@tonic-gate 		if ($1 != NULL) {
1767c478bd9Sstevel@tonic-gate 			free_cmd($1);
1777c478bd9Sstevel@tonic-gate 			bzero(list, sizeof (list_property_t));
1787c478bd9Sstevel@tonic-gate 			num_prop_vals = 0;
1797c478bd9Sstevel@tonic-gate 		}
1807c478bd9Sstevel@tonic-gate 		if (YYRECOVERING())
1817e362f58Scomay 			YYABORT;
1827c478bd9Sstevel@tonic-gate 		yyclearin;
1837c478bd9Sstevel@tonic-gate 		yyerrok;
1847c478bd9Sstevel@tonic-gate 	}
1857c478bd9Sstevel@tonic-gate 	| error terminator
1867c478bd9Sstevel@tonic-gate 	{
1877c478bd9Sstevel@tonic-gate 		if (YYRECOVERING())
1887e362f58Scomay 			YYABORT;
1897c478bd9Sstevel@tonic-gate 		yyclearin;
1907c478bd9Sstevel@tonic-gate 		yyerrok;
1917c478bd9Sstevel@tonic-gate 	}
1927c478bd9Sstevel@tonic-gate 	| terminator
1937c478bd9Sstevel@tonic-gate 	{
1947c478bd9Sstevel@tonic-gate 		return (0);
1957c478bd9Sstevel@tonic-gate 	}
1967c478bd9Sstevel@tonic-gate 
1977c478bd9Sstevel@tonic-gate command: add_command
1987c478bd9Sstevel@tonic-gate 	| cancel_command
1990209230bSgjelinek 	| clear_command
2007c478bd9Sstevel@tonic-gate 	| create_command
2017c478bd9Sstevel@tonic-gate 	| commit_command
2027c478bd9Sstevel@tonic-gate 	| delete_command
2037c478bd9Sstevel@tonic-gate 	| end_command
2047c478bd9Sstevel@tonic-gate 	| exit_command
2057c478bd9Sstevel@tonic-gate 	| export_command
2067c478bd9Sstevel@tonic-gate 	| help_command
2077c478bd9Sstevel@tonic-gate 	| info_command
2087c478bd9Sstevel@tonic-gate 	| remove_command
2097c478bd9Sstevel@tonic-gate 	| revert_command
2107c478bd9Sstevel@tonic-gate 	| select_command
2117c478bd9Sstevel@tonic-gate 	| set_command
2127c478bd9Sstevel@tonic-gate 	| verify_command
2137c478bd9Sstevel@tonic-gate 
214bbec428eSgjelinek terminator:	'\n'	{ newline_terminated = B_TRUE; }
215bbec428eSgjelinek 	|	';'	{ newline_terminated = B_FALSE; }
2167c478bd9Sstevel@tonic-gate 
2177c478bd9Sstevel@tonic-gate add_command: ADD
2187c478bd9Sstevel@tonic-gate 	{
2197c478bd9Sstevel@tonic-gate 		short_usage(CMD_ADD);
2207c478bd9Sstevel@tonic-gate 		(void) fputs("\n", stderr);
221bbec428eSgjelinek 		usage(B_FALSE, HELP_RES_PROPS);
2227c478bd9Sstevel@tonic-gate 		YYERROR;
2237c478bd9Sstevel@tonic-gate 	}
2247c478bd9Sstevel@tonic-gate 	| ADD TOKEN
2257c478bd9Sstevel@tonic-gate 	{
2267c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2277c478bd9Sstevel@tonic-gate 			YYERROR;
2287c478bd9Sstevel@tonic-gate 		cmd = $$;
2297c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &add_func;
2307c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
2317c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
2327c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
2337c478bd9Sstevel@tonic-gate 	}
2347c478bd9Sstevel@tonic-gate 	| ADD resource_type
2357c478bd9Sstevel@tonic-gate 	{
2367c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2377c478bd9Sstevel@tonic-gate 			YYERROR;
2387c478bd9Sstevel@tonic-gate 		cmd = $$;
2397c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &add_func;
2407c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
2417c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
2427c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
2437c478bd9Sstevel@tonic-gate 	}
2447c478bd9Sstevel@tonic-gate 	| ADD property_name property_value
2457c478bd9Sstevel@tonic-gate 	{
2467c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2477c478bd9Sstevel@tonic-gate 			YYERROR;
2487c478bd9Sstevel@tonic-gate 		cmd = $$;
2497c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &add_func;
2507c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
2517c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 1;
2527c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $2;
2537c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
2547c478bd9Sstevel@tonic-gate 	}
2557c478bd9Sstevel@tonic-gate 
2567c478bd9Sstevel@tonic-gate cancel_command: CANCEL
2577c478bd9Sstevel@tonic-gate 	{
2587c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2597c478bd9Sstevel@tonic-gate 			YYERROR;
2607c478bd9Sstevel@tonic-gate 		cmd = $$;
2617c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &cancel_func;
2627c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
2637c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
2647c478bd9Sstevel@tonic-gate 	}
2657c478bd9Sstevel@tonic-gate 	| CANCEL TOKEN
2667c478bd9Sstevel@tonic-gate 	{
2677c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2687c478bd9Sstevel@tonic-gate 			YYERROR;
2697c478bd9Sstevel@tonic-gate 		cmd = $$;
2707c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &cancel_func;
2717c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
2727c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
2737c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
2747c478bd9Sstevel@tonic-gate 	}
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate create_command: CREATE
2777c478bd9Sstevel@tonic-gate 	{
2787c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2797c478bd9Sstevel@tonic-gate 			YYERROR;
2807c478bd9Sstevel@tonic-gate 		cmd = $$;
2817c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &create_func;
2827c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
2837c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
2847c478bd9Sstevel@tonic-gate 	}
2857c478bd9Sstevel@tonic-gate 	| CREATE TOKEN
2867c478bd9Sstevel@tonic-gate 	{
2877c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2887c478bd9Sstevel@tonic-gate 			YYERROR;
2897c478bd9Sstevel@tonic-gate 		cmd = $$;
2907c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &create_func;
2917c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
2927c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
2937c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
2947c478bd9Sstevel@tonic-gate 	}
2957c478bd9Sstevel@tonic-gate 	| CREATE TOKEN TOKEN
2967c478bd9Sstevel@tonic-gate 	{
2977c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
2987c478bd9Sstevel@tonic-gate 			YYERROR;
2997c478bd9Sstevel@tonic-gate 		cmd = $$;
3007c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &create_func;
3017c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 2;
3027c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
3037c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = $3;
3047c478bd9Sstevel@tonic-gate 		$$->cmd_argv[2] = NULL;
3057c478bd9Sstevel@tonic-gate 	}
3067c478bd9Sstevel@tonic-gate 	| CREATE TOKEN TOKEN TOKEN
3077c478bd9Sstevel@tonic-gate 	{
3087c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3097c478bd9Sstevel@tonic-gate 			YYERROR;
3107c478bd9Sstevel@tonic-gate 		cmd = $$;
3117c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &create_func;
3127c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 3;
3137c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
3147c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = $3;
3157c478bd9Sstevel@tonic-gate 		$$->cmd_argv[2] = $4;
3167c478bd9Sstevel@tonic-gate 		$$->cmd_argv[3] = NULL;
3177c478bd9Sstevel@tonic-gate 	}
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate commit_command: COMMIT
3207c478bd9Sstevel@tonic-gate 	{
3217c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3227c478bd9Sstevel@tonic-gate 			YYERROR;
3237c478bd9Sstevel@tonic-gate 		cmd = $$;
3247c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &commit_func;
3257c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
3267c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
3277c478bd9Sstevel@tonic-gate 	}
3287c478bd9Sstevel@tonic-gate 	| COMMIT TOKEN
3297c478bd9Sstevel@tonic-gate 	{
3307c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3317c478bd9Sstevel@tonic-gate 			YYERROR;
3327c478bd9Sstevel@tonic-gate 		cmd = $$;
3337c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &commit_func;
3347c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
3357c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
3367c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
3377c478bd9Sstevel@tonic-gate 	}
3387c478bd9Sstevel@tonic-gate 
3397c478bd9Sstevel@tonic-gate delete_command: DELETE
3407c478bd9Sstevel@tonic-gate 	{
3417c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3427c478bd9Sstevel@tonic-gate 			YYERROR;
3437c478bd9Sstevel@tonic-gate 		cmd = $$;
3447c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &delete_func;
3457c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
3467c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
3477c478bd9Sstevel@tonic-gate 	}
3487c478bd9Sstevel@tonic-gate 	|	DELETE TOKEN
3497c478bd9Sstevel@tonic-gate 	{
3507c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3517c478bd9Sstevel@tonic-gate 			YYERROR;
3527c478bd9Sstevel@tonic-gate 		cmd = $$;
3537c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &delete_func;
3547c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
3557c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
3567c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
3577c478bd9Sstevel@tonic-gate 	}
3587c478bd9Sstevel@tonic-gate 
3597c478bd9Sstevel@tonic-gate end_command: END
3607c478bd9Sstevel@tonic-gate 	{
3617c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3627c478bd9Sstevel@tonic-gate 			YYERROR;
3637c478bd9Sstevel@tonic-gate 		cmd = $$;
3647c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &end_func;
3657c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
3667c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
3677c478bd9Sstevel@tonic-gate 	}
3687c478bd9Sstevel@tonic-gate 	| END TOKEN
3697c478bd9Sstevel@tonic-gate 	{
3707c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3717c478bd9Sstevel@tonic-gate 			YYERROR;
3727c478bd9Sstevel@tonic-gate 		cmd = $$;
3737c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &end_func;
3747c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
3757c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
3767c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
3777c478bd9Sstevel@tonic-gate 	}
3787c478bd9Sstevel@tonic-gate 
3797c478bd9Sstevel@tonic-gate exit_command: EXIT
3807c478bd9Sstevel@tonic-gate 	{
3817c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3827c478bd9Sstevel@tonic-gate 			YYERROR;
3837c478bd9Sstevel@tonic-gate 		cmd = $$;
3847c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &exit_func;
3857c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
3867c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
3877c478bd9Sstevel@tonic-gate 	}
3887c478bd9Sstevel@tonic-gate 	| EXIT TOKEN
3897c478bd9Sstevel@tonic-gate 	{
3907c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
3917c478bd9Sstevel@tonic-gate 			YYERROR;
3927c478bd9Sstevel@tonic-gate 		cmd = $$;
3937c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &exit_func;
3947c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
3957c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
3967c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
3977c478bd9Sstevel@tonic-gate 	}
3987c478bd9Sstevel@tonic-gate 
3997c478bd9Sstevel@tonic-gate export_command: EXPORT
4007c478bd9Sstevel@tonic-gate 	{
4017c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4027c478bd9Sstevel@tonic-gate 			YYERROR;
4037c478bd9Sstevel@tonic-gate 		cmd = $$;
4047c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &export_func;
4057c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
4067c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
4077c478bd9Sstevel@tonic-gate 	}
4087c478bd9Sstevel@tonic-gate 	| EXPORT TOKEN
4097c478bd9Sstevel@tonic-gate 	{
4107c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4117c478bd9Sstevel@tonic-gate 			YYERROR;
4127c478bd9Sstevel@tonic-gate 		cmd = $$;
4137c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &export_func;
4147c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
4157c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
4167c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
4177c478bd9Sstevel@tonic-gate 	}
4187c478bd9Sstevel@tonic-gate 	| EXPORT TOKEN TOKEN
4197c478bd9Sstevel@tonic-gate 	{
4207c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4217c478bd9Sstevel@tonic-gate 			YYERROR;
4227c478bd9Sstevel@tonic-gate 		cmd = $$;
4237c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &export_func;
4247c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 2;
4257c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
4267c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = $3;
4277c478bd9Sstevel@tonic-gate 		$$->cmd_argv[2] = NULL;
4287c478bd9Sstevel@tonic-gate 	}
4297c478bd9Sstevel@tonic-gate 
4307c478bd9Sstevel@tonic-gate help_command:	HELP
4317c478bd9Sstevel@tonic-gate 	{
4327c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4337c478bd9Sstevel@tonic-gate 			YYERROR;
4347c478bd9Sstevel@tonic-gate 		cmd = $$;
4357c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &help_func;
4367c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
4377c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
4387c478bd9Sstevel@tonic-gate 	}
4397c478bd9Sstevel@tonic-gate 	|	HELP TOKEN
4407c478bd9Sstevel@tonic-gate 	{
4417c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4427c478bd9Sstevel@tonic-gate 			YYERROR;
4437c478bd9Sstevel@tonic-gate 		cmd = $$;
4447c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &help_func;
4457c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
4467c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
4477c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
4487c478bd9Sstevel@tonic-gate 	}
4497c478bd9Sstevel@tonic-gate 
4507c478bd9Sstevel@tonic-gate info_command:	INFO
4517c478bd9Sstevel@tonic-gate 	{
4527c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4537c478bd9Sstevel@tonic-gate 			YYERROR;
4547c478bd9Sstevel@tonic-gate 		cmd = $$;
4557c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
4567c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = RT_UNKNOWN;
4577c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
4587c478bd9Sstevel@tonic-gate 	}
4597c478bd9Sstevel@tonic-gate 	|	INFO TOKEN
4607c478bd9Sstevel@tonic-gate 	{
4617c478bd9Sstevel@tonic-gate 		short_usage(CMD_INFO);
4627c478bd9Sstevel@tonic-gate 		(void) fputs("\n", stderr);
463bbec428eSgjelinek 		usage(B_FALSE, HELP_RES_PROPS);
4647c478bd9Sstevel@tonic-gate 		free($2);
4657c478bd9Sstevel@tonic-gate 		YYERROR;
4667c478bd9Sstevel@tonic-gate 	}
4677c478bd9Sstevel@tonic-gate 	|	INFO resource_type
4687c478bd9Sstevel@tonic-gate 	{
4697c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4707c478bd9Sstevel@tonic-gate 			YYERROR;
4717c478bd9Sstevel@tonic-gate 		cmd = $$;
4727c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
4737c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
4747c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
4757c478bd9Sstevel@tonic-gate 	}
476087719fdSdp 	|	INFO ZONENAME
477087719fdSdp 	{
478087719fdSdp 		if (($$ = alloc_cmd()) == NULL)
479087719fdSdp 			YYERROR;
480087719fdSdp 		cmd = $$;
481087719fdSdp 		$$->cmd_handler = &info_func;
482087719fdSdp 		$$->cmd_res_type = RT_ZONENAME;
483087719fdSdp 		$$->cmd_prop_nv_pairs = 0;
484087719fdSdp 	}
4857c478bd9Sstevel@tonic-gate 	|	INFO ZONEPATH
4867c478bd9Sstevel@tonic-gate 	{
4877c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
4887c478bd9Sstevel@tonic-gate 			YYERROR;
4897c478bd9Sstevel@tonic-gate 		cmd = $$;
4907c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
4917c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = RT_ZONEPATH;
4927c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
4937c478bd9Sstevel@tonic-gate 	}
4949acbbeafSnn 	|	INFO BRAND
4959acbbeafSnn 	{
4969acbbeafSnn 		if (($$ = alloc_cmd()) == NULL)
4979acbbeafSnn 			YYERROR;
4989acbbeafSnn 		cmd = $$;
4999acbbeafSnn 		$$->cmd_handler = &info_func;
5009acbbeafSnn 		$$->cmd_res_type = RT_BRAND;
5019acbbeafSnn 		$$->cmd_prop_nv_pairs = 0;
5029acbbeafSnn 	}
5037c478bd9Sstevel@tonic-gate 	|	INFO AUTOBOOT
5047c478bd9Sstevel@tonic-gate 	{
5057c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
5067c478bd9Sstevel@tonic-gate 			YYERROR;
5077c478bd9Sstevel@tonic-gate 		cmd = $$;
5087c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
5097c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = RT_AUTOBOOT;
5107c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
5117c478bd9Sstevel@tonic-gate 	}
512f4b3ec61Sdh 	|	INFO IPTYPE
513f4b3ec61Sdh 	{
514f4b3ec61Sdh 		if (($$ = alloc_cmd()) == NULL)
515f4b3ec61Sdh 			YYERROR;
516f4b3ec61Sdh 		cmd = $$;
517f4b3ec61Sdh 		$$->cmd_handler = &info_func;
518f4b3ec61Sdh 		$$->cmd_res_type = RT_IPTYPE;
519f4b3ec61Sdh 		$$->cmd_prop_nv_pairs = 0;
520f4b3ec61Sdh 	}
5217c478bd9Sstevel@tonic-gate 	|	INFO POOL
5227c478bd9Sstevel@tonic-gate 	{
5237c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
5247c478bd9Sstevel@tonic-gate 			YYERROR;
5257c478bd9Sstevel@tonic-gate 		cmd = $$;
5267c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
5277c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = RT_POOL;
5287c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
5297c478bd9Sstevel@tonic-gate 	}
530ffbafc53Scomay 	|	INFO LIMITPRIV
531ffbafc53Scomay 	{
532ffbafc53Scomay 		if (($$ = alloc_cmd()) == NULL)
533ffbafc53Scomay 			YYERROR;
534ffbafc53Scomay 		cmd = $$;
535ffbafc53Scomay 		$$->cmd_handler = &info_func;
536ffbafc53Scomay 		$$->cmd_res_type = RT_LIMITPRIV;
537ffbafc53Scomay 		$$->cmd_prop_nv_pairs = 0;
538ffbafc53Scomay 	}
5393f2f09c1Sdp 	|	INFO BOOTARGS
5403f2f09c1Sdp 	{
5413f2f09c1Sdp 		if (($$ = alloc_cmd()) == NULL)
5423f2f09c1Sdp 			YYERROR;
5433f2f09c1Sdp 		cmd = $$;
5443f2f09c1Sdp 		$$->cmd_handler = &info_func;
5453f2f09c1Sdp 		$$->cmd_res_type = RT_BOOTARGS;
5463f2f09c1Sdp 		$$->cmd_prop_nv_pairs = 0;
5473f2f09c1Sdp 	}
5480209230bSgjelinek 	|	INFO SCHED
5490209230bSgjelinek 	{
5500209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
5510209230bSgjelinek 			YYERROR;
5520209230bSgjelinek 		cmd = $$;
5530209230bSgjelinek 		$$->cmd_handler = &info_func;
5540209230bSgjelinek 		$$->cmd_res_type = RT_SCHED;
5550209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
5560209230bSgjelinek 	}
5570209230bSgjelinek 	|	INFO SHARES
5580209230bSgjelinek 	{
5590209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
5600209230bSgjelinek 			YYERROR;
5610209230bSgjelinek 		cmd = $$;
5620209230bSgjelinek 		$$->cmd_handler = &info_func;
5630209230bSgjelinek 		$$->cmd_res_type = RT_SHARES;
5640209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
5650209230bSgjelinek 	}
5660209230bSgjelinek 	|	INFO MAXLWPS
5670209230bSgjelinek 	{
5680209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
5690209230bSgjelinek 			YYERROR;
5700209230bSgjelinek 		cmd = $$;
5710209230bSgjelinek 		$$->cmd_handler = &info_func;
5720209230bSgjelinek 		$$->cmd_res_type = RT_MAXLWPS;
5730209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
5740209230bSgjelinek 	}
575ff19e029SMenno Lageman 	|	INFO MAXPROCS
576ff19e029SMenno Lageman 	{
577ff19e029SMenno Lageman 		if (($$ = alloc_cmd()) == NULL)
578ff19e029SMenno Lageman 			YYERROR;
579ff19e029SMenno Lageman 		cmd = $$;
580ff19e029SMenno Lageman 		$$->cmd_handler = &info_func;
581ff19e029SMenno Lageman 		$$->cmd_res_type = RT_MAXPROCS;
582ff19e029SMenno Lageman 		$$->cmd_prop_nv_pairs = 0;
583ff19e029SMenno Lageman 	}
5840209230bSgjelinek 	|	INFO MAXSHMMEM
5850209230bSgjelinek 	{
5860209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
5870209230bSgjelinek 			YYERROR;
5880209230bSgjelinek 		cmd = $$;
5890209230bSgjelinek 		$$->cmd_handler = &info_func;
5900209230bSgjelinek 		$$->cmd_res_type = RT_MAXSHMMEM;
5910209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
5920209230bSgjelinek 	}
5930209230bSgjelinek 	|	INFO MAXSHMIDS
5940209230bSgjelinek 	{
5950209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
5960209230bSgjelinek 			YYERROR;
5970209230bSgjelinek 		cmd = $$;
5980209230bSgjelinek 		$$->cmd_handler = &info_func;
5990209230bSgjelinek 		$$->cmd_res_type = RT_MAXSHMIDS;
6000209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
6010209230bSgjelinek 	}
6020209230bSgjelinek 	|	INFO MAXMSGIDS
6030209230bSgjelinek 	{
6040209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
6050209230bSgjelinek 			YYERROR;
6060209230bSgjelinek 		cmd = $$;
6070209230bSgjelinek 		$$->cmd_handler = &info_func;
6080209230bSgjelinek 		$$->cmd_res_type = RT_MAXMSGIDS;
6090209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
6100209230bSgjelinek 	}
6110209230bSgjelinek 	|	INFO MAXSEMIDS
6120209230bSgjelinek 	{
6130209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
6140209230bSgjelinek 			YYERROR;
6150209230bSgjelinek 		cmd = $$;
6160209230bSgjelinek 		$$->cmd_handler = &info_func;
6170209230bSgjelinek 		$$->cmd_res_type = RT_MAXSEMIDS;
6180209230bSgjelinek 		$$->cmd_prop_nv_pairs = 0;
6190209230bSgjelinek 	}
6205679c89fSjv 	|	INFO HOSTID
6215679c89fSjv 	{
6225679c89fSjv 		if (($$ = alloc_cmd()) == NULL)
6235679c89fSjv 			YYERROR;
6245679c89fSjv 		cmd = $$;
6255679c89fSjv 		$$->cmd_handler = &info_func;
6265679c89fSjv 		$$->cmd_res_type = RT_HOSTID;
6275679c89fSjv 		$$->cmd_prop_nv_pairs = 0;
6285679c89fSjv 	}
6290fbb751dSJohn Levon 	|	INFO FS_ALLOWED
6300fbb751dSJohn Levon 	{
6310fbb751dSJohn Levon 		if (($$ = alloc_cmd()) == NULL)
6320fbb751dSJohn Levon 			YYERROR;
6330fbb751dSJohn Levon 		cmd = $$;
6340fbb751dSJohn Levon 		$$->cmd_handler = &info_func;
6350fbb751dSJohn Levon 		$$->cmd_res_type = RT_FS_ALLOWED;
6360fbb751dSJohn Levon 		$$->cmd_prop_nv_pairs = 0;
6370fbb751dSJohn Levon 	}
6387c478bd9Sstevel@tonic-gate 	|	INFO resource_type property_name EQUAL property_value
6397c478bd9Sstevel@tonic-gate 	{
6407c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
6417c478bd9Sstevel@tonic-gate 			YYERROR;
6427c478bd9Sstevel@tonic-gate 		cmd = $$;
6437c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
6447c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
6457c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 1;
6467c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
6477c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
6487c478bd9Sstevel@tonic-gate 	}
6497c478bd9Sstevel@tonic-gate 	|	INFO resource_type property_name EQUAL property_value property_name EQUAL property_value
6507c478bd9Sstevel@tonic-gate 	{
6517c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
6527c478bd9Sstevel@tonic-gate 			YYERROR;
6537c478bd9Sstevel@tonic-gate 		cmd = $$;
6547c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
6557c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
6567c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 2;
6577c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
6587c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
6597c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[1] = $6;
6607c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[1] = &property[1];
6617c478bd9Sstevel@tonic-gate 	}
6627c478bd9Sstevel@tonic-gate 	|	INFO resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value
6637c478bd9Sstevel@tonic-gate 	{
6647c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
6657c478bd9Sstevel@tonic-gate 			YYERROR;
6667c478bd9Sstevel@tonic-gate 		cmd = $$;
6677c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &info_func;
6687c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
6697c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 3;
6707c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
6717c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
6727c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[1] = $6;
6737c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[1] = &property[1];
6747c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[2] = $9;
6757c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[2] = &property[2];
6767c478bd9Sstevel@tonic-gate 	}
6777c478bd9Sstevel@tonic-gate 
6787c478bd9Sstevel@tonic-gate remove_command: REMOVE
6797c478bd9Sstevel@tonic-gate 	{
6807c478bd9Sstevel@tonic-gate 		short_usage(CMD_REMOVE);
6817c478bd9Sstevel@tonic-gate 		(void) fputs("\n", stderr);
682bbec428eSgjelinek 		usage(B_FALSE, HELP_RES_PROPS);
6837c478bd9Sstevel@tonic-gate 		YYERROR;
6847c478bd9Sstevel@tonic-gate 	}
6850209230bSgjelinek 	| REMOVE TOKEN
6867c478bd9Sstevel@tonic-gate 	{
6877c478bd9Sstevel@tonic-gate 		short_usage(CMD_REMOVE);
6880209230bSgjelinek 		(void) fputs("\n", stderr);
689bbec428eSgjelinek 		usage(B_FALSE, HELP_RES_PROPS);
6907c478bd9Sstevel@tonic-gate 		YYERROR;
6917c478bd9Sstevel@tonic-gate 	}
6920209230bSgjelinek 	| REMOVE resource_type
6930209230bSgjelinek 	{
6940209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
6950209230bSgjelinek 			YYERROR;
6960209230bSgjelinek 		cmd = $$;
6970209230bSgjelinek 		$$->cmd_handler = &remove_func;
6980209230bSgjelinek 		$$->cmd_res_type = $2;
6990209230bSgjelinek 	}
7000209230bSgjelinek 	| REMOVE TOKEN resource_type
7010209230bSgjelinek 	{
7020209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
7030209230bSgjelinek 			YYERROR;
7040209230bSgjelinek 		cmd = $$;
7050209230bSgjelinek 		$$->cmd_handler = &remove_func;
7060209230bSgjelinek 		$$->cmd_res_type = $3;
7070209230bSgjelinek 		$$->cmd_argc = 1;
7080209230bSgjelinek 		$$->cmd_argv[0] = $2;
7090209230bSgjelinek 		$$->cmd_argv[1] = NULL;
7100209230bSgjelinek 	}
7117c478bd9Sstevel@tonic-gate 	| REMOVE property_name property_value
7127c478bd9Sstevel@tonic-gate 	{
7137c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
7147c478bd9Sstevel@tonic-gate 			YYERROR;
7157c478bd9Sstevel@tonic-gate 		cmd = $$;
7167c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &remove_func;
7177c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 1;
7187c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $2;
7197c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
7207c478bd9Sstevel@tonic-gate 	}
7217c478bd9Sstevel@tonic-gate 	| REMOVE resource_type property_name EQUAL property_value
7227c478bd9Sstevel@tonic-gate 	{
7237c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
7247c478bd9Sstevel@tonic-gate 			YYERROR;
7257c478bd9Sstevel@tonic-gate 		cmd = $$;
7267c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &remove_func;
7277c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
7287c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 1;
7297c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
7307c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
7317c478bd9Sstevel@tonic-gate 	}
7327c478bd9Sstevel@tonic-gate 	| REMOVE resource_type property_name EQUAL property_value property_name EQUAL property_value
7337c478bd9Sstevel@tonic-gate 	{
7347c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
7357c478bd9Sstevel@tonic-gate 			YYERROR;
7367c478bd9Sstevel@tonic-gate 		cmd = $$;
7377c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &remove_func;
7387c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
7397c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 2;
7407c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
7417c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
7427c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[1] = $6;
7437c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[1] = &property[1];
7447c478bd9Sstevel@tonic-gate 	}
7457c478bd9Sstevel@tonic-gate 	| REMOVE resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value
7467c478bd9Sstevel@tonic-gate 	{
7477c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
7487c478bd9Sstevel@tonic-gate 			YYERROR;
7497c478bd9Sstevel@tonic-gate 		cmd = $$;
7507c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &remove_func;
7517c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
7527c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 3;
7537c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
7547c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
7557c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[1] = $6;
7567c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[1] = &property[1];
7577c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[2] = $9;
7587c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[2] = &property[2];
7597c478bd9Sstevel@tonic-gate 	}
7607c478bd9Sstevel@tonic-gate 
7617c478bd9Sstevel@tonic-gate revert_command: REVERT
7627c478bd9Sstevel@tonic-gate 	{
7637c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
7647c478bd9Sstevel@tonic-gate 			YYERROR;
7657c478bd9Sstevel@tonic-gate 		cmd = $$;
7667c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &revert_func;
7677c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
7687c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
7697c478bd9Sstevel@tonic-gate 	}
7707c478bd9Sstevel@tonic-gate 	| REVERT TOKEN
7717c478bd9Sstevel@tonic-gate 	{
7727c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
7737c478bd9Sstevel@tonic-gate 			YYERROR;
7747c478bd9Sstevel@tonic-gate 		cmd = $$;
7757c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &revert_func;
7767c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
7777c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
7787c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
7797c478bd9Sstevel@tonic-gate 	}
7807c478bd9Sstevel@tonic-gate 
7817c478bd9Sstevel@tonic-gate select_command: SELECT
7827c478bd9Sstevel@tonic-gate 	{
7837c478bd9Sstevel@tonic-gate 		short_usage(CMD_SELECT);
7847c478bd9Sstevel@tonic-gate 		(void) fputs("\n", stderr);
785bbec428eSgjelinek 		usage(B_FALSE, HELP_RES_PROPS);
7867c478bd9Sstevel@tonic-gate 		YYERROR;
7877c478bd9Sstevel@tonic-gate 	}
7880209230bSgjelinek 	| SELECT PSET
7890209230bSgjelinek 	{
7900209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
7910209230bSgjelinek 			YYERROR;
7920209230bSgjelinek 		cmd = $$;
7930209230bSgjelinek 		$$->cmd_handler = &select_func;
7940209230bSgjelinek 		$$->cmd_res_type = RT_DCPU;
7950209230bSgjelinek 	}
796c97ad5cdSakolb 	| SELECT PCAP
797c97ad5cdSakolb 	{
798c97ad5cdSakolb 		if (($$ = alloc_cmd()) == NULL)
799c97ad5cdSakolb 			YYERROR;
800c97ad5cdSakolb 		cmd = $$;
801c97ad5cdSakolb 		$$->cmd_handler = &select_func;
802c97ad5cdSakolb 		$$->cmd_res_type = RT_PCAP;
803c97ad5cdSakolb 	}
8040209230bSgjelinek 	| SELECT MCAP
8050209230bSgjelinek 	{
8060209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
8070209230bSgjelinek 			YYERROR;
8080209230bSgjelinek 		cmd = $$;
8090209230bSgjelinek 		$$->cmd_handler = &select_func;
8100209230bSgjelinek 		$$->cmd_res_type = RT_MCAP;
8110209230bSgjelinek 	}
8127c478bd9Sstevel@tonic-gate 	| SELECT resource_type
8137c478bd9Sstevel@tonic-gate 	{
8147c478bd9Sstevel@tonic-gate 		short_usage(CMD_SELECT);
8157c478bd9Sstevel@tonic-gate 		YYERROR;
8167c478bd9Sstevel@tonic-gate 	}
8177c478bd9Sstevel@tonic-gate 	| SELECT resource_type property_name EQUAL property_value
8187c478bd9Sstevel@tonic-gate 	{
8197c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
8207c478bd9Sstevel@tonic-gate 			YYERROR;
8217c478bd9Sstevel@tonic-gate 		cmd = $$;
8227c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &select_func;
8237c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
8247c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 1;
8257c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
8267c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
8277c478bd9Sstevel@tonic-gate 	}
8287c478bd9Sstevel@tonic-gate 	| SELECT resource_type property_name EQUAL property_value property_name EQUAL property_value
8297c478bd9Sstevel@tonic-gate 	{
8307c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
8317c478bd9Sstevel@tonic-gate 			YYERROR;
8327c478bd9Sstevel@tonic-gate 		cmd = $$;
8337c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &select_func;
8347c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
8357c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 2;
8367c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
8377c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
8387c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[1] = $6;
8397c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[1] = &property[1];
8407c478bd9Sstevel@tonic-gate 	}
8417c478bd9Sstevel@tonic-gate 	| SELECT resource_type property_name EQUAL property_value property_name EQUAL property_value property_name EQUAL property_value
8427c478bd9Sstevel@tonic-gate 	{
8437c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
8447c478bd9Sstevel@tonic-gate 			YYERROR;
8457c478bd9Sstevel@tonic-gate 		cmd = $$;
8467c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &select_func;
8477c478bd9Sstevel@tonic-gate 		$$->cmd_res_type = $2;
8487c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 3;
8497c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $3;
8507c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
8517c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[1] = $6;
8527c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[1] = &property[1];
8537c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[2] = $9;
8547c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[2] = &property[2];
8557c478bd9Sstevel@tonic-gate 	}
8567c478bd9Sstevel@tonic-gate 
8577c478bd9Sstevel@tonic-gate set_command: SET
8587c478bd9Sstevel@tonic-gate 	{
8597c478bd9Sstevel@tonic-gate 		short_usage(CMD_SET);
8607c478bd9Sstevel@tonic-gate 		(void) fputs("\n", stderr);
861bbec428eSgjelinek 		usage(B_FALSE, HELP_PROPS);
8627c478bd9Sstevel@tonic-gate 		YYERROR;
8637c478bd9Sstevel@tonic-gate 	}
8647c478bd9Sstevel@tonic-gate 	| SET property_name EQUAL OPEN_SQ_BRACKET CLOSE_SQ_BRACKET
8657c478bd9Sstevel@tonic-gate 	{
8667c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
8677c478bd9Sstevel@tonic-gate 			YYERROR;
8687c478bd9Sstevel@tonic-gate 		cmd = $$;
8697c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &set_func;
8707c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 0;
8717c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $2;
8727c478bd9Sstevel@tonic-gate 		property[0].pv_type = PROP_VAL_LIST;
8737c478bd9Sstevel@tonic-gate 		property[0].pv_list = NULL;
8747c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
8757c478bd9Sstevel@tonic-gate 	}
8767c478bd9Sstevel@tonic-gate 	| SET property_name EQUAL property_value
8777c478bd9Sstevel@tonic-gate 	{
8787c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
8797c478bd9Sstevel@tonic-gate 			YYERROR;
8807c478bd9Sstevel@tonic-gate 		cmd = $$;
8817c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &set_func;
8827c478bd9Sstevel@tonic-gate 		$$->cmd_prop_nv_pairs = 1;
8837c478bd9Sstevel@tonic-gate 		$$->cmd_prop_name[0] = $2;
8847c478bd9Sstevel@tonic-gate 		$$->cmd_property_ptr[0] = &property[0];
8857c478bd9Sstevel@tonic-gate 	}
886555afedfScarlsonj 	| SET TOKEN ZONEPATH EQUAL property_value
887555afedfScarlsonj 	{
888555afedfScarlsonj 		if (($$ = alloc_cmd()) == NULL)
889555afedfScarlsonj 			YYERROR;
890555afedfScarlsonj 		cmd = $$;
891555afedfScarlsonj 		$$->cmd_argc = 1;
892555afedfScarlsonj 		$$->cmd_argv[0] = $2;
893555afedfScarlsonj 		$$->cmd_argv[1] = NULL;
894555afedfScarlsonj 		$$->cmd_handler = &set_func;
895555afedfScarlsonj 		$$->cmd_prop_nv_pairs = 1;
896555afedfScarlsonj 		$$->cmd_prop_name[0] = PT_ZONEPATH;
897555afedfScarlsonj 		$$->cmd_property_ptr[0] = &property[0];
898555afedfScarlsonj 	}
8997c478bd9Sstevel@tonic-gate 
9000209230bSgjelinek clear_command: CLEAR
9010209230bSgjelinek 	{
9020209230bSgjelinek 		short_usage(CMD_CLEAR);
9030209230bSgjelinek 		(void) fputs("\n", stderr);
904bbec428eSgjelinek 		usage(B_FALSE, HELP_PROPS);
9050209230bSgjelinek 		YYERROR;
9060209230bSgjelinek 	}
9070209230bSgjelinek 	| CLEAR property_name
9080209230bSgjelinek 	{
9090209230bSgjelinek 		if (($$ = alloc_cmd()) == NULL)
9100209230bSgjelinek 			YYERROR;
9110209230bSgjelinek 		cmd = $$;
9120209230bSgjelinek 		$$->cmd_handler = &clear_func;
9130209230bSgjelinek 		$$->cmd_res_type = $2;
9140209230bSgjelinek 	}
9150209230bSgjelinek 
9167c478bd9Sstevel@tonic-gate verify_command: VERIFY
9177c478bd9Sstevel@tonic-gate 	{
9187c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
9197c478bd9Sstevel@tonic-gate 			YYERROR;
9207c478bd9Sstevel@tonic-gate 		cmd = $$;
9217c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &verify_func;
9227c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 0;
9237c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = NULL;
9247c478bd9Sstevel@tonic-gate 	}
9257c478bd9Sstevel@tonic-gate 	| VERIFY TOKEN
9267c478bd9Sstevel@tonic-gate 	{
9277c478bd9Sstevel@tonic-gate 		if (($$ = alloc_cmd()) == NULL)
9287c478bd9Sstevel@tonic-gate 			YYERROR;
9297c478bd9Sstevel@tonic-gate 		cmd = $$;
9307c478bd9Sstevel@tonic-gate 		$$->cmd_handler = &verify_func;
9317c478bd9Sstevel@tonic-gate 		$$->cmd_argc = 1;
9327c478bd9Sstevel@tonic-gate 		$$->cmd_argv[0] = $2;
9337c478bd9Sstevel@tonic-gate 		$$->cmd_argv[1] = NULL;
9347c478bd9Sstevel@tonic-gate 	}
9357c478bd9Sstevel@tonic-gate 
9367c478bd9Sstevel@tonic-gate resource_type: NET	{ $$ = RT_NET; }
9377c478bd9Sstevel@tonic-gate 	| FS		{ $$ = RT_FS; }
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; }
960*550b6e40SSowmini Varadhan 	| ALLOWED_ADDRESS	{ $$ = PT_ALLOWED_ADDRESS; }
9617c478bd9Sstevel@tonic-gate 	| PHYSICAL	{ $$ = PT_PHYSICAL; }
962de860bd9Sgfaden 	| DEFROUTER	{ $$ = PT_DEFROUTER; }
9637c478bd9Sstevel@tonic-gate 	| NAME		{ $$ = PT_NAME; }
9647c478bd9Sstevel@tonic-gate 	| VALUE		{ $$ = PT_VALUE; }
9657c478bd9Sstevel@tonic-gate 	| MATCH		{ $$ = PT_MATCH; }
9667c478bd9Sstevel@tonic-gate 	| PRIV		{ $$ = PT_PRIV; }
9677c478bd9Sstevel@tonic-gate 	| LIMIT		{ $$ = PT_LIMIT; }
9687c478bd9Sstevel@tonic-gate 	| ACTION	{ $$ = PT_ACTION; }
9699acbbeafSnn 	| BRAND		{ $$ = PT_BRAND; }
9700209230bSgjelinek 	| NCPUS		{ $$ = PT_NCPUS; }
9710209230bSgjelinek 	| LOCKED	{ $$ = PT_LOCKED; }
9720209230bSgjelinek 	| SWAP		{ $$ = PT_SWAP; }
9730209230bSgjelinek 	| IMPORTANCE	{ $$ = PT_IMPORTANCE; }
9740209230bSgjelinek 	| SHARES	{ $$ = PT_SHARES; }
9750209230bSgjelinek 	| MAXLWPS	{ $$ = PT_MAXLWPS; }
976ff19e029SMenno Lageman 	| MAXPROCS	{ $$ = PT_MAXPROCS; }
9770209230bSgjelinek 	| MAXSHMMEM	{ $$ = PT_MAXSHMMEM; }
9780209230bSgjelinek 	| MAXSHMIDS	{ $$ = PT_MAXSHMIDS; }
9790209230bSgjelinek 	| MAXMSGIDS	{ $$ = PT_MAXMSGIDS; }
9800209230bSgjelinek 	| MAXSEMIDS	{ $$ = PT_MAXSEMIDS; }
9810209230bSgjelinek 	| SCHED		{ $$ = PT_SCHED; }
9825679c89fSjv 	| HOSTID	{ $$ = PT_HOSTID; }
983cb8a054bSGlenn Faden 	| USER		{ $$ = PT_USER; }
984cb8a054bSGlenn Faden 	| AUTHS 	{ $$ = PT_AUTHS; }
9850fbb751dSJohn Levon 	| FS_ALLOWED	{ $$ = PT_FS_ALLOWED; }
9867c478bd9Sstevel@tonic-gate 
9877c478bd9Sstevel@tonic-gate /*
9887c478bd9Sstevel@tonic-gate  * The grammar builds data structures from the bottom up.  Thus various
9897c478bd9Sstevel@tonic-gate  * strings are lexed into TOKENs or commands or resource or property values.
9907c478bd9Sstevel@tonic-gate  * Below is where the resource and property values are built up into more
9917c478bd9Sstevel@tonic-gate  * complex data structures.
9927c478bd9Sstevel@tonic-gate  *
9937c478bd9Sstevel@tonic-gate  * There are three kinds of properties: simple (single valued), complex
9947c478bd9Sstevel@tonic-gate  * (one or more name=value pairs) and list (concatenation of one or more
9957c478bd9Sstevel@tonic-gate  * simple or complex properties).
9967c478bd9Sstevel@tonic-gate  *
9977c478bd9Sstevel@tonic-gate  * So the property structure has a type which is one of these, and the
9987c478bd9Sstevel@tonic-gate  * corresponding _simple, _complex or _list is set to the corresponding
9997c478bd9Sstevel@tonic-gate  * lower-level data structure.
10007c478bd9Sstevel@tonic-gate  */
10017c478bd9Sstevel@tonic-gate 
10027c478bd9Sstevel@tonic-gate property_value: simple_prop_val
10037c478bd9Sstevel@tonic-gate 	{
10047c478bd9Sstevel@tonic-gate 		property[num_prop_vals].pv_type = PROP_VAL_SIMPLE;
10057c478bd9Sstevel@tonic-gate 		property[num_prop_vals].pv_simple = $1;
10067c478bd9Sstevel@tonic-gate 		if (list[num_prop_vals] != NULL) {
10077c478bd9Sstevel@tonic-gate 			free_outer_list(list[num_prop_vals]);
10087c478bd9Sstevel@tonic-gate 			list[num_prop_vals] = NULL;
10097c478bd9Sstevel@tonic-gate 		}
10107c478bd9Sstevel@tonic-gate 		num_prop_vals++;
10117c478bd9Sstevel@tonic-gate 	}
10127c478bd9Sstevel@tonic-gate 	| complex_prop_val
10137c478bd9Sstevel@tonic-gate 	{
10147c478bd9Sstevel@tonic-gate 		property[num_prop_vals].pv_type = PROP_VAL_COMPLEX;
10157c478bd9Sstevel@tonic-gate 		property[num_prop_vals].pv_complex = complex;
10167c478bd9Sstevel@tonic-gate 		if (list[num_prop_vals] != NULL) {
10177c478bd9Sstevel@tonic-gate 			free_outer_list(list[num_prop_vals]);
10187c478bd9Sstevel@tonic-gate 			list[num_prop_vals] = NULL;
10197c478bd9Sstevel@tonic-gate 		}
10207c478bd9Sstevel@tonic-gate 		num_prop_vals++;
10217c478bd9Sstevel@tonic-gate 	}
10227c478bd9Sstevel@tonic-gate 	| list_prop_val
10237c478bd9Sstevel@tonic-gate 	{
10247c478bd9Sstevel@tonic-gate 		property[num_prop_vals].pv_type = PROP_VAL_LIST;
10257c478bd9Sstevel@tonic-gate 		property[num_prop_vals].pv_list = list[num_prop_vals];
10267c478bd9Sstevel@tonic-gate 		num_prop_vals++;
10277c478bd9Sstevel@tonic-gate 	}
10287c478bd9Sstevel@tonic-gate 
10297c478bd9Sstevel@tonic-gate /*
10307c478bd9Sstevel@tonic-gate  * One level lower, lists are made up of simple or complex values, so
10317c478bd9Sstevel@tonic-gate  * simple_prop_val and complex_prop_val fill in a list structure and
10327c478bd9Sstevel@tonic-gate  * insert it into the linked list which is built up.  And because
10337c478bd9Sstevel@tonic-gate  * complex properties can have multiple name=value pairs, we keep
10347c478bd9Sstevel@tonic-gate  * track of them in another linked list.
10357c478bd9Sstevel@tonic-gate  *
10367c478bd9Sstevel@tonic-gate  * The complex and list structures for the linked lists are allocated
10377c478bd9Sstevel@tonic-gate  * below, and freed by recursive functions which are ultimately called
10387c478bd9Sstevel@tonic-gate  * by free_cmd(), which is called from the top-most "commands" part of
10397c478bd9Sstevel@tonic-gate  * the grammar.
1040c94c1ef0Sjv  *
1041c94c1ef0Sjv  * NOTE: simple_prop_val and complex_piece need reduction rules for
1042c94c1ef0Sjv  * property_name and resource_type so that the parser will accept property names
1043c94c1ef0Sjv  * and resource type names as property values.
10447c478bd9Sstevel@tonic-gate  */
10457c478bd9Sstevel@tonic-gate 
10467c478bd9Sstevel@tonic-gate simple_prop_val: TOKEN
10477c478bd9Sstevel@tonic-gate 	{
1048c94c1ef0Sjv 		$$ = simple_prop_val_func($1);
1049c94c1ef0Sjv 		free($1);
1050c94c1ef0Sjv 		if ($$ == NULL)
1051c94c1ef0Sjv 			YYERROR;
1052c94c1ef0Sjv 	}
1053c94c1ef0Sjv 	| resource_type
1054c94c1ef0Sjv 	{
1055c94c1ef0Sjv 		if (($$ = simple_prop_val_func(res_types[$1])) == NULL)
1056c94c1ef0Sjv 			YYERROR;
1057c94c1ef0Sjv 	}
1058c94c1ef0Sjv 	| property_name
1059c94c1ef0Sjv 	{
1060c94c1ef0Sjv 		if (($$ = simple_prop_val_func(prop_types[$1])) == NULL)
10617c478bd9Sstevel@tonic-gate 			YYERROR;
10627c478bd9Sstevel@tonic-gate 	}
10637c478bd9Sstevel@tonic-gate 
10647c478bd9Sstevel@tonic-gate complex_prop_val: OPEN_PAREN complex_piece CLOSE_PAREN
10657c478bd9Sstevel@tonic-gate 	{
10667c478bd9Sstevel@tonic-gate 		if ((new_list = alloc_list()) == NULL)
10677c478bd9Sstevel@tonic-gate 			YYERROR;
10687c478bd9Sstevel@tonic-gate 		new_list->lp_simple = NULL;
10697c478bd9Sstevel@tonic-gate 		new_list->lp_complex = complex;
10707c478bd9Sstevel@tonic-gate 		new_list->lp_next = NULL;
10717c478bd9Sstevel@tonic-gate 		if (list[num_prop_vals] == NULL) {
10727c478bd9Sstevel@tonic-gate 			list[num_prop_vals] = new_list;
10737c478bd9Sstevel@tonic-gate 		} else {
10747c478bd9Sstevel@tonic-gate 			for (tmp_list = list[num_prop_vals]; tmp_list != NULL;
10757c478bd9Sstevel@tonic-gate 			    tmp_list = tmp_list->lp_next)
10767c478bd9Sstevel@tonic-gate 				last = tmp_list;
10777c478bd9Sstevel@tonic-gate 			last->lp_next = new_list;
10787c478bd9Sstevel@tonic-gate 		}
10797c478bd9Sstevel@tonic-gate 	}
10807c478bd9Sstevel@tonic-gate 
10817c478bd9Sstevel@tonic-gate complex_piece: property_name EQUAL TOKEN
10827c478bd9Sstevel@tonic-gate 	{
1083c94c1ef0Sjv 		$$ = complex_piece_func($1, $3, NULL);
1084c94c1ef0Sjv 		free($3);
1085c94c1ef0Sjv 		if ($$ == NULL)
1086c94c1ef0Sjv 			YYERROR;
1087c94c1ef0Sjv 	}
1088c94c1ef0Sjv 	| property_name EQUAL resource_type
1089c94c1ef0Sjv 	{
1090c94c1ef0Sjv 		if (($$ = complex_piece_func($1, res_types[$3], NULL)) == NULL)
1091c94c1ef0Sjv 			YYERROR;
1092c94c1ef0Sjv 	}
1093c94c1ef0Sjv 	| property_name EQUAL property_name
1094c94c1ef0Sjv 	{
1095c94c1ef0Sjv 		if (($$ = complex_piece_func($1, prop_types[$3], NULL)) == NULL)
10967c478bd9Sstevel@tonic-gate 			YYERROR;
10977c478bd9Sstevel@tonic-gate 	}
10987c478bd9Sstevel@tonic-gate 	| property_name EQUAL TOKEN COMMA complex_piece
10997c478bd9Sstevel@tonic-gate 	{
1100c94c1ef0Sjv 		$$ = complex_piece_func($1, $3, complex);
1101c94c1ef0Sjv 		free($3);
1102c94c1ef0Sjv 		if ($$ == NULL)
1103c94c1ef0Sjv 			YYERROR;
1104c94c1ef0Sjv 	}
1105c94c1ef0Sjv 	| property_name EQUAL resource_type COMMA complex_piece
1106c94c1ef0Sjv 	{
1107c94c1ef0Sjv 		if (($$ = complex_piece_func($1, res_types[$3], complex)) ==
1108c94c1ef0Sjv 		    NULL)
1109c94c1ef0Sjv 			YYERROR;
1110c94c1ef0Sjv 	}
1111c94c1ef0Sjv 	| property_name EQUAL property_name COMMA complex_piece
1112c94c1ef0Sjv 	{
1113c94c1ef0Sjv 		if (($$ = complex_piece_func($1, prop_types[$3], complex)) ==
1114c94c1ef0Sjv 		    NULL)
11157c478bd9Sstevel@tonic-gate 			YYERROR;
11167c478bd9Sstevel@tonic-gate 	}
11177c478bd9Sstevel@tonic-gate 
11187c478bd9Sstevel@tonic-gate list_piece: simple_prop_val
11197c478bd9Sstevel@tonic-gate 	| complex_prop_val
11207c478bd9Sstevel@tonic-gate 	| simple_prop_val COMMA list_piece
11217c478bd9Sstevel@tonic-gate 	| complex_prop_val COMMA list_piece
11227c478bd9Sstevel@tonic-gate 
11237c478bd9Sstevel@tonic-gate list_prop_val: OPEN_SQ_BRACKET list_piece CLOSE_SQ_BRACKET
11247c478bd9Sstevel@tonic-gate %%
1125