Deleted Added
full compact
parse.y (263720) parse.y (263722)
1%{
2/*-
3 * Copyright (c) 2012 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * This software was developed by Edward Tomasz Napierala under sponsorship
7 * from the FreeBSD Foundation.
8 *

--- 13 unchanged lines hidden (view full) ---

22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
1%{
2/*-
3 * Copyright (c) 2012 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * This software was developed by Edward Tomasz Napierala under sponsorship
7 * from the FreeBSD Foundation.
8 *

--- 13 unchanged lines hidden (view full) ---

22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * $FreeBSD: stable/10/usr.sbin/ctld/parse.y 263720 2014-03-25 12:01:55Z trasz $
30 * $FreeBSD: stable/10/usr.sbin/ctld/parse.y 263722 2014-03-25 12:08:35Z trasz $
31 */
32
33#include <sys/queue.h>
34#include <sys/types.h>
35#include <sys/stat.h>
36#include <assert.h>
37#include <stdio.h>
38#include <stdint.h>

--- 35 unchanged lines hidden (view full) ---

74%%
75
76statements:
77 |
78 statements statement
79 ;
80
81statement:
31 */
32
33#include <sys/queue.h>
34#include <sys/types.h>
35#include <sys/stat.h>
36#include <assert.h>
37#include <stdio.h>
38#include <stdint.h>

--- 35 unchanged lines hidden (view full) ---

74%%
75
76statements:
77 |
78 statements statement
79 ;
80
81statement:
82 debug_statement
82 debug
83 |
83 |
84 timeout_statement
84 timeout
85 |
85 |
86 maxproc_statement
86 maxproc
87 |
87 |
88 pidfile_statement
88 pidfile
89 |
89 |
90 auth_group_definition
90 auth_group
91 |
91 |
92 portal_group_definition
92 portal_group
93 |
93 |
94 target_statement
94 target
95 ;
96
95 ;
96
97debug_statement: DEBUG NUM
97debug: DEBUG NUM
98 {
99 conf->conf_debug = $2;
100 }
101 ;
102
98 {
99 conf->conf_debug = $2;
100 }
101 ;
102
103timeout_statement: TIMEOUT NUM
103timeout: TIMEOUT NUM
104 {
105 conf->conf_timeout = $2;
106 }
107 ;
108
104 {
105 conf->conf_timeout = $2;
106 }
107 ;
108
109maxproc_statement: MAXPROC NUM
109maxproc: MAXPROC NUM
110 {
111 conf->conf_maxproc = $2;
112 }
113 ;
114
110 {
111 conf->conf_maxproc = $2;
112 }
113 ;
114
115pidfile_statement: PIDFILE STR
115pidfile: PIDFILE STR
116 {
117 if (conf->conf_pidfile_path != NULL) {
118 log_warnx("pidfile specified more than once");
119 free($2);
120 return (1);
121 }
122 conf->conf_pidfile_path = $2;
123 }
124 ;
125
116 {
117 if (conf->conf_pidfile_path != NULL) {
118 log_warnx("pidfile specified more than once");
119 free($2);
120 return (1);
121 }
122 conf->conf_pidfile_path = $2;
123 }
124 ;
125
126auth_group_definition: AUTH_GROUP auth_group_name
126auth_group: AUTH_GROUP auth_group_name
127 OPENING_BRACKET auth_group_entries CLOSING_BRACKET
128 {
129 auth_group = NULL;
130 }
131 ;
132
133auth_group_name: STR
134 {

--- 62 unchanged lines hidden (view full) ---

197
198 ap = auth_portal_new(auth_group, $2);
199 free($2);
200 if (ap == NULL)
201 return (1);
202 }
203 ;
204
127 OPENING_BRACKET auth_group_entries CLOSING_BRACKET
128 {
129 auth_group = NULL;
130 }
131 ;
132
133auth_group_name: STR
134 {

--- 62 unchanged lines hidden (view full) ---

197
198 ap = auth_portal_new(auth_group, $2);
199 free($2);
200 if (ap == NULL)
201 return (1);
202 }
203 ;
204
205portal_group_definition: PORTAL_GROUP portal_group_name
205portal_group: PORTAL_GROUP portal_group_name
206 OPENING_BRACKET portal_group_entries CLOSING_BRACKET
207 {
208 portal_group = NULL;
209 }
210 ;
211
212portal_group_name: STR
213 {

--- 54 unchanged lines hidden (view full) ---

268
269 error = portal_group_add_listen(portal_group, $2, true);
270 free($2);
271 if (error != 0)
272 return (1);
273 }
274 ;
275
206 OPENING_BRACKET portal_group_entries CLOSING_BRACKET
207 {
208 portal_group = NULL;
209 }
210 ;
211
212portal_group_name: STR
213 {

--- 54 unchanged lines hidden (view full) ---

268
269 error = portal_group_add_listen(portal_group, $2, true);
270 free($2);
271 if (error != 0)
272 return (1);
273 }
274 ;
275
276target_statement: TARGET target_iqn
276target: TARGET target_name
277 OPENING_BRACKET target_entries CLOSING_BRACKET
278 {
279 target = NULL;
280 }
281 ;
282
277 OPENING_BRACKET target_entries CLOSING_BRACKET
278 {
279 target = NULL;
280 }
281 ;
282
283target_iqn: STR
283target_name: STR
284 {
285 target = target_new(conf, $1);
286 free($1);
287 if (target == NULL)
288 return (1);
289 }
290 ;
291
292target_entries:
293 |
294 target_entries target_entry
295 ;
296
297target_entry:
284 {
285 target = target_new(conf, $1);
286 free($1);
287 if (target == NULL)
288 return (1);
289 }
290 ;
291
292target_entries:
293 |
294 target_entries target_entry
295 ;
296
297target_entry:
298 alias_statement
298 target_alias
299 |
299 |
300 auth_group_statement
300 target_auth_group
301 |
301 |
302 chap_statement
302 target_chap
303 |
303 |
304 chap_mutual_statement
304 target_chap_mutual
305 |
305 |
306 initiator_name_statement
306 target_initiator_name
307 |
307 |
308 initiator_portal_statement
308 target_initiator_portal
309 |
309 |
310 portal_group_statement
310 target_portal_group
311 |
311 |
312 lun_statement
312 target_lun
313 ;
314
313 ;
314
315alias_statement: ALIAS STR
315target_alias: ALIAS STR
316 {
317 if (target->t_alias != NULL) {
318 log_warnx("alias for target \"%s\" "
319 "specified more than once", target->t_iqn);
320 return (1);
321 }
322 target->t_alias = $2;
323 }
324 ;
325
316 {
317 if (target->t_alias != NULL) {
318 log_warnx("alias for target \"%s\" "
319 "specified more than once", target->t_iqn);
320 return (1);
321 }
322 target->t_alias = $2;
323 }
324 ;
325
326auth_group_statement: AUTH_GROUP STR
326target_auth_group: AUTH_GROUP STR
327 {
328 if (target->t_auth_group != NULL) {
329 if (target->t_auth_group->ag_name != NULL)
330 log_warnx("auth-group for target \"%s\" "
331 "specified more than once", target->t_iqn);
332 else
333 log_warnx("cannot mix auth-group with explicit "
334 "authorisations for target \"%s\"",

--- 5 unchanged lines hidden (view full) ---

340 log_warnx("unknown auth-group \"%s\" for target "
341 "\"%s\"", $2, target->t_iqn);
342 return (1);
343 }
344 free($2);
345 }
346 ;
347
327 {
328 if (target->t_auth_group != NULL) {
329 if (target->t_auth_group->ag_name != NULL)
330 log_warnx("auth-group for target \"%s\" "
331 "specified more than once", target->t_iqn);
332 else
333 log_warnx("cannot mix auth-group with explicit "
334 "authorisations for target \"%s\"",

--- 5 unchanged lines hidden (view full) ---

340 log_warnx("unknown auth-group \"%s\" for target "
341 "\"%s\"", $2, target->t_iqn);
342 return (1);
343 }
344 free($2);
345 }
346 ;
347
348chap_statement: CHAP STR STR
348target_chap: CHAP STR STR
349 {
350 const struct auth *ca;
351
352 if (target->t_auth_group != NULL) {
353 if (target->t_auth_group->ag_name != NULL) {
354 log_warnx("cannot mix auth-group with explicit "
355 "authorisations for target \"%s\"",
356 target->t_iqn);

--- 13 unchanged lines hidden (view full) ---

370 ca = auth_new_chap(target->t_auth_group, $2, $3);
371 free($2);
372 free($3);
373 if (ca == NULL)
374 return (1);
375 }
376 ;
377
349 {
350 const struct auth *ca;
351
352 if (target->t_auth_group != NULL) {
353 if (target->t_auth_group->ag_name != NULL) {
354 log_warnx("cannot mix auth-group with explicit "
355 "authorisations for target \"%s\"",
356 target->t_iqn);

--- 13 unchanged lines hidden (view full) ---

370 ca = auth_new_chap(target->t_auth_group, $2, $3);
371 free($2);
372 free($3);
373 if (ca == NULL)
374 return (1);
375 }
376 ;
377
378chap_mutual_statement: CHAP_MUTUAL STR STR STR STR
378target_chap_mutual: CHAP_MUTUAL STR STR STR STR
379 {
380 const struct auth *ca;
381
382 if (target->t_auth_group != NULL) {
383 if (target->t_auth_group->ag_name != NULL) {
384 log_warnx("cannot mix auth-group with explicit "
385 "authorisations for target \"%s\"",
386 target->t_iqn);

--- 20 unchanged lines hidden (view full) ---

407 free($3);
408 free($4);
409 free($5);
410 if (ca == NULL)
411 return (1);
412 }
413 ;
414
379 {
380 const struct auth *ca;
381
382 if (target->t_auth_group != NULL) {
383 if (target->t_auth_group->ag_name != NULL) {
384 log_warnx("cannot mix auth-group with explicit "
385 "authorisations for target \"%s\"",
386 target->t_iqn);

--- 20 unchanged lines hidden (view full) ---

407 free($3);
408 free($4);
409 free($5);
410 if (ca == NULL)
411 return (1);
412 }
413 ;
414
415initiator_name_statement: INITIATOR_NAME STR
415target_initiator_name: INITIATOR_NAME STR
416 {
417 const struct auth_name *an;
418
419 if (target->t_auth_group != NULL) {
420 if (target->t_auth_group->ag_name != NULL) {
421 log_warnx("cannot mix auth-group with "
422 "initiator-name for target \"%s\"",
423 target->t_iqn);

--- 10 unchanged lines hidden (view full) ---

434 }
435 an = auth_name_new(target->t_auth_group, $2);
436 free($2);
437 if (an == NULL)
438 return (1);
439 }
440 ;
441
416 {
417 const struct auth_name *an;
418
419 if (target->t_auth_group != NULL) {
420 if (target->t_auth_group->ag_name != NULL) {
421 log_warnx("cannot mix auth-group with "
422 "initiator-name for target \"%s\"",
423 target->t_iqn);

--- 10 unchanged lines hidden (view full) ---

434 }
435 an = auth_name_new(target->t_auth_group, $2);
436 free($2);
437 if (an == NULL)
438 return (1);
439 }
440 ;
441
442initiator_portal_statement: INITIATOR_PORTAL STR
442target_initiator_portal: INITIATOR_PORTAL STR
443 {
444 const struct auth_portal *ap;
445
446 if (target->t_auth_group != NULL) {
447 if (target->t_auth_group->ag_name != NULL) {
448 log_warnx("cannot mix auth-group with "
449 "initiator-portal for target \"%s\"",
450 target->t_iqn);

--- 10 unchanged lines hidden (view full) ---

461 }
462 ap = auth_portal_new(target->t_auth_group, $2);
463 free($2);
464 if (ap == NULL)
465 return (1);
466 }
467 ;
468
443 {
444 const struct auth_portal *ap;
445
446 if (target->t_auth_group != NULL) {
447 if (target->t_auth_group->ag_name != NULL) {
448 log_warnx("cannot mix auth-group with "
449 "initiator-portal for target \"%s\"",
450 target->t_iqn);

--- 10 unchanged lines hidden (view full) ---

461 }
462 ap = auth_portal_new(target->t_auth_group, $2);
463 free($2);
464 if (ap == NULL)
465 return (1);
466 }
467 ;
468
469portal_group_statement: PORTAL_GROUP STR
469target_portal_group: PORTAL_GROUP STR
470 {
471 if (target->t_portal_group != NULL) {
472 log_warnx("portal-group for target \"%s\" "
473 "specified more than once", target->t_iqn);
474 free($2);
475 return (1);
476 }
477 target->t_portal_group = portal_group_find(conf, $2);
478 if (target->t_portal_group == NULL) {
479 log_warnx("unknown portal-group \"%s\" for target "
480 "\"%s\"", $2, target->t_iqn);
481 free($2);
482 return (1);
483 }
484 free($2);
485 }
486 ;
487
470 {
471 if (target->t_portal_group != NULL) {
472 log_warnx("portal-group for target \"%s\" "
473 "specified more than once", target->t_iqn);
474 free($2);
475 return (1);
476 }
477 target->t_portal_group = portal_group_find(conf, $2);
478 if (target->t_portal_group == NULL) {
479 log_warnx("unknown portal-group \"%s\" for target "
480 "\"%s\"", $2, target->t_iqn);
481 free($2);
482 return (1);
483 }
484 free($2);
485 }
486 ;
487
488lun_statement: LUN lun_number
489 OPENING_BRACKET lun_statement_entries CLOSING_BRACKET
488target_lun: LUN lun_number
489 OPENING_BRACKET lun_entries CLOSING_BRACKET
490 {
491 lun = NULL;
492 }
493 ;
494
495lun_number: NUM
496 {
497 lun = lun_new(target, $1);
498 if (lun == NULL)
499 return (1);
500 }
501 ;
502
490 {
491 lun = NULL;
492 }
493 ;
494
495lun_number: NUM
496 {
497 lun = lun_new(target, $1);
498 if (lun == NULL)
499 return (1);
500 }
501 ;
502
503lun_statement_entries:
503lun_entries:
504 |
504 |
505 lun_statement_entries lun_statement_entry
505 lun_entries lun_entry
506 ;
507
506 ;
507
508lun_statement_entry:
509 backend_statement
508lun_entry:
509 lun_backend
510 |
510 |
511 blocksize_statement
511 lun_blocksize
512 |
512 |
513 device_id_statement
513 lun_device_id
514 |
514 |
515 option_statement
515 lun_option
516 |
516 |
517 path_statement
517 lun_path
518 |
518 |
519 serial_statement
519 lun_serial
520 |
520 |
521 size_statement
521 lun_size
522 ;
523
522 ;
523
524backend_statement: BACKEND STR
524lun_backend: BACKEND STR
525 {
526 if (lun->l_backend != NULL) {
527 log_warnx("backend for lun %d, target \"%s\" "
528 "specified more than once",
529 lun->l_lun, target->t_iqn);
530 free($2);
531 return (1);
532 }
533 lun_set_backend(lun, $2);
534 free($2);
535 }
536 ;
537
525 {
526 if (lun->l_backend != NULL) {
527 log_warnx("backend for lun %d, target \"%s\" "
528 "specified more than once",
529 lun->l_lun, target->t_iqn);
530 free($2);
531 return (1);
532 }
533 lun_set_backend(lun, $2);
534 free($2);
535 }
536 ;
537
538blocksize_statement: BLOCKSIZE NUM
538lun_blocksize: BLOCKSIZE NUM
539 {
540 if (lun->l_blocksize != 0) {
541 log_warnx("blocksize for lun %d, target \"%s\" "
542 "specified more than once",
543 lun->l_lun, target->t_iqn);
544 return (1);
545 }
546 lun_set_blocksize(lun, $2);
547 }
548 ;
549
539 {
540 if (lun->l_blocksize != 0) {
541 log_warnx("blocksize for lun %d, target \"%s\" "
542 "specified more than once",
543 lun->l_lun, target->t_iqn);
544 return (1);
545 }
546 lun_set_blocksize(lun, $2);
547 }
548 ;
549
550device_id_statement: DEVICE_ID STR
550lun_device_id: DEVICE_ID STR
551 {
552 if (lun->l_device_id != NULL) {
553 log_warnx("device_id for lun %d, target \"%s\" "
554 "specified more than once",
555 lun->l_lun, target->t_iqn);
556 free($2);
557 return (1);
558 }
559 lun_set_device_id(lun, $2);
560 free($2);
561 }
562 ;
563
551 {
552 if (lun->l_device_id != NULL) {
553 log_warnx("device_id for lun %d, target \"%s\" "
554 "specified more than once",
555 lun->l_lun, target->t_iqn);
556 free($2);
557 return (1);
558 }
559 lun_set_device_id(lun, $2);
560 free($2);
561 }
562 ;
563
564option_statement: OPTION STR STR
564lun_option: OPTION STR STR
565 {
566 struct lun_option *clo;
567
568 clo = lun_option_new(lun, $2, $3);
569 free($2);
570 free($3);
571 if (clo == NULL)
572 return (1);
573 }
574 ;
575
565 {
566 struct lun_option *clo;
567
568 clo = lun_option_new(lun, $2, $3);
569 free($2);
570 free($3);
571 if (clo == NULL)
572 return (1);
573 }
574 ;
575
576path_statement: PATH STR
576lun_path: PATH STR
577 {
578 if (lun->l_path != NULL) {
579 log_warnx("path for lun %d, target \"%s\" "
580 "specified more than once",
581 lun->l_lun, target->t_iqn);
582 free($2);
583 return (1);
584 }
585 lun_set_path(lun, $2);
586 free($2);
587 }
588 ;
589
577 {
578 if (lun->l_path != NULL) {
579 log_warnx("path for lun %d, target \"%s\" "
580 "specified more than once",
581 lun->l_lun, target->t_iqn);
582 free($2);
583 return (1);
584 }
585 lun_set_path(lun, $2);
586 free($2);
587 }
588 ;
589
590serial_statement: SERIAL STR
590lun_serial: SERIAL STR
591 {
592 if (lun->l_serial != NULL) {
593 log_warnx("serial for lun %d, target \"%s\" "
594 "specified more than once",
595 lun->l_lun, target->t_iqn);
596 free($2);
597 return (1);
598 }
599 lun_set_serial(lun, $2);
600 free($2);
601 }
602 ;
603
591 {
592 if (lun->l_serial != NULL) {
593 log_warnx("serial for lun %d, target \"%s\" "
594 "specified more than once",
595 lun->l_lun, target->t_iqn);
596 free($2);
597 return (1);
598 }
599 lun_set_serial(lun, $2);
600 free($2);
601 }
602 ;
603
604size_statement: SIZE NUM
604lun_size: SIZE NUM
605 {
606 if (lun->l_size != 0) {
607 log_warnx("size for lun %d, target \"%s\" "
608 "specified more than once",
609 lun->l_lun, target->t_iqn);
610 return (1);
611 }
612 lun_set_size(lun, $2);

--- 93 unchanged lines hidden ---
605 {
606 if (lun->l_size != 0) {
607 log_warnx("size for lun %d, target \"%s\" "
608 "specified more than once",
609 lun->l_lun, target->t_iqn);
610 return (1);
611 }
612 lun_set_size(lun, $2);

--- 93 unchanged lines hidden ---