]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
test-plugin-fd: Add plugin's file attribute update
authorMichal Rakowski <michal.rakowski@baculasystems.com>
Mon, 20 Dec 2021 17:54:52 +0000 (18:54 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:57 +0000 (13:56 +0200)
bacula/src/plugins/fd/test-plugin-fd.c

index 8b637f7b776be8517cb6f629c933b07c5e419c2c..beaf22efdd9630f194f8f386db9d973ccd0fbbe6 100644 (file)
@@ -755,7 +755,35 @@ static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
       sp->plug_meta = p_ctx->meta_mgr;
       Dmsg0(0, "Insert metadata!!!!!! CV.pdf\n");
       return bRC_OK;
+   } else if (p_ctx->nb_obj == 9) {
+      time_t now = time(NULL);
+
+      p_ctx->nb_obj++;
+
+      sp->type = FT_REG;
+      sp->fname = "/@size_update_file@";
+      sp->statp.st_mode = 0640;
+      sp->statp.st_ctime = now;
+      sp->statp.st_mtime = now;
+      sp->statp.st_atime = now;
+      sp->statp.st_size = -1; /* Size is unknown at the beginning, should be updated in the next step */
+      sp->statp.st_blksize = 4096;
 
+      Dmsg0(0, "@size_update_file@ initial step\n");
+      return bRC_OK;
+
+   } else if (p_ctx->nb_obj == 10) {
+
+      p_ctx->nb_obj++;
+
+      sp->type = FT_REG;
+      sp->fname = "/@size_update_file@";
+      sp->stat_update = true;    /* File attributes should be updated */
+      sp->statp.st_size = 666;   /* Update size */
+      sp->statp.st_mode = 0777;  /* Update perissions */
+
+      Dmsg0(0, "@size_update_file@ update size\n");
+      return bRC_OK;
    } else {
       return bRC_Stop;
    }