Deleted Added
full compact
parse.y (263722) parse.y (263723)
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 263722 2014-03-25 12:08:35Z trasz $
30 * $FreeBSD: stable/10/usr.sbin/ctld/parse.y 263723 2014-03-25 12:10:30Z 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>

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

311 |
312 target_lun
313 ;
314
315target_alias: ALIAS STR
316 {
317 if (target->t_alias != NULL) {
318 log_warnx("alias for target \"%s\" "
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>

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

311 |
312 target_lun
313 ;
314
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);
319 "specified more than once", target->t_name);
320 return (1);
321 }
322 target->t_alias = $2;
323 }
324 ;
325
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\" "
320 return (1);
321 }
322 target->t_alias = $2;
323 }
324 ;
325
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);
331 "specified more than once", target->t_name);
332 else
333 log_warnx("cannot mix auth-group with explicit "
334 "authorisations for target \"%s\"",
332 else
333 log_warnx("cannot mix auth-group with explicit "
334 "authorisations for target \"%s\"",
335 target->t_iqn);
335 target->t_name);
336 return (1);
337 }
338 target->t_auth_group = auth_group_find(conf, $2);
339 if (target->t_auth_group == NULL) {
340 log_warnx("unknown auth-group \"%s\" for target "
336 return (1);
337 }
338 target->t_auth_group = auth_group_find(conf, $2);
339 if (target->t_auth_group == NULL) {
340 log_warnx("unknown auth-group \"%s\" for target "
341 "\"%s\"", $2, target->t_iqn);
341 "\"%s\"", $2, target->t_name);
342 return (1);
343 }
344 free($2);
345 }
346 ;
347
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\"",
342 return (1);
343 }
344 free($2);
345 }
346 ;
347
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);
356 target->t_name);
357 free($2);
358 free($3);
359 return (1);
360 }
361 } else {
362 target->t_auth_group = auth_group_new(conf, NULL);
363 if (target->t_auth_group == NULL) {
364 free($2);

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

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\"",
357 free($2);
358 free($3);
359 return (1);
360 }
361 } else {
362 target->t_auth_group = auth_group_new(conf, NULL);
363 if (target->t_auth_group == NULL) {
364 free($2);

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

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);
386 target->t_name);
387 free($2);
388 free($3);
389 free($4);
390 free($5);
391 return (1);
392 }
393 } else {
394 target->t_auth_group = auth_group_new(conf, NULL);

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

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\"",
387 free($2);
388 free($3);
389 free($4);
390 free($5);
391 return (1);
392 }
393 } else {
394 target->t_auth_group = auth_group_new(conf, NULL);

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

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);
423 target->t_name);
424 free($2);
425 return (1);
426 }
427 } else {
428 target->t_auth_group = auth_group_new(conf, NULL);
429 if (target->t_auth_group == NULL) {
430 free($2);
431 return (1);

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

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\"",
424 free($2);
425 return (1);
426 }
427 } else {
428 target->t_auth_group = auth_group_new(conf, NULL);
429 if (target->t_auth_group == NULL) {
430 free($2);
431 return (1);

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

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);
450 target->t_name);
451 free($2);
452 return (1);
453 }
454 } else {
455 target->t_auth_group = auth_group_new(conf, NULL);
456 if (target->t_auth_group == NULL) {
457 free($2);
458 return (1);

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

465 return (1);
466 }
467 ;
468
469target_portal_group: PORTAL_GROUP STR
470 {
471 if (target->t_portal_group != NULL) {
472 log_warnx("portal-group for target \"%s\" "
451 free($2);
452 return (1);
453 }
454 } else {
455 target->t_auth_group = auth_group_new(conf, NULL);
456 if (target->t_auth_group == NULL) {
457 free($2);
458 return (1);

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

465 return (1);
466 }
467 ;
468
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);
473 "specified more than once", target->t_name);
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 "
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);
480 "\"%s\"", $2, target->t_name);
481 free($2);
482 return (1);
483 }
484 free($2);
485 }
486 ;
487
488target_lun: LUN lun_number

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

521 lun_size
522 ;
523
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",
481 free($2);
482 return (1);
483 }
484 free($2);
485 }
486 ;
487
488target_lun: LUN lun_number

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

521 lun_size
522 ;
523
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);
529 lun->l_lun, target->t_name);
530 free($2);
531 return (1);
532 }
533 lun_set_backend(lun, $2);
534 free($2);
535 }
536 ;
537
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",
530 free($2);
531 return (1);
532 }
533 lun_set_backend(lun, $2);
534 free($2);
535 }
536 ;
537
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);
543 lun->l_lun, target->t_name);
544 return (1);
545 }
546 lun_set_blocksize(lun, $2);
547 }
548 ;
549
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",
544 return (1);
545 }
546 lun_set_blocksize(lun, $2);
547 }
548 ;
549
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);
555 lun->l_lun, target->t_name);
556 free($2);
557 return (1);
558 }
559 lun_set_device_id(lun, $2);
560 free($2);
561 }
562 ;
563

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

573 }
574 ;
575
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",
556 free($2);
557 return (1);
558 }
559 lun_set_device_id(lun, $2);
560 free($2);
561 }
562 ;
563

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

573 }
574 ;
575
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);
581 lun->l_lun, target->t_name);
582 free($2);
583 return (1);
584 }
585 lun_set_path(lun, $2);
586 free($2);
587 }
588 ;
589
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",
582 free($2);
583 return (1);
584 }
585 lun_set_path(lun, $2);
586 free($2);
587 }
588 ;
589
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);
595 lun->l_lun, target->t_name);
596 free($2);
597 return (1);
598 }
599 lun_set_serial(lun, $2);
600 free($2);
601 }
602 ;
603
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",
596 free($2);
597 return (1);
598 }
599 lun_set_serial(lun, $2);
600 free($2);
601 }
602 ;
603
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);
609 lun->l_lun, target->t_name);
610 return (1);
611 }
612 lun_set_size(lun, $2);
613 }
614 ;
615%%
616
617void

--- 88 unchanged lines hidden ---
610 return (1);
611 }
612 lun_set_size(lun, $2);
613 }
614 ;
615%%
616
617void

--- 88 unchanged lines hidden ---