From: Kern Sibbald Date: Fri, 9 Feb 2007 10:44:31 +0000 (+0000) Subject: 09Feb07 X-Git-Tag: Release-7.0.0~6919 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=62046e71353e8541cc0af22322c086f3a57b3e4c;p=bacula%2Fbacula 09Feb07 kes Update projects list. 08Feb07 kes Implement Include/Exclude file lists in FD as dlists using the new dlistString class. This permits efficiently having large include/exclude lists and completes project Item 25. kes Fix dird/ua_cmds.c so that a cancel command checks if the console is authorized to cancel the job. This fixes bug #767. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4153 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/projects b/bacula/projects index 05eea2aec9..9bf174feaa 100644 --- a/bacula/projects +++ b/bacula/projects @@ -7,6 +7,7 @@ Projects: Items Completed: Item: 18 Quick release of FD-SD connection after backup. Item: 40 Include JobID in spool file name +Item: 25 Implement huge exclude list support using dlist Summary: Item: 1 Accurate restoration of renamed/deleted files @@ -33,7 +34,7 @@ Item: 21 Split documentation Item: 22 Implement support for stacking arbitrary stream filters, sinks. Item: 23 Implement from-client and to-client on restore command line. Item: 24 Add an override in Schedule for Pools based on backup types. -Item: 25 Implement huge exclude list support using hashing. +Item: 25* Implement huge exclude list support using hashing. Item: 26 Implement more Python events in Bacula. Item: 27 Incorporation of XACML2/SAML2 parsing Item: 28 Filesystem watch triggered backup. @@ -86,7 +87,7 @@ Item 1: Accurate restoration of renamed/deleted files Item 2: Implement a Bacula GUI/management tool. Origin: Kern Date: 28 October 2005 - Status: + Status: In progress What: Implement a Bacula console, and management tools probably using Qt3 and C++. @@ -750,10 +751,12 @@ Status: backups, then the Full job would use the proper Storage device, which has more capacity (i.e. a 8TB tape library. -Item 25: Implement huge exclude list support using hashing. +Item 25: Implement huge exclude list support using hashing (dlists). Date: 28 October 2005 Origin: Kern - Status: + Status: Done in 2.1.2 but was done with dlists (doubly linked lists + since hashing will not help. The huge list also supports + large include lists). What: Allow users to specify very large exclude list (currently more than about 1000 files is too many). diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 51f8afcedc..50ca4cf320 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -620,7 +620,7 @@ static void add_file_to_fileset(JCR *jcr, const char *fname, findFILESET *filese free_pool_memory(fn); while (fgets(buf, sizeof(buf), bpipe->rfd)) { strip_trailing_junk(buf); - fileset->incexe->name_list.append(bstrdup(buf)); + fileset->incexe->name_list.append(new_dlistString(buf)); } if ((stat=close_bpipe(bpipe)) != 0) { berrno be; @@ -641,12 +641,12 @@ static void add_file_to_fileset(JCR *jcr, const char *fname, findFILESET *filese while (fgets(buf, sizeof(buf), ffd)) { strip_trailing_junk(buf); Dmsg1(100, "%s\n", buf); - fileset->incexe->name_list.append(bstrdup(buf)); + fileset->incexe->name_list.append(new_dlistString(buf)); } fclose(ffd); break; default: - fileset->incexe->name_list.append(bstrdup(fname)); + fileset->incexe->name_list.append(new_dlistString(fname)); break; } } @@ -696,7 +696,7 @@ static void add_fileset(JCR *jcr, const char *item) fileset->incexe = (findINCEXE *)malloc(sizeof(findINCEXE)); memset(fileset->incexe, 0, sizeof(findINCEXE)); fileset->incexe->opts_list.init(1, true); - fileset->incexe->name_list.init(1, true); + fileset->incexe->name_list.init(); /* for dlist; was 1,true for alist */ fileset->include_list.append(fileset->incexe); break; case 'E': @@ -704,7 +704,7 @@ static void add_fileset(JCR *jcr, const char *item) fileset->incexe = (findINCEXE *)malloc(sizeof(findINCEXE)); memset(fileset->incexe, 0, sizeof(findINCEXE)); fileset->incexe->opts_list.init(1, true); - fileset->incexe->name_list.init(1, true); + fileset->incexe->name_list.init(); fileset->exclude_list.append(fileset->incexe); break; case 'N': @@ -849,8 +849,9 @@ static bool term_fileset(JCR *jcr) Dmsg1(400, "T %s\n", fo->writer); } } - for (j=0; jname_list.size(); j++) { - Dmsg1(400, "F %s\n", (char *)incexe->name_list.get(j)); + dlistString *node; + foreach_dlist(node, &incexe->name_list) { + Dmsg1(400, "F %s\n", node->c_str()); } } for (i=0; iexclude_list.size(); i++) { @@ -889,8 +890,9 @@ static bool term_fileset(JCR *jcr) Dmsg1(400, "XD %s\n", (char *)fo->drivetype.get(k)); } } - for (j=0; jname_list.size(); j++) { - Dmsg1(400, "F %s\n", (char *)incexe->name_list.get(j)); + dlistString *node; + foreach_dlist(node, incexe->name_list) { + Dmsg1(400, "F %s\n", node->c_str()); } } #endif diff --git a/bacula/src/findlib/find.c b/bacula/src/findlib/find.c index 75da814b49..121e37559c 100644 --- a/bacula/src/findlib/find.c +++ b/bacula/src/findlib/find.c @@ -12,7 +12,7 @@ /* 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. @@ -120,13 +120,14 @@ get_win32_driveletters(FF_PKT *ff, char* szDrives) findFILESET *fileset = ff->fileset; if (fileset) { int i; - char *fname; + dlistString *node; for (i=0; iinclude_list.size(); i++) { findINCEXE *incexe = (findINCEXE *)fileset->include_list.get(i); /* look through all files and check */ - foreach_alist(fname, &incexe->name_list) { + foreach_dlist(node, &incexe->name_list) { + char *fname = node->c_str(); /* fname should match x:/ */ if (strlen(fname) >= 2 && B_ISALPHA(fname[0]) && fname[1] == ':') { @@ -190,8 +191,9 @@ find_files(JCR *jcr, FF_PKT *ff, int callback(FF_PKT *ff_pkt, void *hpkt, bool t ff->drivetypes = fo->drivetype; bstrncat(ff->VerifyOpts, fo->VerifyOpts, sizeof(ff->VerifyOpts)); } - char *fname; - foreach_alist(fname, &incexe->name_list) { + dlistString *node; + foreach_dlist(node, &incexe->name_list) { + char *fname = node->c_str(); Dmsg1(100, "F %s\n", fname); ff->top_fname = fname; if (find_one_file(jcr, ff, our_callback, his_pkt, ff->top_fname, (dev_t)-1, true) == 0) { @@ -340,8 +342,9 @@ static bool accept_file(FF_PKT *ff) } fnm_flags = (incexe->current_opts != NULL && incexe->current_opts->flags & FO_IGNORECASE) ? FNM_CASEFOLD : 0; - char *fname; - foreach_alist(fname, &incexe->name_list) { + dlistString *node; + foreach_dlist(node, &incexe->name_list) { + char *fname = node->c_str(); if (fnmatch(fname, ff->fname, fnmode|fnm_flags) == 0) { Dmsg1(100, "Reject wild2: %s\n", ff->fname); return false; /* reject file */ diff --git a/bacula/src/findlib/find.h b/bacula/src/findlib/find.h index 4ed1cdb92c..7b6c7ab741 100644 --- a/bacula/src/findlib/find.h +++ b/bacula/src/findlib/find.h @@ -163,7 +163,7 @@ struct findFOPTS { struct findINCEXE { findFOPTS *current_opts; /* points to current options structure */ alist opts_list; /* options list */ - alist name_list; /* filename list -- holds char * */ + dlist name_list; /* filename list -- holds dlistString */ }; /* diff --git a/bacula/src/lib/dlist.c b/bacula/src/lib/dlist.c index 1e00346047..1dd5be68d8 100644 --- a/bacula/src/lib/dlist.c +++ b/bacula/src/lib/dlist.c @@ -355,8 +355,8 @@ dlistString *new_dlistString(const char *str) dlistString *new_dlistString(const char *str, int len) { dlistString *node; - node = (dlistString *)malloc(sizeof(dlistString) + len); - bstrncpy(node->c_str(), str, len); + node = (dlistString *)malloc(sizeof(dlink) + len +1); + bstrncpy(node->c_str(), str, len + 1); return node; } diff --git a/bacula/src/lib/dlist.h b/bacula/src/lib/dlist.h index 189f02231d..e78b1dc906 100644 --- a/bacula/src/lib/dlist.h +++ b/bacula/src/lib/dlist.h @@ -77,10 +77,14 @@ public: dlist(void); ~dlist() { destroy(); } void init(void *item, dlink *link); + void init(); void prepend(void *item); void append(void *item); void set_prev(void *item, void *prev); void set_next(void *item, void *next); + void *get_prev(void *item); + void *get_next(void *item); + dlink *get_link(void *item); void insert_before(void *item, void *where); void insert_after(void *item, void *where); void *binary_insert(void *item, int compare(void *item1, void *item2)); @@ -112,6 +116,14 @@ inline void dlist::init(void *item, dlink *link) num_items = 0; } +inline void dlist::init() +{ + head = tail = NULL; + loffset = 0; + num_items = 0; +} + + /* * Constructor called with the address of a * member of the list (not the list head), and @@ -140,6 +152,22 @@ inline void dlist::set_next(void *item, void *next) ((dlink *)(((char *)item)+loffset))->next = next; } +inline void *dlist::get_prev(void *item) +{ + return ((dlink *)(((char *)item)+loffset))->prev; +} + +inline void *dlist::get_next(void *item) +{ + return ((dlink *)(((char *)item)+loffset))->next; +} + + +inline dlink *dlist::get_link(void *item) +{ + return (dlink *)((dlink *)(((char *)item)+loffset)); +} + inline bool dlist::empty() const @@ -171,12 +199,13 @@ inline void * dlist::last() const * Kern Sibbald, February 2007 * */ -class dlistString : public dlink +class dlistString { public: char *c_str() { return m_str; }; private: + dlink m_link; char m_str[1]; /* !!! Don't put anything after this as this space is used * to hold the string in inline diff --git a/bacula/src/tools/testfind.c b/bacula/src/tools/testfind.c index f071f83eb6..f756b5094e 100644 --- a/bacula/src/tools/testfind.c +++ b/bacula/src/tools/testfind.c @@ -445,7 +445,7 @@ static bool copy_fileset(FF_PKT *ff, JCR *jcr) fileset->incexe = (findINCEXE *)malloc(sizeof(findINCEXE)); memset(fileset->incexe, 0, sizeof(findINCEXE)); fileset->incexe->opts_list.init(1, true); - fileset->incexe->name_list.init(1, true); + fileset->incexe->name_list.init(0, 0); fileset->include_list.append(fileset->incexe); } else { ie = jcr_fileset->exclude_items[i]; @@ -454,7 +454,7 @@ static bool copy_fileset(FF_PKT *ff, JCR *jcr) fileset->incexe = (findINCEXE *)malloc(sizeof(findINCEXE)); memset(fileset->incexe, 0, sizeof(findINCEXE)); fileset->incexe->opts_list.init(1, true); - fileset->incexe->name_list.init(1, true); + fileset->incexe->name_list.init(0, 0); fileset->exclude_list.append(fileset->incexe); } diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index d2ab0bdde0..37b7758d43 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,7 +1,12 @@ Technical notes on version 2.1 -General: +General: a +09Feb07 +kes Update projects list. 08Feb07 +kes Implement Include/Exclude file lists in FD as dlists using + the new dlistString class. This permits efficiently having + large include/exclude lists and completes project Item 25. kes Fix dird/ua_cmds.c so that a cancel command checks if the console is authorized to cancel the job. This fixes bug #767.