⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conffile.h

📁 开源备份软件源码 AMANDA, the Advanced Maryland Automatic Network Disk Archiver, is a backup system that a
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * Amanda, The Advanced Maryland Automatic Network Disk Archiver * Copyright (c) 1991-2000 University of Maryland at College Park * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of U.M. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission.  U.M. makes no representations about the * suitability of this software for any purpose.  It is provided "as is" * without express or implied warranty. * * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: James da Silva, Systems Design and Analysis Group *                         Computer Science Department *                         University of Maryland at College Park *//* * $Id: conffile.h,v 1.72 2006/07/26 15:17:37 martinea Exp $ * * interface for config file reading code */#ifndef CONFFILE_H#define CONFFILE_H#include "amanda.h"#include "util.h"/* 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). * * Types * ===== * * This module juggles two kinds of types: C types and conftypes.  Conftypes include * everything from integers through property lists, and are specific to the needs of * the configuration system.  Each conftype has a corresponding C type, which is of course * necessary to actually use the data. * * The val_t__CONFTYPE macros represent the canonical correspondance of conftypes to C * types, but in general the relationship is obvious: ints, strings, reals, and so forth * are represented directly.  Enumerated conftypes are represented by the corresponding * C enum type.  The 'rate' conftype is represented as a 2-element array of doubles, and * the 'intrange' conftype is represented as a 2-element array of ints.  exincludes are * a exinclude_t *, and a proplist is represented as a GHashTable *. * * Memory * ====== * Note that, unless specified, all memory in this module is managed by the module * itself; return strings should not be freed by the caller. *//* * Generic values * * This module uses a generic val_t type to hold values of various types -- it's basically * a union with type information and a 'seen' flag.  In a way, it's a very simple equivalent * to Glib's GValue.  It's worth considering rewriting this with GValue, but for the moment, * this works and it's here. *//* holdingdisk types */typedef enum {    HOLD_NEVER,                 /* Always direct to tape  */    HOLD_AUTO,                  /* If possible            */    HOLD_REQUIRED               /* Always to holding disk */} dump_holdingdisk_t;/* Compression types */typedef enum {    COMP_NONE,          /* No compression */    COMP_FAST,          /* Fast compression on client */    COMP_BEST,          /* Best compression on client */    COMP_CUST,          /* Custom compression on client */    COMP_SERVER_FAST,   /* Fast compression on server */    COMP_SERVER_BEST,   /* Best compression on server */    COMP_SERVER_CUST    /* Custom compression on server */} comp_t;/* Encryption types */typedef enum {    ENCRYPT_NONE,               /* No encryption */    ENCRYPT_CUST,               /* Custom encryption on client */    ENCRYPT_SERV_CUST           /* Custom encryption on server */} encrypt_t;/* Estimate strategies */typedef enum {    ES_CLIENT,          /* client estimate */    ES_SERVER,          /* server estimate */    ES_CALCSIZE,        /* calcsize estimate */    ES_ES /* sentinel */} estimate_t;/* Dump strategies */typedef enum {    DS_SKIP,        /* Don't do any dumps at all */    DS_STANDARD,    /* Standard (0 1 1 1 1 2 2 2 ...) */    DS_NOFULL,      /* No full's (1 1 1 ...) */    DS_NOINC,       /* No inc's (0 0 0 ...) */    DS_4,           /* ? (0 1 2 3 4 5 6 7 8 9 10 11 ...) */    DS_5,           /* ? (0 1 1 1 1 1 1 1 1 1 1 1 ...) */    DS_HANOI,       /* Tower of Hanoi (? ? ? ? ? ...) */    DS_INCRONLY,    /* Forced fulls (0 1 1 2 2 FORCE0 1 1 ...) */    DS_DS /* sentinel */} strategy_t;typedef enum {    ALGO_FIRST,    ALGO_FIRSTFIT,    ALGO_LARGEST,    ALGO_LARGESTFIT,    ALGO_SMALLEST,    ALGO_LAST,    ALGO_ALGO /* sentinel */} taperalgo_t;typedef struct exinclude_s {    sl_t *sl_list;    sl_t *sl_file;    int  optional;} exinclude_t;typedef GHashTable* proplist_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_REAL,    CONFTYPE_STR,    CONFTYPE_IDENT,    CONFTYPE_TIME,    CONFTYPE_SIZE,    CONFTYPE_BOOLEAN,    CONFTYPE_COMPRESS,    CONFTYPE_ENCRYPT,    CONFTYPE_HOLDING,    CONFTYPE_ESTIMATE,    CONFTYPE_STRATEGY,    CONFTYPE_TAPERALGO,    CONFTYPE_PRIORITY,    CONFTYPE_RATE,    CONFTYPE_INTRANGE,    CONFTYPE_EXINCLUDE,    CONFTYPE_PROPLIST} conftype_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;        double		r;        char		*s;        ssize_t		size;        time_t		t;        float		rate[2];        exinclude_t	exinclude;        int		intrange[2];        proplist_t      proplist;    } v;    int seen;    conftype_t type;} 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 *);/* 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)/* What is the underlying type of this val_t? * * @param val: val_t* to examine * @returns: conftype_t */#define val_t_type(val) ((val)->type)/* Macros to convert val_t's to a particular type without the benefit of * a typecheck.  Use these only if you really know what you're doing! * * Implementation note: these macros encode the relationship of conftypes * (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)/* * Parameters * * Programs get val_t's by giving the index of the parameters they're interested in. * For global parameters, these start with CNF; for subsections, they start with the * name of the subsection. *//* * Global parameter access */typedef enum {    CNF_ORG,    CNF_CONF,    CNF_INDEX_SERVER,    CNF_TAPE_SERVER,    CNF_AUTH,    CNF_SSH_KEYS,    CNF_AMANDAD_PATH,    CNF_CLIENT_USERNAME,    CNF_GNUTAR_LIST_DIR,    CNF_AMANDATES,    CNF_MAILTO,    CNF_DUMPUSER,    CNF_TAPEDEV,    CNF_DEVICE_PROPERTY,    CNF_CHANGERDEV,    CNF_CHANGERFILE,    CNF_LABELSTR,    CNF_TAPELIST,    CNF_DISKFILE,    CNF_INFOFILE,    CNF_LOGDIR,    CNF_INDEXDIR,    CNF_TAPETYPE,    CNF_DUMPCYCLE,    CNF_RUNSPERCYCLE,    CNF_TAPECYCLE,    CNF_NETUSAGE,    CNF_INPARALLEL,    CNF_DUMPORDER,    CNF_BUMPPERCENT,    CNF_BUMPSIZE,    CNF_BUMPMULT,    CNF_BUMPDAYS,    CNF_TPCHANGER,    CNF_RUNTAPES,    CNF_MAXDUMPS,    CNF_ETIMEOUT,    CNF_DTIMEOUT,    CNF_CTIMEOUT,    CNF_TAPEBUFS,    CNF_DEVICE_OUTPUT_BUFFER_SIZE,    CNF_PRINTER,    CNF_AUTOFLUSH,    CNF_RESERVE,    CNF_MAXDUMPSIZE,    CNF_COLUMNSPEC,    CNF_AMRECOVER_DO_FSF,    CNF_AMRECOVER_CHECK_LABEL,    CNF_AMRECOVER_CHANGER,    CNF_TAPERALGO,    CNF_FLUSH_THRESHOLD_DUMPED,    CNF_FLUSH_THRESHOLD_SCHEDULED,    CNF_TAPERFLUSH,    CNF_DISPLAYUNIT,    CNF_KRB5KEYTAB,    CNF_KRB5PRINCIPAL,    CNF_LABEL_NEW_TAPES,    CNF_USETIMESTAMPS,    CNF_REP_TRIES,    CNF_CONNECT_TRIES,    CNF_REQ_TRIES,    CNF_DEBUG_AMANDAD,    CNF_DEBUG_AMIDXTAPED,    CNF_DEBUG_AMINDEXD,    CNF_DEBUG_AMRECOVER,    CNF_DEBUG_AUTH,    CNF_DEBUG_EVENT,    CNF_DEBUG_HOLDING,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -