Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/ntfstools
In directory usw-pr-cvs1:/tmp/cvs-serv594/ntfstools
Modified Files:
mkntfs.c
Log Message:
Fix mkntfs again.
Index: mkntfs.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/mkntfs.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -U2 -r1.68 -r1.69
--- mkntfs.c 20 Apr 2002 23:09:43 -0000 1.68
+++ mkntfs.c 21 Apr 2002 01:12:55 -0000 1.69
@@ -1183,5 +1183,4 @@
int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type,
const char *name, __u32 name_len, const IGNORE_CASE_BOOL ic,
- const uchar_t *upcase, const __u32 upcase_len,
const ATTR_FLAGS flags, const run_list *rl,
const char *val, const __s64 val_len)
@@ -1360,5 +1359,4 @@
int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type,
const char *name, __u32 name_len, const IGNORE_CASE_BOOL ic,
- const uchar_t *upcase, const __u32 upcase_len,
const ATTR_FLAGS flags, const char *val, const __s64 val_len)
{
@@ -1542,5 +1540,4 @@
int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type,
const char *name, __u32 name_len, const IGNORE_CASE_BOOL ic,
- const uchar_t *upcase, const __u32 upcase_len,
const ATTR_FLAGS flags, const RESIDENT_ATTR_FLAGS res_flags,
const char *val, const __u32 val_len)
@@ -1673,5 +1670,5 @@
/* NTFS 1.2: size of si = 48, NTFS 3.0: size of si = 72 */
err = insert_resident_attr_in_mft_record(m, AT_STANDARD_INFORMATION,
- NULL, 0, 0, NULL, 0, 0, 0, (char*)&si,
+ NULL, 0, 0, 0, 0, (char*)&si,
opt.ntfs_major_ver < 3 ? 48 : 72);
if (err < 0)
@@ -1750,6 +1747,5 @@
fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(uchar_t);
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);
+ 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size);
free(fn);
if (i < 0)
@@ -1772,10 +1768,10 @@
le32_to_cpu(m->bytes_allocated))
err = insert_non_resident_attr_in_mft_record(m,
- AT_SECURITY_DESCRIPTOR, NULL, 0, 0, NULL, 0, 0,
- sd, sd_len);
+ AT_SECURITY_DESCRIPTOR, NULL, 0, 0, 0, sd,
+ sd_len);
else
err = insert_resident_attr_in_mft_record(m,
- AT_SECURITY_DESCRIPTOR, NULL, 0, 0, NULL, 0, 0,
- 0, sd, sd_len);
+ AT_SECURITY_DESCRIPTOR, NULL, 0, 0, 0, 0, sd,
+ sd_len);
if (err < 0)
Eprintf("add_attr_sd failed: %s\n", strerror(-err));
@@ -1785,6 +1781,5 @@
/* Return 0 on success or -errno on error. */
int add_attr_data(MFT_RECORD *m, const char *name, const __u32 name_len,
- const IGNORE_CASE_BOOL ic, const uchar_t *upcase,
- const __u32 upcase_len, const ATTR_FLAGS flags,
+ const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags,
const char *val, const __s64 val_len)
{
@@ -1806,10 +1801,8 @@
le32_to_cpu(m->bytes_allocated) - 512))
err = insert_non_resident_attr_in_mft_record(m, AT_DATA, name,
- name_len, ic, upcase, upcase_len, flags,
- val, val_len);
+ name_len, ic, flags, val, val_len);
else
err = insert_resident_attr_in_mft_record(m, AT_DATA, name,
- name_len, ic, upcase, upcase_len,
- flags, 0, val, val_len);
+ name_len, ic, flags, 0, val, val_len);
if (err < 0)
@@ -1827,5 +1820,4 @@
int add_attr_data_positioned(MFT_RECORD *m, const char *name,
const __u32 name_len, const IGNORE_CASE_BOOL ic,
- const uchar_t *upcase, const __u32 upcase_len,
const ATTR_FLAGS flags, const run_list *rl,
const char *val, const __s64 val_len)
@@ -1834,5 +1826,5 @@
err = insert_positioned_attr_in_mft_record(m, AT_DATA, name, name_len,
- ic, upcase, upcase_len, flags, rl, val, val_len);
+ ic, flags, rl, val, val_len);
if (err < 0)
Eprintf("add_attr_data_positioned failed: %s\n",
@@ -1875,5 +1867,5 @@
}
i = insert_resident_attr_in_mft_record(m, AT_VOLUME_NAME, NULL, 0, 0,
- NULL, 0, 0, 0, (char*)uname, len);
+ 0, 0, (char*)uname, len);
if (uname)
free(uname);
@@ -1895,5 +1887,5 @@
vi.flags = flags & VOLUME_FLAGS_MASK;
err = insert_resident_attr_in_mft_record(m, AT_VOLUME_INFORMATION, NULL,
- 0, 0, NULL, 0, 0, 0, (char*)&vi, sizeof(vi));
+ 0, 0, 0, 0, (char*)&vi, sizeof(vi));
if (err < 0)
Eprintf("add_attr_vol_info failed: %s\n", strerror(-err));
@@ -1903,6 +1895,5 @@
/* Return 0 on success or -errno on error. */
int add_attr_index_root(MFT_RECORD *m, const char *name, const __u32 name_len,
- const IGNORE_CASE_BOOL ic, const uchar_t *upcase,
- const __u32 upcase_len, const ATTR_TYPES indexed_attr_type,
+ const IGNORE_CASE_BOOL ic, const ATTR_TYPES indexed_attr_type,
const COLLATION_RULES collation_rule,
const __u32 index_block_size)
@@ -1971,6 +1962,5 @@
e->reserved = cpu_to_le16(0);
err = insert_resident_attr_in_mft_record(m, AT_INDEX_ROOT, name,
- name_len, ic, upcase, upcase_len,
- 0, 0, (char*)r, val_len);
+ name_len, ic, 0, 0, (char*)r, val_len);
free(r);
if (err < 0)
@@ -1981,6 +1971,5 @@
/* Return 0 on success or -errno on error. */
int add_attr_index_alloc(MFT_RECORD *m, const char *name, const __u32 name_len,
- const IGNORE_CASE_BOOL ic, const uchar_t *upcase,
- const __u32 upcase_len, const char *index_alloc_val,
+ const IGNORE_CASE_BOOL ic, const char *index_alloc_val,
const __u32 index_alloc_val_len)
{
@@ -1988,6 +1977,6 @@
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);
+ name, name_len, ic, 0, index_alloc_val,
+ index_alloc_val_len);
if (err < 0)
Eprintf("add_attr_index_alloc failed: %s\n", strerror(-err));
@@ -1997,6 +1986,5 @@
/* Return 0 on success or -errno on error. */
int add_attr_bitmap(MFT_RECORD *m, const char *name, const __u32 name_len,
- const IGNORE_CASE_BOOL ic, const uchar_t *upcase,
- const __u32 upcase_len, const char *bitmap,
+ const IGNORE_CASE_BOOL ic, const char *bitmap,
const __u32 bitmap_len)
{
@@ -2007,10 +1995,8 @@
le32_to_cpu(m->bytes_allocated))
err = insert_non_resident_attr_in_mft_record(m, AT_BITMAP, name,
- name_len, ic, upcase, upcase_len, 0,
- bitmap, bitmap_len);
+ name_len, ic, 0, bitmap, bitmap_len);
else
err = insert_resident_attr_in_mft_record(m, AT_BITMAP, name,
- name_len, ic, upcase, upcase_len, 0, 0,
- bitmap, bitmap_len);
+ name_len, ic, 0, 0, bitmap, bitmap_len);
if (err < 0)
@@ -2028,5 +2014,4 @@
int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name,
const __u32 name_len, const IGNORE_CASE_BOOL ic,
- const uchar_t *upcase, const __u32 upcase_len,
const run_list *rl, const char *bitmap, const __u32 bitmap_len)
{
@@ -2034,5 +2019,5 @@
err = insert_positioned_attr_in_mft_record(m, AT_BITMAP, name, name_len,
- ic, upcase, upcase_len, 0, rl, bitmap, bitmap_len);
+ ic, 0, rl, bitmap, bitmap_len);
if (err < 0)
Eprintf("add_attr_bitmap_positioned failed: %s\n",
@@ -2050,5 +2035,4 @@
int upgrade_to_large_index(MFT_RECORD *m, const char *name,
__u32 name_len, const IGNORE_CASE_BOOL ic,
- const uchar_t *upcase, const __u32 upcase_len,
INDEX_ALLOCATION **index)
{
@@ -2107,6 +2091,5 @@
ntfs_set_bit(bmp, 0ULL, 1);
/* Bitmap has to be at least 8 bytes in size. */
- err = add_attr_bitmap(m, name, name_len, ic, upcase, upcase_len,
- (char*)&bmp, sizeof(bmp));
+ err = add_attr_bitmap(m, name, name_len, ic, (char*)&bmp, sizeof(bmp));
if (err)
goto err_out;
@@ -2185,6 +2168,6 @@
goto err_out;
}
- err = add_attr_index_alloc(m, name, name_len, ic, upcase, upcase_len,
- (char*)ia_val, index_block_size);
+ err = add_attr_index_alloc(m, name, name_len, ic, (char*)ia_val,
+ index_block_size);
ntfs_post_write_mst_fixup((NTFS_RECORD*)ia_val);
if (err) {
@@ -2450,6 +2433,5 @@
/* Add the file_name to @m_file. */
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);
+ 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size);
if (i < 0) {
Eprintf("create_hardlink failed adding file name attribute: "
@@ -3299,11 +3281,11 @@
err = add_attr_sd(m, sd, i);
}
+ // FIXME: This should be IGNORE_CASE
if (!err)
- err = add_attr_index_root(m, "$I30", 4, IGNORE_CASE, opt.upcase,
- opt.upcase_len, AT_FILE_NAME,
+ err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME,
COLLATION_FILE_NAME, opt.index_block_size);
+ // FIXME: This should be IGNORE_CASE
if (!err)
- err = upgrade_to_large_index(m, "$I30", 4, IGNORE_CASE,
- opt.upcase, opt.upcase_len, &index_block);
+ err = upgrade_to_large_index(m, "$I30", 4, 0, &index_block);
if (!err) {
ctx = ntfs_get_attr_search_ctx(NULL, m);
@@ -3331,5 +3313,5 @@
Vprintf("Creating $MFT (mft record 0)\n");
m = (MFT_RECORD*)buf;
- err = add_attr_data_positioned(m, NULL, 0, 0, NULL, 0, 0, rl_mft, buf,
+ err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mft, buf,
opt.mft_size);
if (!err)
@@ -3345,6 +3327,6 @@
/* mft_bitmap is not modified in mkntfs; no need to sync it later. */
if (!err)
- err = add_attr_bitmap_positioned(m, NULL, 0, 0, NULL, 0,
- rl_mft_bmp, mft_bitmap, mft_bitmap_byte_size);
+ err = add_attr_bitmap_positioned(m, NULL, 0, 0, rl_mft_bmp,
+ mft_bitmap, mft_bitmap_byte_size);
if (err < 0)
err_exit("Couldn't create $MFT: %s\n", strerror(-err));
@@ -3352,6 +3334,6 @@
Vprintf("Creating $MFTMirr (mft record 1)\n");
m = (MFT_RECORD*)(buf + 1 * opt.mft_record_size);
- err = add_attr_data_positioned(m, NULL, 0, 0, NULL, 0, 0, rl_mftmirr,
- buf, rl_mftmirr[0].length * opt.cluster_size);
+ err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mftmirr, buf,
+ rl_mftmirr[0].length * opt.cluster_size);
if (!err)
err = create_hardlink(index_block, root_ref, m,
@@ -3375,6 +3357,6 @@
strerror(errno));
memset(buf2, -1, opt.logfile_size);
- err = add_attr_data_positioned(m, NULL, 0, 0, NULL, 0, 0, rl_logfile,
- buf2, opt.logfile_size);
+ err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_logfile, buf2,
+ opt.logfile_size);
free(buf2);
buf2 = NULL;
@@ -3403,5 +3385,5 @@
}
if (!err)
- err = add_attr_data(m, NULL, 0, 0, NULL, 0, 0, NULL, 0);
+ err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0);
if (!err)
err = add_attr_vol_name(m, opt.volume_label, opt.volume_label ?
@@ -3427,5 +3409,5 @@
strerror(errno));
memcpy(buf2, opt.attr_defs, opt.attr_defs_len);
- err = add_attr_data(m, NULL, 0, 0, NULL, 0, 0, buf2, buf2_size);
+ err = add_attr_data(m, NULL, 0, 0, 0, buf2, buf2_size);
free(buf2);
buf2 = NULL;
@@ -3447,6 +3429,5 @@
Vprintf("Creating $Bitmap (mft record 6)\n");
m = (MFT_RECORD*)(buf + 6 * opt.mft_record_size);
- err = add_attr_data(m, NULL, 0, 0, NULL, 0, 0, lcn_bitmap,
- lcn_bitmap_byte_size);
+ err = add_attr_data(m, NULL, 0, 0, 0, lcn_bitmap, lcn_bitmap_byte_size);
if (!err)
err = create_hardlink(index_block, root_ref, m,
@@ -3526,6 +3507,5 @@
if (!is_boot_sector_ntfs(bs, opt.verbose > 0 ? 0 : 1))
err_exit("FATAL: Generated boot sector is invalid!\n");
- err = add_attr_data_positioned(m, NULL, 0, 0, NULL, 0, 0, rl_boot,
- buf2, 8192);
+ err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_boot, buf2, 8192);
if (!err)
err = create_hardlink(index_block, root_ref, m,
@@ -3574,10 +3554,10 @@
Vprintf("Creating $BadClus (mft record 8)\n");
m = (MFT_RECORD*)(buf + 8 * opt.mft_record_size);
+ // FIXME: This should be IGNORE_CASE
/* Create a sparse named stream of size equal to the volume size. */
- err = add_attr_data_positioned(m, "$Bad", 4, IGNORE_CASE, opt.upcase,
- opt.upcase_len, 0, rl_bad, NULL, opt.nr_clusters *
- opt.cluster_size);
+ err = add_attr_data_positioned(m, "$Bad", 4, 0, 0, rl_bad, NULL,
+ opt.nr_clusters * opt.cluster_size);
if (!err) {
- err = add_attr_data(m, NULL, 0, 0, NULL, 0, 0, NULL, 0);
+ err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0);
}
if (!err) {
@@ -3596,5 +3576,5 @@
Vprintf("Creating $Quota (mft record 9)\n");
m = (MFT_RECORD*)(buf + 9 * opt.mft_record_size);
- err = add_attr_data(m, NULL, 0, 0, NULL, 0, 0, NULL, 0);
+ err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0);
if (!err)
err = create_hardlink(index_block, root_ref, m,
@@ -3611,5 +3591,5 @@
Vprintf("Creating $UpCase (mft record 0xa)\n");
m = (MFT_RECORD*)(buf + 0xa * opt.mft_record_size);
- err = add_attr_data(m, NULL, 0, 0, NULL, 0, 0, (char*)opt.upcase,
+ err = add_attr_data(m, NULL, 0, 0, 0, (char*)opt.upcase,
opt.upcase_len << 1);
if (!err)
@@ -3631,5 +3611,5 @@
Vprintf("Creating system file (mft record 0x%x)\n", i, i);
m = (MFT_RECORD*)(buf + i * opt.mft_record_size);
- err = add_attr_data(m, NULL, 0, 0, NULL, 0, 0, NULL, 0);
+ err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0);
if (!err) {
init_system_file_sd(i, &sd, &j);
@@ -3663,6 +3643,6 @@
err_exit("Failed to allocate attribute search context: %s\n",
strerror(errno));
- err_exit("FIXME: Hit unimplemented code path #5.");
- if (ntfs_lookup_attr(AT_INDEX_ALLOCATION, ustr, j, IGNORE_CASE, 0,
+ // FIXME: This should be IGNORE_CASE!
+ if (ntfs_lookup_attr(AT_INDEX_ALLOCATION, ustr, j, 0, 0,
NULL, 0, ctx)) {
ntfs_put_attr_search_ctx(ctx);
|