Lines Matching defs:cfg

38 #include <sys/nsctl/cfg.h>
107 * CFGFILE *cfg: A pointer to the current config file, or NULL if this
121 cfg_add_user(CFGFILE* cfg, char *path, char *cnode, char *user)
128 self_open = (cfg == NULL);
133 cfg = cfg_open(NULL);
134 if (cfg == NULL) {
138 if (!cfg_lock(cfg, CFG_WRLOCK)) {
140 cfg_close(cfg);
146 ctag = cfg_get_resource(cfg);
152 cfg_resource(cfg, cnode);
157 if (cfg_load_dsvols(cfg) < 0) {
159 cfg_close(cfg);
172 cfg_rewind(cfg, CFG_SEC_CONF);
175 rc = cfg_put_cstring(cfg, "dsvol", buf, strlen(buf));
181 cfg_close(cfg);
188 if (cfg_load_dsvols(cfg) < 0) {
190 cfg_close(cfg);
208 cfg_rewind(cfg, CFG_SEC_CONF);
213 if (cfg_put_cstring(cfg, search_key, buf,
219 cfg_close(cfg);
232 if (cfg_load_dsvols(cfg) < 0) {
234 cfg_close(cfg);
252 (void) cfg_commit(cfg);
253 cfg_close(cfg);
269 * CFGFILE *cfg: A pointer to the current config file, or NULL if this
281 cfg_rem_user(CFGFILE *cfg, char *path, char *cnode, char *user)
290 self_open = (cfg == NULL);
300 ctag = cfg_get_resource(cfg);
306 cfg_resource(cfg, cnode);
311 cfg = cfg_open(NULL);
312 if (cfg == NULL) {
316 if (!cfg_lock(cfg, CFG_WRLOCK)) {
318 cfg_close(cfg);
326 if (cfg_load_dsvols(cfg) < 0) {
328 cfg_close(cfg);
344 cfg_rewind(cfg, CFG_SEC_CONF);
347 if (cfg_put_cstring(cfg, cfg_key, NULL, 0) < 0) {
352 cfg_close(cfg);
358 if (cfg_load_dsvols(cfg) < 0) {
360 cfg_close(cfg);
400 cfg_rewind(cfg, CFG_SEC_CONF);
403 if (cfg_put_cstring(cfg, cfg_key, buf,
409 cfg_close(cfg);
415 if (cfg_load_dsvols(cfg) < 0) {
417 cfg_close(cfg);
424 cfg_rewind(cfg, CFG_SEC_CONF);
427 if (cfg_put_cstring(cfg, cfg_key, NULL,
433 cfg_close(cfg);
445 if (cfg_load_dsvols(cfg) < 0) {
447 cfg_close(cfg);
463 (void) cfg_commit(cfg);
464 cfg_close(cfg);
475 * cfg - The config file to use.
481 cfg_vol_enable(CFGFILE *cfg, char *path, char *ctag, char *user)
491 rc = cfg_add_user(cfg, path, ctag, user);
503 retval = sv_action(path, cfg, ctag, DO_ENABLE);
505 (void) cfg_rem_user(cfg, path, ctag, user);
522 * cfg - The config file to use.
528 cfg_vol_disable(CFGFILE *cfg, char *path, char *ctag, char *user)
538 rc = cfg_rem_user(cfg, path, ctag, user);
555 retval = sv_action(path, cfg, ctag, DO_DISABLE);
576 * 1/ cfg file is open
577 * 2/ cfg file has been write-locked
584 cfg_load_dsvols(CFGFILE *cfg)
593 char *ctag = cfg_get_resource(cfg);
604 cfg_rewind(cfg, CFG_SEC_CONF);
605 entries = cfg_get_section(cfg, &entry, "dsvol");
694 * 1/ cfg file is open
695 * 2/ cfg file has been write-locked
699 cfg_load_svols(CFGFILE *cfg)
705 char *ctag = cfg_get_resource(cfg);
715 cfg_rewind(cfg, CFG_SEC_CONF);
716 entries = cfg_get_section(cfg, &entry, "sv");
783 * cfg - The config file to use
794 cfg_get_canonical_name(CFGFILE *cfg, const char *path, char **result)
803 if (cfg_load_shadows(cfg) < 0) {
836 * cfg - The config file to use
843 cfg_load_shadows(CFGFILE *cfg)
852 if (cfg_load_dsvols(cfg) < 0) {
864 cfg_rewind(cfg, CFG_SEC_CONF);
865 entries = cfg_get_section(cfg, &entry, "ii");
986 CFGFILE *cfg;
997 cfg = cfg_open(NULL);
998 if (cfg == NULL)
1002 cfg_resource(cfg, ctag);
1004 cfg = caller_cfg;
1061 if (!cfg_lock(cfg, CFG_WRLOCK))
1066 cfg_rewind(cfg, CFG_SEC_CONF);
1069 if (cfg_put_cstring(cfg, "sv", buf, CFG_MAX_BUF) < 0) {
1078 if (cfg_load_svols(cfg) < 0) {
1080 cfg_close(cfg);
1088 cfg_rewind(cfg, CFG_SEC_CONF);
1091 if (cfg_put_cstring(cfg, key, NULL, NULL) < 0) {
1104 if (cfg_load_svols(cfg) < 0) {
1106 cfg_close(cfg);
1128 if (cfg == NULL)
1133 (void) cfg_commit(cfg);
1136 cfg_close(cfg);