diff options
Diffstat (limited to 'Duplicati/Library/Snapshots')
-rw-r--r-- | Duplicati/Library/Snapshots/ISnapshotService.cs | 7 | ||||
-rw-r--r-- | Duplicati/Library/Snapshots/LinuxSnapshot.cs | 16 | ||||
-rw-r--r-- | Duplicati/Library/Snapshots/NoSnapshot.cs | 7 | ||||
-rw-r--r-- | Duplicati/Library/Snapshots/NoSnapshotLinux.cs | 16 | ||||
-rw-r--r-- | Duplicati/Library/Snapshots/NoSnapshotWindows.cs | 10 | ||||
-rw-r--r-- | Duplicati/Library/Snapshots/WindowsSnapshot.cs | 10 |
6 files changed, 65 insertions, 1 deletions
diff --git a/Duplicati/Library/Snapshots/ISnapshotService.cs b/Duplicati/Library/Snapshots/ISnapshotService.cs index 9d0ab621d..94f9061f2 100644 --- a/Duplicati/Library/Snapshots/ISnapshotService.cs +++ b/Duplicati/Library/Snapshots/ISnapshotService.cs @@ -82,5 +82,12 @@ namespace Duplicati.Library.Snapshots /// <returns><c>true</c> if this instance is a block device; otherwise, <c>false</c>.</returns>
/// <param name="file">The file or folder to examine</param>
bool IsBlockDevice(string file);
+
+ /// <summary>
+ /// Gets a unique hardlink target ID
+ /// </summary>
+ /// <returns>The hardlink ID</returns>
+ /// <param name="file">The file or folder to examine</param>
+ string HardlinkTargetID(string path);
}
}
diff --git a/Duplicati/Library/Snapshots/LinuxSnapshot.cs b/Duplicati/Library/Snapshots/LinuxSnapshot.cs index 5590cfb45..ebde7ca7a 100644 --- a/Duplicati/Library/Snapshots/LinuxSnapshot.cs +++ b/Duplicati/Library/Snapshots/LinuxSnapshot.cs @@ -484,6 +484,22 @@ namespace Duplicati.Library.Snapshots return true;
}
}
+
+ /// <summary>
+ /// Gets a unique hardlink target ID
+ /// </summary>
+ /// <returns>The hardlink ID</returns>
+ /// <param name="file">The file or folder to examine</param>
+ public string HardlinkTargetID(string path)
+ {
+ var local = ConvertToSnapshotPath(FindSnapShotByLocalPath(path), path);
+ local = local.EndsWith(DIR_SEP) ? local.Substring(0, local.Length - 1) : local;
+
+ if (UnixSupport.File.GetHardlinkCount(local) <= 1)
+ return null;
+
+ return UnixSupport.File.GetInodeTargetID(local);
+ }
#endregion
#region IDisposable Members
diff --git a/Duplicati/Library/Snapshots/NoSnapshot.cs b/Duplicati/Library/Snapshots/NoSnapshot.cs index 1500e6cc1..b2408d462 100644 --- a/Duplicati/Library/Snapshots/NoSnapshot.cs +++ b/Duplicati/Library/Snapshots/NoSnapshot.cs @@ -169,6 +169,13 @@ namespace Duplicati.Library.Snapshots /// <returns><c>true</c> if this instance is a block device; otherwise, <c>false</c>.</returns>
/// <param name="file">The file or folder to examine</param>
public abstract bool IsBlockDevice(string file);
+
+ /// <summary>
+ /// Gets a unique hardlink target ID
+ /// </summary>
+ /// <returns>The hardlink ID</returns>
+ /// <param name="file">The file or folder to examine</param>
+ public abstract string HardlinkTargetID(string path);
#endregion
}
}
diff --git a/Duplicati/Library/Snapshots/NoSnapshotLinux.cs b/Duplicati/Library/Snapshots/NoSnapshotLinux.cs index bf2d19592..8e52040c6 100644 --- a/Duplicati/Library/Snapshots/NoSnapshotLinux.cs +++ b/Duplicati/Library/Snapshots/NoSnapshotLinux.cs @@ -85,7 +85,21 @@ namespace Duplicati.Library.Snapshots default:
return true;
}
- }
+ }
+
+ /// <summary>
+ /// Gets a unique hardlink target ID
+ /// </summary>
+ /// <returns>The hardlink ID</returns>
+ /// <param name="file">The file or folder to examine</param>
+ public override string HardlinkTargetID(string path)
+ {
+ path = path.EndsWith(DIR_SEP) ? path.Substring(0, path.Length - 1) : path;
+ if (UnixSupport.File.GetHardlinkCount(path) <= 1)
+ return null;
+
+ return UnixSupport.File.GetInodeTargetID(path);
+ }
}
}
diff --git a/Duplicati/Library/Snapshots/NoSnapshotWindows.cs b/Duplicati/Library/Snapshots/NoSnapshotWindows.cs index 5bf9a98da..988e89a1b 100644 --- a/Duplicati/Library/Snapshots/NoSnapshotWindows.cs +++ b/Duplicati/Library/Snapshots/NoSnapshotWindows.cs @@ -154,6 +154,16 @@ namespace Duplicati.Library.Snapshots {
return false;
}
+
+ /// <summary>
+ /// Gets a unique hardlink target ID
+ /// </summary>
+ /// <returns>The hardlink ID</returns>
+ /// <param name="file">The file or folder to examine</param>
+ public override string HardlinkTargetID(string path)
+ {
+ return null;
+ }
}
}
diff --git a/Duplicati/Library/Snapshots/WindowsSnapshot.cs b/Duplicati/Library/Snapshots/WindowsSnapshot.cs index 35d8be32a..7692f9189 100644 --- a/Duplicati/Library/Snapshots/WindowsSnapshot.cs +++ b/Duplicati/Library/Snapshots/WindowsSnapshot.cs @@ -383,6 +383,16 @@ namespace Duplicati.Library.Snapshots {
return false;
}
+
+ /// <summary>
+ /// Gets a unique hardlink target ID
+ /// </summary>
+ /// <returns>The hardlink ID</returns>
+ /// <param name="file">The file or folder to examine</param>
+ public string HardlinkTargetID(string path)
+ {
+ return null;
+ }
#endregion
#region IDisposable Members
|