+2003-07-12 Version 1.31 Beta 14Jul03
+- Marc Brueckner reported a crash during restore (a missing tree->)
+- Moved host.h.in file from filed to src.
+- Update btraceback to include host os, distname, distver in output.
+- Split list (in lib) into alist and dlist both with .h and .c.
+- Update home page to include Project status page.
+
2003-07-12 Version 1.31 Beta 10Jul03
- Manual updates.
- Clean up some unused variables detected by the IRIX compiler.
#undef HAVE_OLD_SOCKOPT
#undef HAVE_BIGENDIAN
+
scripts/mtx-changer \
doc/Makefile \
src/Makefile \
+ src/host.h \
src/console/Makefile \
src/console/console.conf \
src/gnome-console/Makefile \
src/stored/Makefile \
src/stored/bacula-sd.conf \
src/filed/Makefile \
- src/filed/host.h \
src/filed/bacula-fd.conf \
src/filed/win32/Makefile \
src/cats/Makefile \
scripts/mtx-changer \
doc/Makefile \
src/Makefile \
+ src/host.h \
src/console/Makefile \
src/console/console.conf \
src/gnome-console/Makefile \
src/stored/Makefile \
src/stored/bacula-sd.conf \
src/filed/Makefile \
- src/filed/host.h \
src/filed/bacula-fd.conf \
src/filed/win32/Makefile \
src/cats/Makefile \
scripts/mtx-changer \
doc/Makefile \
src/Makefile \
+ src/host.h \
src/console/Makefile \
src/console/console.conf \
src/gnome-console/Makefile \
src/stored/Makefile \
src/stored/bacula-sd.conf \
src/filed/Makefile \
- src/filed/host.h \
src/filed/bacula-fd.conf \
src/filed/win32/Makefile \
src/cats/Makefile \
Kern's ToDo List
- 10 July 2003
+ 14 July 2003
Documentation to do: (any release a little bit at a time)
- Document running a test version.
- Document need to add "-u root" to most of MySQL script calls
(./create_mys... ./make_my...).
- Document all the status codes JobLevel, JobType, JobStatus.
+- Document dynamic DNS
Testing to do: (painful)
For 1.32:
-- Figure out how to handle DHCP IP addresses.
+- Implement a Recycle or Prune Current Volume (as from Nic Bellamy),
+ possibly implement Prune Oldest Volume.
- Allow multiple Storage specifications (or multiple names on
a single Storage specification) in the Job record. Thus a job
can be backed up to a number of storage devices.
- Document update volume: jobid, current, before, all
- Document that bscan does not work with multiple simultaneous jobs.
- Update Automatic Volume Labeling in disk.wml
+- Figure out how to handle DHCP IP addresses -- use dynamic DNS.
+- Add OS, GCC version to traceback output.
+
print exepath
print catalog_db
print version
+print host_os
+print distname
+print distver
bt
thread apply all bt
f 0
Makefile
config.h
testprogs
+host.h
distclean: realclean
if test $(srcdir) = .; then $(MAKE) realclean; fi
@(cd $(srcdir); $(RMF) Makefile)
- @$(RMF) config.h
+ @$(RMF) config.h host.h
@$(RMF) -r CVS
install:
#define _BACULA_H 1
#include "config.h"
+#include "host.h"
#define _REENTRANT 1
#define _THREAD_SAFE 1
{
char cwd[2000];
/* Get a new context so we don't destroy restore command args */
- UAContext *ua = new_ua_context(ua->jcr);
+ UAContext *ua = new_ua_context(tree->ua->jcr);
ua->UA_sock = tree->ua->UA_sock; /* patch in UA socket */
bsendmsg(tree->ua, _(
#include "bacula.h"
#include "filed.h"
-#include "host.h"
extern char my_name[];
extern CLIENT *me; /* our client resource */
static char OKrestore[] = "2000 OK restore\n";
static char OKsession[] = "2000 OK session\n";
static char OKstore[] = "2000 OK storage\n";
-static char OKjob[] = "2000 OK Job " FDHOST "," DISTNAME "," DISTVER;
+static char OKjob[] = "2000 OK Job " HOST_OS "," DISTNAME "," DISTVER;
static char OKsetdebug[] = "2000 OK setdebug=%d\n";
static char BADjob[] = "2901 Bad Job\n";
static char EndJob[] = "2800 End Job TermCode=%d JobFiles=%u ReadBytes=%s JobBytes=%s Errors=%u\n";
--- /dev/null
+/*
+ * Define Host machine
+ *
+ * Version $Id$
+ *
+ */
+/*
+ Copyright (C) 2000, 2001, 2002 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
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ */
+
+#define HOST_OS "@host@"
+#define DISTNAME "@DISTNAME@"
+#define DISTVER "@DISTVER@"
bnet.c bnet_server.c \
bpipe.c bshm.c btime.c \
cram-md5.c crc32.c daemon.c edit.c fnmatch.c \
- hmac.c idcache.c jcr.c lex.c list.c \
+ hmac.c idcache.c jcr.c lex.c alist.c dlist.c \
md5.c message.c mem_pool.c parse_conf.c \
queue.c rwlock.c scan.c serial.c sha1.c \
semlock.c signal.c smartall.c tree.c \
bnet.o bnet_server.o \
bpipe.o bshm.o btime.o \
cram-md5.o crc32.o daemon.o edit.o fnmatch.o \
- hmac.o idcache.o jcr.o lex.o list.o \
+ hmac.o idcache.o jcr.o lex.o alist.o dlist.o \
md5.o message.o mem_pool.o parse_conf.o \
queue.o rwlock.o scan.o serial.o sha1.o \
semlock.o signal.o smartall.o tree.o \
--- /dev/null
+/*
+ * Bacula array list routines
+ *
+ * alist is a simple malloc'ed array of pointers. For the moment,
+ * it simply malloc's a bigger array controlled by num_grow.
+ * Default is to realloc the pointer array for each new member.
+ *
+ * Kern Sibbald, June MMIII
+ *
+ * Version $Id$
+ *
+ */
+/*
+ Copyright (C) 2000-2003 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
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ */
+
+#include "bacula.h"
+
+/*
+ * Append an item to the list
+ */
+void alist::append(void *item) {
+ if (num_items == 0) {
+ if (num_grow == 0) {
+ num_grow = 1; /* default if not initialized */
+ }
+ items = (void **)malloc(num_grow * sizeof(void *));
+ max_items = num_grow;
+ } else if (num_items == max_items) {
+ max_items += num_grow;
+ items = (void **)realloc(items, max_items * sizeof(void *));
+ }
+ items[num_items++] = item;
+}
+
+/* Get the index item -- we should probably allow real indexing here */
+void * alist::get(int index)
+{
+ if (index < 0 || index >= num_items) {
+ return NULL;
+ }
+ return items[index];
+}
+
+/* Destroy the list and its contents */
+void alist::destroy()
+{
+ if (items) {
+ for (int i=0; i<num_items; i++) {
+ free(items[i]);
+ }
+ free(items);
+ }
+}
+
+#ifdef TEST_PROGRAM
+
+
+struct FILESET {
+ alist mylist;
+};
+
+int main()
+{
+ FILESET *fileset;
+ char buf[30];
+ alist *mlist;
+
+ fileset = (FILESET *)malloc(sizeof(FILESET));
+ memset(fileset, 0, sizeof(FILESET));
+ fileset->mylist.init();
+
+ printf("Manual allocation/destruction of list:\n");
+
+ for (int i=0; i<20; i++) {
+ sprintf(buf, "This is item %d", i);
+ fileset->mylist.append(bstrdup(buf));
+ }
+ for (int i=0; i<fileset->mylist.size(); i++) {
+ printf("Item %d = %s\n", i, (char *)fileset->mylist[i]);
+ }
+ fileset->mylist.destroy();
+ free(fileset);
+
+ printf("Allocation/destruction using new delete\n");
+ mlist = new alist(10);
+
+ for (int i=0; i<20; i++) {
+ sprintf(buf, "This is item %d", i);
+ mlist->append(bstrdup(buf));
+ }
+ for (int i=0; i<mlist->size(); i++) {
+ printf("Item %d = %s\n", i, (char *)mlist->get(i));
+ }
+
+ delete mlist;
+
+
+ sm_dump(False);
+
+}
+#endif
--- /dev/null
+/*
+ * Version $Id$
+ */
+
+/*
+ Copyright (C) 2000-2003 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
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ */
+
+/*
+ * Array list -- much like a simplified STL vector
+ * array of pointers to inserted items
+ */
+class alist {
+ void **items;
+ int num_items;
+ int max_items;
+ int num_grow;
+public:
+ alist(int num = 1);
+ void init(int num = 1);
+ void append(void *item);
+ void *get(int index);
+ void * operator [](int index) const;
+ int size();
+ void destroy();
+ void grow(int num);
+ void * operator new(size_t);
+ void operator delete(void *);
+};
+
+inline void * alist::operator [](int index) const {
+ if (index < 0 || index >= num_items) {
+ return NULL;
+ }
+ return items[index];
+}
+
+/*
+ * This allows us to do explicit initialization,
+ * allowing us to mix C++ classes inside malloc'ed
+ * C structures. Define before called in constructor.
+ */
+inline void alist::init(int num) {
+ items = NULL;
+ num_items = 0;
+ max_items = 0;
+ num_grow = num;
+}
+
+/* Constructor */
+inline alist::alist(int num) {
+ this->init(num);
+}
+
+
+
+/* Current size of list */
+inline int alist::size()
+{
+ return num_items;
+}
+
+/* How much to grow by each time */
+inline void alist::grow(int num)
+{
+ num_grow = num;
+}
+
+inline void * alist::operator new(size_t)
+{
+ return malloc(sizeof(alist));
+}
+
+inline void alist::operator delete(void *item)
+{
+ ((alist *)item)->destroy();
+ free(item);
+}
--- /dev/null
+/*
+ * Bacula doubly linked list routines.
+ *
+ * dlist is a doubly linked list with the links being in the
+ * list data item.
+ *
+ * Kern Sibbald, July MMIII
+ *
+ * Version $Id$
+ *
+ */
+/*
+ Copyright (C) 2000-2003 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
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ */
+
+#include "bacula.h"
+
+/* ===================================================================
+ * dlist
+ */
+/*
+ * Append an item to the list
+ */
+void dlist::append(void *item)
+{
+ ((dlink *)((char *)item+loffset))->next = NULL;
+ ((dlink *)((char *)item+loffset))->prev = tail;
+ if (tail) {
+ ((dlink *)((char *)tail+loffset))->next = item;
+ }
+ tail = item;
+ if (head == NULL) { /* if empty list, */
+ head = item; /* item is head as well */
+ }
+}
+
+/*
+ * Append an item to the list
+ */
+void dlist::prepend(void *item)
+{
+ ((dlink *)((char *)item+loffset))->next = head;
+ ((dlink *)((char *)item+loffset))->prev = NULL;
+ if (head) {
+ ((dlink *)((char *)head+loffset))->prev = item;
+ }
+ head = item;
+ if (tail == NULL) { /* if empty list, */
+ tail = item; /* item is tail too */
+ }
+}
+
+void dlist::remove(void *item)
+{
+ void *xitem;
+ dlink *ilink = (dlink *)((char *)item+loffset); /* item's link */
+ if (item == head) {
+ head = ilink->next;
+ ((dlink *)((char *)head+loffset))->prev = NULL;
+ } else if (item == tail) {
+ tail = ilink->prev;
+ ((dlink *)((char *)tail+loffset))->next = NULL;
+ } else {
+ xitem = ilink->next;
+ ((dlink *)((char *)xitem+loffset))->prev = ilink->prev;
+ xitem = ilink->prev;
+ ((dlink *)((char *)xitem+loffset))->next = ilink->next;
+ }
+ free(item);
+}
+
+void * dlist::next(void *item)
+{
+ if (item == NULL) {
+ return head;
+ }
+ return ((dlink *)((char *)item+loffset))->next;
+}
+
+/* Destroy the list and its contents */
+void dlist::destroy()
+{
+ for (void *n=head; n; ) {
+ void *ni = ((dlink *)((char *)n+loffset))->next;
+ free(n);
+ n = ni;
+ }
+}
+
+
+
+#ifdef TEST_PROGRAM
+
+struct MYJCR {
+ char *buf;
+ dlist link;
+};
+
+int main()
+{
+ char buf[30];
+ dlist *jcr_chain;
+ MYJCR *save_jcr = NULL;
+
+ jcr_chain = (dlist *)malloc(sizeof(dlist));
+ jcr_chain->init((int)&MYJCR::link);
+
+ printf("Prepend 20 items 0-19\n");
+ for (int i=0; i<20; i++) {
+ MYJCR *jcr;
+ sprintf(buf, "This is dlist item %d", i);
+ jcr = (MYJCR *)malloc(sizeof(MYJCR));
+ jcr->buf = bstrdup(buf);
+ jcr_chain->prepend(jcr);
+ if (i == 10) {
+ save_jcr = jcr;
+ }
+ }
+
+ printf("Remove 10th item\n");
+ free(save_jcr->buf);
+ jcr_chain->remove(save_jcr);
+
+ printf("Print remaining list.\n");
+ for (MYJCR *jcr=NULL; (jcr=(MYJCR *)jcr_chain->next(jcr)); ) {
+ printf("Dlist item = %s\n", jcr->buf);
+ free(jcr->buf);
+ }
+ jcr_chain->destroy();
+ free(jcr_chain);
+
+ sm_dump(False);
+
+}
+#endif
--- /dev/null
+/*
+ * Version $Id$
+ */
+
+/*
+ Copyright (C) 2000-2003 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
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ */
+
+/* ========================================================================
+ *
+ * Doubly linked list -- dlist
+ *
+ */
+
+#define OFFSET(item,link) ((char *)link - (char *)item)
+
+struct dlink {
+ void *next;
+ void *prev;
+};
+
+class dlist {
+ void *head;
+ void *tail;
+ int loffset;
+public:
+ dlist(int offset);
+ void init(int offset);
+ void prepend(void *item);
+ void append(void *item);
+ void remove(void *item);
+ void *next(void *item);
+ void destroy();
+ void *first();
+ void *last();
+ void * operator new(size_t);
+ void operator delete(void *);
+};
+
+/*
+ * This allows us to do explicit initialization,
+ * allowing us to mix C++ classes inside malloc'ed
+ * C structures. Define before called in constructor.
+ */
+inline void dlist::init(int offset) {
+ head = tail = NULL;
+ loffset = (int)offset;
+}
+
+/* Constructor */
+inline dlist::dlist(int offset) {
+ this->init(offset);
+}
+
+inline void * dlist::operator new(size_t)
+{
+ return malloc(sizeof(dlist));
+}
+
+inline void dlist::operator delete(void *item)
+{
+ ((dlist *)item)->destroy();
+ free(item);
+}
+
+
+inline void * dlist::first()
+{
+ return head;
+}
+
+inline void * dlist::last()
+{
+ return tail;
+}
*/
-#include "list.h"
+#include "alist.h"
+#include "dlist.h"
#include "bits.h"
#include "btime.h"
#include "smartall.h"
#endif
#endif
+char *host_os = HOST_OS;
+char *distname = DISTNAME;
+char *distver = DISTVER;
/* Forward referenced functions */
/* */
#define VERSION "1.31"
#define VSTRING "1"
-#define BDATE "10 Jul 2003"
-#define LSMDATE "10Jul03"
+#define BDATE "14 Jul 2003"
+#define LSMDATE "14Jul03"
/* Debug flags */
#define DEBUG 1