예제 #1
0
        /// <summary>
        /// Gets a value indicating if the path points to a block device
        /// </summary>
        /// <returns><c>true</c> if this instance is a block device; otherwise, <c>false</c>.</returns>
        /// <param name="localPath">The file or folder to examine</param>
        public override bool IsBlockDevice(string localPath)
        {
            try
            {
                var n = UnixSupport.File.GetFileType(SystemIOLinux.NormalizePath(localPath));
                switch (n)
                {
                case UnixSupport.File.FileType.Directory:
                case UnixSupport.File.FileType.Symlink:
                case UnixSupport.File.FileType.File:
                    return(false);

                default:
                    return(true);
                }
            }
            catch
            {
                if (!System.IO.File.Exists(SystemIOLinux.NormalizePath(localPath)))
                {
                    return(false);
                }

                throw;
            }
        }
예제 #2
0
        /// <summary>
        /// Gets a unique hardlink target ID
        /// </summary>
        /// <returns>The hardlink ID</returns>
        /// <param name="localPath">The file or folder to examine</param>
        public override string HardlinkTargetID(string localPath)
        {
            var normalizePath = SystemIOLinux.NormalizePath(localPath);

            return(UnixSupport.File.GetHardlinkCount(normalizePath) <= 1
                ? null
                : UnixSupport.File.GetInodeTargetID(normalizePath));
        }
예제 #3
0
            /// <summary>
            /// Converts a local path to a snapshot path
            /// </summary>
            /// <param name="localPath">The local path</param>
            /// <returns>The snapshot path</returns>
            public string ConvertToSnapshotPath(string localPath)
            {
                if (!localPath.StartsWith(MountPoint, StringComparison.Ordinal))
                {
                    throw new InvalidOperationException();
                }

                return(SystemIOLinux.NormalizePath(SnapshotPath + localPath.Substring(MountPoint.Length)));
            }
예제 #4
0
 /// <inheritdoc />
 public override string ConvertToSnapshotPath(string localPath)
 {
     return(SystemIOLinux.NormalizePath(localPath));
 }