X-Git-Url: https://git.gag.com/?p=debian%2Famanda;a=blobdiff_plain;f=server-src%2Fdiskfile.c;h=8a67cbd51de35d57725b5c6a29decf1290ae2555;hp=e11ffd83e851025750b6e47c3c8aaf16fdba2171;hb=b116e9366c7b2ea2c2eb53b0a13df4090e176235;hpb=fd48f3e498442f0cbff5f3606c7c403d0566150e
diff --git a/server-src/diskfile.c b/server-src/diskfile.c
index e11ffd8..8a67cbd 100644
--- a/server-src/diskfile.c
+++ b/server-src/diskfile.c
@@ -198,6 +198,8 @@ add_disk(
disk = alloc(SIZEOF(disk_t));
bzero(disk, SIZEOF(disk_t));
disk->line = 0;
+ disk->allow_split = 0;
+ disk->splitsize = (off_t)0;
disk->tape_splitsize = (off_t)0;
disk->split_diskbuffer = NULL;
disk->fallback_splitsize = (off_t)0;
@@ -641,6 +643,7 @@ parse_diskline(
}
disk->dtype_name = dumptype_name(dtype);
+ disk->config = dtype;
disk->program = dumptype_get_program(dtype);
disk->exclude_list = duplicate_sl(dumptype_get_exclude(dtype).sl_list);
disk->exclude_file = duplicate_sl(dumptype_get_exclude(dtype).sl_file);
@@ -653,9 +656,16 @@ parse_diskline(
/* disk->frequency = dumptype_get_frequency(dtype);*/
disk->auth = dumptype_get_auth(dtype);
disk->maxdumps = dumptype_get_maxdumps(dtype);
+ disk->allow_split = dumptype_get_allow_split(dtype);
disk->tape_splitsize = dumptype_get_tape_splitsize(dtype);
disk->split_diskbuffer = dumptype_get_split_diskbuffer(dtype);
disk->fallback_splitsize = dumptype_get_fallback_splitsize(dtype);
+ if (disk->allow_split) {
+ tapetype_t *tapetype = lookup_tapetype(getconf_str(CNF_TAPETYPE));
+ disk->splitsize = tapetype_get_part_size(tapetype);
+ } else {
+ disk->splitsize = disk->tape_splitsize;
+ }
disk->maxpromoteday = dumptype_get_maxpromoteday(dtype);
disk->bumppercent = dumptype_get_bumppercent(dtype);
disk->bumpsize = dumptype_get_bumpsize(dtype);
@@ -1216,13 +1226,13 @@ xml_optionstr(
disk_t * dp,
int to_server)
{
- char *auth_opt = stralloc("");
- char *kencrypt_opt = stralloc("");
- char *compress_opt = stralloc("");
+ char *auth_opt;
+ char *kencrypt_opt;
+ char *compress_opt;
char *encrypt_opt = stralloc("");
char *decrypt_opt = stralloc("");
- char *record_opt = stralloc("");
- char *index_opt = stralloc("");
+ char *record_opt;
+ char *index_opt;
char *data_path_opt = stralloc("");
char *exclude = stralloc("");
char *exclude_file = NULL;
@@ -1246,14 +1256,16 @@ xml_optionstr(
qdpname = quote_string(dp->name);
if (am_has_feature(their_features, fe_options_auth)) {
auth_opt = vstralloc(" ", dp->auth, "\n", NULL);
+ } else {
+ auth_opt = stralloc("");
}
switch(dp->compress) {
case COMP_FAST:
- compress_opt = " FAST\n";
+ compress_opt = stralloc(" FAST\n");
break;
case COMP_BEST:
- compress_opt = " BEST\n";
+ compress_opt = stralloc(" BEST\n");
break;
case COMP_CUST:
compress_opt = vstralloc(" CUSTOM"
@@ -1263,19 +1275,20 @@ xml_optionstr(
" \n", NULL);
break;
case COMP_SERVER_FAST:
- compress_opt = " SERVER-FAST\n";
+ compress_opt = stralloc(" SERVER-FAST\n");
break;
case COMP_SERVER_BEST:
- compress_opt = " SERVER-BEST\n";
+ compress_opt = stralloc(" SERVER-BEST\n");
break;
case COMP_SERVER_CUST:
- compress_opt = " SERVER-CUSTOM\n";
compress_opt = vstralloc(" SERVER-CUSTOM"
"",
dp->srvcompprog,
"\n"
" \n", NULL);
break;
+ default:
+ compress_opt = stralloc("");
}
switch(dp->encrypt) {
@@ -1321,15 +1334,20 @@ xml_optionstr(
if(dp->index) {
index_opt = " YES\n";
+ } else {
+ index_opt = "";
}
if (dp->kencrypt) {
kencrypt_opt = " YES\n";
+ } else {
+ kencrypt_opt = "";
}
if (am_has_feature(their_features, fe_xml_data_path)) {
switch(dp->data_path) {
case DATA_PATH_AMANDA:
+ amfree(data_path_opt);
data_path_opt = stralloc(" AMANDA\n");
break;
case DATA_PATH_DIRECTTCP:
@@ -1338,6 +1356,7 @@ xml_optionstr(
char *s, *sc;
char *value, *b64value;
+ amfree(data_path_opt);
data_path_opt = stralloc(" DIRECTTCP");
if (dp->dataport_list) {
s = sc = stralloc(dp->dataport_list);
@@ -1441,6 +1460,7 @@ xml_optionstr(
amfree(qdpname);
amfree(auth_opt);
amfree(data_path_opt);
+ amfree(compress_opt);
amfree(exclude);
amfree(exclude_list);
amfree(exclude_file);
@@ -1450,6 +1470,7 @@ xml_optionstr(
amfree(exc);
amfree(decrypt_opt);
amfree(encrypt_opt);
+ amfree(script_opt);
/* result contains at least 'auth=...' */
return result;
@@ -1707,6 +1728,7 @@ xml_scripts(
xml_scr = vstrextend(&xml_scr, xml_scr1, xml_app.result, " \n", NULL);
amfree(b64plugin);
amfree(xml_app.result);
+ amfree(xml_scr1);
}
return xml_scr;
}
@@ -1848,6 +1870,37 @@ match_disklist(
return errstr;
}
+gboolean
+match_dumpfile(
+ dumpfile_t *file,
+ int sargc,
+ char ** sargv)
+{
+ disk_t d;
+ am_host_t h;
+ disklist_t dl;
+
+ /* rather than try to reproduce the adaptive matching logic in
+ * match_disklist, this simply creates a new, fake disklist with one
+ * element in it, and calls match_disklist directly */
+
+ bzero(&h, sizeof(h));
+ h.hostname = file->name;
+ h.disks = &d;
+
+ bzero(&d, sizeof(d));
+ d.host = &h;
+ d.hostname = file->name;
+ d.name = file->disk;
+ d.device = file->disk;
+ d.todo = 1;
+
+ dl.head = dl.tail = &d;
+
+ (void)match_disklist(&dl, sargc, sargv);
+ return d.todo;
+}
+
netif_t *
disklist_netifs(void)
{