Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/include
In directory usw-pr-cvs1:/tmp/cvs-serv1569/include
Modified Files:
layout.h
Log Message:
Fix/expand dircetory info in layout.h and add creation of index root attribute
to mkntfs.c.
Index: layout.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/layout.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -U2 -r1.3 -r1.4
--- layout.h 2001/06/01 19:04:08 1.3
+++ layout.h 2001/06/03 02:09:08 1.4
@@ -1675,15 +1675,19 @@
*/
typedef enum {
- /* When index header is in an index root attribute. */
- NO_INDEX_NODE = 0, /* Small index, i.e. the whole index fits inside
- the index root attribute and hence there is no
- index allocation attribute. */
- HAS_INDEX_NODE = 1, /* Large index, i.e. it doesn't fit in the index
- root attribute and hence an index allocation
+ /* When index header is in an index root attribute: */
+ SMALL_INDEX = 0, /* The index is small enough to fit inside the
+ index root attribute and there is no index
+ allocation attribute present. */
+ LARGE_INDEX = 1, /* The index is too large to fit in the index
+ root attribute and/or an index allocation
attribute is present. */
- /* When index header is in an index block, i.e. is part of index
- allocation attribute. */
- IS_LEAF_NODE = 0, /* */
- NOT_LEAF_NODE = 1, /* */
+ /*
+ * When index header is in an index block, i.e. is part of index
+ * allocation attribute:
+ */
+ LEAF_NODE = 0, /* This is a leaf node, i.e. there are no more
+ nodes branching off it. */
+ INDEX_NODE = 1, /* This node indexes other nodes, i.e. is not a
+ leaf node. */
} __attribute__ ((__packed__)) INDEX_HEADER_FLAGS;
@@ -1693,13 +1697,14 @@
* make up a complete index.
*
- * NOTE: Offsets/sizes are counted relative to the start of the index header
- * structure.
+ * IMPORTANT NOTE: The offset, length and size structure members are counted
+ * relative to the start of the index header structure and not relative to the
+ * start of the index root or index allocation structures themselves.
*/
typedef struct {
__u32 entries_offset; /* Byte offset to first INDEX_ENTRY. */
- __u32 index_block_length; /* Data size of the index in bytes,
+ __u32 index_length; /* Data size of the index in bytes,
i.e. bytes used from allocated
size. */
- __u32 allocated_size; /* Byte size of the index block. */
+ __u32 allocated_size; /* Byte size of this index (block). */
/* NOTE: For the index root attribute, the above two numbers are always
equal, as the attribute is resident and it is resized as needed. In
@@ -1726,5 +1731,6 @@
* index block.
*
- * NOTE: The root directory (FILE_$root) contains an entry for itself.
+ * NOTE: The root directory (FILE_$root) contains an entry for itself. Other
+ * dircetories do not contain entries for themselves, though.
*/
typedef struct {
@@ -1736,5 +1742,5 @@
index entries. If type is $FILE_NAME,
this must be COLLATION_FILE_NAME. */
- __u32 bytes_per_index_block; /* Byte size of each index block (in
+ __u32 index_block_size; /* Size of each index block in bytes (in
the index allocation attribute). */
__u8 clusters_per_index_block; /* Cluster size of each index block (in
@@ -1875,12 +1881,8 @@
/*
- * This is an index entry. A sequence of such entries follows each INDEX_HEADER
- * structure. Together they make up a complete index. The index follows either
- * an index root attribute or an index allocation attribute.
- *
- * NOTE: Before NTFS 3.0 only filename attributes were indexed.
+ * This the index entry header (see below).
*/
typedef struct {
- union { /* Only valid when INDEX_ENTRY_END is not set. */
+/* 0*/ union { /* Only valid when INDEX_ENTRY_END is not set. */
MFT_REF indexed_file; /* The mft reference of the file
described by this index
@@ -1895,10 +1897,22 @@
} __attribute__ ((__packed__));
} __attribute__ ((__packed__));
- __u16 length; /* Byte size of this index entry. */
- __u16 key_length; /* Byte size of the key value, which is in the
+/* 8*/ __u16 length; /* Byte size of this index entry. */
+/* 10*/ __u16 key_length; /* Byte size of the key value, which is in the
index entry. It follows field reserved. */
- INDEX_ENTRY_FLAGS flags; /* Bit field of INDEX_ENTRY_* flags. */
- __u16 reserved; /* Reserved/align to 8-byte boundary. */
- union { /* The key of the indexed attribute. NOTE: Only present
+/* 12*/ INDEX_ENTRY_FLAGS flags; /* Bit field of INDEX_ENTRY_* flags. */
+/* 14*/ __u16 reserved; /* Reserved/align to 8-byte boundary. */
+/* sizeof() = 16 bytes */
+} __attribute__ ((__packed__)) INDEX_ENTRY_HEADER;
+
+/*
+ * This is an index entry. A sequence of such entries follows each INDEX_HEADER
+ * structure. Together they make up a complete index. The index follows either
+ * an index root attribute or an index allocation attribute.
+ *
+ * NOTE: Before NTFS 3.0 only filename attributes were indexed.
+ */
+typedef struct {
+/* 0*/ INDEX_ENTRY_HEADER; /* The index entry header (see above). */
+/* 16*/ union { /* The key of the indexed attribute. NOTE: Only present
if INDEX_ENTRY_END bit in flags is not set. NOTE: On
NTFS versions before 3.0 the only valid key is the
@@ -1932,4 +1946,9 @@
*
* Contains an array of bits (aka a bitfield).
+ *
+ * When used in conjunction with the index allocation attribute, each bit
+ * corresponds to one index block within the index allocation attribute. Thus
+ * the number of bits in the bitmap * index block size / cluster size is the
+ * number of clusters in the index allocation attribute.
*/
typedef struct {
|