3 * DEVD (Device action daemon)
5 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
7 * Copyright (c) 2002 M. Warner Losh <imp@freebsd.org>.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 #include <sys/cdefs.h>
44 struct eps *eps; /* EventProcStatement */
45 struct event_proc *eventproc;
48 %token SEMICOLON BEGINBLOCK ENDBLOCK COMMA
52 %token OPTIONS SET DIRECTORY PID_FILE DEVICE_NAME ACTION MATCH
53 %token ATTACH DETACH NOMATCH NOTIFY MEDIA_TYPE CLASS SUBDEVICE
55 %type <eventproc> match_or_action_list
56 %type <eps> match_or_action match action
79 : OPTIONS BEGINBLOCK options ENDBLOCK SEMICOLON
93 : DIRECTORY STRING SEMICOLON { add_directory($2); }
97 : PID_FILE STRING SEMICOLON { set_pidfile($2); }
101 : SET ID STRING SEMICOLON { set_variable($2, $3); }
105 : ATTACH NUMBER BEGINBLOCK match_or_action_list ENDBLOCK SEMICOLON
106 { add_attach($2, $4); }
107 | ATTACH NUMBER BEGINBLOCK ENDBLOCK SEMICOLON
111 : DETACH NUMBER BEGINBLOCK match_or_action_list ENDBLOCK SEMICOLON
112 { add_detach($2, $4); }
113 | DETACH NUMBER BEGINBLOCK ENDBLOCK SEMICOLON
117 : NOMATCH NUMBER BEGINBLOCK match_or_action_list ENDBLOCK SEMICOLON
118 { add_nomatch($2, $4); }
119 | NOMATCH NUMBER BEGINBLOCK ENDBLOCK SEMICOLON
123 : NOTIFY NUMBER BEGINBLOCK match_or_action_list ENDBLOCK SEMICOLON
124 { add_notify($2, $4); }
125 | NOTIFY NUMBER BEGINBLOCK ENDBLOCK SEMICOLON
129 : match_or_action { $$ = add_to_event_proc( NULL, $1); }
130 | match_or_action_list match_or_action
131 { $$ = add_to_event_proc($1, $2); }
140 : MATCH STRING STRING SEMICOLON { $$ = new_match($2, $3); }
141 | DEVICE_NAME STRING SEMICOLON
142 { $$ = new_match(strdup("device-name"), $2); }
143 | MEDIA_TYPE STRING SEMICOLON
144 { $$ = new_media(strdup("media-type"), $2); }
145 | CLASS STRING SEMICOLON
146 { $$ = new_match(strdup("class"), $2); }
147 | SUBDEVICE STRING SEMICOLON
148 { $$ = new_match(strdup("subdevice"), $2); }
152 : ACTION STRING SEMICOLON { $$ = new_action($2); }