parse.y (279006) | parse.y (279055) |
---|---|
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 279006 2015-02-19 14:52:01Z mav $ | 30 * $FreeBSD: stable/10/usr.sbin/ctld/parse.y 279055 2015-02-20 17:09:49Z mav $ |
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> --- 17 unchanged lines hidden (view full) --- 56extern void yyrestart(FILE *); 57 58%} 59 60%token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL 61%token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP DISCOVERY_FILTER 62%token INITIATOR_NAME INITIATOR_PORTAL ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT 63%token LISTEN LISTEN_ISER LUN MAXPROC OPENING_BRACKET OPTION | 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> --- 17 unchanged lines hidden (view full) --- 56extern void yyrestart(FILE *); 57 58%} 59 60%token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL 61%token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP DISCOVERY_FILTER 62%token INITIATOR_NAME INITIATOR_PORTAL ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT 63%token LISTEN LISTEN_ISER LUN MAXPROC OPENING_BRACKET OPTION |
64%token PATH PIDFILE PORTAL_GROUP REDIRECT SEMICOLON SERIAL SIZE STR | 64%token PATH PIDFILE PORT PORTAL_GROUP REDIRECT SEMICOLON SERIAL SIZE STR |
65%token TARGET TIMEOUT 66 67%union 68{ 69 char *str; 70} 71 72%token <str> STR --- 387 unchanged lines hidden (view full) --- 460 target_chap_mutual 461 | 462 target_initiator_name 463 | 464 target_initiator_portal 465 | 466 target_portal_group 467 | | 65%token TARGET TIMEOUT 66 67%union 68{ 69 char *str; 70} 71 72%token <str> STR --- 387 unchanged lines hidden (view full) --- 460 target_chap_mutual 461 | 462 target_initiator_name 463 | 464 target_initiator_portal 465 | 466 target_portal_group 467 | |
468 target_port 469 | |
|
468 target_redirect 469 | 470 target_lun 471 | 472 target_lun_ref 473 ; 474 475target_alias: ALIAS STR --- 227 unchanged lines hidden (view full) --- 703 "\"%s\"", $2, target->t_name); 704 free($2); 705 return (1); 706 } 707 free($2); 708 } 709 ; 710 | 470 target_redirect 471 | 472 target_lun 473 | 474 target_lun_ref 475 ; 476 477target_alias: ALIAS STR --- 227 unchanged lines hidden (view full) --- 705 "\"%s\"", $2, target->t_name); 706 free($2); 707 return (1); 708 } 709 free($2); 710 } 711 ; 712 |
713target_port: PORT STR 714 { 715 struct pport *pp; 716 struct port *tp; 717 718 pp = pport_find(conf, $2); 719 if (pp == NULL) { 720 log_warnx("unknown port \"%s\" for target \"%s\"", 721 $2, target->t_name); 722 free($2); 723 return (1); 724 } 725 if (!TAILQ_EMPTY(&pp->pp_ports)) { 726 log_warnx("can't link port \"%s\" to target \"%s\", " 727 "port already linked to some target", 728 $2, target->t_name); 729 free($2); 730 return (1); 731 } 732 tp = port_new_pp(conf, target, pp); 733 if (tp == NULL) { 734 log_warnx("can't link port \"%s\" to target \"%s\"", 735 $2, target->t_name); 736 free($2); 737 return (1); 738 } 739 free($2); 740 } 741 ; 742 |
|
711target_redirect: REDIRECT STR 712 { 713 int error; 714 715 error = target_set_redirection(target, $2); 716 free($2); 717 if (error != 0) 718 return (1); --- 213 unchanged lines hidden (view full) --- 932 } 933 934 /* 935 * XXX: Should we also check for owner != 0? 936 */ 937} 938 939struct conf * | 743target_redirect: REDIRECT STR 744 { 745 int error; 746 747 error = target_set_redirection(target, $2); 748 free($2); 749 if (error != 0) 750 return (1); --- 213 unchanged lines hidden (view full) --- 964 } 965 966 /* 967 * XXX: Should we also check for owner != 0? 968 */ 969} 970 971struct conf * |
940conf_new_from_file(const char *path) | 972conf_new_from_file(const char *path, struct conf *oldconf) |
941{ 942 struct auth_group *ag; 943 struct portal_group *pg; | 973{ 974 struct auth_group *ag; 975 struct portal_group *pg; |
976 struct pport *pp; |
|
944 int error; 945 946 log_debugx("obtaining configuration from %s", path); 947 948 conf = conf_new(); 949 | 977 int error; 978 979 log_debugx("obtaining configuration from %s", path); 980 981 conf = conf_new(); 982 |
983 TAILQ_FOREACH(pp, &oldconf->conf_pports, pp_next) 984 pport_copy(pp, conf); 985 |
|
950 ag = auth_group_new(conf, "default"); 951 assert(ag != NULL); 952 953 ag = auth_group_new(conf, "no-authentication"); 954 assert(ag != NULL); 955 ag->ag_type = AG_TYPE_NO_AUTHENTICATION; 956 957 ag = auth_group_new(conf, "no-access"); --- 53 unchanged lines hidden --- | 986 ag = auth_group_new(conf, "default"); 987 assert(ag != NULL); 988 989 ag = auth_group_new(conf, "no-authentication"); 990 assert(ag != NULL); 991 ag->ag_type = AG_TYPE_NO_AUTHENTICATION; 992 993 ag = auth_group_new(conf, "no-access"); --- 53 unchanged lines hidden --- |