• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

Makefile.inH A D03-May-20225.4 KiB163114

README-configH A D10-Dec-20204.6 KiB13597

admin.cH A D10-Dec-20203 KiB12672

authenticate.cH A D10-Dec-202015.1 KiB460335

autoprune.cH A D10-Dec-20206.6 KiB228140

backup.cH A D10-Dec-202036.8 KiB1,173856

bacula-dir.conf.inH A D10-Dec-20209 KiB324292

bdirjson.cH A D10-Dec-202049.5 KiB1,4911,188

bsr.cH A D10-Dec-202021.2 KiB762516

bsr.hH A D10-Dec-20201.8 KiB5816

catreq.cH A D10-Dec-202028.3 KiB816591

dir_plugins.cH A D10-Dec-202015.3 KiB539419

dir_plugins.hH A D10-Dec-20205.4 KiB185121

dird.cH A D10-Dec-202053.1 KiB1,5671,155

dird.hH A D10-Dec-20202.9 KiB11673

dird_conf.cH A D10-Dec-202096 KiB2,6122,173

dird_conf.hH A D10-Dec-202030.5 KiB793606

expand.cH A D10-Dec-202013.6 KiB466357

fd_cmds.cH A D10-Dec-202035.3 KiB1,052798

getmsg.cH A D10-Dec-202014.1 KiB415284

inc_conf.cH A D10-Dec-202026.5 KiB799586

job.cH A D10-Dec-202055.9 KiB1,9351,490

jobq.cH A D10-Dec-202028.8 KiB907637

jobq.hH A D10-Dec-20202.1 KiB7030

mac.cH A D10-Dec-202032 KiB945611

mac_sql.cH A D10-Dec-202025.5 KiB766570

mountreq.cH A D10-Dec-20201.6 KiB7426

msgchan.cH A D10-Dec-202019.3 KiB623471

newvol.cH A D10-Dec-20205.5 KiB172111

next_vol.cH A D10-Dec-202017.8 KiB516305

protos.hH A D10-Dec-202015.3 KiB371264

query.sqlH A D10-Dec-2020312 87

recycle.cH A D10-Dec-20202.4 KiB8143

restore.cH A D10-Dec-202020.8 KiB763514

run_conf.cH A D10-Dec-202022 KiB689565

scheduler.cH A D10-Dec-202013.7 KiB456330

snapshot.cH A D10-Dec-202023 KiB767604

ua.hH A D10-Dec-20205.8 KiB146107

ua_acl.cH A D10-Dec-20203.4 KiB12068

ua_cmds.cH A D10-Dec-202079.8 KiB2,6842,101

ua_collect.cH A D10-Dec-202022.4 KiB625453

ua_dotcmds.cH A D10-Dec-202061.9 KiB2,1801,741

ua_input.cH A D10-Dec-20206 KiB252167

ua_label.cH A D10-Dec-202038.5 KiB1,289990

ua_output.cH A D10-Dec-202036 KiB1,195897

ua_prune.cH A D10-Dec-202028.2 KiB950674

ua_purge.cH A D10-Dec-202024.8 KiB807531

ua_query.cH A D10-Dec-20207.6 KiB300243

ua_restore.cH A D10-Dec-202054.4 KiB1,7401,357

ua_run.cH A D10-Dec-202082.4 KiB2,6082,191

ua_select.cH A D10-Dec-202046.6 KiB1,6671,278

ua_server.cH A D10-Dec-20205.7 KiB232149

ua_status.cH A D10-Dec-202049.6 KiB1,6321,388

ua_tree.cH A D10-Dec-202028.6 KiB936743

ua_update.cH A D10-Dec-202033 KiB1,074904

vbackup.cH A D10-Dec-202019.3 KiB605404

verify.cH A D10-Dec-202029.4 KiB888659

README-config

1
2To add a new resource -- as an example, the BAZ resource,
3  which will have foo record which is an integer,
4  a storage record, which is the name of a storage
5  resource, and a special time field.
6
7 1. Define the Resource type (R_xxx) in dir_config.h
8    Be sure to update the R_LAST define.
9     #define R_BAZ 1011
10     update R_LAST to be R_BAZ
11
12 2. Add a new definition of the resource in dir_config.h
13    The first three are mandatory (will soon be changed
14    to a header structure).
15    struct s_res_baz {
16       char * name;
17       int rcode
18       struct s_res_baz *next;
19
20       int foo;
21       struct res_store *storage;
22       int time;
23    };
24
25 3. In dir_config.c add the new resource to the table
26    of resources (resources[])
27
28    {"baz",     baz_items,  R_BAZ,  NULL},
29
30 4. Create a baz_items, which defines the records that
31    can appear within the BAZ resource:
32
33    static struct res_items bas_items[] = {
34        name,   store sub,   where to store,   extra info
35       {"name", store_name, ITEM(res_baz.name), 0},    /* manditory */
36       {"foo",  store_int,  ITEM(res_baz.foo), 0},
37       {"storage", stor_res, ITEM(res_baz.storage), 0},
38       {"time",  store_time, ITME(res_baz.time), 0},
39    };
40
41 5. Update the dump_resource() subroutine to handle printing
42    your resource.
43
44 6. Update the free_resource() subroutine to handle releasing
45    any allocated memory.
46
47 7. Check for any special initialization in init_resource().
48    Normally, everything is just zeroed.
49
50 8. Update the new_resource() subroutine to handle the two
51    passes of the configurator to be able to create your
52    resource.  Pass 2 is used only for finding a reference
53    to a resource and stuffing its address. In the above example,
54    you will need to include the storage resource.  See the
55    example for the Job Resource.
56
57    Add an entry so that the correct size of your resource is
58    allocated for pass one.
59
60 9. Write any new store routines that you may need.  In this case,
61    we used the store_int and store_res, which are already defined,
62    but we need to add the new special routine store_time().
63    Note, the store subroutine gets control when the parser has
64    identified the record. Everything after the record name
65    must be scanned in the store routine.
66
67
68To add a new resource record:
69
70  1. Add the new record definition to the resource structure definition.
71     See step 2 above. In this case, however, we only add a new field
72     to the existing structure.
73
74  2. Add the new record to the existing res_items structure.  See
75     step 4 above. In this case, however, we only add a new record
76     definition to the exising structure.
77
78  3. Update the dump_resource() routine to dump the new record.
79
80  4. Update the free_resource() routine if you allocated any memory.
81
82  5. Update init_resource() if you have any special requirements (not
83     normally the case).
84
85  6. Update the new_resource() routine if necessary (not normally the
86     case).
87
88  7. Write any new store routine that you may have created to store
89     your record.
90     Note, the store subroutine gets control when the parser has
91     identified the record. Everything after the record name
92     must be scanned in the store routine.  See the examples of
93     store routines that exist.
94
95Note, the core parsing code is in lib/parse_config.c and lib/parse_config.h.
96lib/parse_config.c provides the following store routines:
97
98      store_name   stores a resource name
99      store_str    stores a string
100      store_res    stores a resource
101      store_int    stores an integer
102
103and the following utilities:
104
105      scan_to_eol  causes the lexical scanner to scan to the end of the line
106      scan_error   prints an error message
107      GetResWithName  returns the resource of a specified type and name
108      GetNextRes   returns the next resource of a specified type
109      parse_config parses the configuration file
110      free_config_resources  frees all the resources allocated.
111
112Note: when your store routine gets control, the parser will have already
113scanned the record name (i.e. "baz =") before calling your routine.
114The lexical scanner is by default in a mode where spaces will be
115compressed out of unquoted strings. Consequently if you want to scan
116
117     baz = full backup every sunday
118
119and you do not want to get "full backup every sunday" as a single token
120"fullbackupeverysunday", you must set the no identifier option in the
121lexical scanner options field:
122
123   int options = lc->options;
124
125   lc->options |= LOPT_NO_IDENT;      /* don't eat spaces */
126
127   get_token(lc) ...
128   ...
129
130   lc->options = options;
131   return;
132
133
134
135