]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Replace call .bvfs_ls_all_files with ".bvfs_lsfiles allfiles"
authorEric Bollengier <eric@baculasystems.com>
Fri, 15 Jan 2021 20:22:28 +0000 (21:22 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:02:59 +0000 (09:02 +0100)
bacula/src/dird/ua_dotcmds.c

index 96ac50193c227c9dfa8d86933a7dc78caa0712fc..6500861755dcc3cc0cd8c7d91bbada707d12c53b 100644 (file)
@@ -70,7 +70,6 @@ static bool catalogscmd(UAContext *ua, const char *cmd);
 static bool dot_ls_cmd(UAContext *ua, const char *cmd);
 static bool dot_bvfs_lsdirs(UAContext *ua, const char *cmd);
 static bool dot_bvfs_lsfiles(UAContext *ua, const char *cmd);
-static bool dot_bvfs_ls_all_files(UAContext *ua, const char *cmd);
 static bool dot_bvfs_update(UAContext *ua, const char *cmd);
 static bool dot_bvfs_get_jobids(UAContext *ua, const char *cmd);
 static bool dot_bvfs_versions(UAContext *ua, const char *cmd);
@@ -128,7 +127,6 @@ static struct cmdstruct commands[] = { /* help */  /* can be used in runscript *
  { NT_(".actiononpurge"),aopcmd,                 NULL,       true},
  { NT_(".bvfs_lsdirs"), dot_bvfs_lsdirs,         NULL,       true},
  { NT_(".bvfs_lsfiles"),dot_bvfs_lsfiles,        NULL,       true},
- { NT_(".bvfs_ls_all_files"),dot_bvfs_ls_all_files, NULL,    true},
  { NT_(".bvfs_get_volumes"),dot_bvfs_get_volumes,NULL,       true},
  { NT_(".bvfs_update"), dot_bvfs_update,         NULL,       true},
  { NT_(".bvfs_get_jobids"), dot_bvfs_get_jobids, NULL,       true},
@@ -1082,22 +1080,19 @@ static bool dot_bvfs_get_volumes(UAContext *ua, const char *cmd)
 }
 
 /*
- * .bvfs_lsfiles jobid=1,2,3,4 pathid=10
- * .bvfs_lsfiles jobid=1,2,3,4 path=/
+ * .bvfs_lsfiles allfiles jobid=1,2,3,4
  */
-static bool dot_bvfs_lsfiles(UAContext *ua, const char *cmd)
+static bool dot_bvfs_ls_all_files(UAContext *ua, const char *cmd)
 {
-   DBId_t pathid=0;
    int limit=2000, offset=0;
-   char *path=NULL, *jobid=NULL, *username=NULL;
+   char *jobid=NULL, *username=NULL;
    char *pattern=NULL, *filename=NULL;
-   bool ok;
    int i;
 
-   if (!bvfs_parse_arg(ua, &pathid, &path, &jobid, &username,
+   if (!bvfs_parse_arg(ua, NULL, NULL, &jobid, &username,
                        &limit, &offset))
    {
-      ua->error_msg("Can't find jobid, pathid or path argument\n");
+      ua->error_msg("Can't find jobid argument\n");
       return true;              /* not enough param */
    }
    if ((i = find_arg_with_value(ua, "pattern")) >= 0) {
@@ -1130,17 +1125,9 @@ static bool dot_bvfs_lsfiles(UAContext *ua, const char *cmd)
    if (filename) {
       fs.set_filename(filename);
    }
-   if (pathid) {
-      ok = fs.ch_dir(pathid);
-   } else {
-      ok = fs.ch_dir(path);
-   }
-   if (!ok) {
-      goto bail_out;
-   }
 
    fs.set_offset(offset);
-   fs.ls_files();
+   fs.ls_all_files();
 
 bail_out:
    ua->bvfs = NULL;
@@ -1148,19 +1135,26 @@ bail_out:
 }
 
 /*
- * .bvfs_ls_all_files jobid=1,2,3,4
+ * .bvfs_lsfiles jobid=1,2,3,4 pathid=10
+ * .bvfs_lsfiles jobid=1,2,3,4 path=/
  */
-static bool dot_bvfs_ls_all_files(UAContext *ua, const char *cmd)
+static bool dot_bvfs_lsfiles(UAContext *ua, const char *cmd)
 {
+   DBId_t pathid=0;
    int limit=2000, offset=0;
-   char *jobid=NULL, *username=NULL;
+   char *path=NULL, *jobid=NULL, *username=NULL;
    char *pattern=NULL, *filename=NULL;
+   bool ok;
    int i;
 
-   if (!bvfs_parse_arg(ua, NULL, NULL, &jobid, &username,
+   if (find_arg(ua, "allfiles") > 0) {
+      return dot_bvfs_ls_all_files(ua, cmd);
+   }
+
+   if (!bvfs_parse_arg(ua, &pathid, &path, &jobid, &username,
                        &limit, &offset))
    {
-      ua->error_msg("Can't find jobid argument\n");
+      ua->error_msg("Can't find jobid, pathid or path argument\n");
       return true;              /* not enough param */
    }
    if ((i = find_arg_with_value(ua, "pattern")) >= 0) {
@@ -1193,9 +1187,17 @@ static bool dot_bvfs_ls_all_files(UAContext *ua, const char *cmd)
    if (filename) {
       fs.set_filename(filename);
    }
+   if (pathid) {
+      ok = fs.ch_dir(pathid);
+   } else {
+      ok = fs.ch_dir(path);
+   }
+   if (!ok) {
+      goto bail_out;
+   }
 
    fs.set_offset(offset);
-   fs.ls_all_files();
+   fs.ls_files();
 
 bail_out:
    ua->bvfs = NULL;