* file named AUTHORS, in the root directory of this distribution.
*/
/*
- * $Id: sendbackup-dump.c,v 1.88 2006/03/09 20:06:11 johnfranks Exp $
+ * $Id: sendbackup-dump.c,v 1.90 2006/07/25 18:10:07 martinea Exp $
*
* send backup data using BSD dump
*/
+#include "amanda.h"
#include "sendbackup.h"
#include "getfsent.h"
#include "clock.h"
#define LEAF_AND_DIRS "sed -e \'\ns/^leaf[ \t]*[0-9]*[ \t]*\\.//\nt\n/^dir[ \t]/ {\ns/^dir[ \t]*[0-9]*[ \t]*\\.//\ns%$%/%\nt\n}\nd\n\'"
-static regex_t re_table[] = {
+static amregex_t re_table[] = {
/* the various encodings of dump size */
/* this should also match BSDI pre-3.0's buggy dump program, that
produced doubled DUMP: DUMP: messages */
- AM_SIZE_RE("DUMP: [0-9][0-9]* tape blocks", 1024),
- AM_SIZE_RE("dump: Actual: [0-9][0-9]* tape blocks", 1024),
+ AM_SIZE_RE("DUMP: [0-9][0-9]* tape blocks", 1024, 1),
+ AM_SIZE_RE("dump: Actual: [0-9][0-9]* tape blocks", 1024, 1),
AM_SIZE_RE("backup: There are [0-9][0-9]* tape blocks on [0-9][0-9]* tapes",
- 1024),
+ 1024, 1),
AM_SIZE_RE("backup: [0-9][0-9]* tape blocks on [0-9][0-9]* tape\\(s\\)",
- 1024),
+ 1024, 1),
AM_SIZE_RE("backup: [0-9][0-9]* 1k blocks on [0-9][0-9]* volume\\(s\\)",
- 1024),
+ 1024, 1),
AM_SIZE_RE("DUMP: [0-9][0-9]* blocks \\([0-9][0-9]*KB\\) on [0-9][0-9]* volume",
- 512),
+ 512, 1),
AM_SIZE_RE("DUMP: [0-9][0-9]* blocks \\([0-9][0-9]*\\.[0-9][0-9]*MB\\) on [0-9][0-9]* volume",
- 512),
- AM_SIZE_RE("DUMP: [0-9][0-9]* blocks", 1024),
- AM_SIZE_RE("DUMP: [0-9][0-9]* bytes were dumped", 1),
+ 512, 1),
+ AM_SIZE_RE("DUMP: [0-9][0-9]* blocks \\([0-9][0-9]*KB\\)",
+ 1024, 2),
+ AM_SIZE_RE("DUMP: [0-9][0-9]* blocks \\([0-9][0-9]*\\.[0-9][0-9]*MB\\)",
+ 1048576, 2),
+ AM_SIZE_RE("DUMP: [0-9][0-9]* blocks", 512, 1),
+ AM_SIZE_RE("DUMP: [0-9][0-9]* bytes were dumped", 1, 1),
/* OSF's vdump */
- AM_SIZE_RE("vdump: Dumped [0-9][0-9]* of [0-9][0-9]* bytes", 1),
+ AM_SIZE_RE("vdump: Dumped [0-9][0-9]* of [0-9][0-9]* bytes", 1, 1),
/* DU 4.0a dump */
- AM_SIZE_RE("dump: Actual: [0-9][0-9]* blocks output to pipe", 1024),
+ AM_SIZE_RE("dump: Actual: [0-9][0-9]* blocks output to pipe", 1024, 1),
/* DU 4.0 vdump */
- AM_SIZE_RE("dump: Dumped [0-9][0-9]* of [0-9][0-9]* bytes", 1),
+ AM_SIZE_RE("dump: Dumped [0-9][0-9]* of [0-9][0-9]* bytes", 1, 1),
/* HPUX dump */
- AM_SIZE_RE("DUMP: [0-9][0-9]* KB actual output", 1024),
+ AM_SIZE_RE("DUMP: [0-9][0-9]* KB actual output", 1024, 1),
/* HPUX 10.20 and above vxdump */
- AM_SIZE_RE("vxdump: [0-9][0-9]* tape blocks", 1024),
+ AM_SIZE_RE("vxdump: [0-9][0-9]* tape blocks", 1024, 1),
/* UnixWare vxdump */
- AM_SIZE_RE("vxdump: [0-9][0-9]* blocks", 1024),
+ AM_SIZE_RE("vxdump: [0-9][0-9]* blocks", 1024, 1),
/* SINIX vxdump */
- AM_SIZE_RE(" VXDUMP: [0-9][0-9]* blocks", 512),
+ AM_SIZE_RE(" VXDUMP: [0-9][0-9]* blocks", 512, 1),
/* SINIX ufsdump */
- AM_SIZE_RE(" UFSDUMP: [0-9][0-9]* blocks", 512),
+ AM_SIZE_RE(" UFSDUMP: [0-9][0-9]* blocks", 512, 1),
/* Irix 6.2 xfs dump */
- AM_SIZE_RE("xfsdump: media file size [0-9][0-9]* bytes", 1),
+ AM_SIZE_RE("xfsdump: media file size [0-9][0-9]* bytes", 1, 1),
/* NetApp dump */
- AM_SIZE_RE("DUMP: [0-9][0-9]* KB", 1024),
+ AM_SIZE_RE("DUMP: [0-9][0-9]* KB", 1024, 1),
/* strange dump lines */
AM_STRANGE_RE("should not happen"),
AM_STRANGE_RE(NULL)
};
+static void start_backup(char *host, char *disk, char *amdevice, int level,
+ char *dumpdate, int dataf, int mesgf, int indexf);
+static void end_backup(int status);
+
/*
* doing similar to $ dump | compression | encryption
*/
-static void start_backup(host, disk, amdevice, level, dumpdate, dataf, mesgf, indexf)
- char *host;
- char *disk, *amdevice;
- int level, dataf, mesgf, indexf;
- char *dumpdate;
+static void
+start_backup(
+ char * host,
+ char * disk,
+ char * amdevice,
+ int level,
+ char * dumpdate,
+ int dataf,
+ int mesgf,
+ int indexf)
{
int dumpin, dumpout, compout;
char *dumpkeys = NULL;
char *device = NULL;
char *fstype = NULL;
char *cmd = NULL;
+ char *cmdX = NULL;
char *indexcmd = NULL;
char level_str[NUM_STR_SIZE];
char *compopt = NULL;
char *encryptopt = skip_argument;
+ char *qdisk;
+ char *config;
+
+ (void)dumpdate; /* Quiet unused parameter warning */
+ snprintf(level_str, SIZEOF(level_str), "%d", level);
- snprintf(level_str, sizeof(level_str), "%d", level);
+ qdisk = quote_string(disk);
+ dbprintf(("%s: start: %s:%s lev %d\n",
+ get_pname(), host, qdisk, level));
fprintf(stderr, "%s: start [%s:%s level %d]\n",
- get_pname(), host, disk, level);
+ get_pname(), host, qdisk, level);
+ amfree(qdisk);
- /* apply client-side encryption here */
- if ( options->encrypt == ENCRYPT_CUST ) {
- encpid = pipespawn(options->clnt_encrypt, STDIN_PIPE,
+ /* apply client-side encryption here */
+ if ( options->encrypt == ENCRYPT_CUST ) {
+ encpid = pipespawn(options->clnt_encrypt, STDIN_PIPE,
&compout, &dataf, &mesgf,
options->clnt_encrypt, encryptopt, NULL);
- dbprintf(("%s: pid %ld: %s\n",
+ dbprintf(("%s: pid %ld: %s\n",
debug_prefix_time("-gnutar"), (long)encpid, options->clnt_encrypt));
- } else {
+ } else {
compout = dataf;
encpid = -1;
- }
- /* now do the client-side compression */
+ }
+ /* now do the client-side compression */
- if(options->compress == COMPR_FAST || options->compress == COMPR_BEST) {
+ if(options->compress == COMP_FAST || options->compress == COMP_BEST) {
compopt = skip_argument;
#if defined(COMPRESS_BEST_OPT) && defined(COMPRESS_FAST_OPT)
- if(options->compress == COMPR_BEST) {
+ if(options->compress == COMP_BEST) {
compopt = COMPRESS_BEST_OPT;
} else {
compopt = COMPRESS_FAST_OPT;
dbprintf((" %s", compopt));
}
dbprintf(("\n"));
- } else if (options->compress == COMPR_CUST) {
+ } else if (options->compress == COMP_CUST) {
compopt = skip_argument;
comppid = pipespawn(options->clntcompprog, STDIN_PIPE,
&dumpout, &compout, &mesgf,
#if defined(USE_RUNDUMP) || !defined(DUMP)
cmd = vstralloc(libexecdir, "/", "rundump", versionsuffix(), NULL);
+ cmdX = cmd;
+ if (g_options->config)
+ config = g_options->config;
+ else
+ config = "NOCONFIG";
#else
cmd = stralloc(DUMP);
+ cmdX = skip_argument;
+ config = skip_argument;
#endif
#ifndef AIX_BACKUP /* { */
{
char *progname = cmd = newvstralloc(cmd, libexecdir, "/", "rundump",
versionsuffix(), NULL);
+ cmdX = cmd;
+ if (g_options->config)
+ config = g_options->config;
+ else
+ config = "NOCONFIG";
+
program->backup_name = XFSDUMP;
program->restore_name = XFSRESTORE;
dumpkeys = stralloc(level_str);
dumppid = pipespawn(progname, STDIN_PIPE,
&dumpin, &dumpout, &mesgf,
+ cmdX, config,
"xfsdump",
options->no_record ? "-J" : skip_argument,
"-F",
#ifdef USE_RUNDUMP
char *progname = cmd = newvstralloc(cmd, libexecdir, "/", "rundump",
versionsuffix(), NULL);
+ cmdX = cmd;
+ if (g_options->config)
+ config = g_options->config;
+ else
+ config = "NOCONFIG";
#else
char *progname = cmd = newvstralloc(cmd, VXDUMP, NULL);
+ cmdX = skip_argument;
+ config = skip_argument;
#endif
program->backup_name = VXDUMP;
program->restore_name = VXRESTORE;
dumppid = pipespawn(progname, STDIN_PIPE,
&dumpin, &dumpout, &mesgf,
+ cmdX, config,
"vxdump",
dumpkeys,
"1048576",
{
char *progname = cmd = newvstralloc(cmd, libexecdir, "/", "rundump",
versionsuffix(), NULL);
+ cmdX = cmd;
+ if (g_options->config)
+ config = g_options->config;
+ else
+ config = "NOCONFIG";
device = newstralloc(device, amname_to_dirname(amdevice));
program->backup_name = VDUMP;
program->restore_name = VRESTORE;
dumppid = pipespawn(cmd, STDIN_PIPE,
&dumpin, &dumpout, &mesgf,
+ cmdX, config,
"vdump",
dumpkeys,
"60",
#define RESTORE "restore"
#endif
+#ifdef HAVE_HONOR_NODUMP
+# define PARAM_HONOR_NODUMP "h"
+#else
+# define PARAM_HONOR_NODUMP ""
+#endif
dumpkeys = vstralloc(level_str,
options->no_record ? "" : "u",
"s",
-#ifdef HAVE_HONOR_NODUMP
- "h",
-#endif
+ PARAM_HONOR_NODUMP,
"f",
NULL);
dumppid = pipespawn(cmd, STDIN_PIPE,
&dumpin, &dumpout, &mesgf,
+ cmdX, config,
"dump",
dumpkeys,
"1048576",
dumppid = pipespawn(cmd, STDIN_PIPE,
&dumpin, &dumpout, &mesgf,
+ cmdX, config,
"backup",
dumpkeys,
"-",
aclose(indexf);
}
-static void end_backup(status)
-int status;
+static void
+end_backup(
+ int status)
{
+ (void)status; /* Quiet unused parameter warning */
+
/* don't need to do anything for dump */
}