Lines Matching defs:conf
86 struct conf *
89 struct conf *conf;
91 conf = calloc(1, sizeof(*conf));
92 if (conf == NULL)
94 TAILQ_INIT(&conf->conf_luns);
95 TAILQ_INIT(&conf->conf_targets);
96 TAILQ_INIT(&conf->conf_auth_groups);
97 TAILQ_INIT(&conf->conf_ports);
98 TAILQ_INIT(&conf->conf_portal_groups);
99 TAILQ_INIT(&conf->conf_pports);
100 TAILQ_INIT(&conf->conf_isns);
102 conf->conf_isns_period = 900;
103 conf->conf_isns_timeout = 5;
104 conf->conf_debug = 0;
105 conf->conf_timeout = 60;
106 conf->conf_maxproc = 30;
108 return (conf);
112 conf_delete(struct conf *conf)
121 assert(conf->conf_pidfh == NULL);
123 TAILQ_FOREACH_SAFE(lun, &conf->conf_luns, l_next, ltmp)
125 TAILQ_FOREACH_SAFE(targ, &conf->conf_targets, t_next, tmp)
127 TAILQ_FOREACH_SAFE(ag, &conf->conf_auth_groups, ag_next, cagtmp)
129 TAILQ_FOREACH_SAFE(pg, &conf->conf_portal_groups, pg_next, cpgtmp)
131 TAILQ_FOREACH_SAFE(pp, &conf->conf_pports, pp_next, pptmp)
133 TAILQ_FOREACH_SAFE(is, &conf->conf_isns, i_next, istmp)
135 assert(TAILQ_EMPTY(&conf->conf_ports));
136 free(conf->conf_pidfile_path);
137 free(conf);
482 auth_group_new(struct conf *conf, const char *name)
487 ag = auth_group_find(conf, name);
502 ag->ag_conf = conf;
503 TAILQ_INSERT_TAIL(&conf->conf_auth_groups, ag, ag_next);
529 auth_group_find(const struct conf *conf, const char *name)
533 TAILQ_FOREACH(ag, &conf->conf_auth_groups, ag_next) {
608 portal_group_new(struct conf *conf, const char *name)
612 pg = portal_group_find(conf, name);
625 pg->pg_conf = conf;
629 TAILQ_INSERT_TAIL(&conf->conf_portal_groups, pg, pg_next);
656 portal_group_find(const struct conf *conf, const char *name)
660 TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) {
749 isns_new(struct conf *conf, const char *addr)
756 isns->i_conf = conf;
757 TAILQ_INSERT_TAIL(&conf->conf_isns, isns, i_next);
807 struct conf *conf = isns->i_conf;
817 isns_req_add_str(req, 32, TAILQ_FIRST(&conf->conf_targets)->t_name);
821 isns_req_add_32(req, 6, conf->conf_isns_period);
822 TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) {
830 TAILQ_FOREACH(target, &conf->conf_targets, t_next) {
868 struct conf *conf = isns->i_conf;
874 isns_req_add_str(req, 32, TAILQ_FIRST(&conf->conf_targets)->t_name);
901 struct conf *conf = isns->i_conf;
907 isns_req_add_str(req, 32, TAILQ_FIRST(&conf->conf_targets)->t_name);
933 struct conf *conf = isns->i_conf;
937 if (TAILQ_EMPTY(&conf->conf_targets) ||
938 TAILQ_EMPTY(&conf->conf_portal_groups))
940 set_timeout(conf->conf_isns_timeout, false);
961 struct conf *conf = isns->i_conf;
965 if (TAILQ_EMPTY(&conf->conf_targets) ||
966 TAILQ_EMPTY(&conf->conf_portal_groups))
968 set_timeout(conf->conf_isns_timeout, false);
990 struct conf *conf = isns->i_conf;
994 if (TAILQ_EMPTY(&conf->conf_targets) ||
995 TAILQ_EMPTY(&conf->conf_portal_groups))
997 set_timeout(conf->conf_isns_timeout, false);
1177 pport_new(struct conf *conf, const char *name, uint32_t ctl_port)
1184 pp->pp_conf = conf;
1188 TAILQ_INSERT_TAIL(&conf->conf_pports, pp, pp_next);
1193 pport_find(const struct conf *conf, const char *name)
1197 TAILQ_FOREACH(pp, &conf->conf_pports, pp_next) {
1205 pport_copy(struct pport *pp, struct conf *conf)
1209 ppnew = pport_new(conf, pp->pp_name, pp->pp_ctl_port);
1226 port_new(struct conf *conf, struct target *target, struct portal_group *pg)
1235 if (port_find(conf, name) != NULL) {
1243 port->p_conf = conf;
1246 TAILQ_INSERT_TAIL(&conf->conf_ports, port, p_next);
1255 port_new_ioctl(struct conf *conf, struct target *target, int pp, int vp)
1269 pport = pport_find(conf, pname);
1272 return (port_new_pp(conf, target, pport));
1280 if (port_find(conf, name) != NULL) {
1288 port->p_conf = conf;
1293 TAILQ_INSERT_TAIL(&conf->conf_ports, port, p_next);
1300 port_new_pp(struct conf *conf, struct target *target, struct pport *pp)
1309 if (port_find(conf, name) != NULL) {
1317 port->p_conf = conf;
1319 TAILQ_INSERT_TAIL(&conf->conf_ports, port, p_next);
1328 port_find(const struct conf *conf, const char *name)
1332 TAILQ_FOREACH(port, &conf->conf_ports, p_next) {
1382 target_new(struct conf *conf, const char *name)
1387 targ = target_find(conf, name);
1408 targ->t_conf = conf;
1410 TAILQ_INSERT_TAIL(&conf->conf_targets, targ, t_next);
1430 target_find(struct conf *conf, const char *name)
1434 TAILQ_FOREACH(targ, &conf->conf_targets, t_next) {
1459 lun_new(struct conf *conf, const char *name)
1463 lun = lun_find(conf, name);
1472 lun->l_conf = conf;
1475 TAILQ_INSERT_TAIL(&conf->conf_luns, lun, l_next);
1508 lun_find(const struct conf *conf, const char *name)
1512 TAILQ_FOREACH(lun, &conf->conf_luns, l_next) {
1663 conf_print(struct conf *conf)
1675 TAILQ_FOREACH(ag, &conf->conf_auth_groups, ag_next) {
1689 TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) {
1695 TAILQ_FOREACH(lun, &conf->conf_luns, l_next) {
1703 TAILQ_FOREACH(targ, &conf->conf_targets, t_next) {
1769 conf_verify(struct conf *conf)
1779 if (conf->conf_pidfile_path == NULL)
1780 conf->conf_pidfile_path = checked_strdup(DEFAULT_PIDFILE);
1782 TAILQ_FOREACH(lun, &conf->conf_luns, l_next) {
1787 TAILQ_FOREACH(targ, &conf->conf_targets, t_next) {
1789 targ->t_auth_group = auth_group_find(conf,
1794 pg = portal_group_find(conf, "default");
1796 port_new(conf, targ, pg);
1813 TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) {
1817 auth_group_find(conf, "default");
1841 TAILQ_FOREACH(ag, &conf->conf_auth_groups, ag_next) {
1848 TAILQ_FOREACH(targ, &conf->conf_targets, t_next) {
1854 TAILQ_FOREACH(port, &conf->conf_ports, p_next) {
1860 TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) {
1879 conf_apply(struct conf *oldconf, struct conf *newconf)
2410 struct conf *conf;
2412 conf = portal->p_portal_group->pg_conf;
2420 while (conf->conf_maxproc > 0 && nchildren >= conf->conf_maxproc) {
2422 "waiting for child process to exit", conf->conf_maxproc);
2437 pidfile_close(conf->conf_pidfh);
2450 set_timeout(conf->conf_timeout, true);
2481 main_loop(struct conf *conf, bool dont_fork)
2494 pidfile_write(conf->conf_pidfh);
2509 TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) {
2529 TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) {
2539 TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) {
2648 static struct conf *
2649 conf_new_from_file(const char *path, struct conf *oldconf, bool ucl)
2651 struct conf *conf;
2659 conf = conf_new();
2662 pport_copy(pp, conf);
2664 ag = auth_group_new(conf, "default");
2667 ag = auth_group_new(conf, "no-authentication");
2671 ag = auth_group_new(conf, "no-access");
2675 pg = portal_group_new(conf, "default");
2679 error = uclparse_conf(conf, path);
2681 error = parse_conf(conf, path);
2684 conf_delete(conf);
2690 if (conf->conf_default_ag_defined == false) {
2693 ag = auth_group_find(conf, "default");
2698 if (conf->conf_default_pg_defined == false) {
2701 pg = portal_group_find(conf, "default");
2707 conf->conf_kernel_port_on = true;
2709 error = conf_verify(conf);
2711 conf_delete(conf);
2715 return (conf);
2721 struct conf *oldconf, *newconf, *tmpconf;