- Implement a few more methods for the DEVICE class in SD.
- Add latex directories to make clean
- move DEV_BSIZE to B_DEV_BSIZE to avoid conflicts with
certain header files (FreeBSD).
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1845
91ce42f0-d328-0410-95d8-
f526ca767f89
chmod 755 make_catalog_backup delete_catalog_backup)
clean:
chmod 755 make_catalog_backup delete_catalog_backup)
clean:
- @for I in ${all_subdirs}; \
+ @for I in ${all_subdirs} doc/latex doc/latex-fr; \
do (cd $$I; echo "==>Entering directory `pwd`"; ${MAKE} $@ || exit 1); done
@(cd platforms; echo "==>Entering directory `pwd`"; ${MAKE} $@ || exit 1)
@$(RMF) *~ 1 2 3 core core.* config.guess console.log console.sum
do (cd $$I; echo "==>Entering directory `pwd`"; ${MAKE} $@ || exit 1); done
@(cd platforms; echo "==>Entering directory `pwd`"; ${MAKE} $@ || exit 1)
@$(RMF) *~ 1 2 3 core core.* config.guess console.log console.sum
# clean for distribution
distclean:
# clean for distribution
distclean:
- @for I in $(all_subdirs); do (cd $$I; $(MAKE) $@ || exit 1); done
+ @for I in $(all_subdirs) doc/latex doc/latex-fr; do (cd $$I; $(MAKE) $@ || exit 1); done
@for I in $(all_subdirs); do (cd $$I; $(RMF) startit stopit btraceback); done
@(cd $(srcdir); $(RMF) *~ config.cache config.h config.log config.status config.out)
@(cd $(srcdir); $(RMF) Makefile autoconf/Make.common)
@for I in $(all_subdirs); do (cd $$I; $(RMF) startit stopit btraceback); done
@(cd $(srcdir); $(RMF) *~ config.cache config.h config.log config.status config.out)
@(cd $(srcdir); $(RMF) Makefile autoconf/Make.common)
@$(RMF) -r CVS src/gnome-console/CVS src/tconsole/CVS
devclean:
@$(RMF) -r CVS src/gnome-console/CVS src/tconsole/CVS
devclean:
- @for I in $(all_subdirs); do (cd $$I; $(MAKE) $@ || exit 1); done
+ @for I in $(all_subdirs) doc/latex doc/latex-fr; do (cd $$I; $(MAKE) $@ || exit 1); done
@for I in $(all_subdirs); do (cd $$I; $(RMF) startit stopit btraceback); done
@(cd $(srcdir); $(RMF) *~ config.cache config.h config.log config.status config.out)
@(cd $(srcdir); $(RMF) Makefile autoconf/Make.common)
@for I in $(all_subdirs); do (cd $$I; $(RMF) startit stopit btraceback); done
@(cd $(srcdir); $(RMF) *~ config.cache config.h config.log config.status config.out)
@(cd $(srcdir); $(RMF) Makefile autoconf/Make.common)
/* All tape operations MUST be a multiple of this */
#define TAPE_BSIZE 1024
/* All tape operations MUST be a multiple of this */
#define TAPE_BSIZE 1024
-#if !defined(DEV_BSIZE) && defined(BSIZE)
-#define DEV_BSIZE BSIZE
+
+#ifdef DEV_BSIZE
+#define B_DEV_BSIZE DEV_BSIZE
+#endif
+
+#if !defined(B_DEV_BSIZE) & defined(BSIZE)
+#define B_DEV_BSIZE BSIZE
-#ifndef DEV_BSIZE
-#define DEV_BSIZE 512
+#ifndef B_DEV_BSIZE
+#define B_DEV_BSIZE 512
#include <netinet/in.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <stdlib.h>
if (tlog <= 0) {
berrno be;
char curbuf[256];
if (tlog <= 0) {
berrno be;
char curbuf[256];
- Emsg3(M_ABORT, 0, _("Cannot open stream socket. ERR=%s. Current %s All %s\n"),
+ Emsg3(M_ABORT, 0, _("Cannot open stream socket. ERR=%s. Current %s All %s\n"),
be.strerror(),
p->build_address_str(curbuf, sizeof(curbuf)),
build_addresses_str(addrs, allbuf, sizeof(allbuf)));
be.strerror(),
p->build_address_str(curbuf, sizeof(curbuf)),
build_addresses_str(addrs, allbuf, sizeof(allbuf)));
if (setsockopt(fd_ptr->fd, SOL_SOCKET, SO_REUSEADDR, (sockopt_val_t)&turnon,
sizeof(turnon)) < 0) {
berrno be;
if (setsockopt(fd_ptr->fd, SOL_SOCKET, SO_REUSEADDR, (sockopt_val_t)&turnon,
sizeof(turnon)) < 0) {
berrno be;
- Emsg1(M_WARNING, 0, _("Cannot set SO_REUSEADDR on socket: %s\n"),
+ Emsg1(M_WARNING, 0, _("Cannot set SO_REUSEADDR on socket: %s\n"),
berrno be;
if (tlog <= 0) {
tlog = 2 * 60; /* Complain every 2 minutes */
berrno be;
if (tlog <= 0) {
tlog = 2 * 60; /* Complain every 2 minutes */
- Emsg2(M_WARNING, 0, _("Cannot bind port %d: ERR=%s. Retrying ...\n"),
+ Emsg2(M_WARNING, 0, _("Cannot bind port %d: ERR=%s. Retrying ...\n"),
ntohs(fd_ptr->port), be.strerror());
}
bmicrosleep(5, 0);
if (--tmax <= 0) {
ntohs(fd_ptr->port), be.strerror());
}
bmicrosleep(5, 0);
if (--tmax <= 0) {
- Emsg2(M_ABORT, 0, _("Cannot bind port %d: ERR=%s.\n"), ntohs(fd_ptr->port),
+ Emsg2(M_ABORT, 0, _("Cannot bind port %d: ERR=%s.\n"), ntohs(fd_ptr->port),
close(fd_ptr->fd);
free((void *)fd_ptr);
}
close(fd_ptr->fd);
free((void *)fd_ptr);
}
- Emsg1(M_FATAL, 0, _("Error in select: %s\n"), be.strerror());
+ Emsg1(M_FATAL, 0, _("Error in select: %s\n"), be.strerror());
if (setsockopt(newsockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t)&turnon,
sizeof(turnon)) < 0) {
berrno be;
if (setsockopt(newsockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t)&turnon,
sizeof(turnon)) < 0) {
berrno be;
- Emsg1(M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n"),
+ Emsg1(M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n"),
sockaddr_to_ascii(&cli_addr, buf, sizeof(buf));
V(mutex);
BSOCK *bs;
sockaddr_to_ascii(&cli_addr, buf, sizeof(buf));
V(mutex);
BSOCK *bs;
- bs = init_bsock(NULL, newsockfd, "client", buf, fd_ptr->port, &cli_addr);
+ bs = init_bsock(NULL, newsockfd, "client", buf, fd_ptr->port, &cli_addr);
- Jmsg0(NULL, M_ABORT, 0, _("Could not create client BSOCK.\n"));
+ Jmsg0(NULL, M_ABORT, 0, _("Could not create client BSOCK.\n"));
}
/* Queue client to be served */
if ((stat = workq_add(client_wq, (void *)bs, NULL, 0)) != 0) {
berrno be;
be.set_errno(stat);
}
/* Queue client to be served */
if ((stat = workq_add(client_wq, (void *)bs, NULL, 0)) != 0) {
berrno be;
be.set_errno(stat);
- Jmsg1(NULL, M_ABORT, 0, _("Could not add job to client queue: ERR=%s\n"),
+ Jmsg1(NULL, M_ABORT, 0, _("Could not add job to client queue: ERR=%s\n"),
}
if (tlog <= 0) {
tlog = 2 * 60;
}
if (tlog <= 0) {
tlog = 2 * 60;
- Emsg1(M_ERROR, 0, _("Cannot open stream socket: %s\n"), strerror(errno));
+ Emsg1(M_ERROR, 0, _("Cannot open stream socket: %s\n"), strerror(errno));
}
if (tlog <= 0) {
tlog = 2 * 60;
}
if (tlog <= 0) {
tlog = 2 * 60;
- Emsg2(M_WARNING, 0, _("Cannot bind port %d: ERR=%s: retrying ...\n"), port,
+ Emsg2(M_WARNING, 0, _("Cannot bind port %d: ERR=%s: retrying ...\n"), port,
be.strerror());
}
bmicrosleep(5, 0);
be.strerror());
}
bmicrosleep(5, 0);
- Emsg1(M_FATAL, 0, _("Error in select: %s\n"), strerror(errno));
+ Emsg1(M_FATAL, 0, _("Error in select: %s\n"), strerror(errno));
return NULL;
} else {
if (caller == NULL) {
return NULL;
} else {
if (caller == NULL) {
}
len = strlen(caller) + strlen(who) + 3;
buf = (char *)malloc(len);
}
len = strlen(caller) + strlen(who) + 3;
buf = (char *)malloc(len);
if (dcr->reserved_device) {
lock_device(dev);
dev->num_writers--;
if (dcr->reserved_device) {
lock_device(dev);
dev->num_writers--;
+ if (dev->num_writers < 0) {
+ Jmsg1(dcr->jcr, M_ERROR, 0, _("Hey! num_writers=%d!!!!\n"), dev->num_writers);
+ dev->num_writers = 0;
+ dcr->reserved_device = false;
+ }
block_device(dev, BST_DOING_ACQUIRE);
unlock_device(dev);
block_device(dev, BST_DOING_ACQUIRE);
unlock_device(dev);
- if (dev->can_read() || dev->num_writers > 0) {
Jmsg2(jcr, M_FATAL, 0, _("Device %s is busy. Job %d canceled.\n"),
dev_name(dev), jcr->JobId);
goto get_out;
Jmsg2(jcr, M_FATAL, 0, _("Device %s is busy. Job %d canceled.\n"),
dev_name(dev), jcr->JobId);
goto get_out;
if (!dcr) {
dcr = new_dcr(jcr, dev);
}
if (!dcr) {
dcr = new_dcr(jcr, dev);
}
- dev->state &= ~ST_APPEND; /* clear any previous append mode */
- dev->state |= ST_READ; /* set read mode */
+ dev->clear_append();
+ dev->set_read();
dev->is_labeled();
tape_initially_mounted = tape_previously_mounted;
dev->is_labeled();
tape_initially_mounted = tape_previously_mounted;
+ if (dev->num_writers > 0) {
+ Jmsg2(jcr, M_FATAL, 0, _("Num_writers=%d not zero. Job %d canceled.\n"),
+ dev->num_writers, jcr->JobId);
+ goto get_out;
+ }
+
/* Find next Volume, if any */
vol = jcr->VolList;
if (!vol) {
/* Find next Volume, if any */
vol = jcr->VolList;
if (!vol) {
dev->num_parts = dcr->VolCatInfo.VolCatParts;
for (i=0; i<5; i++) {
dev->num_parts = dcr->VolCatInfo.VolCatParts;
for (i=0; i<5; i++) {
- dev->state &= ~ST_LABEL; /* force reread of label */
+ dev->clear_label(); /* force reread of label */
if (job_canceled(jcr)) {
Mmsg1(dev->errmsg, _("Job %d canceled.\n"), jcr->JobId);
goto get_out; /* error return */
if (job_canceled(jcr)) {
Mmsg1(dev->errmsg, _("Job %d canceled.\n"), jcr->JobId);
goto get_out; /* error return */
- dev->state &= ~ST_APPEND; /* clear any previous append mode */
- dev->num_writers = 0;
- dev->state |= ST_READ; /* set read mode */
+ dev->clear_append();
+ dev->set_read();
set_jcr_job_status(jcr, JS_Running);
dir_send_job_status(jcr);
Jmsg(jcr, M_INFO, 0, _("Ready to read from volume \"%s\" on device %s.\n"),
set_jcr_job_status(jcr, JS_Running);
dir_send_job_status(jcr);
Jmsg(jcr, M_INFO, 0, _("Ready to read from volume \"%s\" on device %s.\n"),
goto get_out;
}
Dmsg1(190, "reserve_append device is %s\n", dev_is_tape(dev)?"tape":"disk");
goto get_out;
}
Dmsg1(190, "reserve_append device is %s\n", dev_is_tape(dev)?"tape":"disk");
- if (dev->can_append() || dev->num_writers > 0) {
+ if (dev->can_append() || dev->num_writers > 0 || dev->reserved_device) {
Dmsg0(190, "device already in append.\n");
/*
Dmsg0(190, "device already in append.\n");
/*
- * Device already in append mode
+ * Device already in append mode or reserved for write
*
* Check if we have the right Volume mounted
* OK if current volume info OK
*
* Check if we have the right Volume mounted
* OK if current volume info OK
+ dev->num_writers++; /* we are now a writer */
if (jcr->NumVolumes == 0) {
jcr->NumVolumes = 1;
}
if (jcr->NumVolumes == 0) {
jcr->NumVolumes = 1;
}
DEVICE *dev = dcr->dev;
lock_device(dev);
Dmsg1(100, "release_device device is %s\n", dev_is_tape(dev)?"tape":"disk");
DEVICE *dev = dcr->dev;
lock_device(dev);
Dmsg1(100, "release_device device is %s\n", dev_is_tape(dev)?"tape":"disk");
- if (dev_state(dev, ST_READ)) {
- dev->state &= ~ST_READ; /* clear read bit */
+
+ /* if device is reserved, job never started, so release the reserve here */
+ if (dcr->reserved_device) {
+ dev->reserved_device--;
+ dcr->reserved_device = false;
+ }
+
+ if (dev->can_read()) {
+ dev->clear_read(); /* clear read bit */
if (!dev_is_tape(dev) || !dev_cap(dev, CAP_ALWAYSOPEN)) {
offline_or_rewind_dev(dev);
close_dev(dev);
if (!dev_is_tape(dev) || !dev_cap(dev, CAP_ALWAYSOPEN)) {
offline_or_rewind_dev(dev);
close_dev(dev);
dir_update_volume_info(dcr, false); /* send Volume info to Director */
}
dir_update_volume_info(dcr, false); /* send Volume info to Director */
}
- if (!dev->num_writers && (!dev->is_tape() || !dev_cap(dev, CAP_ALWAYSOPEN))) {
+ if (dev->num_writers == 0 && dev->is_tape() && !dev_cap(dev, CAP_ALWAYSOPEN)) {
offline_or_rewind_dev(dev);
close_dev(dev);
}
offline_or_rewind_dev(dev);
close_dev(dev);
}
if (!write_block_to_device(dcr)) {
Dmsg2(90, "Got write_block_to_dev error on device %s. %s\n",
dev_name(dev), strerror_dev(dev));
if (!write_block_to_device(dcr)) {
Dmsg2(90, "Got write_block_to_dev error on device %s. %s\n",
dev_name(dev), strerror_dev(dev));
- Jmsg(jcr, M_FATAL, 0, _("Fatal device error: ERR=%s\n"),
- strerror_dev(dev));
+ Jmsg2(jcr, M_FATAL, 0, _("Fatal append error on device %s: ERR=%s\n"),
+ dev_name(dev), strerror_dev(dev));
if (weof_dev(dev, 1) != 0) { /* write eof */
Dmsg0(190, "WEOF error in max file size.\n");
if (weof_dev(dev, 1) != 0) { /* write eof */
Dmsg0(190, "WEOF error in max file size.\n");
+ Jmsg(jcr, M_FATAL, 0, _("Unable to write EOF. ERR=%s\n"),
+ strerror_dev(dev));
terminate_writing_volume(dcr);
dev->dev_errno = ENOSPC;
return false;
}
if (!do_new_file_bookkeeping(dcr)) {
terminate_writing_volume(dcr);
dev->dev_errno = ENOSPC;
return false;
}
if (!do_new_file_bookkeeping(dcr)) {
+ /* Error message already sent */
return false;
}
}
if (!do_dvd_size_checks(dcr)) {
return false;
}
}
if (!do_dvd_size_checks(dcr)) {
+ /* Error message already sent */
char buf[1000];
/* Sanity checks */
char buf[1000];
/* Sanity checks */
- if (TAPE_BSIZE % DEV_BSIZE != 0 || TAPE_BSIZE / DEV_BSIZE == 0) {
+ if (TAPE_BSIZE % B_DEV_BSIZE != 0 || TAPE_BSIZE / B_DEV_BSIZE == 0) {
Emsg2(M_ABORT, 0, "Tape block size (%d) not multiple of system size (%d)\n",
Emsg2(M_ABORT, 0, "Tape block size (%d) not multiple of system size (%d)\n",
- TAPE_BSIZE, DEV_BSIZE);
+ TAPE_BSIZE, B_DEV_BSIZE);
}
if (TAPE_BSIZE != (1 << (ffs(TAPE_BSIZE)-1))) {
Emsg1(M_ABORT, 0, "Tape block size (%d) is not a power of 2\n", TAPE_BSIZE);
}
if (TAPE_BSIZE != (1 << (ffs(TAPE_BSIZE)-1))) {
Emsg1(M_ABORT, 0, "Tape block size (%d) is not a power of 2\n", TAPE_BSIZE);
const char *archive_name() const;
void set_eof();
void set_eot();
const char *archive_name() const;
void set_eof();
void set_eot();
+ void set_append();
+ void set_read();
+ void clear_append();
+ void clear_read();
+ void clear_label();
};
/* Note, these return int not bool! */
};
/* Note, these return int not bool! */
inline int DEVICE::at_eot() const { return state & ST_EOT; }
inline int DEVICE::can_append() const { return state & ST_APPEND; }
inline int DEVICE::can_read() const { return state & ST_READ; }
inline int DEVICE::at_eot() const { return state & ST_EOT; }
inline int DEVICE::can_append() const { return state & ST_APPEND; }
inline int DEVICE::can_read() const { return state & ST_READ; }
+inline void DEVICE::set_append() { state |= ST_APPEND; }
+inline void DEVICE::set_read() { state |= ST_READ; }
+inline void DEVICE::clear_append() { state &= ~ST_APPEND; }
+inline void DEVICE::clear_read() { state &= ~ST_READ; }
+inline void DEVICE::clear_label() { state &= ~ST_LABEL; }
inline const char *DEVICE::strerror() const { return errmsg; }
inline const char *DEVICE::archive_name() const { return dev_name; }
inline const char *DEVICE::strerror() const { return errmsg; }
inline const char *DEVICE::archive_name() const { return dev_name; }
daemon_start_time = time(NULL);
/* Sanity checks */
daemon_start_time = time(NULL);
/* Sanity checks */
- if (TAPE_BSIZE % DEV_BSIZE != 0 || TAPE_BSIZE / DEV_BSIZE == 0) {
+ if (TAPE_BSIZE % B_DEV_BSIZE != 0 || TAPE_BSIZE / B_DEV_BSIZE == 0) {
Emsg2(M_ABORT, 0, "Tape block size (%d) not multiple of system size (%d)\n",
Emsg2(M_ABORT, 0, "Tape block size (%d) not multiple of system size (%d)\n",
- TAPE_BSIZE, DEV_BSIZE);
+ TAPE_BSIZE, B_DEV_BSIZE);
}
if (TAPE_BSIZE != (1 << (ffs(TAPE_BSIZE)-1))) {
Emsg1(M_ABORT, 0, "Tape block size (%d) is not a power of 2\n", TAPE_BSIZE);
}
if (TAPE_BSIZE != (1 << (ffs(TAPE_BSIZE)-1))) {
Emsg1(M_ABORT, 0, "Tape block size (%d) is not a power of 2\n", TAPE_BSIZE);
/* */
#undef VERSION
#define VERSION "1.37.4"
/* */
#undef VERSION
#define VERSION "1.37.4"
-#define BDATE "24 February 2005"
-#define LSMDATE "24Feb05"
+#define BDATE "26 February 2005"
+#define LSMDATE "26Feb05"
/* Debug flags */
#undef DEBUG
/* Debug flags */
#undef DEBUG