]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_dotcmds.c
start to tweak prune algo
[bacula/bacula] / bacula / src / dird / ua_dotcmds.c
index 0668c97b2c3258f43fcd48dd01c9df7ebb6503ee..4a3c9a031032506b609c6886bddf325db2c8ce7f 100644 (file)
@@ -35,7 +35,6 @@
  *
  *     Kern Sibbald, April MMII
  *
- *   Version $Id$
  */
 
 #include "bacula.h"
@@ -188,26 +187,33 @@ static int bvfs_result_handler(void *ctx, int fields, char **row)
    UAContext *ua = (UAContext *)ctx;
    struct stat statp;
    int32_t LinkFI;
-   const char *fileid;
-   char *lstat;
+   char *fileid=row[BVFS_FileId];
+   char *lstat=row[BVFS_LStat];
+   char *jobid=row[BVFS_JobId];
+   
    char empty[] = "A A A A A A A A A A A A A A";
+   char zero[] = "0";
 
-   lstat = (row[BVFS_LStat] && row[BVFS_LStat][0])?row[BVFS_LStat]:empty;
-   fileid = (row[BVFS_FileId] && row[BVFS_FileId][0])?row[BVFS_FileId]:"0";
+   /* We need to deal with non existant path */
+   if (!fileid || !is_a_number(fileid)) {
+      lstat = empty;
+      jobid = zero;
+      fileid = zero;
+   }
 
    memset(&statp, 0, sizeof(struct stat));
    decode_stat(lstat, &statp, &LinkFI);
 
-   Dmsg1(0, "type=%s\n", row[0]);
+   Dmsg1(100, "type=%s\n", row[0]);
    if (bvfs_is_dir(row)) {
       char *path = bvfs_basename_dir(row[BVFS_Name]);
       ua->send_msg("%s\t0\t%s\t%s\t%s\t%s\n", row[BVFS_PathId], fileid,
-                   row[BVFS_JobId], row[BVFS_LStat], path);
+                   jobid, lstat, path);
 
    } else if (bvfs_is_file(row)) {
       ua->send_msg("%s\t%s\t%s\t%s\t%s\t%s\n", row[BVFS_PathId],
-                   row[BVFS_FilenameId], fileid, row[BVFS_JobId],
-                   row[BVFS_LStat], row[BVFS_Name]);
+                   row[BVFS_FilenameId], fileid, jobid,
+                   lstat, row[BVFS_Name]);
    }
 
    return 0;
@@ -771,6 +777,7 @@ static bool levelscmd(UAContext *ua, const char *cmd)
    ua->send_msg("Catalog\n");
    ua->send_msg("InitCatalog\n");
    ua->send_msg("VolumeToCatalog\n");
+   ua->send_msg("Base\n");
    return true;
 }
 
@@ -883,6 +890,8 @@ static bool defaultscmd(UAContext *ua, const char *cmd)
          ua->send_msg("max_vol_bytes=%s", edit_uint64(pool->MaxVolBytes, ed1));
          ua->send_msg("auto_prune=%d", pool->AutoPrune);
          ua->send_msg("recycle=%d", pool->Recycle);
+         ua->send_msg("file_retention=%s", edit_uint64(pool->FileRetention, ed1));
+         ua->send_msg("job_retention=%s", edit_uint64(pool->JobRetention, ed1));
       }
    }
    return true;