📄 config.swg
字号:
amglue_add_enum_tag_fns(interface_key);amglue_add_constant(INTER_COMMENT, interface_key);amglue_add_constant(INTER_MAXUSAGE, interface_key);amglue_copy_to_tag(interface_key, getconf);amglue_add_enum_tag_fns(holdingdisk_key);amglue_add_constant(HOLDING_COMMENT, holdingdisk_key);amglue_add_constant(HOLDING_DISKDIR, holdingdisk_key);amglue_add_constant(HOLDING_DISKSIZE, holdingdisk_key);amglue_add_constant(HOLDING_CHUNKSIZE, holdingdisk_key);amglue_copy_to_tag(holdingdisk_key, getconf);/* * Various enumerated conftypes */amglue_add_enum_tag_fns(dump_holdingdisk_t);amglue_add_constant(HOLD_NEVER, dump_holdingdisk_t);amglue_add_constant(HOLD_AUTO, dump_holdingdisk_t);amglue_add_constant(HOLD_REQUIRED, dump_holdingdisk_t);amglue_copy_to_tag(dump_holdingdisk_t, getconf);amglue_add_enum_tag_fns(comp_t);amglue_add_constant(COMP_NONE, comp_t);amglue_add_constant(COMP_FAST, comp_t);amglue_add_constant(COMP_BEST, comp_t);amglue_add_constant(COMP_CUST, comp_t);amglue_add_constant(COMP_SERVER_FAST, comp_t);amglue_add_constant(COMP_SERVER_BEST, comp_t);amglue_add_constant(COMP_SERVER_CUST, comp_t);amglue_copy_to_tag(comp_t, getconf);amglue_add_enum_tag_fns(encrypt_t);amglue_add_constant(ENCRYPT_NONE, encrypt_t);amglue_add_constant(ENCRYPT_CUST, encrypt_t);amglue_add_constant(ENCRYPT_SERV_CUST, encrypt_t);amglue_copy_to_tag(encrypt_t, getconf);amglue_add_enum_tag_fns(strategy_t);amglue_add_constant(DS_SKIP, strategy_t);amglue_add_constant(DS_STANDARD, strategy_t);amglue_add_constant(DS_NOFULL, strategy_t);amglue_add_constant(DS_NOINC, strategy_t);amglue_add_constant(DS_4, strategy_t);amglue_add_constant(DS_5, strategy_t);amglue_add_constant(DS_HANOI, strategy_t);amglue_add_constant(DS_INCRONLY, strategy_t);amglue_copy_to_tag(strategy_t, getconf);amglue_add_enum_tag_fns(estimate_t);amglue_add_constant(ES_CLIENT, estimate_t);amglue_add_constant(ES_SERVER, estimate_t);amglue_add_constant(ES_CALCSIZE, estimate_t);amglue_copy_to_tag(estimate_t, getconf);amglue_add_enum_tag_fns(taperalgo_t);amglue_add_constant(ALGO_FIRST, taperalgo_t);amglue_add_constant(ALGO_FIRSTFIT, taperalgo_t);amglue_add_constant(ALGO_LARGEST, taperalgo_t);amglue_add_constant(ALGO_LARGESTFIT, taperalgo_t);amglue_add_constant(ALGO_SMALLEST, taperalgo_t);amglue_add_constant(ALGO_LAST, taperalgo_t);amglue_copy_to_tag(taperalgo_t, getconf);/* * val_t typemaps *//* Typemap to convert a val_t, the union in which config values are * stored, to a Perl value of the appropriate type. This converts: * - CONFTYPE_SIZE, CONFTYPE_INT, CONFTYPE_AM64, * CONFTYPE_BOOLEAN -> IV * - CONFTYPE_REAL -> NV * - CONFTYPE_STR, CONFTYPE_IDENT -> PV * - CONFTYPE_TIME -> IV (epoch timestamp) * - CONFTYPE_COMPRESS, CONFTYPE_ENCRYPT, CONFTYPE_ESTIMATE, CONFTYPE_STRATEGY, * CONFTYPE_TAPERALGO, CONFTYPE_PRIORITY, CONFTYPE_HOLDING -> IV (enums) * - CONFTYPE_RATE -> list of two NVs * - CONFTYPE_INTRANGE -> list of two IVs * - CONFTYPE_EXINCLUDE -> hashref with keys 'list' (listref), 'file' (listref), * and 'optional' (int) * - CONFTYPE_PROPLIST -> hashref */%typemap (out) val_t * { switch ($1->type) { case CONFTYPE_RATE: { $result= sv_newmortal(); sv_setnv($result, val_t__rate($1)[0]); argvi++; $result= sv_newmortal(); sv_setnv($result, val_t__rate($1)[1]); argvi++; break; } case CONFTYPE_INTRANGE: { $result= sv_newmortal(); sv_setiv($result, val_t__intrange($1)[0]); argvi++; $result= sv_newmortal(); sv_setiv($result, val_t__intrange($1)[1]); argvi++; break; break; } case CONFTYPE_EXINCLUDE: { /* exincludes are represented in perl as { * 'list' : [ 'list1', 'list2', ..], * 'file' : [ 'file1', 'file2', ..], * 'optional' : 1, * } */ exinclude_t *ei = &val_t__exinclude($1); AV *list_entries = (AV *)sv_2mortal((SV *)newAV()); AV *file_entries = (AV *)sv_2mortal((SV *)newAV()); SV *optional = sv_newmortal(); HV *hv; sle_t *iter; /* first set up each of the hash values */ if (ei->sl_list) { for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) { av_push(list_entries, newSVpv(iter->name, 0)); } } if(ei->sl_file) { for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) { av_push(file_entries, newSVpv(iter->name, 0)); } } sv_setiv(optional, ei->optional); /* now build the hash */ hv = (HV *)sv_2mortal((SV *)newHV()); hv_store(hv, "file", 4, newRV((SV *)file_entries), 0); hv_store(hv, "list", 4, newRV((SV *)list_entries), 0); hv_store(hv, "optional", 8, optional, 0); SvREFCNT_inc(optional); $result = sv_2mortal(newRV((SV *)hv)); argvi++; break; } case CONFTYPE_PROPLIST: $result = sv_2mortal(g_hash_table_to_hashref(val_t__proplist($1))); argvi++; break; case CONFTYPE_SIZE: $result = sv_2mortal(amglue_newSVi64(val_t__size($1))); argvi++; break; case CONFTYPE_AM64: $result = sv_2mortal(amglue_newSVi64(val_t__am64($1))); argvi++; break; case CONFTYPE_BOOLEAN: /* all same as INT.. */ case CONFTYPE_COMPRESS: case CONFTYPE_ENCRYPT: case CONFTYPE_ESTIMATE: case CONFTYPE_STRATEGY: case CONFTYPE_TAPERALGO: case CONFTYPE_PRIORITY: case CONFTYPE_HOLDING: case CONFTYPE_INT: $result = sv_2mortal(amglue_newSVi64(val_t__int($1))); argvi++; break; case CONFTYPE_TIME: $result = sv_2mortal(amglue_newSVi64(val_t__time($1))); argvi++; break; case CONFTYPE_REAL: $result = sv_newmortal(); sv_setnv($result, val_t__real($1)); argvi++; break; case CONFTYPE_IDENT: /* same as STRING */ case CONFTYPE_STR: $result = sv_newmortal(); sv_setpv($result, val_t__str($1)); argvi++; break; /* No match yet -> not one of the "complex" types */ default: SWIG_exception(SWIG_TypeError, "Unknown val_t conftype"); break; }}/* Typemap for the return value of getconf_list; this assumes that * the GSList contains strings, and that it should be freed; both * are true for getconf_list. */%typemap (out) GSList * { GSList *it = $1; while (it) { $result = sv_2mortal(newSVpv(it->data, 0)); argvi++; it = it->next; } g_slist_free($1);}val_t *getconf(confparm_key key);gboolean getconf_seen(confparm_key key);val_t *getconf_byname(char *key);GSList *getconf_list(char *listname);amglue_export_tag(getconf, getconf getconf_seen getconf_byname getconf_list);tapetype_t *lookup_tapetype(char *identifier);val_t *tapetype_getconf(tapetype_t *ttyp, tapetype_key key);char *tapetype_name(tapetype_t *ttyp);gboolean tapetype_seen(tapetype_t *ttyp, tapetype_key key);amglue_export_tag(getconf, lookup_tapetype tapetype_getconf tapetype_name tapetype_seen tapetype_seen);dumptype_t *lookup_dumptype(char *identifier);val_t *dumptype_getconf(dumptype_t *dtyp, dumptype_key key);char *dumptype_name(dumptype_t *dtyp);gboolean dumptype_seen(dumptype_t *dtyp, dumptype_key key);amglue_export_tag(getconf, lookup_dumptype dumptype_getconf dumptype_name dumptype_seen dumptype_seen);interface_t *lookup_interface(char *identifier);val_t *interface_getconf(interface_t *iface, interface_key key);char *interface_name(interface_t *iface);gboolean interface_seen(interface_t *iface, interface_key key);amglue_export_tag(getconf, lookup_interface interface_getconf interface_name interface_seen interface_seen);holdingdisk_t *lookup_holdingdisk(char *identifier);holdingdisk_t *getconf_holdingdisks(void);holdingdisk_t *holdingdisk_next(holdingdisk_t *hdisk);val_t *holdingdisk_getconf(holdingdisk_t *hdisk, holdingdisk_key key);char *holdingdisk_name(holdingdisk_t *hdisk);gboolean holdingdisk_seen(holdingdisk_t *hdisk, holdingdisk_key key);amglue_export_tag(getconf, lookup_holdingdisk holdingdisk_getconf holdingdisk_name getconf_holdingdisks holdingdisk_next holdingdisk_seen holdingdisk_seen);long int getconf_unit_divisor(void);extern int debug_amandad;extern int debug_amidxtaped;extern int debug_amindexd;extern int debug_amrecover;extern int debug_auth;extern int debug_event;extern int debug_holding;extern int debug_protocol;extern int debug_planner;extern int debug_driver;extern int debug_dumper;extern int debug_chunker;extern int debug_taper;extern int debug_selfcheck;extern int debug_sendsize;extern int debug_sendbackup;amglue_export_tag(getconf, getconf_unit_divisor $debug_amandad $debug_amidxtaped $debug_amindexd $debug_amrecover $debug_auth $debug_event $debug_holding $debug_protocol $debug_planner $debug_driver $debug_dumper $debug_chunker $debug_taper $debug_selfcheck $debug_sendsize $debug_sendbackup);/* * Initialization */config_overwrites_t *new_config_overwrites(int size_estimate);void free_config_overwrites(config_overwrites_t *co);void add_config_overwrite(config_overwrites_t *co, char *key, char *value);void add_config_overwrite_opt(config_overwrites_t *co, char *optarg);void apply_config_overwrites(config_overwrites_t *co);amglue_export_tag(init, new_config_overwrites free_config_overwrites add_config_overwrite add_config_overwrite_opt apply_config_overwrites);amglue_add_flag_tag_fns(config_init_flags);amglue_add_constant(CONFIG_INIT_EXPLICIT_NAME, config_init_flags);amglue_add_constant(CONFIG_INIT_USE_CWD, config_init_flags);amglue_add_constant(CONFIG_INIT_CLIENT, config_init_flags);amglue_add_constant(CONFIG_INIT_OVERLAY, config_init_flags);amglue_add_constant(CONFIG_INIT_FATAL, config_init_flags);amglue_copy_to_tag(config_init_flags, init);gboolean config_init(config_init_flags flags, char *arg_config_name);void config_uninit(void);char **get_config_options(int first);amglue_export_tag(init, config_init config_uninit get_config_options);/* These are accessor functions, because SWIG's wrapping of global string * variables is no so good -- the resulting strings can't be passed to other * functions expecting char * arguments. */%inline %{ char *get_config_name(void) { return config_name; } char *get_config_dir(void) { return config_dir; } char *get_config_filename(void) { return config_filename; }%}amglue_export_tag(init, get_config_name get_config_dir get_config_filename);/* * Miscellaneous */void dump_configuration(void);char *config_dir_relative(char *filename);char *taperalgo2str(taperalgo_t taperalgo);gint64 find_multiplier(char * casestr);amglue_export_ok( dump_configuration config_dir_relative taperalgo2str find_multiplier);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -