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