src/filed/fd_snapshot.c
bool convert_path(FF_PKT *ff) {
      if (!*MountPoint || !*SnapMountPoint) {
         Dmsg2(DT_SNAPSHOT, "MountPoint=%s SnapMountPoint=%s\n", 
               NPRT(MountPoint), NPRT(SnapMountPoint));
         return false;
      }
      if (!ff->snap_top_fname) {
         ff->snap_top_fname = get_pool_memory(PM_FNAME);
      }
      ff->volume_path = MountPoint;       /* /tmp */
      ff->snapshot_path = SnapMountPoint; /* /tmp/.snapshot/Job.20140502.01.01.01 */
      ff->top_fname_save = ff->top_fname;

      int mp_first = strlen(MountPoint); /* will point to after MountPoint in top_fname */
      int last = pm_strcpy(ff->snap_top_fname, SnapMountPoint);
      last = MAX(last - 1, 0);

      /* We need to concat path and avoid double / and no / */
      if (ff->snap_top_fname[last] == '/') {
         if (ff->top_fname[mp_first] == '/') {
            ff->snap_top_fname[last] = 0; /* strip double / */
         }
      } else {                            /* no / at all */
         if (ff->top_fname[mp_first] != '/') {
            pm_strcat(ff->snap_top_fname, "/");
         }
      }

      pm_strcat(ff->snap_top_fname, ff->top_fname + mp_first);
      ff->top_fname = ff->snap_top_fname;
      ff->strip_snap_path = true;
      Dmsg1(DT_SNAPSHOT|50, "top_fname=%s\n", ff->top_fname);
      return true;
   }
/* Convert a real top path to a snapshot path
    * and set proper variables inside ff_pkt
    * to translate back all subfiles.
    */
Convert a real top path to a snapshot path
and set proper variables inside ff_pkt
to translate back all subfiles.
Convert a real top path to a snapshot path and set proper variables inside ff_pkt to translate back all subfiles .
bool convert_path(FF_PKT *ff) {
      if (!*MountPoint || !*SnapMountPoint) {
         Dmsg2(DT_SNAPSHOT, "MountPoint=%s SnapMountPoint=%s\n", 
               NPRT(MountPoint), NPRT(SnapMountPoint));
         return false;
      }
      if (!ff->snap_top_fname) {
         ff->snap_top_fname = get_pool_memory(PM_FNAME);
      }
      ff->volume_path = MountPoint;       
      ff->snapshot_path = SnapMountPoint; 
      ff->top_fname_save = ff->top_fname;
      int mp_first = strlen(MountPoint); 
      int last = pm_strcpy(ff->snap_top_fname, SnapMountPoint);
      last = MAX(last - 1, 0);
      if (ff->snap_top_fname[last] == '/') {
         if (ff->top_fname[mp_first] == '/') {
            ff->snap_top_fname[last] = 0; 
         }
      } else {                            
         if (ff->top_fname[mp_first] != '/') {
            pm_strcat(ff->snap_top_fname, "/");
         }
      }
      pm_strcat(ff->snap_top_fname, ff->top_fname + mp_first);
      ff->top_fname = ff->snap_top_fname;
      ff->strip_snap_path = true;
      Dmsg1(DT_SNAPSHOT|50, "top_fname=%s\n", ff->top_fname);
      return true;
   }
bool convert_path ( FF_PKT * ff ) { if ( ! * MountPoint || ! * SnapMountPoint ) { Dmsg2 ( DT_SNAPSHOT , " \n " , NPRT ( MountPoint ) , NPRT ( SnapMountPoint ) ) ; return false ; } if ( ! ff -> snap_top_fname ) { ff -> snap_top_fname = get_pool_memory ( PM_FNAME ) ; } ff -> volume_path = MountPoint ; ff -> snapshot_path = SnapMountPoint ; ff -> top_fname_save = ff -> top_fname ; int mp_first = strlen ( MountPoint ) ; int last = pm_strcpy ( ff -> snap_top_fname , SnapMountPoint ) ; last = MAX ( last - 1 , 0 ) ; if ( ff -> snap_top_fname [ last ] == ' ' ) { if ( ff -> top_fname [ mp_first ] == ' ' ) { ff -> snap_top_fname [ last ] = 0 ; } } else { if ( ff -> top_fname [ mp_first ] != ' ' ) { pm_strcat ( ff -> snap_top_fname , " " ) ; } } pm_strcat ( ff -> snap_top_fname , ff -> top_fname + mp_first ) ; ff -> top_fname = ff -> snap_top_fname ; ff -> strip_snap_path = true ; Dmsg1 ( DT_SNAPSHOT | 50 , " \n " , ff -> top_fname ) ; return true ; }
Convert a real top path to a snapshot path
 and set proper variables inside ff_pkt
 to translate back all subfiles.
Convert a real top path to a snapshot path and set proper variables inside ff_pkt to translate back all subfiles .
/* /tmp */ /* /tmp/.snapshot/Job.20140502.01.01.01 */ /* will point to after MountPoint in top_fname */ /* We need to concat path and avoid double / and no / */ /* strip double / */ /* no / at all */