]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/catreq.c
Simplify the code path in migration and copy jobs
[bacula/bacula] / bacula / src / dird / catreq.c
index 47e0b4790209e3a4d8702b65f6a877fc92231b6f..ab858a90fc68a9eb9ddf3bc48203fdd9b30b7ce5 100644 (file)
@@ -6,7 +6,7 @@
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
@@ -418,12 +418,14 @@ static void update_attribute(JCR *jcr, char *msg, int32_t msglen)
     *   Encoded attributes
     *   Link name (if type==FT_LNK or FT_LNKSAVED)
     *   Encoded extended-attributes (for Win32)
     *   Encoded attributes
     *   Link name (if type==FT_LNK or FT_LNKSAVED)
     *   Encoded extended-attributes (for Win32)
+    *   Delta sequence number (32 bit int)
     *
     * Restore Object
     *   File_index
     *   File_type
     *   Object_index
     *
     * Restore Object
     *   File_index
     *   File_type
     *   Object_index
-    *   Object_len
+    *   Object_len (possibly compressed)
+    *   Object_full_len (not compressed)
     *   Object_compression
     *   Plugin_name
     *   Object_name
     *   Object_compression
     *   Plugin_name
     *   Object_name
@@ -446,14 +448,26 @@ static void update_attribute(JCR *jcr, char *msg, int32_t msglen)
       jcr->attr = check_pool_memory_size(jcr->attr, msglen);
       memcpy(jcr->attr, msg, msglen);
       p = jcr->attr - msg + p;    /* point p into jcr->attr */
       jcr->attr = check_pool_memory_size(jcr->attr, msglen);
       memcpy(jcr->attr, msg, msglen);
       p = jcr->attr - msg + p;    /* point p into jcr->attr */
-      skip_nonspaces(&p);             /* skip FileIndex */
+      skip_nonspaces(&p);         /* skip FileIndex */
       skip_spaces(&p);
       ar->FileType = str_to_int32(p); 
       skip_spaces(&p);
       ar->FileType = str_to_int32(p); 
-      skip_nonspaces(&p);             /* skip FileType */
+      skip_nonspaces(&p);         /* skip FileType */
       skip_spaces(&p);
       fname = p;
       len = strlen(fname);        /* length before attributes */
       attr = &fname[len+1];
       skip_spaces(&p);
       fname = p;
       len = strlen(fname);        /* length before attributes */
       attr = &fname[len+1];
+      ar->DeltaSeq = 0;
+      if (ar->FileType == FT_REG) {
+         p = attr + strlen(attr) + 1;  /* point to link */
+         p = p + strlen(p) + 1;        /* point to extended attributes */
+         p = p + strlen(p) + 1;        /* point to delta sequence */
+         /*
+          * Older FDs don't have a delta sequence, so check if it is there 
+          */
+         if (p - jcr->attr < msglen) {
+            ar->DeltaSeq = str_to_int32(p); /* delta_seq */
+         }
+      }
 
       Dmsg2(400, "dird<stored: stream=%d %s\n", Stream, fname);
       Dmsg1(400, "dird<stored: attr=%s\n", attr);
 
       Dmsg2(400, "dird<stored: stream=%d %s\n", Stream, fname);
       Dmsg1(400, "dird<stored: attr=%s\n", attr);
@@ -492,17 +506,23 @@ static void update_attribute(JCR *jcr, char *msg, int32_t msglen)
 
       Dmsg1(100, "Robj=%s\n", p);
       
 
       Dmsg1(100, "Robj=%s\n", p);
       
-      skip_nonspaces(&p);             /* skip FileIndex */
+      skip_nonspaces(&p);                  /* skip FileIndex */
+      skip_spaces(&p);
+      ro.FileType = str_to_int32(p);        /* FileType */
+      skip_nonspaces(&p);
+      skip_spaces(&p);
+      ro.object_index = str_to_int32(p);    /* Object Index */
+      skip_nonspaces(&p);
+      skip_spaces(&p);
+      ro.object_len = str_to_int32(p);      /* object length possibly compressed */
+      skip_nonspaces(&p);                  
+      skip_spaces(&p);
+      ro.object_full_len = str_to_int32(p); /* uncompressed object length */
+      skip_nonspaces(&p);
       skip_spaces(&p);
       skip_spaces(&p);
-      ro.FileType = str_to_int32(p); 
-      skip_nonspaces(&p);             /* move past FileType */
+      ro.object_compression = str_to_int32(p); /* compression */
+      skip_nonspaces(&p);
       skip_spaces(&p);
       skip_spaces(&p);
-      ro.object_index = str_to_int32(p);
-      skip_nonspaces(&p);             /* move past object_index */
-      ro.object_len = str_to_int32(p);
-      skip_nonspaces(&p);             /* move past object_length */
-      ro.object_compression = str_to_int32(p);
-      skip_nonspaces(&p);             /* move past object_compression */
 
       ro.plugin_name = p;                      /* point to plugin name */
       len = strlen(ro.plugin_name);
 
       ro.plugin_name = p;                      /* point to plugin name */
       len = strlen(ro.plugin_name);