static struct sdirs *setup_sdirs(struct conf **confs) { struct sdirs *sdirs; fail_unless((sdirs=sdirs_alloc())!=NULL); fail_unless(sdirs_init_from_confs(sdirs, confs)==0); return sdirs; }
static struct sdirs *setup_sdirs(void) { struct sdirs *sdirs; fail_unless((sdirs=sdirs_alloc())!=NULL); do_sdirs_init(sdirs); return sdirs; }
// The return code of this is the return code of the standalone process. int champ_chooser_server_standalone(struct conf **globalcs) { int ret=1; struct sdirs *sdirs=NULL; struct conf **cconfs=NULL; const char *orig_client=get_string(globalcs[OPT_ORIG_CLIENT]); if(!(cconfs=confs_alloc())) goto end; confs_init(cconfs); // We need to be given a client name and load the relevant server side // clientconfdir file, because various settings may be overridden // there. if(set_string(cconfs[OPT_CNAME], orig_client) || conf_load_clientconfdir(globalcs, cconfs) || !(sdirs=sdirs_alloc()) || sdirs_init_from_confs(sdirs, cconfs) || champ_chooser_server(sdirs, cconfs, 0 /* resume */)) goto end; ret=0; end: confs_free(&cconfs); sdirs_free(&sdirs); return ret; }
static struct sdirs *setup_sdirs(enum protocol protocol) { struct sdirs *sdirs; fail_unless((sdirs=sdirs_alloc())!=NULL); do_sdirs_init(sdirs, protocol); return sdirs; }
int cstat_init(struct cstat *cstat, const char *name, const char *clientconfdir) { if((clientconfdir && !(cstat->conffile=prepend_s(clientconfdir, name))) || !(cstat->name=strdup_w(name, __func__)) || !(cstat->sdirs=sdirs_alloc())) return -1; return 0; }
static struct sdirs *setup_sdirs(enum protocol protocol) { struct sdirs *sdirs; fail_unless((sdirs=sdirs_alloc())!=NULL); fail_unless(!sdirs_init(sdirs, protocol, BASE, // directory CNAME, // cname NULL, // client_lockdir "a_group", // dedup_group NULL // manual_delete )); return sdirs; }
int run_action_server(struct async *as, const char *incexc, int srestore, int *timer_ret, struct conf **cconfs) { int ret=-1; struct sdirs *sdirs=NULL; if((sdirs=sdirs_alloc()) && !sdirs_init_from_confs(sdirs, cconfs)) ret=run_action_server_do(as, sdirs, incexc, srestore, timer_ret, cconfs); if(sdirs) lock_release(sdirs->lock); sdirs_free(&sdirs); return ret; }
static struct sdirs *setup_sdirs(struct sd *s, int slen, enum protocol protocol) { struct sdirs *sdirs; fail_unless(recursive_delete(BASE)==0); fail_unless((sdirs=sdirs_alloc())!=NULL); fail_unless(!sdirs_init(sdirs, protocol, BASE, // directory "utestclient", // cname NULL, // client_lockdir "a_group", // dedup_group NULL // manual_delete )); build_storage_dirs(sdirs, s, slen); return sdirs; }
static int set_cstat_from_conf(struct cstat *cstat, struct conf **parentconfs, struct conf **cconfs) { struct strlist *s=NULL; // Make sure the permitted flag is set appropriately. cstat->permitted=cstat_permitted(cstat, parentconfs, cconfs); cstat->protocol=get_protocol(cconfs); sdirs_free((struct sdirs **)&cstat->sdirs); if(!(cstat->sdirs=sdirs_alloc()) || sdirs_init_from_confs((struct sdirs *)cstat->sdirs, cconfs)) return -1; strlists_free(&cstat->labels); for(s=get_strlist(cconfs[OPT_LABEL]); s; s=s->next) if(strlist_add_sorted(&cstat->labels, s->path, s->flag)) return -1; return 0; }