Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/ntfstools
In directory usw-pr-cvs1:/tmp/cvs-serv6688/ntfstools
Modified Files:
mkntfs.c
Log Message:
mkntfs delayed. more reverse engineering required to determine exact method of
index entry collation. first few helper functions are already done and entered
into ntfslib in unistr.c
Index: mkntfs.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/mkntfs.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -U2 -r1.16 -r1.17
--- mkntfs.c 2001/06/08 19:58:25 1.16
+++ mkntfs.c 2001/06/09 00:25:56 1.17
@@ -2104,4 +2104,5 @@
// means! Check it out!!! It quite probably is a comparison of the
// actual names within the file_name_attributes rather than this.
+ // TODO: It is not correct indeed. Reverse engineering has begun...
index_end = (char*)&index->index +
le32_to_cpu(index->index.index_length);
@@ -2308,4 +2309,7 @@
}
+#define MAKE_MFT_REF(_ref, _seqno) cpu_to_le64((((__u64)(_seqno)) << 48) \
+ | ((__u64)(_ref)))
+
int main(int argc, char **argv)
{
@@ -2732,5 +2736,5 @@
}
/* The root directory mft reference. */
- root_ref = cpu_to_le64((__u64)FILE_$root << 48 | FILE_$root);
+ root_ref = MAKE_MFT_REF(FILE_$root, FILE_$root);
Dprintf("Creating root directory (mft record 5)\n");
m = (MFT_RECORD*)(buf + 5 * opt.mft_record_size);
@@ -2773,15 +2777,7 @@
err = add_attr_data_positioned(m, NULL, 0, 0, NULL, 0, 0, rl_mft, buf,
opt.mft_size);
- // FIXME: Do a higher level directory link insertion so that we make
- // a call simillar to the below but also with the parent dir and that
- // call does the add_attr_file_name and the insert_file_link_in_dir
- // and anything else necessary in one go.
- // Also think about in general having the functions return the created
- // attribute value so we can modify it in memory and at the end sync to
- // disk rather than having each function call result in a disk read.
- // Even though read/writes should be cached in the buffer cache so it
- // shouldn't be too much of a problem.
if (!err)
- err = add_attr_file_name(m, root_ref, opt.mft_size,
+ err = create_hardlink(index_block, root_ref, m,
+ MAKE_MFT_REF(FILE_$MFT, 1), opt.mft_size,
opt.mft_size, FILE_ATTR_HIDDEN |
FILE_ATTR_SYSTEM, 0, 0, "$MFT",
|