/* Getting Configuration Values
* ============================
*
- * Amanda configurations consist of a number of "global" parameters, as well as named
- * subsections of four types: dumptypes, interfaces, holdingdisks, and tapetypes. The
- * global parameters are fetched with the getconf_CONFTYPE functions, keyed by a
- * confparam_t constant (with prefix CNF_). The subsection parameters are fetched with
- * SUBSEC_get_PARAM() macros, e.g., tapetype_get_blocksize(ttyp), where the argument
- * comes from lookup_SUBSEC(), in this case lookup_tapetype(name).
+ * Amanda configurations consist of a number of "global" parameters, as well as
+ * named subsections of several types. The global parameters are fetched with
+ * the getconf_CONFTYPE functions, keyed by a confparam_t constant (with prefix
+ * CNF_). The subsection parameters are fetched with SUBSEC_get_PARAM()
+ * macros, e.g., tapetype_get_blocksize(ttyp), where the argument comes from
+ * lookup_SUBSEC(), in this case lookup_tapetype(name).
*
* Types
* =====
* ======
* Note that, unless specified, all memory in this module is managed by the module
* itself; return strings should not be freed by the caller.
+ *
+ * Error Handling
+ * ==============
+ * All errors and warnings generated by this module are available from get_config_errors().
+ * It is up to the caller to route these messages to the user. The function
+ * config_print_errors() will print the errors to stderr, as a convenience.
*/
/*
* this works and it's here.
*/
+/* A "seen" struct. Rather than allocate strings all over the place, this
+ * string is in the "parsed_filenames" GSList and will be freed when that
+ * GSList is freed. This struct should be opaque to other modules. */
+typedef struct seen_s {
+ char *block;
+ char *filename;
+ int linenum;
+} seen_t;
+
/* holdingdisk types */
typedef enum {
HOLD_NEVER, /* Always direct to tape */
ES_CLIENT, /* client estimate */
ES_SERVER, /* server estimate */
ES_CALCSIZE, /* calcsize estimate */
- ES_ES /* sentinel */
+ ES_ES /* sentinel */
} estimate_t;
+/* A GSlist where each element is a element_t */
+typedef GSList *estimatelist_t;
+
+typedef enum {
+ AL_OTHER_CONFIG = 1<<0,
+ AL_NON_AMANDA = 1<<1,
+ AL_VOLUME_ERROR = 1<<2,
+ AL_EMPTY = 1<<3,
+} autolabel_enum_t;
+typedef int autolabel_set_t;
+
+typedef struct autolabel_s {
+ char *template;
+ autolabel_set_t autolabel;
+} autolabel_t;
/* Dump strategies */
typedef enum {
ALGO_LARGEST,
ALGO_LARGESTFIT,
ALGO_SMALLEST,
+ ALGO_SMALLESTFIT, /* for internal use */
ALGO_LAST,
+ ALGO_LASTFIT, /* for internal use */
ALGO_ALGO /* sentinel */
} taperalgo_t;
+/* execute_on types */
+#define EXECUTE_ON_PRE_AMCHECK 1<<0
+#define EXECUTE_ON_PRE_DLE_AMCHECK 1<<1
+#define EXECUTE_ON_PRE_HOST_AMCHECK 1<<2
+#define EXECUTE_ON_POST_AMCHECK 1<<3
+#define EXECUTE_ON_POST_DLE_AMCHECK 1<<4
+#define EXECUTE_ON_POST_HOST_AMCHECK 1<<5
+#define EXECUTE_ON_PRE_ESTIMATE 1<<6
+#define EXECUTE_ON_PRE_DLE_ESTIMATE 1<<7
+#define EXECUTE_ON_PRE_HOST_ESTIMATE 1<<8
+#define EXECUTE_ON_POST_ESTIMATE 1<<9
+#define EXECUTE_ON_POST_DLE_ESTIMATE 1<<10
+#define EXECUTE_ON_POST_HOST_ESTIMATE 1<<11
+#define EXECUTE_ON_PRE_BACKUP 1<<12
+#define EXECUTE_ON_PRE_DLE_BACKUP 1<<13
+#define EXECUTE_ON_PRE_HOST_BACKUP 1<<14
+#define EXECUTE_ON_POST_BACKUP 1<<15
+#define EXECUTE_ON_POST_DLE_BACKUP 1<<16
+#define EXECUTE_ON_POST_HOST_BACKUP 1<<17
+#define EXECUTE_ON_PRE_RECOVER 1<<18
+#define EXECUTE_ON_POST_RECOVER 1<<19
+#define EXECUTE_ON_PRE_LEVEL_RECOVER 1<<20
+#define EXECUTE_ON_POST_LEVEL_RECOVER 1<<21
+#define EXECUTE_ON_INTER_LEVEL_RECOVER 1<<22
+typedef int execute_on_t;
+
+typedef int execute_where_t;
+
+typedef enum {
+ SEND_AMREPORT_ALL,
+ SEND_AMREPORT_STRANGE,
+ SEND_AMREPORT_ERROR,
+ SEND_AMREPORT_NEVER
+} send_amreport_t;
+
+typedef enum {
+ DATA_PATH_AMANDA = 1<<0,
+ DATA_PATH_DIRECTTCP = 1<<1,
+} data_path_t;
+
typedef struct exinclude_s {
- sl_t *sl_list;
- sl_t *sl_file;
+ am_sl_t *sl_list;
+ am_sl_t *sl_file;
int optional;
} exinclude_t;
+typedef struct {
+ int append;
+ int priority;
+ GSList* values;
+ seen_t seen;
+} property_t;
+
typedef GHashTable* proplist_t;
+/* A GSlist where each element is a 'char*' */
+typedef GSList* identlist_t;
+
+/* part_cache_types */
+typedef enum {
+ PART_CACHE_TYPE_NONE,
+ PART_CACHE_TYPE_MEMORY,
+ PART_CACHE_TYPE_DISK,
+} part_cache_type_t;
+
+/* host_limit */
+typedef struct {
+ gboolean server;
+ gboolean same_host;
+ GSList *match_pats;
+} host_limit_t;
/* Names for the type of value in a val_t. Mostly for internal use, but useful
* for wrapping val_t's, too. */
typedef enum {
CONFTYPE_INT,
- CONFTYPE_AM64,
+ CONFTYPE_INT64,
CONFTYPE_REAL,
CONFTYPE_STR,
CONFTYPE_IDENT,
CONFTYPE_COMPRESS,
CONFTYPE_ENCRYPT,
CONFTYPE_HOLDING,
- CONFTYPE_ESTIMATE,
+ CONFTYPE_ESTIMATELIST,
CONFTYPE_STRATEGY,
CONFTYPE_TAPERALGO,
CONFTYPE_PRIORITY,
CONFTYPE_RATE,
CONFTYPE_INTRANGE,
CONFTYPE_EXINCLUDE,
- CONFTYPE_PROPLIST
+ CONFTYPE_PROPLIST,
+ CONFTYPE_APPLICATION,
+ CONFTYPE_EXECUTE_ON,
+ CONFTYPE_EXECUTE_WHERE,
+ CONFTYPE_SEND_AMREPORT_ON,
+ CONFTYPE_IDENTLIST,
+ CONFTYPE_DATA_PATH,
+ CONFTYPE_AUTOLABEL,
+ CONFTYPE_PART_CACHE_TYPE,
+ CONFTYPE_HOST_LIMIT,
+ CONFTYPE_NO_YES_ALL,
} conftype_t;
+typedef enum {
+ CONF_UNIT_NONE,
+ CONF_UNIT_K,
+} confunit_t;
+
/* This should be considered an opaque type for any other modules. The complete
* struct is included here to allow quick access via macros. Access it *only* through
* those macros. */
typedef struct val_s {
union {
int i;
- off_t am64;
+ gint64 int64;
double r;
char *s;
ssize_t size;
exinclude_t exinclude;
int intrange[2];
proplist_t proplist;
+ estimatelist_t estimatelist;
+ identlist_t identlist;
+ autolabel_t autolabel;
+ host_limit_t host_limit;
} v;
- int seen;
+ seen_t seen;
conftype_t type;
+ confunit_t unit;
} val_t;
/* Functions to typecheck and extract a particular type of
* value from a val_t. All call error() if the type is incorrect,
* as this is a programming error. */
-int val_t_to_int (val_t *);
-off_t val_t_to_am64 (val_t *);
-float val_t_to_real (val_t *);
-char *val_t_to_str (val_t *); /* (also converts CONFTYPE_IDENT) */
-char *val_t_to_ident (val_t *); /* (also converts CONFTYPE_STR) */
-time_t val_t_to_time (val_t *);
-ssize_t val_t_to_size (val_t *);
-int val_t_to_boolean (val_t *);
-comp_t val_t_to_compress (val_t *);
-encrypt_t val_t_to_encrypt (val_t *);
-dump_holdingdisk_t val_t_to_holding (val_t *);
-estimate_t val_t_to_estimate (val_t *);
-strategy_t val_t_to_strategy (val_t *);
-taperalgo_t val_t_to_taperalgo(val_t *);
-int val_t_to_priority (val_t *);
-float *val_t_to_rate (val_t *); /* array of two floats */
-exinclude_t val_t_to_exinclude(val_t *);
-int *val_t_to_intrange (val_t *); /* array of two ints */
-proplist_t val_t_to_proplist (val_t *);
+int val_t_to_int (val_t *);
+gint64 val_t_to_int64 (val_t *);
+float val_t_to_real (val_t *);
+char *val_t_to_str (val_t *); /* (also converts CONFTYPE_IDENT) */
+char *val_t_to_ident (val_t *); /* (also converts CONFTYPE_STR) */
+identlist_t val_t_to_identlist(val_t *);
+time_t val_t_to_time (val_t *);
+ssize_t val_t_to_size (val_t *);
+int val_t_to_boolean (val_t *);
+int val_t_to_no_yes_all(val_t *);
+comp_t val_t_to_compress (val_t *);
+encrypt_t val_t_to_encrypt (val_t *);
+dump_holdingdisk_t val_t_to_holding (val_t *);
+estimatelist_t val_t_to_estimatelist (val_t *);
+strategy_t val_t_to_strategy (val_t *);
+taperalgo_t val_t_to_taperalgo(val_t *);
+int val_t_to_priority (val_t *);
+float *val_t_to_rate (val_t *); /* array of two floats */
+exinclude_t val_t_to_exinclude(val_t *);
+int *val_t_to_intrange (val_t *); /* array of two ints */
+proplist_t val_t_to_proplist (val_t *);
+char *val_t_to_application(val_t *);
+execute_on_t val_t_to_execute_on(val_t *);
+execute_where_t val_t_to_execute_where(val_t *);
+send_amreport_t val_t_to_send_amreport(val_t *);
+data_path_t val_t_to_data_path(val_t *);
+autolabel_t val_t_to_autolabel(val_t *);
+part_cache_type_t val_t_to_part_cache_type(val_t *);
+host_limit_t *val_t_to_host_limit(val_t *);
/* Has the given val_t been seen in a configuration file or config overwrite?
*
* @param val: val_t* to examine
* @returns: boolean
*/
-#define val_t_seen(val) ((val)->seen)
+#define val_t_seen(val) ((val)->seen.linenum)
/* What is the underlying type of this val_t?
*
* (in the macro name) to the corresponding union field. The macros work
* as lvalues, too.
*/
-#define val_t__seen(val) ((val)->seen)
-#define val_t__int(val) ((val)->v.i)
-#define val_t__am64(val) ((val)->v.am64)
-#define val_t__real(val) ((val)->v.r)
-#define val_t__str(val) ((val)->v.s)
-#define val_t__ident(val) ((val)->v.s)
-#define val_t__time(val) ((val)->v.t)
-#define val_t__size(val) ((val)->v.size)
-#define val_t__boolean(val) ((val)->v.i)
-#define val_t__compress(val) ((val)->v.i)
-#define val_t__encrypt(val) ((val)->v.i)
-#define val_t__holding(val) ((val)->v.i)
-#define val_t__estimate(val) ((val)->v.i)
-#define val_t__strategy(val) ((val)->v.i)
-#define val_t__taperalgo(val) ((val)->v.i)
-#define val_t__priority(val) ((val)->v.i)
-#define val_t__rate(val) ((val)->v.rate)
-#define val_t__exinclude(val) ((val)->v.exinclude)
-#define val_t__intrange(val) ((val)->v.intrange)
-#define val_t__proplist(val) ((val)->v.proplist)
+#define val_t__seen(val) ((val)->seen)
+#define val_t__int(val) ((val)->v.i)
+#define val_t__int64(val) ((val)->v.int64)
+#define val_t__real(val) ((val)->v.r)
+#define val_t__str(val) ((val)->v.s)
+#define val_t__ident(val) ((val)->v.s)
+#define val_t__identlist(val) ((val)->v.identlist)
+#define val_t__time(val) ((val)->v.t)
+#define val_t__size(val) ((val)->v.size)
+#define val_t__boolean(val) ((val)->v.i)
+#define val_t__no_yes_all(val) ((val)->v.i)
+#define val_t__compress(val) ((val)->v.i)
+#define val_t__encrypt(val) ((val)->v.i)
+#define val_t__holding(val) ((val)->v.i)
+#define val_t__estimatelist(val) ((val)->v.estimatelist)
+#define val_t__strategy(val) ((val)->v.i)
+#define val_t__taperalgo(val) ((val)->v.i)
+#define val_t__send_amreport(val) ((val)->v.i)
+#define val_t__priority(val) ((val)->v.i)
+#define val_t__rate(val) ((val)->v.rate)
+#define val_t__exinclude(val) ((val)->v.exinclude)
+#define val_t__intrange(val) ((val)->v.intrange)
+#define val_t__proplist(val) ((val)->v.proplist)
+#define val_t__application(val) ((val)->v.application)
+#define val_t__execute_on(val) ((val)->v.i)
+#define val_t__execute_where(val) ((val)->v.i)
+#define val_t__data_path(val) ((val)->v.i)
+#define val_t__autolabel(val) ((val)->v.autolabel)
+#define val_t__part_cache_type(val) ((val)->v.i)
+#define val_t__host_limit(val) ((val)->v.host_limit)
+
/*
* Parameters
*
CNF_CONF,
CNF_INDEX_SERVER,
CNF_TAPE_SERVER,
+ CNF_AMDUMP_SERVER,
CNF_AUTH,
CNF_SSH_KEYS,
CNF_AMANDAD_PATH,
CNF_CLIENT_USERNAME,
+ CNF_CLIENT_PORT,
CNF_GNUTAR_LIST_DIR,
CNF_AMANDATES,
CNF_MAILTO,
CNF_DUMPUSER,
CNF_TAPEDEV,
CNF_DEVICE_PROPERTY,
+ CNF_PROPERTY,
+ CNF_INTERACTIVITY,
+ CNF_APPLICATION,
+ CNF_APPLICATION_TOOL,
+ CNF_EXECUTE_ON,
+ CNF_PP_SCRIPT,
+ CNF_PP_SCRIPT_TOOL,
+ CNF_PLUGIN,
CNF_CHANGERDEV,
CNF_CHANGERFILE,
CNF_LABELSTR,
CNF_ETIMEOUT,
CNF_DTIMEOUT,
CNF_CTIMEOUT,
- CNF_TAPEBUFS,
CNF_DEVICE_OUTPUT_BUFFER_SIZE,
CNF_PRINTER,
+ CNF_MAILER,
CNF_AUTOFLUSH,
CNF_RESERVE,
CNF_MAXDUMPSIZE,
CNF_AMRECOVER_CHECK_LABEL,
CNF_AMRECOVER_CHANGER,
CNF_TAPERALGO,
+ CNF_SEND_AMREPORT_ON,
CNF_FLUSH_THRESHOLD_DUMPED,
CNF_FLUSH_THRESHOLD_SCHEDULED,
CNF_TAPERFLUSH,
CNF_CONNECT_TRIES,
CNF_REQ_TRIES,
CNF_DEBUG_AMANDAD,
+ CNF_DEBUG_RECOVERY,
CNF_DEBUG_AMIDXTAPED,
CNF_DEBUG_AMINDEXD,
CNF_DEBUG_AMRECOVER,
CNF_RESERVED_UDP_PORT,
CNF_RESERVED_TCP_PORT,
CNF_UNRESERVED_TCP_PORT,
+ CNF_HOLDINGDISK,
+ CNF_AUTOLABEL,
+ CNF_META_AUTOLABEL,
+ CNF_DEBUG_DAYS,
+ CNF_TAPER_PARALLEL_WRITE,
+ CNF_RECOVERY_LIMIT,
+ CNF_TAPERSCAN,
+ CNF_MAX_DLE_BY_VOLUME,
+ CNF_EJECT_VOLUME,
+ CNF_TMPDIR,
CNF_CNF /* sentinel */
} confparm_key;
* @returns: boolean
*/
#define getconf_seen(key) (val_t_seen(getconf((key))))
+#define getconf_linenum(key) (val_t_seen(getconf((key))))
/* (convenience macros)
- * Fetch a gloabl parameter of a specific type. Note that these
+ * Fetch a global parameter of a specific type. Note that these
* convenience macros have a different form from those for the
* subsections: here you specify a type and a key, while for the
* subsections you specify only a key. The difference is historical.
* @returns: various
*/
#define getconf_int(key) (val_t_to_int(getconf((key))))
-#define getconf_am64(key) (val_t_to_am64(getconf((key))))
+#define getconf_int64(key) (val_t_to_int64(getconf((key))))
#define getconf_real(key) (val_t_to_real(getconf((key))))
#define getconf_str(key) (val_t_to_str(getconf((key))))
#define getconf_ident(key) (val_t_to_ident(getconf((key))))
+#define getconf_identlist(key) (val_t_to_identlist(getconf((key))))
#define getconf_time(key) (val_t_to_time(getconf((key))))
#define getconf_size(key) (val_t_to_size(getconf((key))))
#define getconf_boolean(key) (val_t_to_boolean(getconf((key))))
+#define getconf_no_yes_all(key) (val_t_to_no_yes_all(getconf((key))))
#define getconf_compress(key) (val_t_to_compress(getconf((key))))
#define getconf_encrypt(key) (val_t_to_encrypt(getconf((key))))
#define getconf_holding(key) (val_t_to_holding(getconf((key))))
-#define getconf_estimate(key) (val_t_to_estimate(getconf((key))))
+#define getconf_estimatelist(key) (val_t_to_estimatelist(getconf((key))))
#define getconf_strategy(key) (val_t_to_strategy(getconf((key))))
#define getconf_taperalgo(key) (val_t_to_taperalgo(getconf((key))))
#define getconf_priority(key) (val_t_to_priority(getconf((key))))
#define getconf_exinclude(key) (val_t_to_exinclude(getconf((key))))
#define getconf_intrange(key) (val_t_to_intrange(getconf((key))))
#define getconf_proplist(key) (val_t_to_proplist(getconf((key))))
+#define getconf_send_amreport(key) (val_t_to_send_amreport(getconf((key))))
+#define getconf_autolabel(key) (val_t_to_autolabel(getconf((key))))
+#define getconf_part_cache_type(key) (val_t_to_part_cache_type(getconf((key))))
+#define getconf_recovery_limit(key) (val_t_to_host_limit(getconf((key))))
/* Get a list of names for subsections of the given type
*
* desired. */
extern int debug_amandad;
+extern int debug_recovery;
extern int debug_amidxtaped;
extern int debug_amindexd;
extern int debug_amrecover;
TAPETYPE_LENGTH,
TAPETYPE_FILEMARK,
TAPETYPE_SPEED,
- TAPETYPE_FILE_PAD,
+ TAPETYPE_PART_SIZE,
+ TAPETYPE_PART_CACHE_TYPE,
+ TAPETYPE_PART_CACHE_DIR,
+ TAPETYPE_PART_CACHE_MAX_SIZE,
TAPETYPE_TAPETYPE /* sentinel */
} tapetype_key;
* @param ttyp: the tapetype to examine
* @returns: various
*/
-#define tapetype_get_comment(ttyp) (val_t_to_str(tapetype_getconf((ttyp), TAPETYPE_COMMENT)))
-#define tapetype_get_lbl_templ(ttyp) (val_t_to_str(tapetype_getconf((ttyp), TAPETYPE_LBL_TEMPL)))
-#define tapetype_get_blocksize(ttyp) (val_t_to_size(tapetype_getconf((ttyp), TAPETYPE_BLOCKSIZE)))
-#define tapetype_get_readblocksize(ttyp) (val_t_to_size(tapetype_getconf((ttyp), TAPETYPE_READBLOCKSIZE)))
-#define tapetype_get_length(ttyp) (val_t_to_am64(tapetype_getconf((ttyp), TAPETYPE_LENGTH)))
-#define tapetype_get_filemark(ttyp) (val_t_to_am64(tapetype_getconf((ttyp), TAPETYPE_FILEMARK)))
-#define tapetype_get_speed(ttyp) (val_t_to_int(tapetype_getconf((ttyp), TAPETYPE_SPEED)))
-#define tapetype_get_file_pad(ttyp) (val_t_to_boolean(tapetype_getconf((ttyp), TAPETYPE_FILE_PAD)))
+#define tapetype_get_comment(ttyp) (val_t_to_str(tapetype_getconf((ttyp), TAPETYPE_COMMENT)))
+#define tapetype_get_lbl_templ(ttyp) (val_t_to_str(tapetype_getconf((ttyp), TAPETYPE_LBL_TEMPL)))
+#define tapetype_get_blocksize(ttyp) (val_t_to_size(tapetype_getconf((ttyp), TAPETYPE_BLOCKSIZE)))
+#define tapetype_get_readblocksize(ttyp) (val_t_to_size(tapetype_getconf((ttyp), TAPETYPE_READBLOCKSIZE)))
+#define tapetype_get_length(ttyp) (val_t_to_int64(tapetype_getconf((ttyp), TAPETYPE_LENGTH)))
+#define tapetype_get_filemark(ttyp) (val_t_to_int64(tapetype_getconf((ttyp), TAPETYPE_FILEMARK)))
+#define tapetype_get_speed(ttyp) (val_t_to_int(tapetype_getconf((ttyp), TAPETYPE_SPEED)))
+#define tapetype_get_part_size(ttyp) (val_t_to_int64(tapetype_getconf((ttyp), TAPETYPE_PART_SIZE)))
+#define tapetype_get_part_cache_type(ttyp) (val_t_to_part_cache_type(tapetype_getconf((ttyp), TAPETYPE_PART_CACHE_TYPE)))
+#define tapetype_get_part_cache_dir(ttyp) (val_t_to_str(tapetype_getconf((ttyp), TAPETYPE_PART_CACHE_DIR)))
+#define tapetype_get_part_cache_max_size(ttyp) (val_t_to_int64(tapetype_getconf((ttyp), TAPETYPE_PART_CACHE_MAX_SIZE)))
/*
* Dumptype parameter access
+ *
+ * Note that some parameters are generic to the host
*/
typedef enum {
DUMPTYPE_CLNTCOMPPROG,
DUMPTYPE_SRV_ENCRYPT,
DUMPTYPE_CLNT_ENCRYPT,
- DUMPTYPE_AMANDAD_PATH,
- DUMPTYPE_CLIENT_USERNAME,
- DUMPTYPE_SSH_KEYS,
- DUMPTYPE_SECURITY_DRIVER,
+ DUMPTYPE_AMANDAD_PATH, /* host parameter */
+ DUMPTYPE_CLIENT_USERNAME, /* host parameter */
+ DUMPTYPE_SSH_KEYS, /* host parameter */
+ DUMPTYPE_AUTH, /* host parameter */
DUMPTYPE_EXCLUDE,
DUMPTYPE_INCLUDE,
DUMPTYPE_PRIORITY,
DUMPTYPE_DUMPCYCLE,
- DUMPTYPE_MAXDUMPS,
+ DUMPTYPE_MAXDUMPS, /* host parameter */
DUMPTYPE_MAXPROMOTEDAY,
DUMPTYPE_BUMPPERCENT,
DUMPTYPE_BUMPSIZE,
DUMPTYPE_BUMPMULT,
DUMPTYPE_STARTTIME,
DUMPTYPE_STRATEGY,
- DUMPTYPE_ESTIMATE,
+ DUMPTYPE_ESTIMATELIST,
DUMPTYPE_COMPRESS,
DUMPTYPE_ENCRYPT,
DUMPTYPE_SRV_DECRYPT_OPT,
DUMPTYPE_KENCRYPT,
DUMPTYPE_IGNORE,
DUMPTYPE_INDEX,
+ DUMPTYPE_APPLICATION,
+ DUMPTYPE_SCRIPTLIST,
+ DUMPTYPE_PROPERTY,
+ DUMPTYPE_CLIENT_PORT,
+ DUMPTYPE_DATA_PATH,
+ DUMPTYPE_ALLOW_SPLIT,
+ DUMPTYPE_RECOVERY_LIMIT,
+ DUMPTYPE_DUMP_LIMIT,
+ DUMPTYPE_MAX_WARNINGS,
DUMPTYPE_DUMPTYPE /* sentinel */
} dumptype_key;
#define dumptype_get_amandad_path(dtyp) (val_t_to_str(dumptype_getconf((dtyp), DUMPTYPE_AMANDAD_PATH)))
#define dumptype_get_client_username(dtyp) (val_t_to_str(dumptype_getconf((dtyp), DUMPTYPE_CLIENT_USERNAME)))
#define dumptype_get_ssh_keys(dtyp) (val_t_to_str(dumptype_getconf((dtyp), DUMPTYPE_SSH_KEYS)))
-#define dumptype_get_security_driver(dtyp) (val_t_to_str(dumptype_getconf((dtyp), DUMPTYPE_SECURITY_DRIVER)))
+#define dumptype_get_auth(dtyp) (val_t_to_str(dumptype_getconf((dtyp), DUMPTYPE_AUTH)))
#define dumptype_get_exclude(dtyp) (val_t_to_exinclude(dumptype_getconf((dtyp), DUMPTYPE_EXCLUDE)))
#define dumptype_get_include(dtyp) (val_t_to_exinclude(dumptype_getconf((dtyp), DUMPTYPE_INCLUDE)))
#define dumptype_get_priority(dtyp) (val_t_to_priority(dumptype_getconf((dtyp), DUMPTYPE_PRIORITY)))
#define dumptype_get_maxdumps(dtyp) (val_t_to_int(dumptype_getconf((dtyp), DUMPTYPE_MAXDUMPS)))
#define dumptype_get_maxpromoteday(dtyp) (val_t_to_int(dumptype_getconf((dtyp), DUMPTYPE_MAXPROMOTEDAY)))
#define dumptype_get_bumppercent(dtyp) (val_t_to_int(dumptype_getconf((dtyp), DUMPTYPE_BUMPPERCENT)))
-#define dumptype_get_bumpsize(dtyp) (val_t_to_am64(dumptype_getconf((dtyp), DUMPTYPE_BUMPSIZE)))
+#define dumptype_get_bumpsize(dtyp) (val_t_to_int64(dumptype_getconf((dtyp), DUMPTYPE_BUMPSIZE)))
#define dumptype_get_bumpdays(dtyp) (val_t_to_int(dumptype_getconf((dtyp), DUMPTYPE_BUMPDAYS)))
#define dumptype_get_bumpmult(dtyp) (val_t_to_real(dumptype_getconf((dtyp), DUMPTYPE_BUMPMULT)))
#define dumptype_get_starttime(dtyp) (val_t_to_time(dumptype_getconf((dtyp), DUMPTYPE_STARTTIME)))
#define dumptype_get_strategy(dtyp) (val_t_to_strategy(dumptype_getconf((dtyp), DUMPTYPE_STRATEGY)))
-#define dumptype_get_estimate(dtyp) (val_t_to_estimate(dumptype_getconf((dtyp), DUMPTYPE_ESTIMATE)))
+#define dumptype_get_estimatelist(dtyp) (val_t_to_estimatelist(dumptype_getconf((dtyp), DUMPTYPE_ESTIMATELIST)))
#define dumptype_get_compress(dtyp) (val_t_to_compress(dumptype_getconf((dtyp), DUMPTYPE_COMPRESS)))
#define dumptype_get_encrypt(dtyp) (val_t_to_encrypt(dumptype_getconf((dtyp), DUMPTYPE_ENCRYPT)))
#define dumptype_get_srv_decrypt_opt(dtyp) (val_t_to_str(dumptype_getconf((dtyp), DUMPTYPE_SRV_DECRYPT_OPT)))
#define dumptype_get_clnt_decrypt_opt(dtyp) (val_t_to_str(dumptype_getconf((dtyp), DUMPTYPE_CLNT_DECRYPT_OPT)))
#define dumptype_get_comprate(dtyp) (val_t_to_rate(dumptype_getconf((dtyp), DUMPTYPE_COMPRATE)))
-#define dumptype_get_tape_splitsize(dtyp) (val_t_to_am64(dumptype_getconf((dtyp), DUMPTYPE_TAPE_SPLITSIZE)))
-#define dumptype_get_fallback_splitsize(dtyp) (val_t_to_am64(dumptype_getconf((dtyp), DUMPTYPE_FALLBACK_SPLITSIZE)))
+#define dumptype_get_tape_splitsize(dtyp) (val_t_to_int64(dumptype_getconf((dtyp), DUMPTYPE_TAPE_SPLITSIZE)))
+#define dumptype_get_fallback_splitsize(dtyp) (val_t_to_int64(dumptype_getconf((dtyp), DUMPTYPE_FALLBACK_SPLITSIZE)))
#define dumptype_get_split_diskbuffer(dtyp) (val_t_to_str(dumptype_getconf((dtyp), DUMPTYPE_SPLIT_DISKBUFFER)))
#define dumptype_get_record(dtyp) (val_t_to_boolean(dumptype_getconf((dtyp), DUMPTYPE_RECORD)))
#define dumptype_get_skip_incr(dtyp) (val_t_to_boolean(dumptype_getconf((dtyp), DUMPTYPE_SKIP_INCR)))
#define dumptype_get_kencrypt(dtyp) (val_t_to_boolean(dumptype_getconf((dtyp), DUMPTYPE_KENCRYPT)))
#define dumptype_get_ignore(dtyp) (val_t_to_boolean(dumptype_getconf((dtyp), DUMPTYPE_IGNORE)))
#define dumptype_get_index(dtyp) (val_t_to_boolean(dumptype_getconf((dtyp), DUMPTYPE_INDEX)))
+#define dumptype_get_application(dtyp) (val_t_to_application(dumptype_getconf((dtyp), DUMPTYPE_APPLICATION)))
+#define dumptype_get_scriptlist(dtyp) (val_t_to_identlist(dumptype_getconf((dtyp), DUMPTYPE_SCRIPTLIST)))
+#define dumptype_get_property(dtyp) (val_t_to_proplist(dumptype_getconf((dtyp), DUMPTYPE_PROPERTY)))
+#define dumptype_get_client_port(dtyp) (val_t_to_str(dumptype_getconf((dtyp), DUMPTYPE_CLIENT_PORT)))
+#define dumptype_get_data_path(dtyp) (val_t_to_data_path(dumptype_getconf((dtyp), DUMPTYPE_DATA_PATH)))
+#define dumptype_get_allow_split(dtyp) (val_t_to_boolean(dumptype_getconf((dtyp), DUMPTYPE_ALLOW_SPLIT)))
+#define dumptype_get_recovery_limit(dtyp) (val_t_to_host_limit(dumptype_getconf((dtyp), DUMPTYPE_RECOVERY_LIMIT)))
+#define dumptype_get_dump_limit(dtyp) (val_t_to_host_limit(dumptype_getconf((dtyp), DUMPTYPE_DUMP_LIMIT)))
+#define dumptype_get_max_warnings(dtyp) (val_t_to_int(dumptype_getconf((dtyp), DUMPTYPE_MAX_WARNINGS)))
/*
* Interface parameter access
*/
holdingdisk_t *lookup_holdingdisk(char *identifier);
-/* Return the whole linked list of holdingdisks. Use holdingdisk_next
- * to traverse the list.
+/* Return the whole linked list of holdingdisks.
*
* @returns: first holding disk
*/
-holdingdisk_t *getconf_holdingdisks(void);
-
-/* Return the next holdingdisk in the list.
- *
- * @param hdisk: holding disk
- * @returns: NULL if hdisk is the last disk, otherwise the next holding
- * disk
- */
-holdingdisk_t *holdingdisk_next(holdingdisk_t *hdisk);
+GSList *getconf_holdingdisks(void);
/* Given a holdingdisk and a key, return a pointer to the corresponding val_t.
*
*/
#define holdingdisk_get_comment(hdisk) (val_t_to_str(holdingdisk_getconf((hdisk), HOLDING_COMMENT)))
#define holdingdisk_get_diskdir(hdisk) (val_t_to_str(holdingdisk_getconf((hdisk), HOLDING_DISKDIR)))
-#define holdingdisk_get_disksize(hdisk) (val_t_to_am64(holdingdisk_getconf((hdisk), HOLDING_DISKSIZE)))
-#define holdingdisk_get_chunksize(hdisk) (val_t_to_am64(holdingdisk_getconf((hdisk), HOLDING_CHUNKSIZE)))
+#define holdingdisk_get_disksize(hdisk) (val_t_to_int64(holdingdisk_getconf((hdisk), HOLDING_DISKSIZE)))
+#define holdingdisk_get_chunksize(hdisk) (val_t_to_int64(holdingdisk_getconf((hdisk), HOLDING_CHUNKSIZE)))
+
+/* A application-tool interface */
+typedef enum application_e {
+ APPLICATION_COMMENT,
+ APPLICATION_PLUGIN,
+ APPLICATION_PROPERTY,
+ APPLICATION_CLIENT_NAME,
+ APPLICATION_APPLICATION
+} application_key;
+
+/* opaque object */
+typedef struct application_s application_t;
+
+/* Given the name of the application, return a application object. Returns NULL
+ * if no matching application exists. Note that the match is case-insensitive.
+ *
+ * @param identifier: name of the desired application
+ * @returns: object or NULL
+ */
+
+application_t *lookup_application(char *identifier);
+
+/* Given a application and a key, return a pointer to the corresponding val_t.
+ *
+ * @param ttyp: the application to examine
+ * @param key: application (one of the APPLICATION_* constants)
+ * @returns: pointer to value
+ */
+val_t *application_getconf(application_t *app, application_key key);
+
+/* Get the name of this application.
+ *
+ * @param ttyp: the application to examine
+ * @returns: name of the application
+ */
+char *application_name(application_t *app);
+
+/* (convenience macro) has this parameter been seen in this application? This
+ * applies to the specific parameter *within* the application.
+ *
+ * @param key: application_key
+ * @returns: boolean
+ */
+#define application_seen(app, key) (val_t_seen(application_getconf((app), (key))))
+
+/* (convenience macros)
+ * fetch a particular parameter; caller must know the correct type.
+ *
+ * @param ttyp: the application to examine
+ * @returns: various
+ */
+#define application_get_comment(application) (val_t_to_str(application_getconf((application), APPLICATION_COMMENT))
+#define application_get_plugin(application) (val_t_to_str(application_getconf((application), APPLICATION_PLUGIN)))
+#define application_get_property(application) (val_t_to_proplist(application_getconf((application), APPLICATION_PROPERTY)))
+#define application_get_client_name(application) (val_t_to_str(application_getconf((application), APPLICATION_CLIENT_NAME)))
+
+/* A pp-script-tool interface */
+typedef enum pp_script_e {
+ PP_SCRIPT_COMMENT,
+ PP_SCRIPT_PLUGIN,
+ PP_SCRIPT_PROPERTY,
+ PP_SCRIPT_EXECUTE_ON,
+ PP_SCRIPT_EXECUTE_WHERE,
+ PP_SCRIPT_ORDER,
+ PP_SCRIPT_SINGLE_EXECUTION,
+ PP_SCRIPT_CLIENT_NAME,
+ PP_SCRIPT_PP_SCRIPT
+} pp_script_key;
+
+/* opaque object */
+typedef struct pp_script_s pp_script_t;
+
+/* Given the name of the pp_script, return a pp_script object. Returns NULL
+ * if no matching pp_script exists. Note that the match is case-insensitive.
+ *
+ * @param identifier: name of the desired pp_script
+ * @returns: object or NULL
+ */
+
+pp_script_t *lookup_pp_script(char *identifier);
+
+/* Given a pp_script and a key, return a pointer to the corresponding val_t.
+ *
+ * @param ttyp: the pp_script to examine
+ * @param key: pp_script (one of the PP_SCRIPT_* constants)
+ * @returns: pointer to value
+ */
+val_t *pp_script_getconf(pp_script_t *pps, pp_script_key key);
+
+/* Get the name of this pp_script.
+ *
+ * @param ttyp: the pp_script to examine
+ * @returns: name of the pp_script
+ */
+char *pp_script_name(pp_script_t *pps);
+
+/* (convenience macro) has this parameter been seen in this pp_script? This
+ * applies to the specific parameter *within* the pp_script.
+ *
+ * @param key: pp_script_key
+ * @returns: boolean
+ */
+#define pp_script_seen(pps, key) (val_t_seen(pp_script_getconf((pps), (key))))
+
+/* (convenience macros)
+ * fetch a particular parameter; caller must know the correct type.
+ *
+ * @param ttyp: the pp_script to examine
+ * @returns: various
+ */
+
+#define pp_script_get_comment(pp_script) (val_t_to_str(pp_script_getconf((pp_script), PP_SCRIPT_COMMENT)))
+#define pp_script_get_plugin(pp_script) (val_t_to_str(pp_script_getconf((pp_script), PP_SCRIPT_PLUGIN)))
+#define pp_script_get_property(pp_script) (val_t_to_proplist(pp_script_getconf((pp_script), PP_SCRIPT_PROPERTY)))
+#define pp_script_get_execute_on(pp_script) (val_t_to_execute_on(pp_script_getconf((pp_script), PP_SCRIPT_EXECUTE_ON)))
+#define pp_script_get_execute_where(pp_script) (val_t_to_execute_where(pp_script_getconf((pp_script), PP_SCRIPT_EXECUTE_WHERE)))
+#define pp_script_get_order(pp_script) (val_t_to_int(pp_script_getconf((pp_script), PP_SCRIPT_ORDER)))
+#define pp_script_get_single_execution(pp_script) (val_t_to_boolean(pp_script_getconf((pp_script), PP_SCRIPT_SINGLE_EXECUTION)))
+#define pp_script_get_client_name(pp_script) (val_t_to_str(pp_script_getconf((pp_script), PP_SCRIPT_CLIENT_NAME)))
+
+pp_script_t *lookup_pp_script(char *identifier);
+
+/* A device definition */
+typedef enum {
+ DEVICE_CONFIG_COMMENT,
+ DEVICE_CONFIG_TAPEDEV,
+ DEVICE_CONFIG_DEVICE_PROPERTY,
+ DEVICE_CONFIG_DEVICE_CONFIG
+} device_config_key;
+
+/* opaque object */
+typedef struct device_config_s device_config_t;
+
+/* Given the name of the device, return a device_config_t object. Returns NULL
+ * if no matching device exists. Note that the match is case-insensitive.
+ *
+ * @param identifier: name of the desired device
+ * @returns: object or NULL
+ */
+
+device_config_t *lookup_device_config(char *identifier);
+
+/* Given a device_config and a key, return a pointer to the corresponding val_t.
+ *
+ * @param ttyp: the device_config to examine
+ * @param key: device_config (one of the DEVICE_CONFIG_* constants)
+ * @returns: pointer to value
+ */
+val_t *device_config_getconf(device_config_t *devconf, device_config_key key);
+
+/* Get the name of this device_config.
+ *
+ * @param ttyp: the device_config to examine
+ * @returns: name of the device_config
+ */
+char *device_config_name(device_config_t *devconf);
+
+/* (convenience macro) has this parameter been seen in this device_config? This
+ * applies to the specific parameter *within* the device_config.
+ *
+ * @param key: device_config_key
+ * @returns: boolean
+ */
+#define device_config_seen(devconf, key) (val_t_seen(device_config_getconf((devconf), (key))))
+
+/* (convenience macros)
+ * fetch a particular parameter; caller must know the correct type.
+ *
+ * @param devconf: the device_config to examine
+ * @returns: various
+ */
+
+#define device_config_get_comment(devconf) (val_t_to_str(device_config_getconf((devconf), DEVICE_CONFIG_COMMENT)))
+#define device_config_get_tapedev(devconf) (val_t_to_str(device_config_getconf((devconf), DEVICE_CONFIG_TAPEDEV)))
+#define device_config_get_property(devconf) (val_t_to_proplist(device_config_getconf((devconf), DEVICE_CONFIG_DEVICE_PROPERTY)))
+
+device_config_t *lookup_device_config(char *identifier);
+
+/* A changer definition */
+typedef enum {
+ CHANGER_CONFIG_COMMENT,
+ CHANGER_CONFIG_TAPEDEV,
+ CHANGER_CONFIG_TPCHANGER,
+ CHANGER_CONFIG_CHANGERDEV,
+ CHANGER_CONFIG_CHANGERFILE,
+ CHANGER_CONFIG_PROPERTY,
+ CHANGER_CONFIG_DEVICE_PROPERTY,
+ CHANGER_CONFIG_CHANGER_CONFIG
+} changer_config_key;
+
+/* opaque object */
+typedef struct changer_config_s changer_config_t;
+
+/* Given the name of the changer, return a changer_config_t object. Returns NULL
+ * if no matching changer exists. Note that the match is case-insensitive.
+ *
+ * @param identifier: name of the desired changer
+ * @returns: object or NULL
+ */
+
+changer_config_t *lookup_changer_config(char *identifier);
+
+/* Given a changer_config and a key, return a pointer to the corresponding val_t.
+ *
+ * @param ttyp: the changer_config to examine
+ * @param key: changer_config (one of the DEVICE_CONFIG_* constants)
+ * @returns: pointer to value
+ */
+val_t *changer_config_getconf(changer_config_t *devconf, changer_config_key key);
+
+/* Get the name of this changer_config.
+ *
+ * @param ttyp: the changer_config to examine
+ * @returns: name of the changer_config
+ */
+char *changer_config_name(changer_config_t *devconf);
+
+/* (convenience macro) has this parameter been seen in this changer_config? This
+ * applies to the specific parameter *within* the changer_config.
+ *
+ * @param key: changer_config_key
+ * @returns: boolean
+ */
+#define changer_config_seen(devconf, key) (val_t_seen(changer_config_getconf((devconf), (key))))
+
+/* (convenience macros)
+ * fetch a particular parameter; caller must know the correct type.
+ *
+ * @param devconf: the changer_config to examine
+ * @returns: various
+ */
+
+#define changer_config_get_comment(devconf) (val_t_to_str(changer_config_getconf((devconf), CHANGER_CONFIG_COMMENT)))
+#define changer_config_get_tapedev(devconf) (val_t_to_str(changer_config_getconf((devconf), CHANGER_CONFIG_TAPEDEV)))
+#define changer_config_get_tpchanger(devconf) (val_t_to_str(changer_config_getconf((devconf), CHANGER_CONFIG_TPCHANGER)))
+#define changer_config_get_changerdev(devconf) (val_t_to_str(changer_config_getconf((devconf), CHANGER_CONFIG_CHANGERDEV)))
+#define changer_config_get_changerfile(devconf) (val_t_to_str(changer_config_getconf((devconf), CHANGER_CONFIG_CHANGERFILE)))
+
+changer_config_t *lookup_changer_config(char *identifier);
+
+/* A interacrtivity interface */
+typedef enum interactivity_e {
+ INTERACTIVITY_COMMENT,
+ INTERACTIVITY_PLUGIN,
+ INTERACTIVITY_PROPERTY,
+ INTERACTIVITY_INTERACTIVITY
+} interactivity_key;
+
+/* opaque object */
+typedef struct interactivity_s interactivity_t;
+
+/* Given the name of the interactivity, return a interactivity object.
+ * Returns NULL if no matching interactivity exists.
+ * Note that the match is case-insensitive.
+ *
+ * @param identifier: name of the desired interactivity
+ * @returns: object or NULL
+ */
+
+interactivity_t *lookup_interactivity(char *identifier);
+
+/* Given a interactivity and a key, return a pointer to the corresponding val_t.
+ *
+ * @param ttyp: the interactivity to examine
+ * @param key: interactivity (one of the INTERACTIVITY_* constants)
+ * @returns: pointer to value
+ */
+val_t *interactivity_getconf(interactivity_t *app, interactivity_key key);
+
+/* Get the name of this interactivity.
+ *
+ * @param ttyp: the interactivity to examine
+ * @returns: name of the interactivity
+ */
+char *interactivity_name(interactivity_t *app);
+
+/* (convenience macro) has this parameter been seen in this interactivity?
+ * This applies to the specific parameter *within* the interactivity.
+ *
+ * @param key: interactivity_key
+ * @returns: boolean
+ */
+#define interactivity_seen(app, key) (val_t_seen(interactivity_getconf((app), (key))))
+
+/* (convenience macros)
+ * fetch a particular parameter; caller must know the correct type.
+ *
+ * @param ttyp: the interactivity to examine
+ * @returns: various
+ */
+#define interactivity_get_comment(interactivity) (val_t_to_str(interactivity_getconf((interactivity), INTERACTIVITY_COMMENT))
+#define interactivity_get_plugin(interactivity) (val_t_to_str(interactivity_getconf((interactivity), INTERACTIVITY_PLUGIN)))
+#define interactivity_get_property(interactivity) (val_t_to_proplist(interactivity_getconf((interactivity), INTERACTIVITY_PROPERTY)))
+
+/* A taperscan interface */
+typedef enum taperscan_e {
+ TAPERSCAN_COMMENT,
+ TAPERSCAN_PLUGIN,
+ TAPERSCAN_PROPERTY,
+ TAPERSCAN_TAPERSCAN
+} taperscan_key;
+
+/* opaque object */
+typedef struct taperscan_s taperscan_t;
+
+/* Given the name of the taperscan, return a taperscan object.
+ * Returns NULL if no matching taperscan exists.
+ * Note that the match is case-insensitive.
+ *
+ * @param identifier: name of the desired taperscan
+ * @returns: object or NULL
+ */
+
+taperscan_t *lookup_taperscan(char *identifier);
+
+/* Given a taperscan and a key, return a pointer to the corresponding val_t.
+ *
+ * @param ttyp: the taperscan to examine
+ * @param key: taperscan (one of the TAPERSCAN_* constants)
+ * @returns: pointer to value
+ */
+val_t *taperscan_getconf(taperscan_t *app, taperscan_key key);
+
+/* Get the name of this taperscan.
+ *
+ * @param ttyp: the taperscan to examine
+ * @returns: name of the taperscan
+ */
+char *taperscan_name(taperscan_t *app);
+
+/* (convenience macro) has this parameter been seen in this taperscan?
+ * This applies to the specific parameter *within* the taperscan.
+ *
+ * @param key: taperscan_key
+ * @returns: boolean
+ */
+#define taperscan_seen(app, key) (val_t_seen(taperscan_getconf((app), (key))))
+
+/* (convenience macros)
+ * fetch a particular parameter; caller must know the correct type.
+ *
+ * @param ttyp: the taperscan to examine
+ * @returns: various
+ */
+#define taperscan_get_comment(taperscan) (val_t_to_str(taperscan_getconf((taperscan), TAPERSCAN_COMMENT))
+#define taperscan_get_plugin(taperscan) (val_t_to_str(taperscan_getconf((taperscan), TAPERSCAN_PLUGIN)))
+#define taperscan_get_property(taperscan) (val_t_to_proplist(taperscan_getconf((taperscan), TAPERSCAN_PROPERTY)))
+
+
+/*
+ * Error Handling
+ */
+
+typedef enum {
+ /* No errors or warnings */
+ CFGERR_OK = 0,
+
+ /* warnings were encountered */
+ CFGERR_WARNINGS = 1,
+
+ /* errors (and maybe some warnings too, who knows) were encountered */
+ CFGERR_ERRORS = 2,
+} cfgerr_level_t;
+
+/*
+ * Errors
+ */
+
+/* Get a GSList of all error and warning messages accumulated so far.
+ *
+ * @param (output) errlist: pointer to the list of error strings; allocated
+ * memory remains the responsibility of the config module. If errlist is
+ * NULL, the list is not returned.
+ * @returns: current error level
+ */
+cfgerr_level_t config_errors(GSList **errlist);
+
+/* Clear any error conditions.
+ */
+void config_clear_errors(void);
+
+/* Print the list of current error and warning messages, one per line,
+ * to stderr. This is a convenience function for command-line
+ * applications.
+ */
+void config_print_errors(void);
+
+/* Add an error message to the list of errors, and make sure tha the
+ * error level is at least LEVEL. This is used by the diskfile module
+ * to insert its errors into this module's error list.
+ *
+ * @param level: level for this error
+ * @param errmsg: error message; conffile takes responsibility for freeing
+ * this string.
+ */
+void config_add_error(cfgerr_level_t level, char *errmsg);
/*
* Command-line handling
*/
/* opaque type */
-typedef struct config_overwrites_s config_overwrites_t;
+typedef struct config_overrides_s config_overrides_t;
-/* Create a new, empty config_overwrites object.
+/* Create a new, empty config_overrides object.
*
* @param size_estimate: a guess at the number of overwrites; argc/2 is a
* good estimate.
* @returns: new object
*/
-config_overwrites_t *new_config_overwrites(int size_estimate);
+config_overrides_t *new_config_overrides(int size_estimate);
-/* Free a config_overwrites object. This usually won't be needed, as
- * apply_config_overwrites takes ownership of the overwrites for you.
+/* Free a config_overrides object. This usually won't be needed, as
+ * apply_config_overrides takes ownership of the overwrites for you.
*
- * @param co: config_overwrites object
+ * @param co: config_overrides object
*/
-void free_config_overwrites(config_overwrites_t *co);
+void free_config_overrides(config_overrides_t *co);
-/* Add an overwrite to a config_overwrites object.
+/* Add an overwrite to a config_overrides object.
*
- * @param co: the config_overwrites object
+ * @param co: the config_overrides object
* @param key: the configuration parameter's key, possibly with the format
* SUBTYPE:NAME:KEYWORD
* @param value: the value for the parameter, as would be seen in amanda.conf
*/
-void add_config_overwrite(config_overwrites_t *co,
+void add_config_override(config_overrides_t *co,
char *key,
char *value);
-/* Add an overwrite option from the command line to a config_overwrites
+/* Add an overwrite option from the command line to a config_overrides
* object. Calls error() with any errors
*
- * @param co: the config_overwrites object
+ * @param co: the config_overrides object
* @param optarg: the value of the command-line option
*/
-void add_config_overwrite_opt(config_overwrites_t *co,
+void add_config_override_opt(config_overrides_t *co,
char *optarg);
/* Given a command line, represented as argc/argv, extract any -o options
*
* This is the deprecated way to extract config overwrites, for applications
* which do not use getopt. The preferred method is to use getopt and
- * call add_config_overwrite_opt for any -o options.
+ * call add_config_override_opt for any -o options.
*
* @param argc: (in/out) command-line length
* @param argv: (in/out) command-line strings
- * @returns: newly allocated config_overwrites object
+ * @returns: newly allocated config_overrides object
*/
-config_overwrites_t *
-extract_commandline_config_overwrites(int *argc,
+config_overrides_t *
+extract_commandline_config_overrides(int *argc,
char ***argv);
-/* Apply configuration overwrites to the current configuration and take
- * ownership of the config_overwrites object.
+/* Set configuration overwrites to the current configuration and take
+ * ownership of the config_overrides object.
*
- * If any parameters are not matched in the current symbol table, or
- * correspond to named subsections which do not exist, this function calls
- * error() and does not return.
- *
- * @param co: the config_overwrites object
+ * @param co: the config_overrides object
*/
-void apply_config_overwrites(config_overwrites_t *co);
+void set_config_overrides(config_overrides_t *co);
/*
* Initialization
/* New configuration should "overlay" existing configuration; this
* is used by clients to load multiple amanda-client.conf files. */
CONFIG_INIT_OVERLAY = 1 << 3,
-
- /* If the file doesn't exist, halt with an error. */
- CONFIG_INIT_FATAL = 1 << 4,
} config_init_flags;
/* Initialize this application's configuration, with the specific actions
* - otherwise, for the client only, se config_dir to CONFIG_DIR and
* config_name to NULL.
* - depending on CONFIG_INIT_CLIENT, read amanda.conf or amanda-client.conf
- * - in the event of an error, call error() if CONFIG_INIT_FATAL, otherwise
- * record a message in the debug log and return false.
*
* @param flags: flags indicating desired behavior, as above
* @param arg_config_name: config name to use (from e.g., argv[1])
- * @returns: true on success, false on failure, unless CONFIG_INIT_FATAL
+ * @returns: current error level
*/
-gboolean config_init(config_init_flags flags,
- char *arg_config_name);
+cfgerr_level_t config_init(
+ config_init_flags flags,
+ char *arg_config_name);
/* Free all memory allocated for the configuration. This effectively
* reverses the effects of config_init().
*/
void config_uninit(void);
-/* Encode any applied config_overwrites into a strv format suitale for
+/* Encode any applied config_overrides into a strv format suitale for
* executing another Amanda tool.
*
* The * result is dynamically allocated and NULL terminated. There is no
*/
char **get_config_options(int first);
-/* The name of the configuration under which this application is running.
- * This variable is initialized by config_init, and should be treated as
- * read-only.
- */
-extern char *config_name;
+/* Get the config name */
+char *get_config_name(void);
-/* The directory containing the configuration for this application. This
- * variable is initialized by config_init, and should be treated as read-only.
- */
-extern char *config_dir;
+/* Get the config directory */
+char *get_config_dir(void);
-/* The most recently read top-level configuration file. This variable is
- * initialized by config_init, and should be treated as read-only.
- */
-extern char *config_filename;
+/* Get the config filename */
+char *get_config_filename(void);
/*
* Utilities
* This function only dumps the server configuration, and will fail on
* clients.
*/
-void dump_configuration(void);
+void dump_configuration(gboolean print_default, gboolean print_source);
+
+void dump_dumptype(dumptype_t *dp, char *prefix, gboolean print_default,
+ gboolean print_source);
/* Return a sequence of strings giving the printable representation
* of the given val_t. If str_needs_quotes is true and each string is
* @param str_needs_quotes: add quotes to CONFTYPE_STR values?
* @returns: NULL-terminated string vector
*/
-char **val_t_display_strs(val_t *val, int str_needs_quotes);
+char **val_t_display_strs(val_t *val, int str_needs_quotes, gboolean print_source,
+ gboolean print_unit);
/* Read a dumptype; this is used by this module as well as by diskfile.c to
* read the disklist. The two are carefully balanced in their parsing process.
*/
dumptype_t *read_dumptype(char *name, FILE *from, char *fname, int *linenum);
+/* Every call return a pointer to a string with an increasing number; this is
+ * used by this module as well as by diskfile.c to read the disklist.
+ *
+ * Nobody else should use this function. Seriously.
+ *
+ * @returns: a pointer to a static string.
+ */
+char *anonymous_value(void);
+
/* Extend a relative filename with the current config_dir; if filename is already
* absolute, this is equivalent to stralloc.
*
*/
gint64 find_multiplier(char * casestr);
+/* Converts a string matching any of Amanda's names for "true" or
+ * "false" to a boolean value.
+ *
+ * @param str: string to match
+ * @returns: 0 or 1 (boolean) or -1 (no match)
+ */
+int string_to_boolean(const char *str);
+
+/* Return a pointer to a static string for the data_path */
+char *data_path_to_string(data_path_t data_path);
+
+/* Return the data_path for the string */
+data_path_t data_path_from_string(char *data);
+
+void free_property_t(gpointer p);
+
+/* Converts a string into Amanda property name style.
+ *
+ * @param name: The name to convert.
+ * @returns: A newly allocated string, with name in lowercase and
+ * any instances of '_' replaced with '-'.
+ */
+gchar *amandaify_property_name(const gchar *name);
+
#endif /* ! CONFFILE_H */