From b6a75b353230d2e66be0f5311b0ca672641e307e Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 7 Jun 2003 15:30:48 +0000 Subject: [PATCH] First cut Win32 data stream detection. Fix Win98 restore bug. Pass mtime_only to FD git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@569 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/.cvsignore | 2 ++ bacula/kernstodo | 6 +++++- bacula/scripts/.cvsignore | 1 + bacula/src/baconfig.h | 24 ++++++++++++------------ bacula/src/cats/sql_create.c | 3 ++- bacula/src/dird/backup.c | 8 ++++---- bacula/src/dird/catreq.c | 2 +- bacula/src/dird/dird.c | 4 ++-- bacula/src/dird/fd_cmds.c | 2 +- bacula/src/dird/verify.c | 2 +- bacula/src/jcr.h | 1 + 11 files changed, 32 insertions(+), 23 deletions(-) diff --git a/bacula/.cvsignore b/bacula/.cvsignore index 368ec6f09d..e87bcd24e3 100644 --- a/bacula/.cvsignore +++ b/bacula/.cvsignore @@ -36,3 +36,5 @@ stopit stopmysql console.log console.sum +zapall +zaptapes diff --git a/bacula/kernstodo b/bacula/kernstodo index 224b413688..874ca22d7c 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -34,6 +34,8 @@ Testing to do: (painful) - Figure out how to use ssh or stunnel to protect Bacula communications. For 1.31 release: +- lstat() is not going to work on Win32 for testing date. +- Implement a Recycle command - Something is not right in last block of fill command. - Check this below from Phil. > When the job was done, Bacula reported 11084 files restored: @@ -57,7 +59,7 @@ For 1.31 release: user had re-linked the file between the backup and the restore. Do lstat() to see if it is already properly linked. Same for symlinked file. -- Remove the Jmsg() in sql_find.c:102 or only print on hard error. + Make sure ifnewer, ifolder, never, ... apply correctly. - Implement List Volume Job=xxx or List scheduled volumes or Status Director - Instrument use_count on DEVICE packets and ensure that the device is @@ -967,3 +969,5 @@ Done: (see kernsdone for more) It doesnt show the last 20 jobs , but some older ones. - Fix Verify VolumeToCatalog to use BSRs -- it is broken. - Implement Release Storage=xxx +- Fix restore on Win95/98 +- Remove the Jmsg() in sql_find.c:102 or only print on hard error. diff --git a/bacula/scripts/.cvsignore b/bacula/scripts/.cvsignore index a0987b45b3..804abf5efc 100644 --- a/bacula/scripts/.cvsignore +++ b/bacula/scripts/.cvsignore @@ -5,3 +5,4 @@ bacula.desktop.gnome1 bacula.desktop.gnome2 console gconsole +mtx-changer diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index d6c3b3cb25..ff4eef9e06 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -97,18 +97,18 @@ /* Stream definitions. Once defined these must NEVER * change as they go on the storage media. */ -#define STREAM_UNIX_ATTRIBUTES 1 /* Generic Unix attributes */ -#define STREAM_FILE_DATA 2 /* Standard uncompressed data */ -#define STREAM_MD5_SIGNATURE 3 /* MD5 signature for the file */ -#define STREAM_GZIP_DATA 4 /* GZip compressed file data */ -#define STREAM_WIN32_ATTRIBUTES 5 /* Windows attributes (superset of Unix) */ -#define STREAM_SPARSE_DATA 6 /* Sparse data stream */ -#define STREAM_SPARSE_GZIP_DATA 7 -#define STREAM_PROGRAM_NAMES 8 /* program names for program data */ -#define STREAM_PROGRAM_DATA 9 /* Data needing program */ -#define STREAM_SHA1_SIGNATURE 10 /* SHA1 signature for the file */ -#define STREAM_WIN32_DATA 11 /* Win32 BackupRead data */ -#define STREAM_WIN32_GZIP_DATA 12 /* Gzipped Win32 BackupRead data */ +#define STREAM_UNIX_ATTRIBUTES 1 /* Generic Unix attributes */ +#define STREAM_FILE_DATA 2 /* Standard uncompressed data */ +#define STREAM_MD5_SIGNATURE 3 /* MD5 signature for the file */ +#define STREAM_GZIP_DATA 4 /* GZip compressed file data */ +#define STREAM_UNIX_ATTRIBUTES_EX 5 /* Extended Unix attr. Win32Ex/FreeBSD */ +#define STREAM_SPARSE_DATA 6 /* Sparse data stream */ +#define STREAM_SPARSE_GZIP_DATA 7 +#define STREAM_PROGRAM_NAMES 8 /* program names for program data */ +#define STREAM_PROGRAM_DATA 9 /* Data needing program */ +#define STREAM_SHA1_SIGNATURE 10 /* SHA1 signature for the file */ +#define STREAM_WIN32_DATA 11 /* Win32 BackupRead data */ +#define STREAM_WIN32_GZIP_DATA 12 /* Gzipped Win32 BackupRead data */ /* * Internal code for Signature types diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index 670570c009..0b6c4183be 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -471,7 +471,8 @@ int db_create_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar) /* * Make sure we have an acceptable attributes record. */ - if (!(ar->Stream == STREAM_UNIX_ATTRIBUTES || ar->Stream == STREAM_WIN32_ATTRIBUTES)) { + if (!(ar->Stream == STREAM_UNIX_ATTRIBUTES || + ar->Stream == STREAM_UNIX_ATTRIBUTES_EX)) { Mmsg0(&mdb->errmsg, _("Attempt to put non-attributes into catalog\n")); Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg); return 0; diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 3b722d40bb..21ec4630c0 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -41,7 +41,7 @@ /* Commands sent to File daemon */ static char backupcmd[] = "backup\n"; static char storaddr[] = "storage address=%s port=%d ssl=%d\n"; -static char levelcmd[] = "level = %s%s\n"; +static char levelcmd[] = "level = %s%s mtime_only=%d\n"; /* Responses received from File daemon */ static char OKbackup[] = "2000 OK backup\n"; @@ -224,14 +224,14 @@ int do_backup(JCR *jcr) */ switch (jcr->JobLevel) { case L_BASE: - bnet_fsend(fd, levelcmd, "base", " "); + bnet_fsend(fd, levelcmd, "base", " ", 0); break; case L_FULL: - bnet_fsend(fd, levelcmd, "full", " "); + bnet_fsend(fd, levelcmd, "full", " ", 0); break; case L_DIFFERENTIAL: case L_INCREMENTAL: - bnet_fsend(fd, levelcmd, "since ", jcr->stime); + bnet_fsend(fd, levelcmd, "since ", jcr->stime, 0); free_pool_memory(jcr->stime); jcr->stime = NULL; break; diff --git a/bacula/src/dird/catreq.c b/bacula/src/dird/catreq.c index 5ce9194cb2..9abe3b509d 100644 --- a/bacula/src/dird/catreq.c +++ b/bacula/src/dird/catreq.c @@ -392,7 +392,7 @@ void catalog_update(JCR *jcr, BSOCK *bs, char *msg) Dmsg5(99, "UpdCat VolSessId=%d VolSessT=%d FI=%d Strm=%d data_len=%d\n", VolSessionId, VolSessionTime, FileIndex, Stream, data_len); - if (Stream == STREAM_UNIX_ATTRIBUTES || Stream == STREAM_WIN32_ATTRIBUTES) { + if (Stream == STREAM_UNIX_ATTRIBUTES || Stream == STREAM_UNIX_ATTRIBUTES_EX) { skip_nonspaces(&p); /* skip FileIndex */ skip_spaces(&p); skip_nonspaces(&p); /* skip FileType */ diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c index c5e1f5ef0a..d197713855 100644 --- a/bacula/src/dird/dird.c +++ b/bacula/src/dird/dird.c @@ -370,8 +370,8 @@ Without that I don't know who I am :-(\n"), configfile); catalog->db_password, catalog->db_address, catalog->db_port, catalog->db_socket); if (!db_open_database(NULL, db)) { - Jmsg(NULL, M_FATAL, 0, _("Could not open database \"%s\".\n"), - catalog->db_name); + Jmsg(NULL, M_FATAL, 0, _("Could not open %s database \"%s\".\n"), + catalog_db, catalog->db_name); OK = FALSE; } else { /* If a pool is defined for this job, create the pool DB diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index 3353180ee3..0aa9e4ae9b 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -361,7 +361,7 @@ msglen=%d msg=%s\n"), len, fd->msglen, fd->msg); *fn = *p++; /* term filename and point to attribs */ attr = p; - if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_WIN32_ATTRIBUTES) { + if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_UNIX_ATTRIBUTES_EX) { jcr->JobFiles++; jcr->FileIndex = file_index; ar.attr = attr; diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 31bc11d251..605d668d94 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -502,7 +502,7 @@ int get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId) /* * Got attributes stream, decode it */ - if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_WIN32_ATTRIBUTES) { + if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_UNIX_ATTRIBUTES_EX) { uint32_t LinkFIf, LinkFIc; Dmsg2(400, "file_index=%d attr=%s\n", file_index, attr); jcr->JobFiles++; diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 19968c0a3c..f54d15b15d 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -162,6 +162,7 @@ struct JCR { /*********FIXME********* add missing files and files to be retried */ int incremental; /* set if incremental for SINCE */ time_t mtime; /* begin time for SINCE */ + int mtime_only; /* compare only mtime and not ctime as well */ int mode; /* manual/auto run */ int status; /* job status */ long Ticket; /* Ticket */ -- 2.39.5