--- /dev/null
+EndJob.pyc
+NewVolume.pyc
+StartJob.pyc
- Optimized bootstrap.
For 1.37:
+- Add Set Error from Python.
- Create a new GUI chapter explaining all the GUI programs.
- Tell the "restore" user when browsing is no longer possible.
- Add disk seeking on restore.
- Directory
Pool
- Media Type (read/write)
- - Device Group
+ - Device List
+ - Next Pool
+ - Migration High
+ - Migration Low
+ - Migration Time (time after which data migrated to next Pool)
+ - Maximum Devices (that can use Pool simultaneously)
Media
- Autochanger Id
- List of Devices/Device Groups/Storage groups
(i.e. physical restraint)
+ - Migration High
+ - Migration Low
+ - Migration Time (time after which data migrated to next Pool)
+ - Maximum Devices (that can use Pool simultaneously)
Autochanger
- Device list
db_lock(mdb);
if (type == VERT_LIST) {
Mmsg(mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,"
- "AcceptAnyVolume,VolRetention,VolUseDuration,MaxVolJobs,MaxVolBytes,"
- "AutoPrune,Recycle,PoolType,LabelFormat,Enabled,ScratchPoolId,"
- "RecyclePoolId "
- "FROM Pool ORDER BY PoolId");
+ "AcceptAnyVolume,VolRetention,VolUseDuration,MaxVolJobs,MaxVolBytes,"
+ "AutoPrune,Recycle,PoolType,LabelFormat,Enabled,ScratchPoolId,"
+ "RecyclePoolId "
+ "FROM Pool ORDER BY PoolId");
} else {
Mmsg(mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,PoolType,LabelFormat "
- "FROM Pool ORDER BY PoolId");
+ "FROM Pool ORDER BY PoolId");
}
if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
db_lock(mdb);
if (type == VERT_LIST) {
Mmsg(mdb->cmd, "SELECT ClientId,Name,Uname,AutoPrune,FileRetention,"
- "FileRetention,JobRetention "
- "FROM Client ORDER BY ClientId");
+ "FileRetention,JobRetention "
+ "FROM Client ORDER BY ClientId");
} else {
Mmsg(mdb->cmd, "SELECT ClientId,Name,FileRetention,JobRetention "
- "FROM Client ORDER BY ClientId");
+ "FROM Client ORDER BY ClientId");
}
if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
db_lock(mdb);
if (type == VERT_LIST) {
if (mdbr->VolumeName[0] != 0) {
- Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,Slot,PoolId,"
- "MediaType,FirstWritten,LastWritten,LabelDate,VolJobs,"
- "VolFiles,VolBlocks,VolMounts,VolBytes,VolErrors,VolWrites,"
- "VolCapacityBytes,VolStatus,Recycle,VolRetention,"
- "VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes,InChanger,"
- "EndFile,EndBlock "
- "FROM Media WHERE Media.VolumeName='%s'", mdbr->VolumeName);
+ Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,Slot,PoolId,"
+ "MediaType,FirstWritten,LastWritten,LabelDate,VolJobs,"
+ "VolFiles,VolBlocks,VolMounts,VolBytes,VolErrors,VolWrites,"
+ "VolCapacityBytes,VolStatus,Recycle,VolRetention,"
+ "VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes,InChanger,"
+ "EndFile,EndBlock "
+ "FROM Media WHERE Media.VolumeName='%s'", mdbr->VolumeName);
} else {
- Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,Slot,PoolId,"
- "MediaType,FirstWritten,LastWritten,LabelDate,VolJobs,"
- "VolFiles,VolBlocks,VolMounts,VolBytes,VolErrors,VolWrites,"
- "VolCapacityBytes,VolStatus,Recycle,VolRetention,"
- "VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes,InChanger,"
- "EndFile,EndBlock "
- "FROM Media WHERE Media.PoolId=%u ORDER BY MediaId", mdbr->PoolId);
+ Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,Slot,PoolId,"
+ "MediaType,FirstWritten,LastWritten,LabelDate,VolJobs,"
+ "VolFiles,VolBlocks,VolMounts,VolBytes,VolErrors,VolWrites,"
+ "VolCapacityBytes,VolStatus,Recycle,VolRetention,"
+ "VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes,InChanger,"
+ "EndFile,EndBlock "
+ "FROM Media WHERE Media.PoolId=%u ORDER BY MediaId", mdbr->PoolId);
}
} else {
if (mdbr->VolumeName[0] != 0) {
- Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolStatus,"
- "VolBytes,VolFiles,VolRetention,Recycle,Slot,InChanger,MediaType,LastWritten "
- "FROM Media WHERE Media.VolumeName='%s'", mdbr->VolumeName);
+ Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolStatus,"
+ "VolBytes,VolFiles,VolRetention,Recycle,Slot,InChanger,MediaType,LastWritten "
+ "FROM Media WHERE Media.VolumeName='%s'", mdbr->VolumeName);
} else {
- Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolStatus,"
- "VolBytes,VolFiles,VolRetention,Recycle,Slot,InChanger,MediaType,LastWritten "
- "FROM Media WHERE Media.PoolId=%u ORDER BY MediaId", mdbr->PoolId);
+ Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolStatus,"
+ "VolBytes,VolFiles,VolRetention,Recycle,Slot,InChanger,MediaType,LastWritten "
+ "FROM Media WHERE Media.PoolId=%u ORDER BY MediaId", mdbr->PoolId);
}
}
db_lock(mdb);
if (type == VERT_LIST) {
if (JobId > 0) { /* do by JobId */
- Mmsg(mdb->cmd, "SELECT JobMediaId,JobId,MediaId,Media.VolumeName,"
- "FirstIndex,LastIndex,StartFile,JobMedia.EndFile,StartBlock,"
- "JobMedia.EndBlock "
- "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId "
- "AND JobMedia.JobId=%u", JobId);
+ Mmsg(mdb->cmd, "SELECT JobMediaId,JobId,Media.MediaId,Media.VolumeName,"
+ "FirstIndex,LastIndex,StartFile,JobMedia.EndFile,StartBlock,"
+ "JobMedia.EndBlock "
+ "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId "
+ "AND JobMedia.JobId=%u", JobId);
} else {
- Mmsg(mdb->cmd, "SELECT JobMediaId,JobId,MediaId,Media.VolumeName,"
- "FirstIndex,LastIndex,StartFile,JobMedia.EndFile,StartBlock,"
- "JobMedia.EndBlock "
- "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId");
+ Mmsg(mdb->cmd, "SELECT JobMediaId,JobId,Media.MediaId,Media.VolumeName,"
+ "FirstIndex,LastIndex,StartFile,JobMedia.EndFile,StartBlock,"
+ "JobMedia.EndBlock "
+ "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId");
}
} else {
if (JobId > 0) { /* do by JobId */
- Mmsg(mdb->cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
- "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId "
- "AND JobMedia.JobId=%u", JobId);
+ Mmsg(mdb->cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
+ "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId "
+ "AND JobMedia.JobId=%u", JobId);
} else {
- Mmsg(mdb->cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
- "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId");
+ Mmsg(mdb->cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
+ "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId");
}
}
if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
if (type == VERT_LIST) {
if (jr->JobId == 0 && jr->Job[0] == 0) {
Mmsg(mdb->cmd,
- "SELECT JobId,Job,Job.Name,PurgedFiles,Type,Level,"
- "Job.ClientId,Client.Name,JobStatus,SchedTime,"
- "StartTime,EndTime,JobTDate,"
- "VolSessionId,VolSessionTime,JobFiles,JobErrors,"
- "JobMissingFiles,Job.PoolId,Pool.Name,Job.FileSetId,FileSet.FileSet "
- "FROM Job,Client,Pool,FileSet WHERE "
- "Client.ClientId=Job.ClientId AND Pool.PoolId=Job.PoolId "
- "AND FileSet.FileSetId=Job.FileSetId ORDER BY StartTime");
+ "SELECT JobId,Job,Job.Name,PurgedFiles,Type,Level,"
+ "Job.ClientId,Client.Name,JobStatus,SchedTime,"
+ "StartTime,EndTime,JobTDate,"
+ "VolSessionId,VolSessionTime,JobFiles,JobErrors,"
+ "JobMissingFiles,Job.PoolId,Pool.Name,Job.FileSetId,FileSet.FileSet "
+ "FROM Job,Client,Pool,FileSet WHERE "
+ "Client.ClientId=Job.ClientId AND Pool.PoolId=Job.PoolId "
+ "AND FileSet.FileSetId=Job.FileSetId ORDER BY StartTime");
} else { /* single record */
Mmsg(mdb->cmd,
- "SELECT JobId,Job,Job.Name,PurgedFiles,Type,Level,"
- "Job.ClientId,Client.Name,JobStatus,SchedTime,"
- "StartTime,EndTime,JobTDate,"
- "VolSessionId,VolSessionTime,JobFiles,JobErrors,"
- "JobMissingFiles,Job.PoolId,Pool.Name,Job.FileSetId,FileSet.FileSet "
- "FROM Job,Client,Pool,FileSet WHERE Job.JobId=%u AND "
- "Client.ClientId=Job.ClientId AND Pool.PoolId=Job.PoolId "
- "AND FileSet.FileSetId=Job.FileSetId", jr->JobId);
+ "SELECT JobId,Job,Job.Name,PurgedFiles,Type,Level,"
+ "Job.ClientId,Client.Name,JobStatus,SchedTime,"
+ "StartTime,EndTime,JobTDate,"
+ "VolSessionId,VolSessionTime,JobFiles,JobErrors,"
+ "JobMissingFiles,Job.PoolId,Pool.Name,Job.FileSetId,FileSet.FileSet "
+ "FROM Job,Client,Pool,FileSet WHERE Job.JobId=%u AND "
+ "Client.ClientId=Job.ClientId AND Pool.PoolId=Job.PoolId "
+ "AND FileSet.FileSetId=Job.FileSetId", jr->JobId);
}
} else {
if (jr->JobId == 0 && jr->Job[0] == 0) {
Mmsg(mdb->cmd,
- "SELECT JobId,Name,StartTime,Type,Level,JobFiles,JobBytes,JobStatus "
- "FROM Job ORDER BY StartTime");
+ "SELECT JobId,Name,StartTime,Type,Level,JobFiles,JobBytes,JobStatus "
+ "FROM Job ORDER BY StartTime");
} else { /* single record */
- Mmsg(mdb->cmd, "SELECT JobId,Name,StartTime,Type,Level,"
- "JobFiles,JobBytes,JobStatus FROM Job WHERE JobId=%u", jr->JobId);
+ Mmsg(mdb->cmd, "SELECT JobId,Name,StartTime,Type,Level,"
+ "JobFiles,JobBytes,JobStatus FROM Job WHERE JobId=%u", jr->JobId);
}
}
if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
*/
/*
- Copyright (C) 2000-2004 Kern Sibbald and John Walker
+ Copyright (C) 2000-2004 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
if (!db_find_last_jobid(jcr, jcr->db, Name, &jr)) {
if (jcr->JobLevel == L_VERIFY_CATALOG) {
Jmsg(jcr, M_FATAL, 0, _(
- "Unable to find JobId of previous InitCatalog Job.\n"
- "Please run a Verify with Level=InitCatalog before\n"
- "running the current Job.\n"));
+ "Unable to find JobId of previous InitCatalog Job.\n"
+ "Please run a Verify with Level=InitCatalog before\n"
+ "running the current Job.\n"));
} else {
Jmsg(jcr, M_FATAL, 0, _(
- "Unable to find JobId of previous Job for this client.\n"));
+ "Unable to find JobId of previous Job for this client.\n"));
}
goto bail_out;
}
jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG) {
verify_jr.JobId = verify_jobid;
if (!db_get_job_record(jcr, jcr->db, &verify_jr)) {
- Jmsg(jcr, M_FATAL, 0, _("Could not get job record for previous Job. ERR=%s"),
+ Jmsg(jcr, M_FATAL, 0, _("Could not get job record for previous Job. ERR=%s"),
db_strerror(jcr->db));
goto bail_out;
}
if (verify_jr.JobStatus != 'T') {
- Jmsg(jcr, M_FATAL, 0, _("Last Job %d did not terminate normally. JobStatus=%c\n"),
+ Jmsg(jcr, M_FATAL, 0, _("Last Job %d did not terminate normally. JobStatus=%c\n"),
verify_jobid, verify_jr.JobStatus);
goto bail_out;
}
jr.VolSessionId, jr.VolSessionTime,
jr.StartFile, jr.EndFile, jr.StartBlock,
jr.EndBlock);
- if (!response(jcr, fd, OKsession, "Session", DISPLAY_ERROR)) {
+ if (!response(jcr, fd, OKsession, "Session", DISPLAY_ERROR)) {
goto bail_out;
}
}
default:
term_msg = term_code;
bsnprintf(term_code, sizeof(term_code),
- _("Inappropriate term code: %d %c\n"), TermCode, TermCode);
+ _("Inappropriate term code: %d %c\n"), TermCode, TermCode);
break;
}
bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
char buf[MAXSTRING];
POOLMEM *fname = get_pool_memory(PM_MESSAGE);
int do_SIG = NO_SIG;
- long file_index = 0;
+ int32_t file_index = 0;
memset(&fdbr, 0, sizeof(FILE_DBR));
fd = jcr->file_bsock;
Dmsg1(200, "Atts+SIG=%s\n", fd->msg);
if ((len = sscanf(fd->msg, "%ld %d %100s", &file_index, &stream,
fname)) != 3) {
- Jmsg3(jcr, M_FATAL, 0, _("bird<filed: bad attributes, expected 3 fields got %d\n"
+ Jmsg3(jcr, M_FATAL, 0, _("bird<filed: bad attributes, expected 3 fields got %d\n"
" mslen=%d msg=%s\n"), len, fd->msglen, fd->msg);
goto bail_out;
}
*/
if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_UNIX_ATTRIBUTES_EX) {
int32_t LinkFIf, LinkFIc;
- Dmsg2(400, "file_index=%d attr=%s\n", file_index, attr);
+ Dmsg2(400, "file_index=%d attr=%s\n", file_index, attr);
jcr->JobFiles++;
jcr->FileIndex = file_index; /* remember attribute file_index */
decode_stat(attr, &statf, &LinkFIf); /* decode file stat packet */
jcr->fn_printed = false;
pm_strcpy(jcr->fname, fname); /* move filename into JCR */
- Dmsg2(040, "dird<filed: stream=%d %s\n", stream, jcr->fname);
- Dmsg1(020, "dird<filed: attr=%s\n", attr);
+ Dmsg2(040, "dird<filed: stream=%d %s\n", stream, jcr->fname);
+ Dmsg1(020, "dird<filed: attr=%s\n", attr);
/*
* Find equivalent record in the database
fdbr.FileId = 0;
if (!db_get_file_attributes_record(jcr, jcr->db, jcr->fname,
jcr->verify_jr, &fdbr)) {
- Jmsg(jcr, M_INFO, 0, _("New file: %s\n"), jcr->fname);
- Dmsg1(020, _("File not in catalog: %s\n"), jcr->fname);
+ Jmsg(jcr, M_INFO, 0, _("New file: %s\n"), jcr->fname);
+ Dmsg1(020, _("File not in catalog: %s\n"), jcr->fname);
stat = JS_Differences;
continue;
} else {
db_mark_file_record(jcr, jcr->db, fdbr.FileId, jcr->JobId);
}
- Dmsg3(400, "Found %s in catalog. inx=%d Opts=%s\n", jcr->fname,
+ Dmsg3(400, "Found %s in catalog. inx=%d Opts=%s\n", jcr->fname,
file_index, Opts_SIG);
decode_stat(fdbr.LStat, &statc, &LinkFIc); /* decode catalog stat */
/*
for (p=Opts_SIG; *p; p++) {
char ed1[30], ed2[30];
switch (*p) {
- case 'i': /* compare INODEs */
+ case 'i': /* compare INODEs */
if (statc.st_ino != statf.st_ino) {
prt_fname(jcr);
- Jmsg(jcr, M_INFO, 0, _(" st_ino differ. Cat: %s File: %s\n"),
+ Jmsg(jcr, M_INFO, 0, _(" st_ino differ. Cat: %s File: %s\n"),
edit_uint64((uint64_t)statc.st_ino, ed1),
edit_uint64((uint64_t)statf.st_ino, ed2));
stat = JS_Differences;
}
break;
- case 'p': /* permissions bits */
+ case 'p': /* permissions bits */
if (statc.st_mode != statf.st_mode) {
prt_fname(jcr);
- Jmsg(jcr, M_INFO, 0, _(" st_mode differ. Cat: %x File: %x\n"),
+ Jmsg(jcr, M_INFO, 0, _(" st_mode differ. Cat: %x File: %x\n"),
(uint32_t)statc.st_mode, (uint32_t)statf.st_mode);
stat = JS_Differences;
}
break;
- case 'n': /* number of links */
+ case 'n': /* number of links */
if (statc.st_nlink != statf.st_nlink) {
prt_fname(jcr);
- Jmsg(jcr, M_INFO, 0, _(" st_nlink differ. Cat: %d File: %d\n"),
+ Jmsg(jcr, M_INFO, 0, _(" st_nlink differ. Cat: %d File: %d\n"),
(uint32_t)statc.st_nlink, (uint32_t)statf.st_nlink);
stat = JS_Differences;
}
break;
- case 'u': /* user id */
+ case 'u': /* user id */
if (statc.st_uid != statf.st_uid) {
prt_fname(jcr);
- Jmsg(jcr, M_INFO, 0, _(" st_uid differ. Cat: %u File: %u\n"),
+ Jmsg(jcr, M_INFO, 0, _(" st_uid differ. Cat: %u File: %u\n"),
(uint32_t)statc.st_uid, (uint32_t)statf.st_uid);
stat = JS_Differences;
}
break;
- case 'g': /* group id */
+ case 'g': /* group id */
if (statc.st_gid != statf.st_gid) {
prt_fname(jcr);
- Jmsg(jcr, M_INFO, 0, _(" st_gid differ. Cat: %u File: %u\n"),
+ Jmsg(jcr, M_INFO, 0, _(" st_gid differ. Cat: %u File: %u\n"),
(uint32_t)statc.st_gid, (uint32_t)statf.st_gid);
stat = JS_Differences;
}
break;
- case 's': /* size */
+ case 's': /* size */
if (statc.st_size != statf.st_size) {
prt_fname(jcr);
- Jmsg(jcr, M_INFO, 0, _(" st_size differ. Cat: %s File: %s\n"),
+ Jmsg(jcr, M_INFO, 0, _(" st_size differ. Cat: %s File: %s\n"),
edit_uint64((uint64_t)statc.st_size, ed1),
edit_uint64((uint64_t)statf.st_size, ed2));
stat = JS_Differences;
}
break;
- case 'a': /* access time */
+ case 'a': /* access time */
if (statc.st_atime != statf.st_atime) {
prt_fname(jcr);
- Jmsg(jcr, M_INFO, 0, _(" st_atime differs\n"));
+ Jmsg(jcr, M_INFO, 0, _(" st_atime differs\n"));
stat = JS_Differences;
}
break;
- case 'm':
+ case 'm':
if (statc.st_mtime != statf.st_mtime) {
prt_fname(jcr);
- Jmsg(jcr, M_INFO, 0, _(" st_mtime differs\n"));
+ Jmsg(jcr, M_INFO, 0, _(" st_mtime differs\n"));
stat = JS_Differences;
}
break;
- case 'c': /* ctime */
+ case 'c': /* ctime */
if (statc.st_ctime != statf.st_ctime) {
prt_fname(jcr);
- Jmsg(jcr, M_INFO, 0, _(" st_ctime differs\n"));
+ Jmsg(jcr, M_INFO, 0, _(" st_ctime differs\n"));
stat = JS_Differences;
}
break;
- case 'd': /* file size decrease */
+ case 'd': /* file size decrease */
if (statc.st_size > statf.st_size) {
prt_fname(jcr);
- Jmsg(jcr, M_INFO, 0, _(" st_size decrease. Cat: %s File: %s\n"),
+ Jmsg(jcr, M_INFO, 0, _(" st_size decrease. Cat: %s File: %s\n"),
edit_uint64((uint64_t)statc.st_size, ed1),
edit_uint64((uint64_t)statf.st_size, ed2));
stat = JS_Differences;
}
break;
- case '5': /* compare MD5 */
- Dmsg1(500, "set Do_MD5 for %s\n", jcr->fname);
+ case '5': /* compare MD5 */
+ Dmsg1(500, "set Do_MD5 for %s\n", jcr->fname);
do_SIG = MD5_SIG;
break;
- case '1': /* compare SHA1 */
+ case '1': /* compare SHA1 */
do_SIG = SHA1_SIG;
break;
- case ':':
- case 'V':
+ case ':':
+ case 'V':
default:
break;
}
* It came across in the Opts_SIG field.
*/
} else if (stream == STREAM_MD5_SIGNATURE || stream == STREAM_SHA1_SIGNATURE) {
- Dmsg2(400, "stream=SIG inx=%d SIG=%s\n", file_index, Opts_SIG);
+ Dmsg2(400, "stream=SIG inx=%d SIG=%s\n", file_index, Opts_SIG);
/*
* When ever we get a signature is MUST have been
* preceded by an attributes record, which sets attr_file_index
*/
if (jcr->FileIndex != (uint32_t)file_index) {
- Jmsg2(jcr, M_FATAL, 0, _("MD5/SHA1 index %d not same as attributes %d\n"),
+ Jmsg2(jcr, M_FATAL, 0, _("MD5/SHA1 index %d not same as attributes %d\n"),
file_index, jcr->FileIndex);
goto bail_out;
}
if (strcmp(buf, fdbr.SIG) != 0) {
prt_fname(jcr);
if (debug_level >= 10) {
- Jmsg(jcr, M_INFO, 0, _(" %s not same. File=%s Cat=%s\n"),
- stream==STREAM_MD5_SIGNATURE?"MD5":"SHA1", buf, fdbr.SIG);
+ Jmsg(jcr, M_INFO, 0, _(" %s not same. File=%s Cat=%s\n"),
+ stream==STREAM_MD5_SIGNATURE?"MD5":"SHA1", buf, fdbr.SIG);
} else {
- Jmsg(jcr, M_INFO, 0, _(" %s differs.\n"),
- stream==STREAM_MD5_SIGNATURE?"MD5":"SHA1");
+ Jmsg(jcr, M_INFO, 0, _(" %s differs.\n"),
+ stream==STREAM_MD5_SIGNATURE?"MD5":"SHA1");
}
stat = JS_Differences;
}
jcr->JobFiles = file_index;
}
if (is_bnet_error(fd)) {
+ berrno be;
Jmsg2(jcr, M_FATAL, 0, _("bdird<filed: bad attributes from filed n=%d : %s\n"),
- n, strerror(errno));
+ n, be.strerror());
goto bail_out;
}
* the database where the MarkedId != current JobId
*/
jcr->fn_printed = false;
- sprintf(buf,
+ bsnprintf(buf, sizeof(buf),
"SELECT Path.Path,Filename.Name FROM File,Path,Filename "
"WHERE File.JobId=%d "
"AND File.MarkedId!=%d AND File.PathId=Path.PathId "
* We are called here for each record that matches the above
* SQL query -- that is for each file contained in the Catalog
* that was not marked earlier. This means that the file in
- * question is a missing file (in the Catalog but on on Disk).
+ * question is a missing file (in the Catalog but not on Disk).
*/
static int missing_handler(void *ctx, int num_fields, char **row)
{
break;
}
if ((jcr->authenticated) && (!cmds[i].monitoraccess) && (jcr->director->monitor)) {
- Dmsg1(100, "Command %s illegal.\n", cmds[i].cmd);
+ Dmsg1(100, "Command %s illegal.\n", cmds[i].cmd);
bnet_fsend(dir, illegal_cmd);
bnet_sig(dir, BNET_EOD);
break;
}
- Dmsg1(100, "Executing %s command.\n", cmds[i].cmd);
+ Dmsg1(100, "Executing %s command.\n", cmds[i].cmd);
if (!cmds[i].func(jcr)) { /* do command */
quit = true; /* error or fully terminated, get out */
- Dmsg0(20, "Quit command loop due to command error or Job done.\n");
+ Dmsg0(20, "Quit command loop due to command error or Job done.\n");
}
break;
}
if (sscanf(dir->msg, "cancel Job=%127s", Job) == 1) {
if (!(cjcr=get_jcr_by_full_name(Job))) {
- bnet_fsend(dir, "2901 Job %s not found.\n", Job);
+ bnet_fsend(dir, "2901 Job %s not found.\n", Job);
} else {
if (cjcr->store_bsock) {
P(cjcr->mutex);
}
set_jcr_job_status(cjcr, JS_Canceled);
free_jcr(cjcr);
- bnet_fsend(dir, _("2001 Job %s marked to be canceled.\n"), Job);
+ bnet_fsend(dir, _("2001 Job %s marked to be canceled.\n"), Job);
}
} else {
bnet_fsend(dir, _("2902 Error scanning cancel command.\n"));
bpipe = open_bpipe(ecmd, 0, "r");
free_pool_memory(ecmd);
if (bpipe == NULL) {
- Jmsg(jcr, M_FATAL, 0, _("%s could not execute\n"), name);
- set_jcr_job_status(jcr, JS_FatalError);
+ berrno be;
+ Jmsg(jcr, M_FATAL, 0, _("%s could not execute. ERR=%s\n"), name,
+ be.strerror());
return 0;
}
while (fgets(line, sizeof(line), bpipe->rfd)) {
+ int len = strlen(line);
+ if (len > 0 && line[len-1] ! = '\n') {
+ bstrncat(line, sizeof(line), "\n");
+ }
Jmsg(jcr, M_INFO, 0, _("%s: %s"), name, line);
}
status = close_bpipe(bpipe);
if (status != 0) {
- Jmsg(jcr, M_FATAL, 0, _("%s returned non-zero status=%d\n"), name,
- status);
- set_jcr_job_status(jcr, JS_FatalError);
+ berrno be;
+ Jmsg(jcr, M_FATAL, 0, _("%s returned non-zero status=%d. ERR=%s\n"), name,
+ status, be.strerror(status));
return 0;
}
return 1;
bpipe = open_bpipe(fn, 0, "r");
free_pool_memory(fn);
if (!bpipe) {
- Jmsg(jcr, M_FATAL, 0, _("Cannot run program: %s. ERR=%s\n"),
+ Jmsg(jcr, M_FATAL, 0, _("Cannot run program: %s. ERR=%s\n"),
p, strerror(errno));
return;
}
if (list == INC_LIST) {
*q = 0; /* terminate options */
strcpy(buf, fname);
- strcat(buf, " ");
+ strcat(buf, " ");
optlen = strlen(buf);
} else {
optlen = 0;
}
}
if ((stat=close_bpipe(bpipe)) != 0) {
- Jmsg(jcr, M_FATAL, 0, _("Error running program: %s. RtnStat=%d ERR=%s\n"),
+ Jmsg(jcr, M_FATAL, 0, _("Error running program: %s. RtnStat=%d ERR=%s\n"),
p, stat, strerror(errno));
return;
}
p++; /* skip over < */
if ((ffd = fopen(p, "r")) == NULL) {
berrno be;
- Jmsg(jcr, M_FATAL, 0, _("Cannot open %s file: %s. ERR=%s\n"),
- list==INC_LIST?"included":"excluded", p, be.strerror());
+ Jmsg(jcr, M_FATAL, 0, _("Cannot open %s file: %s. ERR=%s\n"),
+ list==INC_LIST?"included":"excluded", p, be.strerror());
return;
}
/* Copy File options */
if (list == INC_LIST) {
*q = 0; /* terminate options */
strcpy(buf, fname);
- strcat(buf, " ");
+ strcat(buf, " ");
optlen = strlen(buf);
} else {
optlen = 0;
bpipe = open_bpipe(fn, 0, "r");
free_pool_memory(fn);
if (!bpipe) {
- Jmsg(jcr, M_FATAL, 0, _("Cannot run program: %s. ERR=%s\n"),
+ Jmsg(jcr, M_FATAL, 0, _("Cannot run program: %s. ERR=%s\n"),
p, strerror(errno));
return;
}
fileset->incexe->name_list.append(bstrdup(buf));
}
if ((stat=close_bpipe(bpipe)) != 0) {
- Jmsg(jcr, M_FATAL, 0, _("Error running program: %s. RtnStat=%d ERR=%s\n"),
+ Jmsg(jcr, M_FATAL, 0, _("Error running program: %s. RtnStat=%d ERR=%s\n"),
p, stat, strerror(errno));
return;
}
p++; /* skip over < */
if ((ffd = fopen(p, "r")) == NULL) {
berrno be;
- Jmsg(jcr, M_FATAL, 0, _("Cannot open FileSet input file: %s. ERR=%s\n"),
+ Jmsg(jcr, M_FATAL, 0, _("Cannot open FileSet input file: %s. ERR=%s\n"),
p, be.strerror());
return;
}
regerror(rc, preg, prbuf, sizeof(prbuf));
regfree(preg);
free(preg);
- Jmsg(jcr, M_FATAL, 0, "REGEX %s compile error. ERR=%s\n", item, prbuf);
+ Jmsg(jcr, M_FATAL, 0, "REGEX %s compile error. ERR=%s\n", item, prbuf);
state = state_error;
break;
}
for (j=0; j<incexe->opts_list.size(); j++) {
findFOPTS *fo = (findFOPTS *)incexe->opts_list.get(j);
for (k=0; k<fo->regex.size(); k++) {
- Dmsg1(400, "R %s\n", (char *)fo->regex.get(k));
+ Dmsg1(400, "R %s\n", (char *)fo->regex.get(k));
}
for (k=0; k<fo->wild.size(); k++) {
- Dmsg1(400, "W %s\n", (char *)fo->wild.get(k));
+ Dmsg1(400, "W %s\n", (char *)fo->wild.get(k));
}
for (k=0; k<fo->base.size(); k++) {
- Dmsg1(400, "B %s\n", (char *)fo->base.get(k));
+ Dmsg1(400, "B %s\n", (char *)fo->base.get(k));
}
for (k=0; k<fo->fstype.size(); k++) {
- Dmsg1(400, "X %s\n", (char *)fo->fstype.get(k));
+ Dmsg1(400, "X %s\n", (char *)fo->fstype.get(k));
}
if (fo->reader) {
- Dmsg1(400, "D %s\n", fo->reader);
+ Dmsg1(400, "D %s\n", fo->reader);
}
if (fo->writer) {
- Dmsg1(400, "T %s\n", fo->writer);
+ Dmsg1(400, "T %s\n", fo->writer);
}
}
for (j=0; j<incexe->name_list.size(); j++) {
- Dmsg1(400, "F %s\n", (char *)incexe->name_list.get(j));
+ Dmsg1(400, "F %s\n", (char *)incexe->name_list.get(j));
}
}
for (i=0; i<fileset->exclude_list.size(); i++) {
for (j=0; j<incexe->opts_list.size(); j++) {
findFOPTS *fo = (findFOPTS *)incexe->opts_list.get(j);
for (k=0; k<fo->regex.size(); k++) {
- Dmsg1(400, "R %s\n", (char *)fo->regex.get(k));
+ Dmsg1(400, "R %s\n", (char *)fo->regex.get(k));
}
for (k=0; k<fo->wild.size(); k++) {
- Dmsg1(400, "W %s\n", (char *)fo->wild.get(k));
+ Dmsg1(400, "W %s\n", (char *)fo->wild.get(k));
}
for (k=0; k<fo->base.size(); k++) {
- Dmsg1(400, "B %s\n", (char *)fo->base.get(k));
+ Dmsg1(400, "B %s\n", (char *)fo->base.get(k));
}
for (k=0; k<fo->fstype.size(); k++) {
- Dmsg1(400, "X %s\n", (char *)fo->fstype.get(k));
+ Dmsg1(400, "X %s\n", (char *)fo->fstype.get(k));
}
}
for (j=0; j<incexe->name_list.size(); j++) {
- Dmsg1(400, "F %s\n", (char *)incexe->name_list.get(j));
+ Dmsg1(400, "F %s\n", (char *)incexe->name_list.get(j));
}
}
return ff->fileset->state != state_error;
case 'p': /* use portable data format */
fo->flags |= FO_PORTABLE;
break;
- case 'R': /* Resource forks and Finder Info */
+ case 'R': /* Resource forks and Finder Info */
fo->flags |= FO_HFSPLUS;
case 'r': /* read fifo */
fo->flags |= FO_READFIFO;
break;
case 'V': /* verify options */
/* Copy Verify Options */
- for (j=0; *p && *p != ':'; p++) {
+ for (j=0; *p && *p != ':'; p++) {
fo->VerifyOpts[j] = *p;
if (j < (int)sizeof(fo->VerifyOpts) - 1) {
j++;
break;
case 'Z': /* gzip compression */
fo->flags |= FO_GZIP;
- fo->GZIP_level = *++p - '0';
- Dmsg1(200, "Compression level=%d\n", fo->GZIP_level);
+ fo->GZIP_level = *++p - '0';
+ Dmsg1(200, "Compression level=%d\n", fo->GZIP_level);
break;
default:
- Emsg1(M_ERROR, 0, "Unknown include/exclude option: %c\n", *p);
+ Emsg1(M_ERROR, 0, "Unknown include/exclude option: %c\n", *p);
break;
}
}
if (bnet_recv(dir) <= 0) { /* get response */
goto bail_out;
}
- if (sscanf(dir->msg, "btime %s", buf) != 1) {
+ if (sscanf(dir->msg, "btime %s", buf) != 1) {
goto bail_out;
}
if (i < 2) { /* toss first two results */
his_time = str_to_uint64(buf);
rt = get_current_btime() - bt_start; /* compute round trip time */
bt_adj -= his_time - bt_start - rt/2;
- Dmsg2(200, "rt=%s adj=%s\n", edit_uint64(rt, ed1), edit_uint64(bt_adj, ed2));
+ Dmsg2(200, "rt=%s adj=%s\n", edit_uint64(rt, ed1), edit_uint64(bt_adj, ed2));
}
bt_adj = bt_adj / 8; /* compute average time */
adj = btime_to_utime(bt_adj);
since_time += adj; /* adjust for clock difference */
if (adj != 0) {
- Jmsg(jcr, M_INFO, 0, _("Since time adjusted by %d seconds.\n"), adj);
+ Jmsg(jcr, M_INFO, 0, _("Since time adjusted by %d seconds.\n"), adj);
}
bnet_sig(dir, BNET_EOD);
if (bget_msg(sd) >= 0) {
Dmsg1(110, "<stored: %s", sd->msg);
if (sscanf(sd->msg, OK_open, &jcr->Ticket) != 1) {
- Jmsg(jcr, M_FATAL, 0, _("Bad response to append open: %s\n"), sd->msg);
+ Jmsg(jcr, M_FATAL, 0, _("Bad response to append open: %s\n"), sd->msg);
goto cleanup;
}
Dmsg1(110, "Got Ticket=%d\n", jcr->Ticket);
while (bget_msg(sd) >= 0) { /* stop on signal or error */
if (sscanf(sd->msg, OK_close, &SDJobStatus) == 1) {
ok = 1;
- Dmsg2(200, "SDJobStatus = %d %c\n", SDJobStatus, (char)SDJobStatus);
+ Dmsg2(200, "SDJobStatus = %d %c\n", SDJobStatus, (char)SDJobStatus);
}
}
if (!ok) {
- Jmsg(jcr, M_FATAL, 0, _("Append Close with SD failed.\n"));
+ Jmsg(jcr, M_FATAL, 0, _("Append Close with SD failed.\n"));
goto cleanup;
}
if (SDJobStatus != JS_Terminated) {
- Jmsg(jcr, M_FATAL, 0, _("Bad status %d returned from Storage Daemon.\n"),
+ Jmsg(jcr, M_FATAL, 0, _("Bad status %d returned from Storage Daemon.\n"),
SDJobStatus);
}
}
if (sscanf(dir->msg, restorecmd, &replace, &prefix_links, where) != 3) {
if (sscanf(dir->msg, restorecmd1, &replace, &prefix_links) != 2) {
pm_strcpy(jcr->errmsg, dir->msg);
- Jmsg(jcr, M_FATAL, 0, _("Bad replace command. CMD=%s\n"), jcr->errmsg);
+ Jmsg(jcr, M_FATAL, 0, _("Bad replace command. CMD=%s\n"), jcr->errmsg);
return 0;
}
*where = 0;
if (bget_msg(sd) >= 0) {
Dmsg1(110, "bfiled<stored: %s", sd->msg);
if (sscanf(sd->msg, OK_open, &jcr->Ticket) != 1) {
- Jmsg(jcr, M_FATAL, 0, _("Bad response to SD read open: %s\n"), sd->msg);
+ Jmsg(jcr, M_FATAL, 0, _("Bad response to SD read open: %s\n"), sd->msg);
return 0;
}
Dmsg1(110, "bfiled: got Ticket=%d\n", jcr->Ticket);
*/
int is_bnet_error(BSOCK * bsock)
{
+ errno = bsock->b_errno;
return bsock->errors;
}
/* */
#undef VERSION
#define VERSION "1.37.1"
-#define BDATE "24 December 2004"
-#define LSMDATE "24Dec04"
+#define BDATE "30 December 2004"
+#define LSMDATE "30Dec04"
/* Debug flags */
#undef DEBUG
int
kill(int pid, int signal)
{
- int rval = 0;
- if (!TerminateProcess((HANDLE)pid, (UINT) signal)) {
- rval = -1;
- errno = b_errno_win32;
- }
- CloseHandle((HANDLE)pid);
- return rval;
+ int rval = 0;
+ if (!TerminateProcess((HANDLE)pid, (UINT) signal)) {
+ rval = -1;
+ errno = b_errno_win32;
+ }
+ CloseHandle((HANDLE)pid);
+ return rval;
}
#ifndef HAVE_MINGW
int
close_bpipe(BPIPE *bpipe)
{
- int rval = 0;
- if (bpipe->rfd) fclose(bpipe->rfd);
- if (bpipe->wfd) fclose(bpipe->wfd);
-
- if (bpipe->wait) {
- int remaining_wait = bpipe->wait;
- do {
- DWORD exitCode;
- if (!GetExitCodeProcess((HANDLE)bpipe->worker_pid, &exitCode)) {
- const char *err = errorString();
- rval = b_errno_win32;
- d_msg(__FILE__, __LINE__, 0,
- "GetExitCode error %s\n", err);
- LocalFree((void *)err);
- break;
- }
-
- if (exitCode == STILL_ACTIVE) {
- bmicrosleep(1, 0); /* wait one second */
- remaining_wait--;
- }
- else break;
- } while(remaining_wait);
- rval = ETIME; /* timed out */
- }
+ int rval = 0;
+ if (bpipe->rfd) fclose(bpipe->rfd);
+ if (bpipe->wfd) fclose(bpipe->wfd);
+
+ if (bpipe->wait) {
+ int remaining_wait = bpipe->wait;
+ do {
+ DWORD exitCode;
+ if (!GetExitCodeProcess((HANDLE)bpipe->worker_pid, &exitCode)) {
+ const char *err = errorString();
+ rval = b_errno_win32;
+ d_msg(__FILE__, __LINE__, 0,
+ "GetExitCode error %s\n", err);
+ LocalFree((void *)err);
+ break;
+ }
- if (bpipe->timer_id) {
- stop_child_timer(bpipe->timer_id);
- }
- free((void *)bpipe);
- return rval;
+ if (exitCode == STILL_ACTIVE) {
+ bmicrosleep(1, 0); /* wait one second */
+ remaining_wait--;
+ } else if (exitCode != 0) {
+ rval = exitCode | b_errno_exit;
+ break;
+ } else {
+ break;
+ }
+ } while(remaining_wait);
+ rval = ETIME; /* timed out */ }
+
+ if (bpipe->timer_id) {
+ stop_child_timer(bpipe->timer_id);
+ }
+ free((void *)bpipe);
+ return rval;
}
int