#############################################################################
# Makefile for building: bat
-# Generated by qmake (2.01a) (Qt 4.2.1) on: Tue Mar 20 22:04:12 2007
+# Generated by qmake (2.01a) (Qt 4.2.1) on: Wed Mar 21 18:09:48 2007
# Project: bat.pro
# Template: app
# Command: /usr/bin/qmake -unix -o Makefile bat.pro
medialist/medialist.h \
ui/ui_medialist.h \
bat_conf.h \
- qstd.h
+ qstd.h \
+ mediaedit/mediaedit.h \
+ ui/ui_mediaedit.h \
+ joblist/joblist.h \
+ ui/ui_joblist.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/medialist.o medialist/medialist.cpp
obj/mediaedit.o: mediaedit/mediaedit.cpp bat.h \
this->hide();
scmd = QString("label volume=\"%1\" pool=\"%2\" storage=\"%3\" slot=%4\n")
.arg(volumeName->text()).arg(storageCombo->currentText())
- .arg(poolCombo->currentText()).arg(slotSpin->value());
+ .arg(poolCombo->currentText())
+ .arg(slotSpin->value());
m_console->write_dir(scmd.toUtf8().data());
m_console->displayToPrompt();
m_console->notify(true);
-/*
- * Block definitions for Bacula media data format.
- *
- * Kern Sibbald, MM
- *
- * Version $Id$
- *
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Block definitions for Bacula media data format.
+ *
+ * Kern Sibbald, MM
+ *
+ * Version $Id$
+ *
+ */
#ifndef __BLOCK_H
bool DEVICE::eod(DCR *dcr)
{
struct mtop mt_com;
- struct mtget mt_stat;
bool ok = true;
boffset_t pos;
+ int32_t os_file;
if (m_fd < 0) {
dev_errno = EBADF;
if (has_cap(CAP_FASTFSF) && !has_cap(CAP_EOM)) {
Dmsg0(100,"Using FAST FSF for EOM\n");
/* If unknown position, rewind */
- if (!dev_get_os_pos(this, &mt_stat)) {
+ if (get_os_tape_file() < 0) {
if (!rewind(NULL)) {
return false;
}
return false;
}
- if (!dev_get_os_pos(this, &mt_stat)) {
+ os_file = get_os_tape_file();
+ if (os_file < 0) {
berrno be;
clrerror(-1);
Mmsg2(errmsg, _("ioctl MTIOCGET error on %s. ERR=%s.\n"),
print_name(), be.strerror());
return false;
}
- Dmsg2(100, "EOD file=%d block=%d\n", mt_stat.mt_fileno, mt_stat.mt_blkno);
+ Dmsg1(100, "EOD file=%d\n", os_file);
set_ateof();
- file = mt_stat.mt_fileno;
+ file = os_file;
} else {
#else
{
* Avoid infinite loop by ensuring we advance.
*/
if (!at_eot() && file_num == (int)file) {
- struct mtget mt_stat;
Dmsg1(100, "fsf did not advance from file %d\n", file_num);
set_ateof();
- if (dev_get_os_pos(this, &mt_stat)) {
- Dmsg2(100, "Adjust file from %d to %d\n", file_num, mt_stat.mt_fileno);
- file = mt_stat.mt_fileno;
+ os_file = get_os_tape_file();
+ if (os_file >= 0) {
+ Dmsg2(100, "Adjust file from %d to %d\n", file_num, os_file);
+ file = os_file;
}
break;
}
* the second EOF.
*/
if (has_cap(CAP_BSFATEOM)) {
- struct mtget mt_stat;
/* Backup over EOF */
ok = bsf(1);
/* If BSF worked and fileno is known (not -1), set file */
- if (dev_get_os_pos(this, &mt_stat)) {
- Dmsg2(100, "BSFATEOF adjust file from %d to %d\n", file , mt_stat.mt_fileno);
- file = mt_stat.mt_fileno;
+ os_file = get_os_tape_file();
+ if (os_file >= 0) {
+ Dmsg2(100, "BSFATEOF adjust file from %d to %d\n", file , os_file);
+ file = os_file;
} else {
file++; /* wing it -- not correct on all OSes */
}
*/
bool DEVICE::fsf(int num)
{
- struct mtget mt_stat;
+ int32_t os_file;
struct mtop mt_com;
int stat = 0;
mt_com.mt_op = MTFSF;
mt_com.mt_count = num;
stat = tape_ioctl(m_fd, MTIOCTOP, (char *)&mt_com);
- if (stat < 0 || !dev_get_os_pos(this, &mt_stat)) {
+ if (stat < 0 || (os_file=get_os_tape_file()) < 0) {
berrno be;
set_eot();
Dmsg0(200, "Set ST_EOT\n");
Dmsg1(200, "%s", errmsg);
return false;
}
- Dmsg2(200, "fsf file=%d block=%d\n", mt_stat.mt_fileno, mt_stat.mt_blkno);
+ Dmsg1(200, "fsf file=%d\n", os_file);
set_ateof();
- file = mt_stat.mt_fileno;
+ file = os_file;
return true;
/*
void DEVICE::clrerror(int func)
{
const char *msg = NULL;
- struct mtget mt_stat;
char buf[100];
dev_errno = errno; /* save errno */
*/
/* On some systems such as NetBSD, this clears all errors */
- tape_ioctl(m_fd, MTIOCGET, (char *)&mt_stat);
+ get_os_tape_file();
/* Found on Linux */
#ifdef MTIOCLRERR
return device->hdr.name;
}
+/* Returns file position on tape or -1 */
+int32_t DEVICE::get_os_tape_file()
+{
+ struct mtget mt_stat;
+
+ if (has_cap(CAP_MTIOCGET) &&
+ tape_ioctl(m_fd, MTIOCGET, (char *)&mt_stat) == 0) {
+ return mt_stat.mt_fileno;
+ }
+ return -1;
+}
+
char *
dev_vol_name(DEVICE *dev)
{
bool weof(int num); /* in dev.c */
void lock_door(); /* in dev.c */
void unlock_door(); /* in dev.c */
+ int32_t get_os_tape_file(); /* in dev.c */
bool scan_dir_for_volume(DCR *dcr); /* in scan.c */
bool reposition(DCR *dcr, uint32_t rfile, uint32_t rblock); /* in dev.c */
void clrerror(int func); /* in dev.c */
-/*
- *
- * Routines for handling mounting tapes for reading and for
- * writing.
- *
- * Kern Sibbald, August MMII
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ *
+ * Routines for handling mounting tapes for reading and for
+ * writing.
+ *
+ * Kern Sibbald, August MMII
+ *
+ * Version $Id$
+ */
#include "bacula.h" /* pull in global headers */
#include "stored.h" /* pull in Storage Deamon headers */
" part=%d size=%s\n"), dcr->VolumeName,
dev->part, edit_uint64(dev->VolCatInfo.VolCatBytes,ed1));
} else {
- Jmsg(jcr, M_ERROR, 0, _("I cannot write on Volume \"%s\" because: "
+ Jmsg(jcr, M_ERROR, 0, _("I cannot write on DVD Volume \"%s\" because: "
"The sizes do not match! Volume=%s Catalog=%s\n"),
dcr->VolumeName,
edit_uint64(dev->part_start + dev->part_size, ed1),
mark_volume_in_error(dcr);
goto mount_next_vol;
}
- }
- /* *****FIXME**** we should do some checking for files too */
- if (dev->is_tape()) {
+ } else if (dev->is_tape()) {
/*
* Check if we are positioned on the tape at the same place
* that the database says we should be.
Jmsg(jcr, M_INFO, 0, _("Ready to append to end of Volume \"%s\" at file=%d.\n"),
dcr->VolumeName, dev->get_file());
} else {
- Jmsg(jcr, M_ERROR, 0, _("I cannot write on Volume \"%s\" because:\n"
+ Jmsg(jcr, M_ERROR, 0, _("I cannot write on tape Volume \"%s\" because:\n"
"The number of files mismatch! Volume=%u Catalog=%u\n"),
dcr->VolumeName, dev->get_file(), dev->VolCatInfo.VolCatFiles);
mark_volume_in_error(dcr);
goto mount_next_vol;
}
+ } else if (dev->is_file()) {
+ char ed1[50], ed2[50];
+ boffset_t pos;
+ pos = dev->lseek(dcr, (boffset_t)0, SEEK_END);
+ if (dev->VolCatInfo.VolCatBytes == (uint64_t)pos) {
+ Jmsg(jcr, M_INFO, 0, _("Ready to append to end of Volume \"%s\""
+ " size=%s\n"), dcr->VolumeName,
+ edit_uint64(dev->VolCatInfo.VolCatBytes, ed1));
+ } else {
+ Jmsg(jcr, M_ERROR, 0, _("I cannot write on disk Volume \"%s\" because: "
+ "The sizes do not match! Volume=%s Catalog=%s\n"),
+ dcr->VolumeName,
+ edit_uint64(pos, ed1),
+ edit_uint64(dev->VolCatInfo.VolCatBytes, ed2));
+ mark_volume_in_error(dcr);
+ goto mount_next_vol;
+ }
}
dev->VolCatInfo.VolCatMounts++; /* Update mounts */
Dmsg1(150, "update volinfo mounts=%d\n", dev->VolCatInfo.VolCatMounts);
Technical notes on version 2.1
General:
+21Mar07
+kes Implement SD code to check length of disk volume before appending.
18Mar07
kes Correct return status on db_batch... routines.
kes Add call to db_write_batch_file_records() to migration code.