From f1a7920e20da628fc938d7beb4d623e713e815b6 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 19 May 2008 19:52:19 +0000 Subject: [PATCH] ebl Add patch for tokyo support git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6994 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/patches/testing/accurate-tokyo.patch | 274 ++++++++++++++++++++ 1 file changed, 274 insertions(+) create mode 100644 bacula/patches/testing/accurate-tokyo.patch diff --git a/bacula/patches/testing/accurate-tokyo.patch b/bacula/patches/testing/accurate-tokyo.patch new file mode 100644 index 0000000000..7ff07c17e2 --- /dev/null +++ b/bacula/patches/testing/accurate-tokyo.patch @@ -0,0 +1,274 @@ +Index: src/filed/Makefile.in +=================================================================== +--- src/filed/Makefile.in (révision 6991) ++++ src/filed/Makefile.in (copie de travail) +@@ -7,6 +7,7 @@ + @MCOMMON@ + + srcdir = . ++libdir = ../lib + VPATH = . + .PATH: . + +@@ -55,7 +56,7 @@ + # inference rules + .c.o: + @echo "Compiling $<" +- $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< ++ $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) -I$(libdir) $(CFLAGS) $< + #------------------------------------------------------------------------- + all: Makefile @WIN32@ bacula-fd @STATIC_FD@ + @echo "==== Make of filed is good ====" +@@ -78,15 +79,15 @@ + (cd win32; $(MAKE) DESTDIR=$(DESTDIR)) + @rm -f bacula-fd.exe + +-bacula-fd: $(SVROBJS) ../findlib/libfind.a ../lib/libbac.a @WIN32@ ++bacula-fd: $(SVROBJS) ../findlib/libfind.a ../lib/libbac.a ../lib/libtokyocabinet.a @WIN32@ + @echo "Linking $@ ..." + $(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(SVROBJS) \ +- $(WIN32LIBS) $(FDLIBS) -lfind -lbac -lm $(PYTHON_LIBS) $(LIBS) \ ++ $(WIN32LIBS) $(FDLIBS) -lfind -lbac -ltokyocabinet -lm $(PYTHON_LIBS) $(LIBS) \ + $(DLIB) $(WRAPLIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) + + static-bacula-fd: $(SVROBJS) ../findlib/libfind.a ../lib/libbac.a @WIN32@ + $(CXX) $(WLDFLAGS) $(LDFLAGS) -static -L../lib -L../findlib -o $@ $(SVROBJS) \ +- $(WIN32LIBS) $(FDLIBS) -lfind -lbac -lm $(PYTHON_LIBS) $(LIBS) \ ++ $(WIN32LIBS) $(FDLIBS) -lfind -lbac -ltokyodbm -lm $(PYTHON_LIBS) $(LIBS) \ + $(DLIB) $(WRAPLIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) + strip $@ + +@@ -152,7 +153,7 @@ + @$(MV) Makefile Makefile.bak + @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile + @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile +- @$(CXX) -S -M $(CPPFLAGS) $(XINC) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile ++ @$(CXX) -S -M $(CPPFLAGS) $(XINC) $(PYTHON_INC) -I$(srcdir) -I$(basedir) -I$(libdir) *.c >> Makefile + @if test -f Makefile ; then \ + $(RMF) Makefile.bak; \ + else \ +Index: src/filed/accurate.c +=================================================================== +--- src/filed/accurate.c (révision 6991) ++++ src/filed/accurate.c (copie de travail) +@@ -36,16 +36,12 @@ + static int dbglvl=200; + + typedef struct PrivateCurFile { +-#ifndef USE_TCADB +- hlink link; +-#endif + char *fname; /* not stored with tchdb mode */ + time_t ctime; + time_t mtime; + bool seen; + } CurFile; + +-#ifdef USE_TCADB + static void realfree(void *p); /* used by tokyo code */ + + /* +@@ -190,83 +186,6 @@ + return true; + } + +-#else /* HTABLE mode */ +- +-static bool accurate_mark_file_as_seen(JCR *jcr, CurFile *elt) +-{ +- CurFile *temp = (CurFile *)jcr->file_list->lookup(elt->fname); +- temp->seen = 1; /* records are in memory */ +- return true; +-} +- +-static bool accurate_lookup(JCR *jcr, char *fname, CurFile *ret) +-{ +- bool found=false; +- ret->seen = 0; +- +- CurFile *temp = (CurFile *)jcr->file_list->lookup(fname); +- if (temp) { +- memcpy(ret, temp, sizeof(CurFile)); +- found=true; +-// Dmsg1(dbglvl, "lookup <%s> ok\n", fname); +- } +- +- return found; +-} +- +-static bool accurate_init(JCR *jcr, int nbfile) +-{ +- CurFile *elt=NULL; +- jcr->file_list = (htable *)malloc(sizeof(htable)); +- jcr->file_list->init(elt, &elt->link, nbfile); +- return true; +-} +- +-/* This function is called at the end of backup +- * We walk over all hash disk element, and we check +- * for elt.seen. +- */ +-bool accurate_send_deleted_list(JCR *jcr) +-{ +- CurFile *elt; +- FF_PKT *ff_pkt; +- int stream = STREAM_UNIX_ATTRIBUTES; +- +- if (!jcr->accurate || jcr->JobLevel == L_FULL) { +- goto bail_out; +- } +- +- if (jcr->file_list == NULL) { +- goto bail_out; +- } +- +- ff_pkt = init_find_files(); +- ff_pkt->type = FT_DELETED; +- +- foreach_htable (elt, jcr->file_list) { +- if (!elt->seen) { /* already seen */ +- Dmsg2(dbglvl, "deleted fname=%s seen=%i\n", elt->fname, elt->seen); +- ff_pkt->fname = elt->fname; +- ff_pkt->statp.st_mtime = elt->mtime; +- ff_pkt->statp.st_ctime = elt->ctime; +- encode_and_send_attributes(jcr, ff_pkt, stream); +- } +-// free(elt->fname); +- } +- +- term_find_files(ff_pkt); +-bail_out: +- /* TODO: clean htable when this function is not reached ? */ +- if (jcr->file_list) { +- jcr->file_list->destroy(); +- free(jcr->file_list); +- jcr->file_list = NULL; +- } +- return true; +-} +- +-#endif /* common code */ +- + static bool accurate_add_file(JCR *jcr, char *fname, char *lstat) + { + bool ret = true; +@@ -278,7 +197,6 @@ + elt.mtime = statp.st_mtime; + elt.seen = 0; + +-#ifdef USE_TCADB + if (!tcadbput(jcr->file_list, + fname, strlen(fname)+1, + &elt, sizeof(CurFile))) +@@ -286,15 +204,6 @@ + Jmsg(jcr, M_ERROR, 1, _("Can't update accurate hash disk ERR=%s\n")); + ret = false; + } +-#else /* HTABLE */ +- CurFile *item; +- /* we store CurFile, fname and ctime/mtime in the same chunk */ +- item = (CurFile *)jcr->file_list->hash_malloc(sizeof(CurFile)+strlen(fname)+1); +- memcpy(item, &elt, sizeof(CurFile)); +- item->fname = (char *)item+sizeof(CurFile); +- strcpy(item->fname, fname); +- jcr->file_list->insert(item->fname, item); +-#endif + + // Dmsg2(dbglvl, "add fname=<%s> lstat=%s\n", fname, lstat); + return ret; +@@ -399,8 +308,6 @@ + return true; + } + +-#ifdef USE_TCADB +- + /* + * Tokyo Cabinet library doesn't use smartalloc by default + * results need to be released with real free() +@@ -411,4 +318,3 @@ + free(p); + } + +-#endif +Index: src/filed/filed.h +=================================================================== +--- src/filed/filed.h (révision 6991) ++++ src/filed/filed.h (copie de travail) +@@ -35,11 +35,7 @@ + + + #define FILE_DAEMON 1 +-#ifdef USE_TCADB /* hash disk based */ +-# include +-#else +-# include "lib/htable.h" +-#endif ++#include "lib/tcadb.h" + #include "filed_conf.h" + #include "fd_plugins.h" + #include "findlib/find.h" +Index: src/jcr.h +=================================================================== +--- src/jcr.h (révision 6991) ++++ src/jcr.h (copie de travail) +@@ -341,12 +341,8 @@ + CRYPTO_CTX crypto; /* Crypto ctx */ + DIRRES* director; /* Director resource */ + bool VSS; /* VSS used by FD */ +-#ifdef USE_TCADB + TCADB *file_list; /* Previous file list (accurate mode) */ + POOLMEM *hash_name; +-#else +- htable *file_list; /* Previous file list (accurate mode) */ +-#endif + #endif /* FILE_DAEMON */ + + +Index: src/lib/Makefile.in +=================================================================== +--- src/lib/Makefile.in (révision 6993) ++++ src/lib/Makefile.in (copie de travail) +@@ -47,7 +47,6 @@ + + EXTRAOBJS = @OBJLIST@ + +- + .SUFFIXES: .c .o .ch .dvi .pdf .tex .view .w .1 + .PHONY: + .DONTCARE: +@@ -62,10 +61,17 @@ + $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< + + #------------------------------------------------------------------------- +-all: Makefile libbac.a ++all: Makefile libbac.a libtokyocabinet.a + @echo "==== Make of lib is good ====" + @echo " " + ++libtokyocabinet.a: ++ @(cd tokyocabinet ; echo "==>Entering directory `pwd`"; \ ++ $(MAKE) $@ || (echo ""; echo ""; echo " ====== Error in `pwd` ======"; \ ++ echo ""; echo "";)); ++ @cp tokyocabinet/tcadb.h tokyocabinet/tcbdb.h tokyocabinet/tchdb.h . ++ @cp tokyocabinet/libtokyocabinet.a . ++ + libbac.a: $(LIBOBJS) + @echo "Making $@ ..." + $(AR) rc $@ $(LIBOBJS) +@@ -113,7 +119,7 @@ + @echo "Compiling $<" + $(NO_ECHO)$(CXX) -fPIC $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< + +- ++ + install: + + uninstall: +@@ -121,6 +127,7 @@ + clean: + $(RMF) *.a core a.out *.o *.bak *.tex *.pdf *~ *.intpro *.extpro 1 2 3 + $(RMF) rwlock_test md5sum sha1sum ++ (cd tokyocabinet ; make clean) + + realclean: clean + $(RMF) tags -- 2.39.5