Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/include
In directory usw-pr-cvs1:/tmp/cvs-serv28090/include
Modified Files:
attrib.h mft.h ntfs_rec.h
Log Message:
More header development. AttrDef description.
Index: attrib.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/attrib.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** attrib.h 2001/01/27 14:22:02 1.3
--- attrib.h 2001/01/28 05:49:57 1.4
***************
*** 27,30 ****
--- 27,49 ----
/*
+ * The data attribute of FILE_$AttrDef contains a sequence of attribute
+ * definitions for the NTFS volume. With this, it is supposed to be safe for an
+ * older NTFS driver to mount a volume containing a newer NTFS version without
+ * damaging it (that's the theory. In practice it's: not damaging it too much).
+ * The flags describe whether the attribute can be resident/non-resident and
+ * possibly other things, too but the actual bits are unknown.
+ */
+ typedef struct {
+ /*hex ofs*/
+ /* 0*/ __u16 name[64]; /* Name of the attribute. */
+ /* 80*/ __u32 type; /* Type of the attribute. */
+ /* 84*/ __u32 unknown[2]; /* ??? */
+ /* 8c*/ __u32 flags; /* ??? */
+ /* 90*/ __u64 min_size; /* Minimum size of attribute. */
+ /* 98*/ __u64 max_size; /* Maximum size of attribute. */
+ /* sizeof() = 0xa0 or 160 bytes */
+ } __attribute__ ((__packed__)) ATTRIBUTE_DEFINITION;
+
+ /*
* System defined attributes (32-bit).
*/
***************
*** 52,83 ****
/*
- * System file numbers. All these files are always marked as used in the $Mft
- * bitmap attribute, presumably in order to avoid accidental allocation for
- * random other mft records.
- */
- typedef enum {
- FILE_$Mft = 0, /* Master file table (mft). */
- FILE_$MftMirr = 1, /* Mft mirror (copy of first 4 mft records). */
- FILE_$LogFile = 2, /* Journalling log. */
- FILE_$Volume = 3, /* Volume name, flags and ntfs version. */
- FILE_$AttrDef = 4, /* Attribute definitions. */
- FILE_$root = 5, /* Root directory. */
- FILE_$BitMap = 6, /* Allocation map of all clusters. */
- FILE_$Boot = 7, /* Boot sector (always at cluster 0). */
- FILE_$BadClus = 8, /* Contains all bad clusters. */
- FILE_$Secure = 9, /* Shared security descriptors. */
- FILE_$UpCase = 10, /* Upcase table for all 65536 Unicode chars. */
- FILE_$Extend = 11, /* Directory containing other system files (eg.
- $ObjId, $Quota, $Reparse and $UsnJrnl). This
- is new to NTFS3.0. */
- FILE_reserved12 = 12, /* Reserved for future use (records 12-15). */
- FILE_reserved13 = 13,
- FILE_reserved14 = 14,
- FILE_reserved15 = 15,
- FILE_first_user = 16, /* First user file, used as test limit for
- whether to allow opening a file or not. */
- } NTFS_SYSTEM_FILES;
-
- /*
* Attribute flags (16-bit).
*/
--- 71,74 ----
***************
*** 85,89 ****
ATTRIBUTE_IS_COMPRESSED = cpu_to_le16(0x0001),
ATTRIBUTE_COMPRESSION_MASK = cpu_to_le16(0x00ff), /* Compression method
! * mask. First
* illegal value. */
ATTRIBUTE_IS_ENCRYPTED = cpu_to_le16(0x4000),
--- 76,80 ----
ATTRIBUTE_IS_COMPRESSED = cpu_to_le16(0x0001),
ATTRIBUTE_COMPRESSION_MASK = cpu_to_le16(0x00ff), /* Compression method
! * mask. Also, first
* illegal value. */
ATTRIBUTE_IS_ENCRYPTED = cpu_to_le16(0x4000),
***************
*** 96,100 ****
typedef struct {
/*Ofs*/
! /* 0*/ ATTRIBUTE_TYPE type; /* The (4-byte) type of the attribute. */
/* 4*/ __u32 length; /* Byte size of the resident part of the
attribute (aligned to 8-byte boundary). */
--- 87,91 ----
typedef struct {
/*Ofs*/
! /* 0*/ ATTRIBUTE_TYPE type; /* The (32-bit) type of the attribute. */
/* 4*/ __u32 length; /* Byte size of the resident part of the
attribute (aligned to 8-byte boundary). */
***************
*** 107,111 ****
record. Note that the name is stored as a
Unicode string. */
! /* 12*/ ATTRIBUTE_FLAGS flags; /* Bit array of ATTRIBUTE_* flags (16-bit). */
/* 14*/ __u16 instance; /* The instance of this attribute record. This
number is unique within this mft record (see
--- 98,102 ----
record. Note that the name is stored as a
Unicode string. */
! /* 12*/ ATTRIBUTE_FLAGS flags; /* Flags describing the attribute. */
/* 14*/ __u16 instance; /* The instance of this attribute record. This
number is unique within this mft record (see
***************
*** 121,125 ****
RESIDENT_ATTRIBUTE_IS_INDEXED = 0x01, /* Attribute is referenced in
an index somewhere (has
! implications for deleting
modifying the attribute). */
} __attribute__ ((__packed__)) RESIDENT_ATTRIBUTE_FLAGS;
--- 112,116 ----
RESIDENT_ATTRIBUTE_IS_INDEXED = 0x01, /* Attribute is referenced in
an index somewhere (has
! implications for deleting or
modifying the attribute). */
} __attribute__ ((__packed__)) RESIDENT_ATTRIBUTE_FLAGS;
***************
*** 147,154 ****
/* 16*/ __u64 lowest_vcn; /* Lowest valid virtual cluster number (vcn)
for this portion of the attribute value or
! 0 if this is the only portion (usually the
case. - Only when an attribute list is used
does lowest_vcn != 0 ever occur. */
! /* 24*/ __u64 highest_vcn; /* Highest valid vcn of this portion of the
attribute value. - Usually there is only one
portion, so this usually equals the attribute
--- 138,145 ----
/* 16*/ __u64 lowest_vcn; /* Lowest valid virtual cluster number (vcn)
for this portion of the attribute value or
! 0 if this is the only extent (usually the
case. - Only when an attribute list is used
does lowest_vcn != 0 ever occur. */
! /* 24*/ __u64 highest_vcn; /* Highest valid vcn of this extent of the
attribute value. - Usually there is only one
portion, so this usually equals the attribute
***************
*** 238,249 ****
* NOTE: Always resident.
* NOTE: Present in all base file records on a volume.
*/
typedef struct {
/*Ofs*/
! /* 0*/ __u64 creation_time; /* When the file was created. */
! /* 8*/ __u64 last_modification_time; /* Time of last change of data
! attribute. */
! /* 16*/ __u64 last_change_time; /* Time of last change of this mft
! record. */
/* 24*/ __u64 last_access_time; /* Approximate time when the file was
last accessed (obviously this is not
--- 229,245 ----
* NOTE: Always resident.
* NOTE: Present in all base file records on a volume.
+ * NOTE: There is conflicting information about the meaning of each of the time
+ * fields but the meaning as defined below has been verified to be
+ * correct by practical experimentation on Windows NT4 SP6a and is hence
+ * assumed to be the one and only correct interpretation.
*/
typedef struct {
/*Ofs*/
! /* 0*/ __u64 creation_time; /* Time file was created. Updated when
! a filename is changed(?). */
! /* 8*/ __u64 last_data_change_time; /* Time the data attribute was last
! modified. */
! /* 16*/ __u64 last_mft_change_time; /* Time this mft record was last
! modified. */
/* 24*/ __u64 last_access_time; /* Approximate time when the file was
last accessed (obviously this is not
***************
*** 310,327 ****
* Attribute: Attribute list (0x20).
*
! * The value of the attribute list attribute consists of a sequence of
! * variable length, 64-bit aligned ATTRIBUTE_LIST_ENTRY records. The value
! * can be either resident or non-resident.
! * The attribute list attribute contains one entry for each attribute of the
! * file in which the list is located, except for the list attribute itself.
! * The list is sorted first by: attribute type, then by attribute name (if
! * present) and third by attribute value. In the third case the attribute
! * value of the referenced attribute is required to be resident. Also, it is
! * not allowed to have two attributes with all three sorting keys equal.
! * Further restrictions:
* - If not resident, the vcn to lcn mapping array has to fit inside the
* base mft record.
* - The attribute list attribute value has a maximum size of 256kb. This
* is imposed by the Windows cache manager.
*/
typedef struct {
--- 306,335 ----
* Attribute: Attribute list (0x20).
*
! * NOTE: Can be either resident or non-resident.
! * NOTE: Value consists of a sequence of variable length, 8-byte aligned,
! * ATTRIBUTE_LIST_ENTRY records.
! * NOTE: The attribute list attribute contains one entry for each attribute of
! * the file in which the list is located, except for the list attribute
! * itself. The list is sorted: first by attribute type, then by attribute
! * name (if present) and third by attribute value. In the third case the
! * attribute value of the referenced attribute is required to be
! * resident. Also, it is not allowed to have two attributes with all
! * three sorting keys equal.
! * NOTE: Further restrictions:
* - If not resident, the vcn to lcn mapping array has to fit inside the
* base mft record.
* - The attribute list attribute value has a maximum size of 256kb. This
* is imposed by the Windows cache manager.
+ * NOTE: Attribute lists are only used when the attributes of mft record do not
+ * fit inside the mft record despite all attributes (that can be made
+ * non-resident) having been made non-resident. This can happen e.g. when:
+ * - File has a large number of hard links (lots of file name
+ * attributes present).
+ * - The mapping pairs array of some non-resident attribute
+ * becomes so large due to fragmentation that it overflows the
+ * mft record.
+ * - The security descriptor is very complex (not applicable to
+ * NTFS 3.0 volumes).
+ * - There are many named streams.
*/
typedef struct {
***************
*** 367,374 ****
/*
! * Possible namespaces for filenames in ntfs.
*/
typedef enum {
! FILENAME_POSIX = cpu_to_le16(0x0000),
/* This is the largest namespace. It is case sensitive and
allows all Unicode characters except for: '\0' and '/'.
--- 375,382 ----
/*
! * Possible namespaces for filenames in ntfs (8-bit).
*/
typedef enum {
! FILENAME_POSIX = 0x00,
/* This is the largest namespace. It is case sensitive and
allows all Unicode characters except for: '\0' and '/'.
***************
*** 377,396 ****
standard utilities and thus a "del filename" will delete
both "filename" and "fileName" without warning. */
! FILENAME_WIN32 = cpu_to_le16(0x0001),
/* The standard WinNT/2k NTFS long filenames. Case insensitive.
All Unicode chars except: '\0', '"', '*', '/', ':', '<',
'>', '?', '\' and '|'. Further, names cannot end with a '.'
or a space. */
! FILENAME_DOS = cpu_to_le16(0x0002),
/* The standard DOS filenames (8.3 format). Uppercase only.
All 8-bit characters greater space, except: '"', '*', '+',
',', '/', ':', ';', '<', '=', '>', '?' and '\'. */
! FILENAME_WIN32_AND_DOS = cpu_to_le16(0x0003),
/* 3 means that both the Win32 and the DOS filenames are
identical and hence have been saved in this single filename
record. */
- SIZE_INDICATOR_FOR_ATTRIBUTE_PACKED = 0xffff;
- /* This is not defined by ntfs but we need it to tell gcc
- to make this enum type 16-bit. */
} __attribute__ ((__packed__)) FILENAME_TYPE_FLAGS;
--- 385,401 ----
standard utilities and thus a "del filename" will delete
both "filename" and "fileName" without warning. */
! FILENAME_WIN32 = 0x01,
/* The standard WinNT/2k NTFS long filenames. Case insensitive.
All Unicode chars except: '\0', '"', '*', '/', ':', '<',
'>', '?', '\' and '|'. Further, names cannot end with a '.'
or a space. */
! FILENAME_DOS = 0x02,
/* The standard DOS filenames (8.3 format). Uppercase only.
All 8-bit characters greater space, except: '"', '*', '+',
',', '/', ':', ';', '<', '=', '>', '?' and '\'. */
! FILENAME_WIN32_AND_DOS = 0x03,
/* 3 means that both the Win32 and the DOS filenames are
identical and hence have been saved in this single filename
record. */
} __attribute__ ((__packed__)) FILENAME_TYPE_FLAGS;
***************
*** 399,402 ****
--- 404,415 ----
*
* NOTE: Always resident.
+ * NOTE: All fields, except the parent_directory_mft_reference are only updated
+ * when the filename is changed. Until then, they just become out of sync
+ * with reality and the more up to date values are present in the
+ * standard information attribute.
+ * NOTE: There is conflicting information about the meaning of each of the time
+ * fields but the meaning as defined below has been verified to be
+ * correct by practical experimentation on Windows NT4 SP6a and is hence
+ * assumed to be the one and only correct interpretation.
*/
typedef struct {
***************
*** 404,415 ****
referenced from. */
__u64 creation_time; /* Time file was created. */
! __u64 last_modification_time; /* Time data attribute was
last modified. */
! __u64 last_change_time; /* Time mft record was
! modified. */
! __u64 last_access_time; /* Last time mft record was
! accessed. See notes for this
! in attribute standard
! information above. */
__u64 allocated_size; /* Byte size of allocated space
for the data attribute.
--- 417,426 ----
referenced from. */
__u64 creation_time; /* Time file was created. */
! __u64 last_data_change_time; /* Time the data attribute was
! last modified. */
! __u64 last_mft_change_time; /* Time this mft record was
last modified. */
! __u64 last_access_time; /* Last time this mft record
! was accessed. */
__u64 allocated_size; /* Byte size of allocated space
for the data attribute.
***************
*** 420,424 ****
NOTE: Only present when
lowest_vcn is 0. */
! FILE_ATTRIBUTE_FLAGS file_attributes; /* Flags describing the file.*/
union {
struct {
--- 431,435 ----
NOTE: Only present when
lowest_vcn is 0. */
! FILE_ATTRIBUTE_FLAGS file_attributes; /* Flags describing the file. */
union {
struct {
***************
*** 434,440 ****
} __attribute__ ((__packed__));
__u8 filename_length; /* Length of filename in
! Unicode characters. */
! __u8 filename_type; /* Bit field of FILENAME_TYPE_*
! flags. */
__u16 filename[filename_length]; /* Filename in Unicode. */
} __attribute__ ((__packed__)) FILENAME_ATTRIBUTE;
--- 445,450 ----
} __attribute__ ((__packed__));
__u8 filename_length; /* Length of filename in
! (Unicode) characters. */
! FILENAME_TYPE_FLAGS filename_type; /* Namespace of the filename. */
__u16 filename[filename_length]; /* Filename in Unicode. */
} __attribute__ ((__packed__)) FILENAME_ATTRIBUTE;
Index: mft.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/mft.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** mft.h 2001/01/27 14:22:02 1.2
--- mft.h 2001/01/28 05:49:57 1.3
***************
*** 30,33 ****
--- 30,73 ----
/*
+ * System file numbers. All these files are always marked as used in the bitmap
+ * attribute of the mft; presumably in order to avoid accidental allocation for
+ * random other mft records.
+ */
+ typedef enum {
+ FILE_$Mft = 0, /* Master file table (mft). Data attribute
+ contains the entries and bitmap attribute
+ records which ones are in use (bit==1). */
+ FILE_$MftMirr = 1, /* Mft mirror (copy of first four mft records)
+ in data attribute. */
+ FILE_$LogFile = 2, /* Journalling log in data attribute. */
+ FILE_$Volume = 3, /* Volume name attribute and volume information
+ attribute (flags and ntfs version). */
+ FILE_$AttrDef = 4, /* Array of attribute definitions in data
+ attribute. */
+ FILE_$root = 5, /* Root directory. */
+ FILE_$BitMap = 6, /* Allocation bitmap of all clusters in bitmap
+ attribute. */
+ FILE_$Boot = 7, /* Boot sector (always at cluster 0) in data
+ attribute. */
+ FILE_$BadClus = 8, /* Contains all bad clusters in the non-resident
+ data attribute. */
+ FILE_$Secure = 9, /* Shared security descriptors in data attribute
+ and two indexes into the descriptors.
+ Appeared in Windows NT4 SP4 (I think). */
+ FILE_$UpCase = 10, /* Uppercase equivalents of all 65536 Unicode
+ characters in data attribute. */
+ FILE_$Extend = 11, /* Directory containing other system files (eg.
+ $ObjId, $Quota, $Reparse and $UsnJrnl). This
+ is new to NTFS3.0. */
+ FILE_reserved12 = 12, /* Reserved for future use (records 12-15). */
+ FILE_reserved13 = 13,
+ FILE_reserved14 = 14,
+ FILE_reserved15 = 15,
+ FILE_first_user = 16, /* First user file, used as test limit for
+ whether to allow opening a file or not. */
+ } NTFS_SYSTEM_FILES;
+
+
+ /*
* These are the so far known MFT_RECORD_* flags which contain information
* about the mft record in which they are present.
***************
*** 42,47 ****
* used whenever a structure needs to refer to a record in the mft.
*
! * A reference consists of the 48-bit index into the mft and the 16-bit
! * sequence number used to detect stale references.
*
* The sequence number is a circular counter (skipping 0) describing how many
--- 82,87 ----
* used whenever a structure needs to refer to a record in the mft.
*
! * A reference consists of a 48-bit index into the mft and a 16-bit sequence
! * number used to detect stale references.
*
* The sequence number is a circular counter (skipping 0) describing how many
***************
*** 56,61 ****
* for high_part being 0 and if not either BUG(), cause a panic() or handle
* the situation in some other way. This shouldn't be a problem as a volume has
! * to become HUGE in order to need more than 32 bits worth of mft records.
! * Assuming the standard mft records size of 1kb only the records (never mind
* the non-resident attributes, etc.) would require 4Tb of space on their own
* for the first 32 bits worth of records. This is only if some strange person
--- 96,101 ----
* for high_part being 0 and if not either BUG(), cause a panic() or handle
* the situation in some other way. This shouldn't be a problem as a volume has
! * to become HUGE in order to need more than 32-bits worth of mft records.
! * Assuming the standard mft record size of 1kb only the records (never mind
* the non-resident attributes, etc.) would require 4Tb of space on their own
* for the first 32 bits worth of records. This is only if some strange person
***************
*** 65,82 ****
*/
typedef union {
! struct {
! struct {
! __u32 low_part; /* Mft record number being referenced split */
! __u16 high_part;/* into the low 32-bits and the high 16-bits. */
} __attribute__ ((__packed__));
! __u16 sequence_number; /* The sequence number, see above. */
! } __attribute__ ((__packed__));
! __u64 mft_reference; /* The whole mft reference as one number. */
} __attribute__ ((__packed__)) MFT_REFERENCE;
! /* The mft record header present at the beginning of every record in the mft. */
typedef struct {
/*Ofs*/
! /* 0*/ NTFS_RECORD_HEADER ntfs;
/* 8*/ __s64 lsn; /* Log file sequence number for this record. */
/* 16*/ __u16 sequence_number; /* Number of times this mft record has been
--- 105,131 ----
*/
typedef union {
! /* We have a union so that we can either use the reference as one
! 64-bit number or as the individual parts (i.e. the mft index and the
! sequence number) broken up using a structure. Since there is no
! 48-bit data type we need to use another struct dividing the mft
! index into the low 32-bits and the high 16-bits. */
! struct {
! struct {
! __u32 low_part; /* Low 32-bits of mft index. */
! __u16 high_part; /* High 32-bits of mft index. */
! } __attribute__ ((__packed__));
! __u16 sequence_number; /* 16-bit sequence number. */
} __attribute__ ((__packed__));
!
! __u64 mft_reference; /* Mft reference as one value.*/
} __attribute__ ((__packed__)) MFT_REFERENCE;
! /*
! * The mft record header present at the beginning of every record in the mft.
! * This is followed by a sequence of variable length attribute records.
! */
typedef struct {
/*Ofs*/
! /* 0*/ NTFS_RECORD_HEADER ntfs;/* Usually the magic is "FILE". */
/* 8*/ __s64 lsn; /* Log file sequence number for this record. */
/* 16*/ __u16 sequence_number; /* Number of times this mft record has been
***************
*** 110,114 ****
belongs (this is then used to locate the
attribute list attribute present in the base
! record which describes the extension record
and hence might need modification when the
extension record itself is modified). */
--- 159,163 ----
belongs (this is then used to locate the
attribute list attribute present in the base
! record which describes this extension record
and hence might need modification when the
extension record itself is modified). */
Index: ntfs_rec.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/ntfs_rec.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ntfs_rec.h 2001/01/24 02:13:24 1.1
--- ntfs_rec.h 2001/01/28 05:49:57 1.2
***************
*** 28,32 ****
/*
* Magic identifiers present at the beginning of all ntfs record containing
! * records (like mft records for example.
*/
typedef enum {
--- 28,32 ----
/*
* Magic identifiers present at the beginning of all ntfs record containing
! * records (like mft records for example).
*/
typedef enum {
***************
*** 71,76 ****
* this array is contained. Note that the first entry is the Update Sequence
* Number (usn), a cyclic counter of how many times the protected record has
! * been written to disk. (The values 0 and -1 (ie. 0xffff) are not used.) All
! * last __u16's of each sector have to be equal to the Usn (during reading) or
* are set to it (during writing). If they are not, an incomplete multi sector
* transfer has occured when the data was written.
--- 71,76 ----
* this array is contained. Note that the first entry is the Update Sequence
* Number (usn), a cyclic counter of how many times the protected record has
! * been written to disk. The values 0 and -1 (ie. 0xffff) are not used. All
! * last __u16's of each sector have to be equal to the usn (during reading) or
* are set to it (during writing). If they are not, an incomplete multi sector
* transfer has occured when the data was written.
|