Modified FileAttributes enum so it correctly works as a flag.

Removed DevicePath from FileEntryInfo structure.
	Added filesystem ID as a union struct of uint32, uint64 and
	guid.
	Added NoData and NoSuchExtendedAttribute errors.
This commit is contained in:
2016-07-22 00:44:52 +01:00
parent a702542649
commit f47947f09a

View File

@@ -36,110 +36,113 @@
// ****************************************************************************/ // ****************************************************************************/
// //$Id$ // //$Id$
using System; using System;
using System.Runtime.InteropServices;
using System.Security.Policy;
namespace DiscImageChef.Filesystems namespace DiscImageChef.Filesystems
{ {
/// <summary> /// <summary>
/// File attributes. /// File attributes.
/// </summary> /// </summary>
[Flags] [Flags]
public enum FileAttributes public enum FileAttributes : ulong
{ {
/// <summary>File is an alias (Mac OS)</summary> /// <summary>File is an alias (Mac OS)</summary>
Alias, Alias = 0x01,
/// <summary>Indicates that the file can only be writable appended</summary> /// <summary>Indicates that the file can only be writable appended</summary>
AppendOnly, AppendOnly = 0x02,
/// <summary>File is candidate for archival/backup</summary> /// <summary>File is candidate for archival/backup</summary>
Archive, Archive = 0x04,
/// <summary>File is a block device</summary> /// <summary>File is a block device</summary>
BlockDevice, BlockDevice = 0x08,
/// <summary>File is stored on filesystem block units instead of device sectors</summary> /// <summary>File is stored on filesystem block units instead of device sectors</summary>
BlockUnits, BlockUnits = 0x10,
/// <summary>Directory is a bundle or file contains a BNDL resource</summary> /// <summary>Directory is a bundle or file contains a BNDL resource</summary>
Bundle, Bundle = 0x20,
/// <summary>File is a char device</summary> /// <summary>File is a char device</summary>
CharDevice, CharDevice = 0x40,
/// <summary>File is compressed</summary> /// <summary>File is compressed</summary>
Compressed, Compressed = 0x80,
/// <summary>File is compressed and should not be uncompressed on read</summary> /// <summary>File is compressed and should not be uncompressed on read</summary>
CompressedRaw, CompressedRaw = 0x100,
/// <summary>File has compression errors</summary> /// <summary>File has compression errors</summary>
CompressionError, CompressionError = 0x200,
/// <summary>Compressed file is dirty</summary> /// <summary>Compressed file is dirty</summary>
CompressionDirty, CompressionDirty = 0x400,
/// <summary>File is a device</summary> /// <summary>File is a device</summary>
Device, Device = 0x800,
/// <summary>File is a directory</summary> /// <summary>File is a directory</summary>
Directory, Directory = 0x1000,
/// <summary>File is encrypted</summary> /// <summary>File is encrypted</summary>
Encrypted, Encrypted = 0x2000,
/// <summary>File is stored on disk using extents</summary> /// <summary>File is stored on disk using extents</summary>
Extents, Extents = 0x4000,
/// <summary>File is a FIFO</summary> /// <summary>File is a FIFO</summary>
FIFO, FIFO = 0x8000,
/// <summary>File is a normal file</summary> /// <summary>File is a normal file</summary>
File, File = 0x10000,
/// <summary>File is a Mac OS file containing desktop databases that has already been added to the desktop database</summary> /// <summary>File is a Mac OS file containing desktop databases that has already been added to the desktop database</summary>
HasBeenInited, HasBeenInited = 0x20000,
/// <summary>File contains an icon resource / EA</summary> /// <summary>File contains an icon resource / EA</summary>
HasCustomIcon, HasCustomIcon = 0x40000,
/// <summary>File is a Mac OS extension or control panel lacking INIT resources</summary> /// <summary>File is a Mac OS extension or control panel lacking INIT resources</summary>
HasNoINITs, HasNoINITs = 0x80000,
/// <summary>File is hidden/invisible</summary> /// <summary>File is hidden/invisible</summary>
Hidden, Hidden = 0x100000,
/// <summary>File cannot be written, deleted, modified or linked to</summary> /// <summary>File cannot be written, deleted, modified or linked to</summary>
Immutable, Immutable = 0x200000,
/// <summary>Directory is indexed using hashed trees</summary> /// <summary>Directory is indexed using hashed trees</summary>
IndexedDirectory, IndexedDirectory = 0x400000,
/// <summary>File contents are stored alongside its inode (or equivalent)</summary> /// <summary>File contents are stored alongside its inode (or equivalent)</summary>
Inline, Inline = 0x800000,
/// <summary>File contains integrity checks</summary> /// <summary>File contains integrity checks</summary>
IntegrityStream, IntegrityStream = 0x1000000,
/// <summary>File is on desktop</summary> /// <summary>File is on desktop</summary>
IsOnDesk, IsOnDesk = 0x2000000,
/// <summary>File changes are written to filesystem journal before being written to file itself</summary> /// <summary>File changes are written to filesystem journal before being written to file itself</summary>
Journaled, Journaled = 0x4000000,
/// <summary>Access time will not be modified</summary> /// <summary>Access time will not be modified</summary>
NoAccessTime, NoAccessTime = 0x8000000,
/// <summary>File will not be subject to copy-on-write</summary> /// <summary>File will not be subject to copy-on-write</summary>
NoCopyOnWrite, NoCopyOnWrite = 0x10000000,
/// <summary>File will not be backed up</summary> /// <summary>File will not be backed up</summary>
NoDump, NoDump = 0x20000000,
/// <summary>File contents should not be scrubed</summary> /// <summary>File contents should not be scrubed</summary>
NoScrub, NoScrub = 0x40000000,
/// <summary>File contents should not be indexed</summary> /// <summary>File contents should not be indexed</summary>
NotIndexed, NotIndexed = 0x80000000,
/// <summary>File is offline</summary> /// <summary>File is offline</summary>
Offline, Offline = 0x100000000,
/// <summary>File is password protected, but contents are not encrypted on disk</summary> /// <summary>File is password protected, but contents are not encrypted on disk</summary>
Password, Password = 0x200000000,
/// <summary>File is read-only</summary> /// <summary>File is read-only</summary>
ReadOnly, ReadOnly = 0x400000000,
/// <summary>File is a reparse point</summary> /// <summary>File is a reparse point</summary>
ReparsePoint, ReparsePoint = 0x800000000,
/// <summary>When file is removed its content will be overwritten with zeroes</summary> /// <summary>When file is removed its content will be overwritten with zeroes</summary>
Secured, Secured = 0x1000000000,
/// <summary>File contents are sparse</summary> /// <summary>File contents are sparse</summary>
Sparse, Sparse = 0x2000000000,
/// <summary>File is a shadow (OS/2)</summary> /// <summary>File is a shadow (OS/2)</summary>
Shadow, Shadow = 0x4000000000,
/// <summary>File is shared</summary> /// <summary>File is shared</summary>
Shared, Shared = 0x8000000000,
/// <summary>File is a stationery</summary> /// <summary>File is a stationery</summary>
Stationery, Stationery = 0x10000000000,
/// <summary>File is a symbolic link</summary> /// <summary>File is a symbolic link</summary>
Symlink, Symlink = 0x20000000000,
/// <summary>File writes are synchronously written to disk</summary> /// <summary>File writes are synchronously written to disk</summary>
Sync, Sync = 0x40000000000,
/// <summary>File belongs to the operating system</summary> /// <summary>File belongs to the operating system</summary>
System, System = 0x80000000000,
/// <summary>If file end is a partial block its contend will be merged with other files</summary> /// <summary>If file end is a partial block its contend will be merged with other files</summary>
TailMerged, TailMerged = 0x100000000000,
/// <summary>File is temporary</summary> /// <summary>File is temporary</summary>
Temporary, Temporary = 0x200000000000,
/// <summary>Subdirectories inside of this directory are not related and should be allocated elsewhere</summary> /// <summary>Subdirectories inside of this directory are not related and should be allocated elsewhere</summary>
TopDirectory, TopDirectory = 0x400000000000,
/// <summary>If file is deleted, contents should be stored, for a possible future undeletion</summary> /// <summary>If file is deleted, contents should be stored, for a possible future undeletion</summary>
Undeletable Undeletable = 0x800000000000
} }
/// <summary> /// <summary>
@@ -178,8 +181,6 @@ namespace DiscImageChef.Filesystems
/// <summary>File last modification date</summary> /// <summary>File last modification date</summary>
public DateTime LastWriteTime { get { return mtimeUtc.ToLocalTime(); } set { mtimeUtc = value.ToUniversalTime(); } } public DateTime LastWriteTime { get { return mtimeUtc.ToLocalTime(); } set { mtimeUtc = value.ToUniversalTime(); } }
/// <summary>Path of device that contains this file</summary>
public string DevicePath;
/// <summary>inode number for this file</summary> /// <summary>inode number for this file</summary>
public ulong Inode; public ulong Inode;
/// <summary>POSIX permissions/mode for this file</summary> /// <summary>POSIX permissions/mode for this file</summary>
@@ -202,6 +203,11 @@ namespace DiscImageChef.Filesystems
public class FileSystemInfo public class FileSystemInfo
{ {
public FileSystemInfo()
{
Id = new FileSystemId();
}
/// <summary>Filesystem type</summary> /// <summary>Filesystem type</summary>
public string Type; public string Type;
/// <summary>ID of plugin for this file</summary> /// <summary>ID of plugin for this file</summary>
@@ -217,7 +223,25 @@ namespace DiscImageChef.Filesystems
/// <summary>Maximum length of filenames on this filesystem</summary> /// <summary>Maximum length of filenames on this filesystem</summary>
public ushort FilenameLength; public ushort FilenameLength;
/// <summary>Filesystem ID</summary> /// <summary>Filesystem ID</summary>
public Guid Id; public FileSystemId Id;
}
[StructLayout(LayoutKind.Explicit)]
public struct FileSystemId
{
[FieldOffset(0)]
public bool IsInt;
[FieldOffset(1)]
public bool IsLong;
[FieldOffset(2)]
public bool IsGuid;
[FieldOffset(3)]
public UInt32 Serial32;
[FieldOffset(3)]
public UInt64 Serial64;
[FieldOffset(3)]
public Guid uuid;
} }
/// <summary> /// <summary>
@@ -241,6 +265,10 @@ namespace DiscImageChef.Filesystems
IsDirectory = -21, IsDirectory = -21,
/// <summary>Name is too long</summary> /// <summary>Name is too long</summary>
NameTooLong = -36, NameTooLong = -36,
/// <summary>There is no data available</summary>
NoData = 61,
/// <summary>There is no such attribute</summary>
NoSuchExtendedAttribute = NoData,
/// <summary>No such device</summary> /// <summary>No such device</summary>
NoSuchDevice = -19, NoSuchDevice = -19,
/// <summary>No such file or directory</summary> /// <summary>No such file or directory</summary>
@@ -267,6 +295,10 @@ namespace DiscImageChef.Filesystems
EISDIR = IsDirectory, EISDIR = IsDirectory,
/// <summary>Name is too long</summary> /// <summary>Name is too long</summary>
ENAMETOOLONG = NameTooLong, ENAMETOOLONG = NameTooLong,
/// <summary>There is no such attribute</summary>
ENOATTR = NoSuchExtendedAttribute,
/// <summary>There is no data available</summary>
ENODATA = NoData,
/// <summary>No such device</summary> /// <summary>No such device</summary>
ENODEV = NoSuchDevice, ENODEV = NoSuchDevice,
/// <summary>No such file or directory</summary> /// <summary>No such file or directory</summary>