- bool found=false;
- ret->seen = 0;
-
- if (tchdbget3(jcr->file_list,
- fname, strlen(fname)+1,
- ret, sizeof(CurFile)) != -1)
- {
- found = true;
- ret->fname = fname;
-// Dmsg1(dbglvl, "lookup <%s> ok\n", fname);
- }
- return found;
-}
-
-/* Create tokyo dbm hash file
- * If something goes wrong, we cancel accurate mode.
- */
-static bool accurate_init(JCR *jcr, int nbfile)
-{
- jcr->file_list = tchdbnew();
- tchdbsetcache(jcr->file_list, 300000);
- tchdbtune(jcr->file_list,
- nbfile, /* nb bucket 0.5n to 4n */
- 6, /* size of element 2^x */
- 16,
- 0); /* options like compression */
-
- POOLMEM *name = get_pool_memory(PM_MESSAGE);
- make_unique_filename(name, jcr->JobId, "accurate");
-
- if(!tchdbopen(jcr->file_list, name, HDBOWRITER | HDBOCREAT)){
- Jmsg(jcr, M_ERROR, 1, _("Can't open accurate hash disk ERR=%s\n"),
- tchdberrmsg(tchdbecode(jcr->file_list)));
- Jmsg(jcr, M_INFO, 1, _("Disabling accurate mode\n"));
- tchdbdel(jcr->file_list);
- jcr->file_list = NULL;
- jcr->accurate = false;
- }
- free_pool_memory(name);
- return jcr->file_list != NULL;
-}
-
-/* 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)
-{
- char *key;
- 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;
-
- /* traverse records */
- tchdbiterinit(jcr->file_list);
- while((key = tchdbiternext2(jcr->file_list)) != NULL) {
- if (tchdbget3(jcr->file_list,
- key, strlen(key)+1,
- &elt, sizeof(CurFile)) != -1)
- {
- if (!elt.seen) {
- ff_pkt->fname = key;
- ff_pkt->statp.st_mtime = elt.mtime;
- ff_pkt->statp.st_ctime = elt.ctime;
- encode_and_send_attributes(jcr, ff_pkt, stream);
- }
- realfree(key); /* tokyo cabinet have to use real free() */
- }