* Version $Id$
*/
/*
- Copyright (C) 2000-2003 Kern Sibbald and John Walker
+ Copyright (C) 2000-2004 Kern Sibbald and John Walker
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
static char *rec_state_to_str(DEV_RECORD *rec);
#endif
-int read_records(JCR *jcr, DEVICE *dev,
- int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec),
- int mount_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block))
+bool read_records(DCR *dcr,
+ bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec),
+ bool mount_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block))
{
+ JCR *jcr = dcr->jcr;
+ DEVICE *dev = dcr->dev;
DEV_BLOCK *block;
DEV_RECORD *rec = NULL;
uint32_t record;
- int ok = TRUE;
+ bool ok = true;
bool done = false;
SESSION_LABEL sessrec;
dlist *recs; /* linked list of rec packets open */
block = new_block(dev);
- recs = new dlist(rec, &rec->link);
+ recs = New(dlist(rec, &rec->link));
position_to_first_file(jcr, dev);
for ( ; ok && !done; ) {
if (job_canceled(jcr)) {
- ok = FALSE;
+ ok = false;
break;
}
- if (!read_block_from_device(jcr, dev, block, CHECK_BLOCK_NUMBERS)) {
+ if (!read_block_from_device(dcr, block, CHECK_BLOCK_NUMBERS)) {
if (dev_state(dev, ST_EOT)) {
DEV_RECORD *trec = new_record();
dev->file, dev_name(dev), jcr->VolumeName);
if (!mount_cb(jcr, dev, block)) {
Jmsg(jcr, M_INFO, 0, "End of all volumes.\n");
- ok = FALSE;
+ ok = false;
/*
* Create EOT Label so that Media record may
* be properly updated because this is the last
* and pass it off to the callback routine, then continue
* most likely reading the previous record.
*/
- read_block_from_device(jcr, dev, block, NO_BLOCK_NUMBER_CHECK);
+ read_block_from_device(dcr, block, NO_BLOCK_NUMBER_CHECK);
read_record_from_block(block, trec);
handle_session_record(dev, trec, &sessrec);
ok = record_cb(jcr, dev, block, trec);
Dmsg0(000, "Did fsr\n");
continue; /* try to continue */
}
- ok = FALSE;
+ ok = false;
break;
}
}
static void handle_session_record(DEVICE *dev, DEV_RECORD *rec, SESSION_LABEL *sessrec)
{
- char *rtype;
+ const char *rtype;
char buf[100];
+
memset(sessrec, 0, sizeof(sessrec));
switch (rec->FileIndex) {
case PRE_LABEL: