Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/ntfstools
In directory usw-pr-cvs1:/tmp/cvs-serv12722/ntfstools
Modified Files:
mkntfs.c ntfsdump_logfile.c ntfsfix.c sd.c
Log Message:
Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work.
Index: mkntfs.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/mkntfs.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -U2 -r1.67 -r1.68
--- mkntfs.c 19 Apr 2002 21:09:55 -0000 1.67
+++ mkntfs.c 20 Apr 2002 23:09:43 -0000 1.68
@@ -473,25 +473,25 @@
switch (type) {
- case $STANDARD_INFORMATION:
+ case AT_STANDARD_INFORMATION:
// TODO
printf("%s\n", todo);
return;
- case $ATTRIBUTE_LIST:
+ case AT_ATTRIBUTE_LIST:
// TODO
printf("%s\n", todo);
return;
- case $FILE_NAME:
+ case AT_FILE_NAME:
// TODO
printf("%s\n", todo);
return;
- case $OBJECT_ID:
+ case AT_OBJECT_ID:
// TODO
printf("%s\n", todo);
return;
- case $SECURITY_DESCRIPTOR:
+ case AT_SECURITY_DESCRIPTOR:
// TODO
printf("%s\n", todo);
return;
- case $VOLUME_NAME:
+ case AT_VOLUME_NAME:
printf("Volume name length = %i\n", val_len);
if (val_len) {
@@ -508,5 +508,5 @@
}
return;
- case $VOLUME_INFORMATION:
+ case AT_VOLUME_INFORMATION:
#define VOL_INF(x) ((VOLUME_INFORMATION *)(x))
printf("NTFS version %i.%i\n", VOL_INF(val)->major_ver,
@@ -568,31 +568,31 @@
printf("\n");
return;
- case $DATA:
+ case AT_DATA:
printf(skip, "DATA");
return;
- case $INDEX_ROOT:
+ case AT_INDEX_ROOT:
// TODO
printf("%s\n", todo);
return;
- case $INDEX_ALLOCATION:
+ case AT_INDEX_ALLOCATION:
// TODO
printf("%s\n", todo);
return;
- case $BITMAP:
+ case AT_BITMAP:
printf(skip, "BITMAP");
return;
- case $REPARSE_POINT:
+ case AT_REPARSE_POINT:
// TODO
printf("%s\n", todo);
return;
- case $EA_INFORMATION:
+ case AT_EA_INFORMATION:
// TODO
printf("%s\n", don_t_know);
return;
- case $EA:
+ case AT_EA:
// TODO
printf("%s\n", don_t_know);
return;
- case $LOGGED_UTILITY_STREAM:
+ case AT_LOGGED_UTILITY_STREAM:
// TODO
printf("%s\n", don_t_know);
@@ -601,6 +601,7 @@
i = le32_to_cpu(type);
printf("Cannot display unknown %s defined attribute type 0x%x"
- ".\n", i >= le32_to_cpu($FIRST_USER_DEFINED_ATTRIBUTE) ?
- "user" : "system", i);
+ ".\n", i >=
+ le32_to_cpu(AT_FIRST_USER_DEFINED_ATTRIBUTE) ?
+ "user" : "system", i);
}
}
@@ -669,6 +670,6 @@
printf("-- Beginning dump of attribute record. --\n");
- if (a->type == $END) {
- printf("Attribute type = 0x%x ($END)\n", le32_to_cpu($END));
+ if (a->type == AT_END) {
+ printf("Attribute type = 0x%x ($END)\n", le32_to_cpu(AT_END));
u = le32_to_cpu(a->length);
printf("Length of resident part = %u (0x%x)\n", u, u);
@@ -794,5 +795,5 @@
while ((char*)a < (char*)m + le32_to_cpu(m->bytes_in_use)) {
dump_attr_record(a);
- if (a->type == $END)
+ if (a->type == AT_END)
break;
a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length));
@@ -839,5 +840,5 @@
m->next_attr_instance = cpu_to_le16(0);
a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset));
- a->type = $END;
+ a->type = AT_END;
a->length = cpu_to_le32(0);
#if 0
@@ -1217,9 +1218,18 @@
goto err_out;
}
- if (find_attr(type, uname, name_len, ic, upcase, upcase_len, NULL, 0,
- ctx)) {
+ if (ic == IGNORE_CASE) {
+ Eprintf("FIXME: Hit unimplemented code path #1.\n");
+ err = -ENOTSUP;
+ goto err_out;
+ }
+ if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, NULL, 0, ctx)) {
err = -EEXIST;
goto err_out;
}
+ if (errno != ENOENT) {
+ Eprintf("Corrupt inode.\n");
+ err = -errno;
+ goto err_out;
+ }
a = ctx->attr;
if (flags & ATTR_COMPRESSION_MASK) {
@@ -1384,9 +1394,18 @@
goto err_out;
}
- if (find_attr(type, uname, name_len, ic, upcase, upcase_len, NULL, 0,
- ctx)) {
+ if (ic == IGNORE_CASE) {
+ Eprintf("FIXME: Hit unimplemented code path #2.\n");
+ err = -ENOTSUP;
+ goto err_out;
+ }
+ if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, NULL, 0, ctx)) {
err = -EEXIST;
goto err_out;
}
+ if (errno != ENOENT) {
+ Eprintf("Corrupt inode.\n");
+ err = -errno;
+ goto err_out;
+ }
a = ctx->attr;
if (flags & ATTR_COMPRESSION_MASK) {
@@ -1551,9 +1570,19 @@
goto err_out;
}
- if (find_attr(type, uname, name_len, ic, upcase, upcase_len, val,
- val_len, ctx)) {
+ if (ic == IGNORE_CASE) {
+ Eprintf("FIXME: Hit unimplemented code path #3.\n");
+ err = -ENOTSUP;
+ goto err_out;
+ }
+ if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, val, val_len,
+ ctx)) {
err = -EEXIST;
goto err_out;
}
+ if (errno != ENOENT) {
+ Eprintf("Corrupt inode.\n");
+ err = -errno;
+ goto err_out;
+ }
a = ctx->attr;
/* sizeof(resident attribute record header) == 24 */
@@ -1643,5 +1672,5 @@
}
/* NTFS 1.2: size of si = 48, NTFS 3.0: size of si = 72 */
- err = insert_resident_attr_in_mft_record(m, $STANDARD_INFORMATION,
+ err = insert_resident_attr_in_mft_record(m, AT_STANDARD_INFORMATION,
NULL, 0, 0, NULL, 0, 0, 0, (char*)&si,
opt.ntfs_major_ver < 3 ? 48 : 72);
@@ -1669,10 +1698,11 @@
return -ENOMEM;
}
- if (!find_attr($STANDARD_INFORMATION, NULL, 0, 0, NULL, 0, NULL, 0,
+ if (ntfs_lookup_attr(AT_STANDARD_INFORMATION, NULL, 0, 0, 0, NULL, 0,
ctx)) {
+ int eo = errno;
Eprintf("BUG: Standard information attribute not present in "
"file record\n");
ntfs_put_attr_search_ctx(ctx);
- return -EINVAL;
+ return -eo;
}
si = (STANDARD_INFORMATION*)((char*)ctx->attr +
@@ -1719,6 +1749,7 @@
fn->file_name_length = i;
fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(uchar_t);
- i = insert_resident_attr_in_mft_record(m, $FILE_NAME, NULL, 0, 0, NULL,
- 0, 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size);
+ i = insert_resident_attr_in_mft_record(m, AT_FILE_NAME, NULL, 0, 0,
+ NULL, 0, 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn,
+ fn_size);
free(fn);
if (i < 0)
@@ -1741,9 +1772,9 @@
le32_to_cpu(m->bytes_allocated))
err = insert_non_resident_attr_in_mft_record(m,
- $SECURITY_DESCRIPTOR, NULL, 0, 0, NULL, 0, 0,
+ AT_SECURITY_DESCRIPTOR, NULL, 0, 0, NULL, 0, 0,
sd, sd_len);
else
err = insert_resident_attr_in_mft_record(m,
- $SECURITY_DESCRIPTOR, NULL, 0, 0, NULL, 0, 0,
+ AT_SECURITY_DESCRIPTOR, NULL, 0, 0, NULL, 0, 0,
0, sd, sd_len);
if (err < 0)
@@ -1774,9 +1805,9 @@
min(le32_to_cpu(m->bytes_allocated),
le32_to_cpu(m->bytes_allocated) - 512))
- err = insert_non_resident_attr_in_mft_record(m, $DATA, name,
+ err = insert_non_resident_attr_in_mft_record(m, AT_DATA, name,
name_len, ic, upcase, upcase_len, flags,
val, val_len);
else
- err = insert_resident_attr_in_mft_record(m, $DATA, name,
+ err = insert_resident_attr_in_mft_record(m, AT_DATA, name,
name_len, ic, upcase, upcase_len,
flags, 0, val, val_len);
@@ -1802,5 +1833,5 @@
int err;
- err = insert_positioned_attr_in_mft_record(m, $DATA, name, name_len,
+ err = insert_positioned_attr_in_mft_record(m, AT_DATA, name, name_len,
ic, upcase, upcase_len, flags, rl, val, val_len);
if (err < 0)
@@ -1843,5 +1874,5 @@
len = 0;
}
- i = insert_resident_attr_in_mft_record(m, $VOLUME_NAME, NULL, 0, 0,
+ i = insert_resident_attr_in_mft_record(m, AT_VOLUME_NAME, NULL, 0, 0,
NULL, 0, 0, 0, (char*)uname, len);
if (uname)
@@ -1863,5 +1894,5 @@
vi.minor_ver = minor_ver;
vi.flags = flags & VOLUME_FLAGS_MASK;
- err = insert_resident_attr_in_mft_record(m, $VOLUME_INFORMATION, NULL,
+ err = insert_resident_attr_in_mft_record(m, AT_VOLUME_INFORMATION, NULL,
0, 0, NULL, 0, 0, 0, (char*)&vi, sizeof(vi));
if (err < 0)
@@ -1885,6 +1916,6 @@
if (!r)
return -errno;
- r->type = indexed_attr_type == $FILE_NAME ? $FILE_NAME : 0;
- if (indexed_attr_type == $FILE_NAME &&
+ r->type = indexed_attr_type == AT_FILE_NAME ? AT_FILE_NAME : 0;
+ if (indexed_attr_type == AT_FILE_NAME &&
collation_rule != COLLATION_FILE_NAME) {
free(r);
@@ -1939,5 +1970,5 @@
e->flags = INDEX_ENTRY_END;
e->reserved = cpu_to_le16(0);
- err = insert_resident_attr_in_mft_record(m, $INDEX_ROOT, name,
+ err = insert_resident_attr_in_mft_record(m, AT_INDEX_ROOT, name,
name_len, ic, upcase, upcase_len,
0, 0, (char*)r, val_len);
@@ -1956,6 +1987,6 @@
int err;
- err = insert_non_resident_attr_in_mft_record(m, $INDEX_ALLOCATION, name,
- name_len, ic, upcase, upcase_len, 0,
+ err = insert_non_resident_attr_in_mft_record(m, AT_INDEX_ALLOCATION,
+ name, name_len, ic, upcase, upcase_len, 0,
index_alloc_val, index_alloc_val_len);
if (err < 0)
@@ -1975,9 +2006,9 @@
if (le32_to_cpu(m->bytes_in_use) + 24 + bitmap_len >
le32_to_cpu(m->bytes_allocated))
- err = insert_non_resident_attr_in_mft_record(m, $BITMAP, name,
+ err = insert_non_resident_attr_in_mft_record(m, AT_BITMAP, name,
name_len, ic, upcase, upcase_len, 0,
bitmap, bitmap_len);
else
- err = insert_resident_attr_in_mft_record(m, $BITMAP, name,
+ err = insert_resident_attr_in_mft_record(m, AT_BITMAP, name,
name_len, ic, upcase, upcase_len, 0, 0,
bitmap, bitmap_len);
@@ -2002,5 +2033,5 @@
int err;
- err = insert_positioned_attr_in_mft_record(m, $BITMAP, name, name_len,
+ err = insert_positioned_attr_in_mft_record(m, AT_BITMAP, name, name_len,
ic, upcase, upcase_len, 0, rl, bitmap, bitmap_len);
if (err < 0)
@@ -2050,9 +2081,14 @@
return -ENOMEM;
}
- err = find_attr($INDEX_ROOT, uname, name_len, ic, upcase, upcase_len,
- NULL, 0, ctx);
+ if (ic == IGNORE_CASE) {
+ Eprintf("FIXME: Hit unimplemented code path #4.\n");
+ err = -ENOTSUP;
+ goto err_out;
+ }
+ err = ntfs_lookup_attr(AT_INDEX_ROOT, uname, name_len, ic, 0, NULL, 0,
+ ctx);
if (uname)
free(uname);
- if (!err) {
+ if (err) {
err = -ENOTDIR;
goto err_out;
@@ -2413,5 +2449,5 @@
m_file->link_count = cpu_to_le16(i + 1);
/* Add the file_name to @m_file. */
- i = insert_resident_attr_in_mft_record(m_file, $FILE_NAME, NULL, 0, 0,
+ i = insert_resident_attr_in_mft_record(m_file, AT_FILE_NAME, NULL, 0, 0,
NULL, 0, 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn,
fn_size);
@@ -3240,5 +3276,5 @@
ntfs_set_bit(mft_bitmap, 0LL + i, 1);
file_attrs = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM;
- if (i == FILE_$root) {
+ if (i == FILE_root) {
if (opt.disable_indexing)
file_attrs |= FILE_ATTR_NOT_CONTENT_INDEXED;
@@ -3250,5 +3286,5 @@
}
/* The root directory mft reference. */
- root_ref = MAKE_MFT_REF(FILE_$root, FILE_$root);
+ root_ref = MAKE_MFT_REF(FILE_root, FILE_root);
Vprintf("Creating root directory (mft record 5)\n");
m = (MFT_RECORD*)(buf + 5 * opt.mft_record_size);
@@ -3260,11 +3296,11 @@
".", FILE_NAME_WIN32_AND_DOS);
if (!err) {
- init_system_file_sd(FILE_$root, &sd, &i);
+ init_system_file_sd(FILE_root, &sd, &i);
err = add_attr_sd(m, sd, i);
}
if (!err)
err = add_attr_index_root(m, "$I30", 4, IGNORE_CASE, opt.upcase,
- opt.upcase_len, $FILE_NAME, COLLATION_FILE_NAME,
- opt.index_block_size);
+ opt.upcase_len, AT_FILE_NAME,
+ COLLATION_FILE_NAME, opt.index_block_size);
if (!err)
err = upgrade_to_large_index(m, "$I30", 4, IGNORE_CASE,
@@ -3276,5 +3312,6 @@
"context: %s\n", strerror(errno));
/* There is exactly one file name so this is ok. */
- if (!find_attr($FILE_NAME, NULL, 0, 0, NULL, 0, NULL, 0, ctx)) {
+ if (ntfs_lookup_attr(AT_FILE_NAME, NULL, 0, 0, 0, NULL, 0,
+ ctx)) {
ntfs_put_attr_search_ctx(ctx);
err_exit("BUG: $FILE_NAME attribute not found.\n");
@@ -3298,10 +3335,10 @@
if (!err)
err = create_hardlink(index_block, root_ref, m,
- MAKE_MFT_REF(FILE_$MFT, 1), opt.mft_size,
+ MAKE_MFT_REF(FILE_MFT, 1), opt.mft_size,
opt.mft_size, FILE_ATTR_HIDDEN |
FILE_ATTR_SYSTEM, 0, 0, "$MFT",
FILE_NAME_WIN32_AND_DOS);
if (!err) {
- init_system_file_sd(FILE_$MFT, &sd, &i);
+ init_system_file_sd(FILE_MFT, &sd, &i);
err = add_attr_sd(m, sd, i);
}
@@ -3319,5 +3356,5 @@
if (!err)
err = create_hardlink(index_block, root_ref, m,
- MAKE_MFT_REF(FILE_$MFTMirr, FILE_$MFTMirr),
+ MAKE_MFT_REF(FILE_MFTMirr, FILE_MFTMirr),
rl_mftmirr[0].length * opt.cluster_size,
rl_mftmirr[0].length * opt.cluster_size,
@@ -3325,5 +3362,5 @@
"$MFTMirr", FILE_NAME_WIN32_AND_DOS);
if (!err) {
- init_system_file_sd(FILE_$MFTMirr, &sd, &i);
+ init_system_file_sd(FILE_MFTMirr, &sd, &i);
err = add_attr_sd(m, sd, i);
}
@@ -3344,10 +3381,10 @@
if (!err)
err = create_hardlink(index_block, root_ref, m,
- MAKE_MFT_REF(FILE_$LogFile, FILE_$LogFile),
+ MAKE_MFT_REF(FILE_LogFile, FILE_LogFile),
opt.logfile_size, opt.logfile_size,
FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0,
"$LogFile", FILE_NAME_WIN32_AND_DOS);
if (!err) {
- init_system_file_sd(FILE_$LogFile, &sd, &i);
+ init_system_file_sd(FILE_LogFile, &sd, &i);
err = add_attr_sd(m, sd, i);
}
@@ -3358,9 +3395,9 @@
m = (MFT_RECORD*)(buf + 3 * opt.mft_record_size);
err = create_hardlink(index_block, root_ref, m,
- MAKE_MFT_REF(FILE_$Volume, FILE_$Volume), 0LL, 0LL,
+ MAKE_MFT_REF(FILE_Volume, FILE_Volume), 0LL, 0LL,
FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0,
"$Volume", FILE_NAME_WIN32_AND_DOS);
if (!err) {
- init_system_file_sd(FILE_$Volume, &sd, &i);
+ init_system_file_sd(FILE_Volume, &sd, &i);
err = add_attr_sd(m, sd, i);
}
@@ -3395,5 +3432,5 @@
if (!err)
err = create_hardlink(index_block, root_ref, m,
- MAKE_MFT_REF(FILE_$AttrDef, FILE_$AttrDef),
+ MAKE_MFT_REF(FILE_AttrDef, FILE_AttrDef),
(buf2_size + opt.cluster_size - 1) &
~(opt.cluster_size - 1), buf2_size,
@@ -3402,5 +3439,5 @@
buf2_size = 0;
if (!err) {
- init_system_file_sd(FILE_$AttrDef, &sd, &i);
+ init_system_file_sd(FILE_AttrDef, &sd, &i);
err = add_attr_sd(m, sd, i);
}
@@ -3414,5 +3451,5 @@
if (!err)
err = create_hardlink(index_block, root_ref, m,
- MAKE_MFT_REF(FILE_$Bitmap, FILE_$Bitmap),
+ MAKE_MFT_REF(FILE_Bitmap, FILE_Bitmap),
(lcn_bitmap_byte_size + opt.cluster_size - 1) &
~(opt.cluster_size - 1), lcn_bitmap_byte_size,
@@ -3420,5 +3457,5 @@
"$Bitmap", FILE_NAME_WIN32_AND_DOS);
if (!err) {
- init_system_file_sd(FILE_$Bitmap, &sd, &i);
+ init_system_file_sd(FILE_Bitmap, &sd, &i);
err = add_attr_sd(m, sd, i);
}
@@ -3465,17 +3502,17 @@
bs->clusters_per_mft_record);
if (opt.index_block_size >= opt.cluster_size)
- bs->clusters_per_index_block = opt.index_block_size /
+ bs->clusters_per_index_record = opt.index_block_size /
opt.cluster_size;
else {
- bs->clusters_per_index_block = -(ffs(opt.index_block_size) - 1);
- if ((1 << -bs->clusters_per_index_block) !=
+ bs->clusters_per_index_record = -(ffs(opt.index_block_size) - 1);
+ if ((1 << -bs->clusters_per_index_record) !=
opt.index_block_size)
- err_exit("BUG: calculated clusters_per_index_block "
+ err_exit("BUG: calculated clusters_per_index_record "
"is wrong (= 0x%x)\n",
- bs->clusters_per_index_block);
+ bs->clusters_per_index_record);
}
Dprintf("Clusters per index block = %i (0x%x)\n",
- bs->clusters_per_index_block,
- bs->clusters_per_index_block);
+ bs->clusters_per_index_record,
+ bs->clusters_per_index_record);
/* Generate a 64-bit random number for the serial number. */
bs->volume_serial_number = scpu_to_le64(((__s64)random() << 32) |
@@ -3493,5 +3530,5 @@
if (!err)
err = create_hardlink(index_block, root_ref, m,
- MAKE_MFT_REF(FILE_$Boot, FILE_$Boot),
+ MAKE_MFT_REF(FILE_Boot, FILE_Boot),
(8192 + opt.cluster_size - 1) &
~(opt.cluster_size - 1), 8192,
@@ -3499,5 +3536,5 @@
"$Boot", FILE_NAME_WIN32_AND_DOS);
if (!err) {
- init_system_file_sd(FILE_$Boot, &sd, &i);
+ init_system_file_sd(FILE_Boot, &sd, &i);
err = add_attr_sd(m, sd, i);
}
@@ -3546,10 +3583,10 @@
if (!err) {
err = create_hardlink(index_block, root_ref, m,
- MAKE_MFT_REF(FILE_$BadClus, FILE_$BadClus),
+ MAKE_MFT_REF(FILE_BadClus, FILE_BadClus),
0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM,
0, 0, "$BadClus", FILE_NAME_WIN32_AND_DOS);
}
if (!err) {
- init_system_file_sd(FILE_$BadClus, &sd, &i);
+ init_system_file_sd(FILE_BadClus, &sd, &i);
err = add_attr_sd(m, sd, i);
}
@@ -3566,5 +3603,5 @@
FILE_NAME_WIN32_AND_DOS);
if (!err) {
- init_system_file_sd(FILE_$Secure, &sd, &i);
+ init_system_file_sd(FILE_Secure, &sd, &i);
err = add_attr_sd(m, sd, i);
}
@@ -3578,5 +3615,5 @@
if (!err)
err = create_hardlink(index_block, root_ref, m,
- MAKE_MFT_REF(FILE_$UpCase, FILE_$UpCase),
+ MAKE_MFT_REF(FILE_UpCase, FILE_UpCase),
((opt.upcase_len << 1) + opt.cluster_size - 1) &
~(opt.cluster_size - 1), opt.upcase_len << 1,
@@ -3584,5 +3621,5 @@
"$UpCase", FILE_NAME_WIN32_AND_DOS);
if (!err) {
- init_system_file_sd(FILE_$UpCase, &sd, &i);
+ init_system_file_sd(FILE_UpCase, &sd, &i);
err = add_attr_sd(m, sd, i);
}
@@ -3626,6 +3663,7 @@
err_exit("Failed to allocate attribute search context: %s\n",
strerror(errno));
- if (!find_attr($INDEX_ALLOCATION, ustr, j, IGNORE_CASE, opt.upcase,
- opt.upcase_len, NULL, 0, ctx)) {
+ err_exit("FIXME: Hit unimplemented code path #5.");
+ if (ntfs_lookup_attr(AT_INDEX_ALLOCATION, ustr, j, IGNORE_CASE, 0,
+ NULL, 0, ctx)) {
ntfs_put_attr_search_ctx(ctx);
err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n");
@@ -3660,5 +3698,5 @@
err_exit("Failed to allocate attribute search context: %s\n",
strerror(errno));
- if (!find_attr($DATA, NULL, 0, 0, NULL, 0, NULL, 0, ctx)) {
+ if (ntfs_lookup_attr(AT_DATA, NULL, 0, 0, 0, NULL, 0, ctx)) {
ntfs_put_attr_search_ctx(ctx);
err_exit("BUG: $DATA attribute not found.\n");
Index: ntfsdump_logfile.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/ntfsdump_logfile.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -U2 -r1.17 -r1.18
--- ntfsdump_logfile.c 20 Apr 2002 01:53:03 -0000 1.17
+++ ntfsdump_logfile.c 20 Apr 2002 23:09:43 -0000 1.18
@@ -123,5 +123,5 @@
}
/* Read in $LogFile. */
- mref = (MFT_REF)FILE_$LogFile;
+ mref = (MFT_REF)FILE_LogFile;
if (ntfs_read_file_record(vol, mref, &m, NULL)) {
fprintf(stderr, "Error reading mft record for $LogFile.\n");
@@ -134,5 +134,5 @@
}
/* Find the $DATA attribute of the $LogFile. */
- if (!find_attr($DATA, NULL, 0, 0, NULL, 0, NULL, 0, ctx)) {
+ if (ntfs_lookup_attr(AT_DATA, NULL, 0, 0, 0, NULL, 0, ctx)) {
fprintf(stderr, "Error: Attribute $DATA was not found in" \
"$LogFile!\n");
Index: ntfsfix.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/ntfsfix.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -U2 -r1.27 -r1.28
--- ntfsfix.c 20 Apr 2002 01:53:03 -0000 1.27
+++ ntfsfix.c 20 Apr 2002 23:09:43 -0000 1.28
@@ -129,5 +129,5 @@
/* Read $MFT and $MFTmirr. */
printf("Going to read $Mft... ");
- mref = (MFT_REF)FILE_$MFT;
+ mref = (MFT_REF)FILE_MFT;
br = ntfs_read_mft_records(vol, mref, 4, (MFT_RECORD*)b1);
if (br) {
@@ -311,5 +311,5 @@
/* Write $Volume to $Mft. */
printf("Writing $Volume to $Mft... ");
- mref = (MFT_REF)FILE_$Volume;
+ mref = (MFT_REF)FILE_Volume;
br = ntfs_write_mft_record(vol, mref, (MFT_RECORD*)(b1 + 3 * mrs));
if (br) {
@@ -350,8 +350,8 @@
goto log_file_error;
}
- if (!find_attr($DATA, NULL, 0, 0, NULL, 0, NULL, 0, ctx)) {
+ if (ntfs_lookup_attr(AT_DATA, NULL, 0, 0, 0, NULL, 0, ctx)) {
puts(FAILED);
fprintf(stderr, "Error: Attribute $DATA was not found in" \
- "$LogFile!\n");
+ "$LogFile!\n");
goto log_file_error;
}
Index: sd.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/sd.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -U2 -r1.3 -r1.4
--- sd.c 15 Apr 2002 20:04:30 -0000 1.3
+++ sd.c 20 Apr 2002 23:09:43 -0000 1.4
@@ -44,5 +44,5 @@
sd->alignment = 0;
sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT;
- if (sys_file_no == FILE_$root) {
+ if (sys_file_no == FILE_root) {
*sd_val_len = 0x50;
sd->owner = cpu_to_le32(0x30);
@@ -62,5 +62,5 @@
acl->revision = 2;
acl->alignment1 = 0;
- if (sys_file_no == FILE_$root) {
+ if (sys_file_no == FILE_root) {
acl->size = cpu_to_le16(0x1c);
acl->ace_count = cpu_to_le16(1);
@@ -76,5 +76,5 @@
aa_ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL));
aa_ace->type = ACCESS_ALLOWED_ACE_TYPE;
- if (sys_file_no == FILE_$root)
+ if (sys_file_no == FILE_root)
aa_ace->flags = CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE;
else
@@ -82,11 +82,11 @@
aa_ace->size = cpu_to_le16(0x14);
switch (sys_file_no) {
- case FILE_$MFT: case FILE_$MFTMirr: case FILE_$LogFile:
- case FILE_$AttrDef: case FILE_$Bitmap: case FILE_$Boot:
- case FILE_$BadClus: case FILE_$UpCase:
+ case FILE_MFT: case FILE_MFTMirr: case FILE_LogFile:
+ case FILE_AttrDef: case FILE_Bitmap: case FILE_Boot:
+ case FILE_BadClus: case FILE_UpCase:
aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ |
FILE_READ_ATTRIBUTES | FILE_READ_EA | FILE_READ_DATA;
break;
- case FILE_$Volume: case FILE_$Secure: case 0xb ... 0xf:
+ case FILE_Volume: case FILE_Secure: case 0xb ... 0xf:
aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_WRITE |
FILE_WRITE_ATTRIBUTES | FILE_READ_ATTRIBUTES |
@@ -94,5 +94,5 @@
FILE_WRITE_DATA | FILE_READ_DATA;
break;
- case FILE_$root:
+ case FILE_root:
aa_ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES |
FILE_READ_ATTRIBUTES | FILE_DELETE_CHILD |
@@ -109,5 +109,5 @@
aa_ace->sid.identifier_authority.value[3] = 0;
aa_ace->sid.identifier_authority.value[4] = 0;
- if (sys_file_no == FILE_$root) {
+ if (sys_file_no == FILE_root) {
/* SECURITY_WORLD_SID_AUTHORITY (S-1-1) */
aa_ace->sid.identifier_authority.value[5] = 1;
@@ -126,5 +126,5 @@
* a second ACE.
*/
- if (sys_file_no != FILE_$root) {
+ if (sys_file_no != FILE_root) {
/* The second ACE of the DACL. Type is access allowed. */
aa_ace = (ACCESS_ALLOWED_ACE*)((char*)aa_ace +
@@ -134,13 +134,13 @@
aa_ace->size = cpu_to_le16(0x18);
switch (sys_file_no) {
- case FILE_$MFT: case FILE_$MFTMirr:
- case FILE_$LogFile: case FILE_$AttrDef:
- case FILE_$Bitmap: case FILE_$Boot:
- case FILE_$BadClus: case FILE_$UpCase:
+ case FILE_MFT: case FILE_MFTMirr:
+ case FILE_LogFile: case FILE_AttrDef:
+ case FILE_Bitmap: case FILE_Boot:
+ case FILE_BadClus: case FILE_UpCase:
aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ |
FILE_READ_ATTRIBUTES | FILE_READ_EA |
FILE_READ_DATA;
break;
- case FILE_$Volume: case FILE_$Secure:
+ case FILE_Volume: case FILE_Secure:
case 0xb ... 0xf:
aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ |
|