Changes by: flatcap
Update of /cvsroot/linux-ntfs/ntfs-driver-tng/scripts
In directory usw-pr-cvs1:/tmp/cvs-serv16949/scripts
Modified Files:
compat.c rl.c
Log Message:
now the real file and the test cases both work
Index: compat.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/scripts/compat.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -U2 -r1.7 -r1.8
--- compat.c 12 Feb 2002 02:30:59 -0000 1.7
+++ compat.c 12 Feb 2002 16:12:55 -0000 1.8
@@ -269,15 +269,14 @@
printf(" VCN LCN len\n");
- for (i = 0; ; i++) {
- LCN lcn = (rl + i)->lcn;
+ for (i = 0; ; i++, rl++) {
+ LCN lcn = rl->lcn;
- if (abbr) {
- if (len > 50) {
- if (i == 3)
+ if (abbr)
+ if (len > 20) {
+ if (i == 4)
printf (" ...\n");
- if ((i > 2) && (i < (len - 2)))
+ if ((i > 3) && (i < (len - 3)))
continue;
}
- }
if (lcn < (LCN)0) {
@@ -287,11 +286,9 @@
index = 4;
printf("%8lld %8s %8lld\n",
- (rl + i)->vcn, lcn_str[index],
- (rl + i)->length);
+ rl->vcn, lcn_str[index], rl->length);
} else
printf("%8lld %8lld %8lld\n",
- (rl + i)->vcn, (rl + i)->lcn,
- (rl + i)->length);
- if (!(rl + i)->length)
+ rl->vcn, rl->lcn, rl->length);
+ if (!rl->length)
break;
}
Index: rl.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/scripts/rl.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -U2 -r1.15 -r1.16
--- rl.c 12 Feb 2002 03:41:08 -0000 1.15
+++ rl.c 12 Feb 2002 16:12:55 -0000 1.16
@@ -199,7 +199,11 @@
rl_mc (res, loc + disc - hole, new, left, nsize - left);
- if (res[loc+nsize-left+disc-hole].lcn <= LCN_HOLE) {
+ if ((res[loc+nsize-left+disc-hole].lcn == LCN_HOLE) ||
+ (res[loc+nsize-left+disc-hole].lcn == LCN_RL_NOT_MAPPED)) {
res[loc+nsize-left+disc-hole].length -= (new[nsize-1].vcn +
new[nsize-1].length - new[0].vcn);
+ }
+
+ if (res[loc+nsize-left+disc-hole].lcn <= LCN_HOLE) {
res[loc+nsize-left+disc-hole].vcn =
res[loc+nsize-left+disc-hole-1].vcn +
@@ -261,5 +265,5 @@
left = ntfs_rl_merge (orig + loc - 1, new);
- printf("loc = %i, right = %i, left = %i\n", loc, right, left);
+ //printf("loc = %i, right = %i, left = %i\n", loc, right, left);
res = ntfs_rl_realloc (orig, osize, osize + nsize - left - right);
@@ -461,8 +465,8 @@
(srl[send-1].vcn + srl[send-1].length)));
- ntfs_debug("dstart = %i, dfinal = %i, dend = %i\n", dstart, dfinal, dend);
- ntfs_debug("sstart = %i, sfinal = %i, send = %i\n", sstart, sfinal, send);
- ntfs_debug("start = %i, finish = %i\n", start, finish);
- ntfs_debug("ds = %i, ss = %i, dins = %i\n", ds, ss, dins);
+ //ntfs_debug("dstart = %i, dfinal = %i, dend = %i\n", dstart, dfinal, dend);
+ //ntfs_debug("sstart = %i, sfinal = %i, send = %i\n", sstart, sfinal, send);
+ //ntfs_debug("start = %i, finish = %i\n", start, finish);
+ //ntfs_debug("ds = %i, ss = %i, dins = %i\n", ds, ss, dins);
if (start)
if (finish)
@@ -889,6 +893,6 @@
page1 = ntfs_malloc_nofs (PAGE_SIZE); \
page2 = ntfs_malloc_nofs (PAGE_SIZE); \
- memset (page1, 'D', PAGE_SIZE); \
- memset (page2, 'S', PAGE_SIZE); \
+ memset (page1, -7, PAGE_SIZE); \
+ memset (page2, -7, PAGE_SIZE); \
memcpy (page1, file##Y, sizeof (file##Y)); \
memcpy (page2, s##X, sizeof (s##X)); \
@@ -973,12 +977,10 @@
(R)->length = S;
- u8 *buf1 = NULL;
- u8 *buf2 = NULL;
- u8 *buf3 = NULL;
+ ATTR_RECORD *buf1 = NULL;
+ ATTR_RECORD *buf2 = NULL;
+ ATTR_RECORD *buf3 = NULL;
run_list *rl1 = NULL;
run_list *rl2 = NULL;
run_list *rl3 = NULL;
- run_list *res1 = NULL;
- run_list *res2 = NULL;
ntfs_volume vol;
@@ -997,24 +999,24 @@
vol.major_ver = 3;
- if (!read_buffer ("attr1", buf1, 1024))
+ if (!read_buffer ("attr1", (void*) buf1, 1024))
return 1;
- if (!read_buffer ("attr2", buf2, 1024))
+ if (!read_buffer ("attr2", (void*) buf2, 1024))
return 1;
- if (!read_buffer ("attr3", buf3, 1024))
+ if (!read_buffer ("attr3", (void*) buf3, 1024))
return 1;
// CASE 123 - WORKS FINE.
-#if 0
- rl1 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf1, NULL);
+#if 1 || (TEST == 1)
+ rl1 = decompress_mapping_pairs (&vol, buf1, NULL);
if (IS_ERR (rl1))
return 1;
//printf ("rl1 %p\n", rl1);
// rl_insert: OK
- rl2 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf2, rl1);
+ rl2 = decompress_mapping_pairs (&vol, buf2, rl1);
if (IS_ERR (rl2))
return 1;
//printf ("rl2 %p\n", rl2);
// rl_replace: OK
- rl3 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf3, rl2);
+ rl3 = decompress_mapping_pairs (&vol, buf3, rl2);
if (IS_ERR (rl3))
return 1;
@@ -1023,16 +1025,16 @@
// CASE 132 - DOESN'T WORK YET.
-#if 1
- rl1 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf1, NULL);
+#if 0 || (TEST == 2)
+ rl1 = decompress_mapping_pairs (&vol, buf1, NULL);
if (IS_ERR (rl1))
return 1;
//printf ("rl1 %p\n", rl1);
// rl_replace: FAILED
- rl2 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf3, rl1);
+ rl2 = decompress_mapping_pairs (&vol, buf3, rl1);
if (IS_ERR (rl2))
return 1;
//printf ("rl2 %p\n", rl2);
// not looked at
- rl3 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf2, rl2);
+ rl3 = decompress_mapping_pairs (&vol, buf2, rl2);
if (IS_ERR (rl3))
return 1;
@@ -1041,16 +1043,16 @@
// CASE 213 - DOESN'T WORK YET.
-#if 0
- rl1 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf2, NULL);
+#if 0 || (TEST == 3)
+ rl1 = decompress_mapping_pairs (&vol, buf2, NULL);
if (IS_ERR (rl1))
return 1;
//printf ("rl1 %p\n", rl1);
// rl_append: FAILED
- rl2 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf1, rl1);
+ rl2 = decompress_mapping_pairs (&vol, buf1, rl1);
if (IS_ERR (rl2))
return 1;
//printf ("rl2 %p\n", rl2);
// not looked at
- rl3 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf3, rl2);
+ rl3 = decompress_mapping_pairs (&vol, buf3, rl2);
if (IS_ERR (rl3))
return 1;
@@ -1059,16 +1061,16 @@
// CASE 312 - DOESN'T WORK YET.
-#if 0
- rl1 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf3, NULL);
+#if 0 || (TEST == 4)
+ rl1 = decompress_mapping_pairs (&vol, buf3, NULL);
if (IS_ERR (rl1))
return 1;
//printf ("rl1 %p\n", rl1);
// rl_append: FAILED
- rl2 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf1, rl1);
+ rl2 = decompress_mapping_pairs (&vol, buf1, rl1);
if (IS_ERR (rl2))
return 1;
//printf ("rl2 %p\n", rl2);
// not looked at
- rl3 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf2, rl2);
+ rl3 = decompress_mapping_pairs (&vol, buf2, rl2);
if (IS_ERR (rl3))
return 1;
@@ -1077,16 +1079,16 @@
// CASE 231 - DOESN'T WORK YET.
-#if 0
- rl1 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf2, NULL);
+#if 0 || (TEST == 5)
+ rl1 = decompress_mapping_pairs (&vol, buf2, NULL);
if (IS_ERR (rl1))
return 1;
//printf ("rl1 %p\n", rl1);
// rl_replace: OK
- rl2 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf3, rl1);
+ rl2 = decompress_mapping_pairs (&vol, buf3, rl1);
if (IS_ERR (rl2))
return 1;
//printf ("rl2 %p\n", rl2);
// rl_append: FAILED
- rl3 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf1, rl2);
+ rl3 = decompress_mapping_pairs (&vol, buf1, rl2);
if (IS_ERR (rl3))
return 1;
@@ -1095,55 +1097,19 @@
// CASE 321 - DOESN'T WORK YET.
-#if 0
- rl1 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf3, NULL);
+#if 0 || (TEST == 6)
+ rl1 = decompress_mapping_pairs (&vol, buf3, NULL);
if (IS_ERR (rl1))
return 1;
//printf ("rl1 %p\n", rl1);
// rl_split: FAILED
- rl2 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf2, rl1);
+ rl2 = decompress_mapping_pairs (&vol, buf2, rl1);
if (IS_ERR (rl2))
return 1;
//printf ("rl2 %p\n", rl2);
// not looked at
- rl3 = decompress_mapping_pairs (&vol, (ATTR_RECORD*) buf1, rl2);
+ rl3 = decompress_mapping_pairs (&vol, buf1, rl2);
if (IS_ERR (rl3))
return 1;
//printf ("rl3 %p\n", rl3);
-#endif
-
- //ntfs_debug_dump_runlist (rl1);
- //ntfs_debug_dump_runlist (rl2);
- //ntfs_debug_dump_runlist (rl3);
-#if 0
- switch (TEST)
- {
- case 1:
- res1 = merge_run_lists (rl1, rl2); //printf ("res1 %p\n", res1);
- res2 = merge_run_lists (res1, rl3); //printf ("res2 %p\n", res2);
- break;
- case 2:
- res1 = merge_run_lists (rl1, rl3); //printf ("res1 %p\n", res1);
- res2 = merge_run_lists (res1, rl2); //printf ("res2 %p\n", res2);
- break;
- case 3:
- res1 = merge_run_lists (rl2, rl1); //printf ("res1 %p\n", res1);
- res2 = merge_run_lists (res1, rl3); //printf ("res2 %p\n", res2);
- break;
- case 4:
- res1 = merge_run_lists (rl2, rl3); //printf ("res1 %p\n", res1);
- res2 = merge_run_lists (res1, rl1); //printf ("res2 %p\n", res2);
- break;
- case 5:
- res1 = merge_run_lists (rl3, rl1); //printf ("res1 %p\n", res1);
- res2 = merge_run_lists (res1, rl2); //printf ("res2 %p\n", res2);
- break;
- case 6:
- res1 = merge_run_lists (rl3, rl2); //printf ("res1 %p\n", res1);
- res2 = merge_run_lists (res1, rl1); //printf ("res2 %p\n", res2);
- break;
- }
- //ntfs_debug_dump_runlist (res2);
- ntfs_free (res2);
- //printf ("success\n");
#endif
/*
|