diff --git a/Claunia.IO/ChangeLog b/Claunia.IO/ChangeLog index 9fd4273..44b8b7e 100644 --- a/Claunia.IO/ChangeLog +++ b/Claunia.IO/ChangeLog @@ -1,3 +1,10 @@ +2015-04-25 Natalia Portillo + + * Claunia.IO.csproj: + * Interop/Apple/Interop.Apple.types.cs: + * Interop/Apple/Interop.Apple.getattrlist.cs: + Defined Mac OS X's getattrlist(2). + 2015-02-12 Natalia Portillo * Claunia.IO.csproj: diff --git a/Claunia.IO/Claunia.IO.csproj b/Claunia.IO/Claunia.IO.csproj index 13b565f..150dbe4 100644 --- a/Claunia.IO/Claunia.IO.csproj +++ b/Claunia.IO/Claunia.IO.csproj @@ -53,6 +53,7 @@ + diff --git a/Claunia.IO/Interop/Apple/Interop.Apple.getattrlist.cs b/Claunia.IO/Interop/Apple/Interop.Apple.getattrlist.cs new file mode 100644 index 0000000..aa5863c --- /dev/null +++ b/Claunia.IO/Interop/Apple/Interop.Apple.getattrlist.cs @@ -0,0 +1,747 @@ +// +// Interop.Apple.getattrlist.cs +// +// Author: +// Natalia Portillo +// +// Copyright (c) 2015 © Claunia.com +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System.Runtime.InteropServices; +using System; + +internal static partial class Interop +{ + internal static partial class Apple + { + /// + /// Determines what attributes are returned by the function + /// + [StructLayout(LayoutKind.Sequential)] + internal struct AttrList + { + /// + /// Number of attr bit sets in list, ATTR_BIT_MAP_COUNT + /// + [MarshalAs(UnmanagedType.U2)] + public ushort bitmapCount; + /// + /// To maintain 4-byte alignment + /// + [MarshalAs(UnmanagedType.U2)] + public UInt16 reserved; + /// + /// Common attribut group + /// + [MarshalAs(UnmanagedType.U4)] + public cmnAttrGroup_t commonAttr; + /// + /// Volume attribute group + /// + [MarshalAs(UnmanagedType.U4)] + public volAttrGroup_t volAttr; + /// + /// Directory attribute group + /// + [MarshalAs(UnmanagedType.U4)] + public dirAttrGroup_t dirAttr; + /// + /// File attribute group + /// + [MarshalAs(UnmanagedType.U4)] + public fileAttrGroup_t fileAttr; + /// + /// Fork attribute group + /// + [MarshalAs(UnmanagedType.U4)] + public forkAttrGroup_t forkAttr; + } + + internal const UInt16 ATTR_BIT_MAP_COUNT = 5; + internal const UInt32 DIR_MNTSTATUS_MNTPOINT = 0x00000001; + + [StructLayout(LayoutKind.Sequential)] + internal struct AttrReference + { + /// + /// Offset in bytes from this structure to the structure data + /// + [MarshalAs(UnmanagedType.I4)] + Int32 dataOffset; + /// + /// Length of the attribute data in bytes, always alligned to 4 bytes. + /// + [MarshalAs(UnmanagedType.U4)] + UInt32 Length; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct VolCapabilitiesSet + { + /// + /// Contains information about the volume format + /// + [MarshalAs(UnmanagedType.U4)] + public volCapabilitiesFormat_t volCapabilitiesFormat; + /// + /// Contains information about optional functions supported by the volume format implementation + /// + [MarshalAs(UnmanagedType.U4)] + public UInt32 volCapabilitiesInterfaces; + /// + /// Reserved, should be 0. + /// + [MarshalAs(UnmanagedType.U4)] + public UInt32 volCapabilitiesReserved1; + /// + /// Reserved, should be 0. + /// + [MarshalAs(UnmanagedType.U4)] + public UInt32 volCapabilitiesReserved2; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct VolCapabilitiesAttr + { + /// + /// Indicates whether a particular feature is implemented. + /// + VolCapabilitiesSet capabilities; + /// + /// Indicates which flags are known to the volume format implementation. + /// + VolCapabilitiesSet valid; + } + + /// + /// Determines what attributes are returned by the function + /// + [StructLayout(LayoutKind.Sequential)] + internal struct AttributeSet + { + /// + /// Common attribute group + /// + [MarshalAs(UnmanagedType.U4)] + public cmnAttrGroup_t commonAttr; + /// + /// Volume attribute group + /// + [MarshalAs(UnmanagedType.U4)] + public volAttrGroup_t volAttr; + /// + /// Directory attribute group + /// + [MarshalAs(UnmanagedType.U4)] + public dirAttrGroup_t dirAttr; + /// + /// File attribute group + /// + [MarshalAs(UnmanagedType.U4)] + public fileAttrGroup_t fileAttr; + /// + /// Fork attribute group + /// + [MarshalAs(UnmanagedType.U4)] + public forkAttrGroup_t forkAttr; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct VolAttributesAttr + { + /// + /// Indicates whether a particular attribute is implemented. + /// + AttributeSet capabilities; + /// + /// Indicates which flags are known to the volume format implementation. + /// + AttributeSet valid; + } + + /// + /// "options" parameter for getattrlist(2) + /// + [Flags] + internal enum getAttrListOptions : uint + { + /// + /// Do not follow symlinks + /// + FSOPT_NOFOLLOW = 0x00000001, + /// + /// The size of attributes reported will be the size needed to hold all the requested attributes + /// + FSOPT_REPORT_FULLSIZE = 0x00000002, + /// + /// Return all requested attributes, even ones not supported by the object or filesystem. + /// Fills default values for invalid ones. + /// + FSOPT_PACK_INVAL_ATTRS = 0x00000004, + /// + /// If set, then ATTR_CMN_GEN_COUNT and ATTR_CMN_DOCUMENT_ID can be requested. + /// + FSOPT_ATTR_CMN_EXTENDED = 0x00000008 + } + + /// + /// Common attributes to all types of file system objects. + /// + [Flags] + internal enum cmnAttrGroup_t : uint + { + /// + /// An attribute_set_t structure reporting which of the requested attributes were actually returned. + /// It will always be the first attribute returned. + /// + ATTR_CMN_RETURNED_ATTRS = 0x80000000, + /// + /// An structure containing the name of the file system object as an UTF-8 C string. + /// + ATTR_CMN_NAME = 0x00000001, + /// + /// A dev_t containing the device number of the device on which this file system object's volume is mounted. + /// + /// + ATTR_CMN_DEVID = 0x00000002, + /// + /// An fsid_t containing the file system identifier for the volume on which the file system object resides. + /// + /// + ATTR_CMN_FSID = 0x00000004, + /// + /// An fsobj_type_t that identifies the type of file system object. + /// + /// + ATTR_CMN_OBJTYPE = 0x00000008, + /// + /// An fsobj_tag_t that identifies the type of file system containing the object. + /// + /// + ATTR_CMN_OBJTAG = 0x00000010, + /// + /// An fsobj_id_t that uniquely identifies the file system object within a mounted volume for the duration of it's mount. + /// It is not guaranteed to be persistent. + /// + ATTR_CMN_OBJID = 0x00000020, + /// + /// An fsobj_id_t that uniquely identifies fhe file system object, guaranteed to be persistent between mounts. + /// + ATTR_CMN_OBJPERMANENTID = 0x00000040, + /// + /// An fsobj_id_t that uniquely identifies the parent directory of the file system object for the duration of it's mount. + /// It is not guaranteed to be persistent. + /// If the file system object is hard linked from multiple directories, the parent returned for this attribute is non deterministic. + /// + ATTR_CMN_PAROBJID = 0x00000080, + /// + /// A containing a text encoding hint for the file system objects name. + /// File systems without an appropiate text encoding value should return + /// + ATTR_CMN_SCRIPT = 0x00000100, + /// + /// A containint the time that the file system object was created. + /// + ATTR_CMN_CRTIME = 0x00000200, + /// + /// A containint the time that the file system object was last modified. + /// + /// + ATTR_CMN_MODTIME = 0x00000400, + /// + /// A containint the time that the file system object's attributes were last modified. + /// + /// + ATTR_CMN_CHGTIME = 0x00000800, + /// + /// A containint the time that the file system object was last accessed. + /// + /// + ATTR_CMN_ACCTIME = 0x00001000, + /// + /// A containint the time that the file system object was last backed up. + /// + ATTR_CMN_BKUPTIME = 0x00002000, + /// + /// . + /// Multibyte fields are always returned big endian. + /// + ATTR_CMN_FNDRINFO = 0x00004000, + /// + /// A uid_t containing the owner of the file system object. + /// + /// + ATTR_CMN_OWNERID = 0x00008000, + /// + /// A gid_t containing the group of the file system object. + /// + /// + ATTR_CMN_GRPID = 0x00010000, + /// + /// A containing a the access permissions of the file system object. + /// + /// + ATTR_CMN_ACCESSMASK = 0x00020000, + /// + /// A containing file flags of the file system object. + /// + /// + ATTR_CMN_FLAGS = 0x00040000, + /// + /// Not implemented + /// + [Obsolete("Never implemented")] + ATTR_CMN_NAMEDATTRCOUNT = 0x00080000, + /// + /// Not implemented + /// + [Obsolete("Never implemented")] + ATTR_CMN_NAMEDATTRLIST = 0x00100000, + /// + /// A containing a non zero monotonically increasing generation count for this file system object. + /// Tracks the number of times the data in the object has been modified. + /// Requires to be set. + /// + ATTR_CMN_GEN_COUNT = 0x00080000, + /// + /// A containing the document ID. This value is assigned by the kernel to an object to track + /// it regardless of where it gets moved. + /// Requires to be set. + /// + ATTR_CMN_DOCUMENT_ID = 0x00100000, + /// + /// A containing the effective permissions of the current user (the process calling). + /// + ATTR_CMN_USERACCESS = 0x00200000, + /// + /// An containing a kauth_filesec with the ACL entry only. + /// + ATTR_CMN_EXTENDED_SECURITY = 0x00400000, + /// + /// A guid_t of the owner of the file system object. + /// + ATTR_CMN_UUID = 0x00800000, + /// + /// A guid_t of the group to which the file system object belongs. + /// + ATTR_CMN_GRPUUID = 0x01000000, + /// + /// A that uniquely identifies the file system object within it's mounted volume. + /// + /// + ATTR_CMN_FILEID = 0x02000000, + /// + /// A that uniquely identifies the parent directory of the file system object. + /// + ATTR_CMN_PARENTID = 0x04000000, + /// + /// An containing the full path (resolving all symlinks) to the filesystem object as an UTF-8 C string. + /// Inconsistent behaviour may be observed on hard linked items, particularly if the file system does not support + /// + ATTR_CMN_FULLPATH = 0x08000000, + /// + /// A that contains the time that the file system object was created OR renamed into its containing directory. + /// Inconsistent behaviour may be observed on hard linked items. + /// + ATTR_CMN_ADDEDTIME = 0x10000000, + /// + /// A that contains the file or directory's data protection class. + /// + ATTR_CMN_DATA_PROTECT_FLAGS = 0x00000000 + } + + /// + /// Attributes that relate to volumes (mounted file systems) + /// + [Flags] + internal enum volAttrGroup_t : uint + { + /// + /// This MUST ALWAYS BE SET + /// + ATTR_VOL_INFO = 0x80000000, + /// + /// A containing the file system type. + /// + /// + ATTR_VOL_FSTYPE = 0x00000001, + /// + /// A containing the volume signature word. + /// This value is unique within a given file system type and lets distinguish between volume formats handled by same file system. + /// + ATTR_VOL_SIGNATURE = 0x00000002, + /// + /// An off_t containing the total size of the volume in bytes. + /// + ATTR_VOL_SIZE = 0x00000004, + /// + /// An off_t containing the free space of the volume in bytes. + /// + ATTR_VOL_SPACEFREE = 0x00000008, + /// + /// An off_t containing the free space of the volume in bytes that is available to non-privileged resources. + /// + ATTR_VOL_SPACEAVAIL = 0x00000010, + /// + /// An off_t containing the minimum allocation size on the volume in bytes. + /// + ATTR_VOL_MINALLOCATION = 0x00000020, + /// + /// An off_t conaining the allocation clump of the volume in btes. + /// + ATTR_VOL_ALLOCATIONCLUMP = 0x00000040, + /// + /// A containing the optimal block size when reading or writing. + /// + /// + ATTR_VOL_IOBLOCKSIZE = 0x00000080, + /// + /// A containing the number of file system objects on the volume. + /// + ATTR_VOL_OBJCOUNT = 0x00000100, + /// + /// A containing the number of files on the volume. + /// + ATTR_VOL_FILECOUNT = 0x00000200, + /// + /// A containing the number of directories on the volume. + /// + ATTR_VOL_DIRCOUNT = 0x00000400, + /// + /// A containing the maximum number of file system objects that can be stored on the volume. + /// + ATTR_VOL_MAXOBJCOUNT = 0x00000800, + /// + /// An containing the path to the volume's mount point as an UTF-8 C string. + /// + ATTR_VOL_MOUNTPOINT = 0x00001000, + /// + /// An containing the volume name as an UTF-8 C string. + /// + ATTR_VOL_NAME = 0x00002000, + /// + /// A containing the volume mount flags. + /// + /// + ATTR_VOL_MOUNTFLAGS = 0x00004000, + /// + /// An with the same value as . + /// For local volumes this is the path to the device on which the volume is mounted in an UTF-8 C string. + /// For network volumes this is a unique string identifying the mount. + /// + ATTR_VOL_MOUNTEDDEVICE = 0x00008000, + /// + /// A bitmap of text encodings used in the volume, corresponding to encodingsBitmap as DTS Technote 1150 + /// + ATTR_VOL_ENCODINGSUSED = 0x00010000, + /// + /// A describing the optional features supported by this volume. + /// + ATTR_VOL_CAPABILITIES = 0x00020000, + /// + /// A guid containing the file system UUID. + /// + ATTR_VOL_UUID = 0x00040000, + /// + /// A describing the attributes supported by this volume. + /// + ATTR_VOL_ATTRIBUTES = 0x40000000 + } + + /// + /// Attributes corresponding to directories + /// + [Flags] + internal enum dirAttrGroup_t : uint + { + /// + /// A containing the number of hard links to this directory. + /// + ATTR_DIR_LINKCOUNT = 0x00000001, + /// + /// A containing the number of file system objects in the directory. + /// + ATTR_DIR_ENTRYCOUNT = 0x00000002, + /// + /// A containing flags describing what's mounted in the directory. + /// Currently only is defined, to indicate a file system is mounted on this directory. + /// + ATTR_DIR_MOUNTSTATUS = 0x00000004 + } + + /// + /// Attributes corresponding to files + /// + [Flags] + internal enum fileAttrGroup_t : uint + { + /// + /// A containing the number of hard links to this file. + /// + /// + ATTR_FILE_LINKCOUNT = 0x00000001, + /// + /// An off_t containing the total number of bytes in all forks (logical size). + /// + ATTR_FILE_TOTALSIZE = 0x00000002, + /// + /// An off_t containing the total number of bytes allocated for all forks (physical size). + /// + ATTR_FILE_ALLOCSIZE = 0x00000004, + /// + /// A containing the optimal block size for reading/writing this file. + /// + ATTR_FILE_IOBLOCKSIZE = 0x00000008, + /// + /// A containing the allocation clump size in bytes for this file. + /// + ATTR_FILE_CLUMPSIZE = 0x00000020, + /// + /// A containing the device type for a special device file. + /// + /// + ATTR_FILE_DEVTYPE = 0x00000020, + /// + /// A whose value is reserved. + /// + ATTR_FILE_FILETYPE = 0x00000040, + /// + /// A containing the number of forks in the file. + /// No file systems implement more than two forks (data and resource). + /// + ATTR_FILE_FORKCOUNT = 0x00000080, + /// + /// A containing a list of the named forks in the file. + /// Because Mac OS X only supports data and resource fork, the content of this attribute is not yet defined. + /// + ATTR_FILE_FORKLIST = 0x00000100, + /// + /// An off_t containing the logical size of the data fork in bytes + /// + ATTR_FILE_DATALENGTH = 0x00000200, + /// + /// An off_t containing the physical size of the data fork in bytes + /// + ATTR_FILE_DATAALLOCSIZE = 0x00000400, + /// + /// A diskextent structure representing the first eight extents of the data fork + /// This attribute should not be used, and may not be accurate. + /// + ATTR_FILE_DATAEXTENTS = 0x00000800, + /// + /// An off_t containing the logical size of the resource fork in bytes + /// + ATTR_FILE_RSRCLENGTH = 0x00001000, + /// + /// An off_t containing the physical size of the resource fork in bytes + /// + ATTR_FILE_RSRCALLOCSIZE = 0x00002000, + /// + /// A diskextent structure representing the first eight extents of the resource fork + /// This attribute should not be used, and may not be accurate. + /// + ATTR_FILE_RSRCEXTENTS = 0x00004000 + } + + /// + /// Attributes related to the actual data in the file. + /// They are not properly implemented and should not be requested. + /// + [Flags] + internal enum forkAttrGroup_t : uint + { + /// + /// An off_t containing the logical size of the fork in bytes + /// + ATTR_FORK_TOTALSIZE = 0x00000001, + /// + /// An off_t containing the physical size of the fork in bytes + /// + ATTR_FORK_ALLOCSIZE = 0x00000002 + } + + [Flags] + internal enum volCapabilitiesFormat_t : uint + { + /// + /// The volume supports persistent object identifiers + /// + VOL_CAP_FMT_PERSISTENTOBJECTIDS = 0x00000001, + /// + /// The volume supports symbolic links + /// + VOL_CAP_FMT_SYMBOLICLINKS = 0x00000002, + /// + /// The volume supports hard links + /// + VOL_CAP_FMT_HARDLINKS = 0x00000004, + /// + /// The volume supports journaling + /// Introduced in Mac OS X 10.3 + /// + VOL_CAP_FMT_JOURNAL = 0x00000008, + /// + /// The volume uses journaling + /// Introduced in Mac OS X 10.3 + /// + VOL_CAP_FMT_JOURNAL_ACTIVE = 0x00000010, + /// + /// The volume does not store reliable times for the root directory. + /// Introduced in Mac OS X 10.3 + /// + VOL_CAP_FMT_NO_ROOT_TIMES = 0x00000020, + /// + /// The volume supports sparse files. + /// Introduced in Mac OS X 10.3 + /// + VOL_CAP_FMT_SPARSE_FILES = 0x00000040, + /// + /// The volume keeps track of allocated but unwritten runs of a file. + /// Introduced in Mac OS X 10.3 + /// + VOL_CAP_FMT_ZERO_RUNS = 0x00000080, + /// + /// The volume treats upper and lower characters in file and directory names as different. + /// Introduced in Mac OS X 10.3 + /// + VOL_CAP_FMT_CASE_SENSITIVE = 0x00000100, + /// + /// The volume preserves the case of file and directory names. + /// Introduced in Mac OS X 10.3 + /// + VOL_CAP_FMT_CASE_PRESERVING = 0x00000200, + /// + /// Indicates that statfs(2) on this volume is fast enough as to not need to be cached by callers. + /// Introduced in Mac OS X 10.3 + /// + VOL_CAP_FMT_FAST_STATFS = 0x00000400, + /// + /// The volume supports bigger than 4GiB files. + /// Introduced in Mac OS X 10.4 + /// + VOL_CAP_FMT_2TB_FILESIZE = 0x00000800, + /// + /// The volume supports open deny modes + /// + VOL_CAP_FMT_OPENDENYMODES = 0x00001000, + /// + /// The volume supports and maps it to the volume's native "hidden" or "invisible" bit. + /// + VOL_CAP_FMT_HIDDEN_FILES = 0x00002000, + /// + /// The volume is able to get an absolute path from a persistent object ID. + /// + VOL_CAP_FMT_PATH_FROM_ID = 0x00004000, + /// + /// The volume does not support determining values for total, available or free blocks. + /// Introduced in Mac OS X 10.6 + /// + VOL_CAP_FMT_NO_VOLUME_SIZES = 0x00008000, + /// + /// The volume uses 64-bit object IDs. + /// + VOL_CAP_FMT_64BIT_OBJECT_IDS = 0x00020000, + /// + /// The volume supports transparent decompression of compressed files using decmpfs. + /// + VOL_CAP_FMT_DECMPFS_COMPRESSION = 0x00010000 + } + + [Flags] + internal enum volCapabilitiesInterfaces_t : uint + { + /// + /// The volume implementation supports searchfs(2) + /// + VOL_CAP_INT_SEARCHFS = 0x00000001, + /// + /// The volume implementation supports getattrlist(2) and setattrlist(2) + /// + VOL_CAP_INT_ATTRLIST = 0x00000002, + /// + /// The volume implementation supports being exported via NFS + /// + VOL_CAP_INT_NFSEXPORT = 0x00000004, + /// + /// The volume implementation supports getdirentriesattr(2) + /// + VOL_CAP_INT_READDIRATTR = 0x00000008, + /// + /// The volume implementation supports exchangedata(2) + /// + VOL_CAP_INT_EXCHANGEDATA = 0x00000010, + /// + /// The volume implementation supports the private and undocumented copyfile() + /// + VOL_CAP_INT_COPYFILE = 0x00000020, + /// + /// The volume implementation supports F_PREALLOCATE in fcntl(2) + /// + VOL_CAP_INT_ALLOCATE = 0x00000040, + /// + /// The volume implementation allows you to modify the volume name using setattrlist(2) + /// + VOL_CAP_INT_VOL_RENAME = 0x00000080, + /// + /// The volume implementation supports advisory locking + /// + VOL_CAP_INT_ADVLOCK = 0x00000100, + /// + /// The volume implementation supports whole file locks + /// + VOL_CAP_INT_FLOCK = 0x00000200, + /// + /// The volume implementation supports extended security controls (ACLs) + /// + VOL_CAP_INT_EXTENDED_SECURITY = 0x00000400, + /// + /// The volume implementation supports + /// + VOL_CAP_INT_USERACCESS = 0x00000800, + /// + /// The volume implementation supports AFP-stlye mandatory byte range locks via ioctl(2) + /// + VOL_CAP_INT_MANLOCK = 0x00001000, + /// + /// The volume implementation supports native named streams + /// + VOL_CAP_INT_NAMEDSTREAMS = 0x00002000, + /// + /// The volume implementation supports native extended attributes + /// + VOL_CAP_INT_EXTENDED_ATTR = 0x00004000, + /// + /// The volume implementation supports kqueue notifications for remote events + /// + VOL_CAP_INT_REMOTE_EVENT = 0x00008000 + } + + /// + /// Gets the specified lists of attributes for the file system object. + /// + /// Path to the file system object. + /// List of attributes to get. + /// Pointer to a buffer to store the attributes on it. + /// Allocated size of . + /// . + [DllImport(Libraries.Libc, SetLastError = true)] + public static extern int getattrlist(string path, AttrList attrList, IntPtr attrBuf, UInt32 attrBufSize, UInt32 options); + } +} + diff --git a/Claunia.IO/Interop/Apple/Interop.Apple.types.cs b/Claunia.IO/Interop/Apple/Interop.Apple.types.cs index 6a6570f..a50400f 100644 --- a/Claunia.IO/Interop/Apple/Interop.Apple.types.cs +++ b/Claunia.IO/Interop/Apple/Interop.Apple.types.cs @@ -44,6 +44,512 @@ internal static partial class Interop [MarshalAs(UnmanagedType.I4)] public int tv_nsec; } - } -} + enum vtype + { + VNON = 0, + VREG = 1, + VDIR = 2, + VBLK = 3, + VCHR = 4, + VLNK = 5, + VSOCK = 6, + VFIFO = 7, + VBAD = 8, + VSTR = 9, + VCPLX = 10 + } + + enum vtagtype + { + VT_NON = 0, + VT_UFS = 1, + VT_NFS = 2, + VT_MFS = 3, + VT_MSDOSFS = 4, + VT_LFS = 5, + VT_LOFS = 6, + VT_FDESC = 7, + VT_PORTAL = 8, + VT_NULL = 9, + VT_UMAP = 10, + VT_KERNFS = 11, + VT_PROCFS = 12, + VT_AFS = 13, + VT_ISOFS = 14, + VT_MOCKFS = 15, + VT_HFS = 16, + VT_ZFS = 17, + VT_DEVFS = 18, + VT_WEBDAV = 19, + VT_UDF = 20, + VT_AFP = 21, + VT_CDDA = 22, + VT_CIFS = 23, + VT_OTHER = 24 + } + + enum text_encoding_t : uint + { + kTextEncodingMacRoman = 0, + kTextEncodingMacJapanese = 1, + kTextEncodingMacChineseTrad = 2, + kTextEncodingMacKorean = 3, + kTextEncodingMacArabic = 4, + kTextEncodingMacHebrew = 5, + kTextEncodingMacGreek = 6, + kTextEncodingMacCyrillic = 7, + kTextEncodingMacDevanagari = 9, + kTextEncodingMacGurmukhi = 10, + kTextEncodingMacGujarati = 11, + kTextEncodingMacOriya = 12, + kTextEncodingMacBengali = 13, + kTextEncodingMacTamil = 14, + kTextEncodingMacTelugu = 15, + kTextEncodingMacKannada = 16, + kTextEncodingMacMalayalam = 17, + kTextEncodingMacSinhalese = 18, + kTextEncodingMacBurmese = 19, + kTextEncodingMacKhmer = 20, + kTextEncodingMacThai = 21, + kTextEncodingMacLaotian = 22, + kTextEncodingMacGeorgian = 23, + kTextEncodingMacArmenian = 24, + kTextEncodingMacChineseSimp = 25, + kTextEncodingMacTibetan = 26, + kTextEncodingMacMongolian = 27, + kTextEncodingMacEthiopic = 28, + kTextEncodingMacCentralEurRoman = 29, + kTextEncodingMacVietnamese = 30, + kTextEncodingMacExtArabic = 31, + kTextEncodingMacSymbol = 33, + kTextEncodingMacDingbats = 34, + kTextEncodingMacTurkish = 35, + kTextEncodingMacCroatian = 36, + kTextEncodingMacIcelandic = 37, + kTextEncodingMacRomanian = 38, + kTextEncodingMacCeltic = 39, + kTextEncodingMacGaelic = 40, + kTextEncodingMacKeyboardGlyphs = 41, + + // Older names + kTextEncodingMacTradChinese = kTextEncodingMacChineseTrad, + kTextEncodingMacRSymbol = 8, + kTextEncodingMacSimpChinese = kTextEncodingMacChineseSimp, + kTextEncodingMacGeez = kTextEncodingMacEthiopic, + kTextEncodingMacEastEurRoman = kTextEncodingMacCentralEurRoman, + kTextEncodingMacUninterp = 32, + + + /// + /// Meta-value, Unicode as a Mac encoding + /// + kTextEncodingMacUnicode = 0x7E, + + // Variant Mac OS encodings that use script codes other than 0 + // The following use script code 4, smArabic + /// + /// Like MacArabic but uses Farsi digits + /// + kTextEncodingMacFarsi = 0x8C, + // The following use script code 7, smCyrillic + /// + /// Meta-value in TEC 1.5 & later; maps to kTextEncodingMacCyrillic variant + /// + kTextEncodingMacUkrainian = 0x98, + // The following use script code 28, smEthiopic + /// + /// The following use script code 32, smUnimplemented + /// + kTextEncodingMacInuit = 0xEC, + /// + /// VT100/102 font from Comm Toolbox: Latin-1 repertoire + box drawing etc + /// + kTextEncodingMacVT100 = 0xFC, + + /// + /// Meta-value, should never appear in a table. + /// + kTextEncodingMacHFS = 0xFF, + + /// + /// Meta-value, should never appear in a table. + /// + kTextEncodingUnicodeDefault = 0x0100, + kTextEncodingUnicodeV1_1 = 0x0101, + /// + /// Code points identical to Unicode 1.1 + /// + kTextEncodingISO10646_1993 = 0x0101, + /// + /// New location for Korean Hangul + /// + kTextEncodingUnicodeV2_0 = 0x0103, + /// + /// We treat both Unicode 2.0 and Unicode 2.1 as 2.1 + /// + kTextEncodingUnicodeV2_1 = 0x0103, + kTextEncodingUnicodeV3_0 = 0x0104, + /// + /// Adds characters requiring surrogate pairs in UTF-16 + /// + kTextEncodingUnicodeV3_1 = 0x0105, + kTextEncodingUnicodeV3_2 = 0x0106, + kTextEncodingUnicodeV4_0 = 0x0108, + kTextEncodingUnicodeV5_0 = 0x010A, + + // ISO 8-bit and 7-bit encodings begin at 0x200 + /// + /// ISO 8859-1, Western European + /// + kTextEncodingISOLatin1 = 0x0201, + /// + /// ISO 8859-2, Central European + /// + kTextEncodingISOLatin2 = 0x0202, + /// + /// ISO 8859-3, South European (Maltese...) + /// + kTextEncodingISOLatin3 = 0x0203, + /// + /// ISO 8859-4, North European & some Baltic + /// + kTextEncodingISOLatin4 = 0x0204, + /// + /// ISO 8859-5 + /// + kTextEncodingISOLatinCyrillic = 0x0205, + /// + /// ISO 8859-6, = ASMO 708, =DOS CP 708 + /// + kTextEncodingISOLatinArabic = 0x0206, + /// + /// ISO 8859-7 + /// + kTextEncodingISOLatinGreek = 0x0207, + /// + /// ISO 8859-8 + /// + kTextEncodingISOLatinHebrew = 0x0208, + /// + /// ISO 8859-9, Turkish + /// + kTextEncodingISOLatin5 = 0x0209, + /// + /// ISO 8859-10, Nordic + /// + kTextEncodingISOLatin6 = 0x020A, + /// + /// ISO 8859-13, Baltic Rim + /// + kTextEncodingISOLatin7 = 0x020D, + /// + /// ISO 8859-14, Celtic + /// + kTextEncodingISOLatin8 = 0x020E, + /// + /// ISO 8859-15, 8859-1 changed for EURO & CP1252 letters + /// + kTextEncodingISOLatin9 = 0x020F, + /// + /// ISO 8859-16, Romanian + /// + kTextEncodingISOLatin10 = 0x0210, + + // MS-DOS & Windows encodings begin at 0x400 + /// + /// code page 437 + /// + kTextEncodingDOSLatinUS = 0x0400, + /// + /// code page 737 (formerly code page 437G) + /// + kTextEncodingDOSGreek = 0x0405, + /// + /// code page 775 + /// + kTextEncodingDOSBalticRim = 0x0406, + /// + /// code page 850, "Multilingual" + /// + kTextEncodingDOSLatin1 = 0x0410, + /// + /// code page 851 + /// + kTextEncodingDOSGreek1 = 0x0411, + /// + /// code page 852, Slavic + /// + kTextEncodingDOSLatin2 = 0x0412, + /// + /// code page 855, IBM Cyrillic + /// + kTextEncodingDOSCyrillic = 0x0413, + /// + /// code page 857, IBM Turkish + /// + kTextEncodingDOSTurkish = 0x0414, + /// + /// code page 860 + /// + kTextEncodingDOSPortuguese = 0x0415, + /// + /// code page 861 + /// + kTextEncodingDOSIcelandic = 0x0416, + /// + /// code page 862 + /// + kTextEncodingDOSHebrew = 0x0417, + /// + /// code page 863 + /// + kTextEncodingDOSCanadianFrench = 0x0418, + /// + /// code page 864 + /// + kTextEncodingDOSArabic = 0x0419, + /// + /// code page 865 + /// + kTextEncodingDOSNordic = 0x041A, + /// + /// code page 866 + /// + kTextEncodingDOSRussian = 0x041B, + /// + /// code page 869, IBM Modern Greek + /// + kTextEncodingDOSGreek2 = 0x041C, + /// + /// code page 874, also for Windows + /// + kTextEncodingDOSThai = 0x041D, + /// + /// code page 932, also for Windows; Shift-JIS with additions + /// + kTextEncodingDOSJapanese = 0x0420, + /// + /// code page 936, also for Windows; was EUC-CN, now GBK (EUC-CN extended) + /// + kTextEncodingDOSChineseSimplif = 0x0421, + /// + /// code page 949, also for Windows; Unified Hangul Code (EUC-KR extended) + /// + kTextEncodingDOSKorean = 0x0422, + /// + /// code page 950, also for Windows; Big-5 + /// + kTextEncodingDOSChineseTrad = 0x0423, + /// + /// code page 1252 + /// + kTextEncodingWindowsLatin1 = 0x0500, + /// + /// code page 1252 (alternate name) + /// + kTextEncodingWindowsANSI = 0x0500, + /// + /// code page 1250, Central Europe + /// + kTextEncodingWindowsLatin2 = 0x0501, + /// + /// code page 1251, Slavic Cyrillic + /// + kTextEncodingWindowsCyrillic = 0x0502, + /// + /// code page 1253 + /// + kTextEncodingWindowsGreek = 0x0503, + /// + /// code page 1254, Turkish + /// + kTextEncodingWindowsLatin5 = 0x0504, + /// + /// code page 1255 + /// + kTextEncodingWindowsHebrew = 0x0505, + /// + /// code page 1256 + /// + kTextEncodingWindowsArabic = 0x0506, + /// + /// code page 1257 + /// + kTextEncodingWindowsBalticRim = 0x0507, + /// + /// code page 1258 + /// + kTextEncodingWindowsVietnamese = 0x0508, + /// + /// code page 1361, for Windows NT + /// + kTextEncodingWindowsKoreanJohab = 0x0510, + + // Various national standards begin at 0x600 + kTextEncodingUS_ASCII = 0x0600, + /// + /// ANSEL (ANSI Z39.47) for library use + /// + kTextEncodingANSEL = 0x0601, + /// + /// JIS Roman and 1-byte katakana (halfwidth) + /// + kTextEncodingJIS_X0201_76 = 0x0620, + kTextEncodingJIS_X0208_83 = 0x0621, + kTextEncodingJIS_X0208_90 = 0x0622, + kTextEncodingJIS_X0212_90 = 0x0623, + kTextEncodingJIS_C6226_78 = 0x0624, + /// + /// Shift-JIS format encoding of JIS X0213 planes 1 and 2 + /// + kTextEncodingShiftJIS_X0213 = 0x0628, + /// + /// JIS X0213 in plane-row-column notation (3 bytes) + /// + kTextEncodingJIS_X0213_MenKuTen = 0x0629, + kTextEncodingGB_2312_80 = 0x0630, + /// + /// annex to GB 13000-93; for Windows 95; EUC-CN extended + /// + kTextEncodingGBK_95 = 0x0631, + kTextEncodingGB_18030_2000 = 0x0632, + /// + /// same as KSC 5601-92 without Johab annex + /// + kTextEncodingKSC_5601_87 = 0x0640, + /// + /// KSC 5601-92 Johab annex + /// + kTextEncodingKSC_5601_92_Johab = 0x0641, + /// + /// CNS 11643-1992 plane 1 + /// + kTextEncodingCNS_11643_92_P1 = 0x0651, + /// + /// CNS 11643-1992 plane 2 + /// + kTextEncodingCNS_11643_92_P2 = 0x0652, + /// + /// CNS 11643-1992 plane 3 (was plane 14 in 1986 version) + /// + kTextEncodingCNS_11643_92_P3 = 0x0653, + + // ISO 2022 collections begin at 0x800 + /// + /// RFC 1468 + /// + kTextEncodingISO_2022_JP = 0x0820, + /// + /// RFC 1554 + /// + kTextEncodingISO_2022_JP_2 = 0x0821, + /// + /// RFC 2237 + /// + kTextEncodingISO_2022_JP_1 = 0x0822, + /// + /// JIS X0213 + /// + kTextEncodingISO_2022_JP_3 = 0x0823, + /// + /// RFC 1922 + /// + kTextEncodingISO_2022_CN = 0x0830, + /// + /// RFC 1922 + /// + kTextEncodingISO_2022_CN_EXT = 0x0831, + /// + /// RFC 1557 + /// + kTextEncodingISO_2022_KR = 0x0840, + + // EUC collections begin at 0x900 + /// + /// ISO 646, 1-byte katakana, JIS 208, JIS 212 + /// + kTextEncodingEUC_JP = 0x0920, + /// + /// ISO 646, GB 2312-80 + /// + kTextEncodingEUC_CN = 0x0930, + /// + /// ISO 646, CNS 11643-1992 Planes 1-16 + /// + kTextEncodingEUC_TW = 0x0931, + /// + /// RFC 1557: ISO 646, KS C 5601-1987 + /// + kTextEncodingEUC_KR = 0x0940, + + // Misc standards begin at 0xA00 + /// + /// plain Shift-JIS + /// + kTextEncodingShiftJIS = 0x0A01, + /// + /// RFC 1489, Russian internet standard + /// + kTextEncodingKOI8_R = 0x0A02, + /// + /// Big-5 (has variants) + /// + kTextEncodingBig5 = 0x0A03, + /// + /// Mac OS Roman permuted to align with ISO Latin-1 + /// + kTextEncodingMacRomanLatin1 = 0x0A04, + /// + /// HZ (RFC 1842, for Chinese mail & news) + /// + kTextEncodingHZ_GB_2312 = 0x0A05, + /// + /// Big-5 with Hong Kong special char set supplement + /// + kTextEncodingBig5_HKSCS_1999 = 0x0A06, + /// + /// RFC 1456, Vietnamese + /// + kTextEncodingVISCII = 0x0A07, + /// + /// RFC 2319, Ukrainian + /// + kTextEncodingKOI8_U = 0x0A08, + /// + /// Taiwan Big-5E standard + /// + kTextEncodingBig5_E = 0x0A09, + + // Other platform encodings + /// + /// NextStep Latin encoding + /// + kTextEncodingNextStepLatin = 0x0B01, + /// + /// NextStep Japanese encoding (variant of EUC-JP) + /// + kTextEncodingNextStepJapanese = 0x0B02, + + // EBCDIC & IBM host encodings begin at 0xC00 + /// + /// basic EBCDIC-US + /// + kTextEncodingEBCDIC_US = 0x0C01, + /// + /// code page 037, extended EBCDIC (Latin-1 set) for US,Canada... + /// + kTextEncodingEBCDIC_CP037 = 0x0C02, + + // Special values + /// + /// Multi-encoding text with external run info + /// + kTextEncodingMultiRun = 0x0FFF, + /// + /// Unknown or unspecified + /// + kTextEncodingUnknown = 0xFFFF + } + } +} \ No newline at end of file