NTFS_INDEX_ prefix $I30, $SII, $SDH, $O and $Q indexes
parent
9be56ad848
commit
746dff1a24
|
@ -35,11 +35,11 @@
|
|||
/* The little endian Unicode strings $I30, $SII, $SDH, $O, $Q
|
||||
* as a global constant.
|
||||
*/
|
||||
extern ntfschar I30[5];
|
||||
extern ntfschar SII[5];
|
||||
extern ntfschar SDH[5];
|
||||
extern ntfschar O[3];
|
||||
extern ntfschar Q[3];
|
||||
extern ntfschar NTFS_INDEX_I30[5];
|
||||
extern ntfschar NTFS_INDEX_SII[5];
|
||||
extern ntfschar NTFS_INDEX_SDH[5];
|
||||
extern ntfschar NTFS_INDEX_O[3];
|
||||
extern ntfschar NTFS_INDEX_Q[3];
|
||||
|
||||
extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni,
|
||||
const ntfschar *uname, const int uname_len);
|
||||
|
|
|
@ -349,7 +349,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
|
|||
na = calloc(sizeof(ntfs_attr), 1);
|
||||
if (!na)
|
||||
return NULL;
|
||||
if (name && name != AT_UNNAMED && name != I30) {
|
||||
if (name && name != AT_UNNAMED && name != NTFS_INDEX_I30) {
|
||||
name = ntfs_ucsndup(name, name_len);
|
||||
if (!name) {
|
||||
err = errno;
|
||||
|
@ -427,7 +427,7 @@ void ntfs_attr_close(ntfs_attr *na)
|
|||
if (NAttrNonResident(na) && na->rl)
|
||||
free(na->rl);
|
||||
/* Don't release if using an internal constant. */
|
||||
if (na->name != AT_UNNAMED && na->name != I30)
|
||||
if (na->name != AT_UNNAMED && na->name != NTFS_INDEX_I30)
|
||||
free(na->name);
|
||||
free(na);
|
||||
}
|
||||
|
|
|
@ -51,18 +51,18 @@
|
|||
* The little endian Unicode strings "$I30", "$SII", "$SDH", "$O"
|
||||
* and "$Q" as global constants.
|
||||
*/
|
||||
ntfschar I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'),
|
||||
ntfschar NTFS_INDEX_I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'),
|
||||
const_cpu_to_le16('3'), const_cpu_to_le16('0'),
|
||||
const_cpu_to_le16('\0') };
|
||||
ntfschar SII[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'),
|
||||
ntfschar NTFS_INDEX_SII[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'),
|
||||
const_cpu_to_le16('I'), const_cpu_to_le16('I'),
|
||||
const_cpu_to_le16('\0') };
|
||||
ntfschar SDH[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'),
|
||||
ntfschar NTFS_INDEX_SDH[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'),
|
||||
const_cpu_to_le16('D'), const_cpu_to_le16('H'),
|
||||
const_cpu_to_le16('\0') };
|
||||
ntfschar O[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('O'),
|
||||
ntfschar NTFS_INDEX_O[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('O'),
|
||||
const_cpu_to_le16('\0') };
|
||||
ntfschar Q[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('Q'),
|
||||
ntfschar NTFS_INDEX_Q[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('Q'),
|
||||
const_cpu_to_le16('\0') };
|
||||
|
||||
/**
|
||||
|
@ -117,7 +117,7 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
|
|||
return -1;
|
||||
|
||||
/* Find the index root attribute in the mft record. */
|
||||
if (ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL,
|
||||
if (ntfs_attr_lookup(AT_INDEX_ROOT, NTFS_INDEX_I30, 4, CASE_SENSITIVE, 0, NULL,
|
||||
0, ctx)) {
|
||||
ntfs_log_perror("Index root attribute missing in directory inode "
|
||||
"0x%llx", (unsigned long long)dir_ni->mft_no);
|
||||
|
@ -252,7 +252,7 @@ found_it:
|
|||
} /* Child node present, descend into it. */
|
||||
|
||||
/* Open the index allocation attribute. */
|
||||
ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, I30, 4);
|
||||
ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4);
|
||||
if (!ia_na) {
|
||||
ntfs_log_perror("Failed to open index allocation attribute. Directory "
|
||||
"inode 0x%llx is corrupt or driver bug",
|
||||
|
@ -757,7 +757,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos,
|
|||
(unsigned long long)dir_ni->mft_no, (long long)*pos);
|
||||
|
||||
/* Open the index allocation attribute. */
|
||||
ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, I30, 4);
|
||||
ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4);
|
||||
if (!ia_na) {
|
||||
if (errno != ENOENT) {
|
||||
ntfs_log_perror("Failed to open index allocation attribute. "
|
||||
|
@ -808,7 +808,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos,
|
|||
/* Get the offset into the index root attribute. */
|
||||
ir_pos = (int)*pos;
|
||||
/* Find the index root attribute in the mft record. */
|
||||
if (ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL,
|
||||
if (ntfs_attr_lookup(AT_INDEX_ROOT, NTFS_INDEX_I30, 4, CASE_SENSITIVE, 0, NULL,
|
||||
0, ctx)) {
|
||||
ntfs_log_debug("Index root attribute missing in directory inode "
|
||||
"0x%llx.\n", (unsigned long long)dir_ni->mft_no);
|
||||
|
@ -899,7 +899,7 @@ skip_index_root:
|
|||
goto err_out;
|
||||
}
|
||||
|
||||
bmp_na = ntfs_attr_open(dir_ni, AT_BITMAP, I30, 4);
|
||||
bmp_na = ntfs_attr_open(dir_ni, AT_BITMAP, NTFS_INDEX_I30, 4);
|
||||
if (!bmp_na) {
|
||||
ntfs_log_perror("Failed to open index bitmap attribute");
|
||||
goto dir_err_out;
|
||||
|
@ -1153,7 +1153,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len,
|
|||
ie->key_length = 0;
|
||||
ie->flags = INDEX_ENTRY_END;
|
||||
/* Add INDEX_ROOT attribute to inode. */
|
||||
if (ntfs_attr_add(ni, AT_INDEX_ROOT, I30, 4, (u8*)ir, ir_len)) {
|
||||
if (ntfs_attr_add(ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4, (u8*)ir, ir_len)) {
|
||||
err = errno;
|
||||
free(ir);
|
||||
ntfs_log_error("Failed to add INDEX_ROOT attribute.");
|
||||
|
@ -1254,7 +1254,7 @@ int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len)
|
|||
if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
|
||||
ntfs_attr *na;
|
||||
|
||||
na = ntfs_attr_open(ni, AT_INDEX_ROOT, I30, 4);
|
||||
na = ntfs_attr_open(ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4);
|
||||
if (!na) {
|
||||
ntfs_log_error("Corrupt directory or library bug.");
|
||||
errno = EIO;
|
||||
|
@ -1317,7 +1317,7 @@ search:
|
|||
if (errno)
|
||||
goto err_out;
|
||||
/* Search for such FILE_NAME in index. */
|
||||
ictx = ntfs_index_ctx_get(dir_ni, I30, 4);
|
||||
ictx = ntfs_index_ctx_get(dir_ni, NTFS_INDEX_I30, 4);
|
||||
if (!ictx)
|
||||
goto err_out;
|
||||
if (ntfs_index_lookup(fn, le32_to_cpu(actx->attr->value_length), ictx))
|
||||
|
@ -1471,7 +1471,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len)
|
|||
err = errno;
|
||||
ntfs_log_error("Failed to add FILE_NAME attribute.");
|
||||
/* Try to remove just added attribute from index. */
|
||||
ictx = ntfs_index_ctx_get(dir_ni, I30, 4);
|
||||
ictx = ntfs_index_ctx_get(dir_ni, NTFS_INDEX_I30, 4);
|
||||
if (!ictx)
|
||||
goto rollback_failed;
|
||||
if (ntfs_index_lookup(fn, fn_len, ictx)) {
|
||||
|
@ -1787,8 +1787,8 @@ struct ntfs_dir * ntfs_dir_create(ntfs_volume *vol, MFT_REF mft_num)
|
|||
}
|
||||
|
||||
dir->inode = inode;
|
||||
dir->iroot = ntfs_attr_open(inode, AT_INDEX_ROOT, I30, 4);
|
||||
dir->ialloc = ntfs_attr_open(inode, AT_INDEX_ALLOCATION, I30, 4);
|
||||
dir->iroot = ntfs_attr_open(inode, AT_INDEX_ROOT, NTFS_INDEX_I30, 4);
|
||||
dir->ialloc = ntfs_attr_open(inode, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4);
|
||||
|
||||
if (!dir->iroot) {
|
||||
ntfs_dir_free(dir);
|
||||
|
@ -1805,7 +1805,7 @@ struct ntfs_dir * ntfs_dir_create(ntfs_volume *vol, MFT_REF mft_num)
|
|||
dir->mft_num = mft_num;
|
||||
|
||||
// This may not exist
|
||||
dir->bitmap = ntfs_bmp_create(inode, AT_BITMAP, I30, 4);
|
||||
dir->bitmap = ntfs_bmp_create(inode, AT_BITMAP, NTFS_INDEX_I30, 4);
|
||||
|
||||
if (dir->iroot) {
|
||||
rec = find_first_attribute(AT_INDEX_ROOT, inode->mrec);
|
||||
|
|
|
@ -477,7 +477,7 @@ int ntfs_index_add_filename(ntfs_inode *ni, FILE_NAME_ATTR *fn, MFT_REF mref)
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
ictx = ntfs_index_ctx_get(ni, I30, 4);
|
||||
ictx = ntfs_index_ctx_get(ni, NTFS_INDEX_I30, 4);
|
||||
if (!ictx)
|
||||
return -1;
|
||||
fn_size = (fn->file_name_length * sizeof(ntfschar)) +
|
||||
|
|
|
@ -530,7 +530,7 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni)
|
|||
ntfs_log_trace("Failed to open inode with index.\n");
|
||||
continue;
|
||||
}
|
||||
ictx = ntfs_index_ctx_get(index_ni, I30, 4);
|
||||
ictx = ntfs_index_ctx_get(index_ni, NTFS_INDEX_I30, 4);
|
||||
if (!ictx) {
|
||||
if (!err)
|
||||
err = errno;
|
||||
|
|
|
@ -1422,7 +1422,7 @@ int ntfs_dt_root_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie,
|
|||
del->header->index_length += len;
|
||||
del->header->allocated_size += len;
|
||||
|
||||
ntfs_mft_resize_resident(del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len);
|
||||
ntfs_mft_resize_resident(del->dir->inode, AT_INDEX_ROOT, NTFS_INDEX_I30, 4, del->data, del->data_len);
|
||||
|
||||
//utils_dump_mem(attr, 0, del->data_len, DM_DEFAULTS);
|
||||
|
||||
|
@ -1573,7 +1573,7 @@ BOOL ntfs_dt_root_remove(struct ntfs_dt *del, int del_num)
|
|||
del->header->index_length = del->data_len - 16;
|
||||
del->header->allocated_size = del->data_len - 16;
|
||||
|
||||
ntfs_mft_resize_resident(del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len);
|
||||
ntfs_mft_resize_resident(del->dir->inode, AT_INDEX_ROOT, NTFS_INDEX_I30, 4, del->data, del->data_len);
|
||||
old = del->data;
|
||||
del->data = realloc(del->data, del->data_len);
|
||||
del->header = (INDEX_HEADER*) (del->data + 0x10);
|
||||
|
@ -1908,7 +1908,7 @@ int ntfs_dt_root_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, str
|
|||
//utils_dump_mem(parent->data, 0, parent->data_len, DM_DEFAULTS);
|
||||
ntfs_log_debug("\n");
|
||||
|
||||
ntfs_mft_resize_resident(parent->dir->inode, AT_INDEX_ROOT, I30, 4, parent->data, parent->data_len);
|
||||
ntfs_mft_resize_resident(parent->dir->inode, AT_INDEX_ROOT, NTFS_INDEX_I30, 4, parent->data, parent->data_len);
|
||||
|
||||
//realloc children, sub_nodes
|
||||
ntfs_dt_create_children2(parent, parent->child_count + 1);
|
||||
|
|
|
@ -2897,12 +2897,12 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) {
|
|||
sii_data->size_in_sds = sds_header->length;
|
||||
if ((err = insert_index_entry_in_res_dir_index(idx_entry_sdh,
|
||||
sdh_size, m,
|
||||
SDH, 4, AT_UNUSED)))
|
||||
NTFS_INDEX_SDH, 4, AT_UNUSED)))
|
||||
break;
|
||||
|
||||
if ((err = insert_index_entry_in_res_dir_index(idx_entry_sii,
|
||||
sii_size, m,
|
||||
SII, 4, AT_UNUSED)))
|
||||
NTFS_INDEX_SII, 4, AT_UNUSED)))
|
||||
break;
|
||||
sds_header = (SECURITY_DESCRIPTOR_HEADER*)((char*)sds_header +
|
||||
(cpu_to_le32(sds_header->length + 0x0F) &
|
||||
|
@ -2961,7 +2961,7 @@ static int initialize_quota(MFT_RECORD *m) {
|
|||
|
||||
err = insert_index_entry_in_res_dir_index(idx_entry_o,
|
||||
o_size, m,
|
||||
O, 2, AT_UNUSED);
|
||||
NTFS_INDEX_O, 2, AT_UNUSED);
|
||||
free(idx_entry_o);
|
||||
if (err) return err;
|
||||
|
||||
|
@ -2988,7 +2988,7 @@ static int initialize_quota(MFT_RECORD *m) {
|
|||
|
||||
err = insert_index_entry_in_res_dir_index(idx_entry_q1,
|
||||
q1_size, m,
|
||||
Q, 2, AT_UNUSED);
|
||||
NTFS_INDEX_Q, 2, AT_UNUSED);
|
||||
free(idx_entry_q1);
|
||||
if (err) return err;
|
||||
|
||||
|
@ -3023,7 +3023,7 @@ static int initialize_quota(MFT_RECORD *m) {
|
|||
|
||||
err = insert_index_entry_in_res_dir_index(idx_entry_q2,
|
||||
q2_size, m,
|
||||
Q, 2, AT_UNUSED);
|
||||
NTFS_INDEX_Q, 2, AT_UNUSED);
|
||||
free(idx_entry_q2);
|
||||
|
||||
return err;
|
||||
|
@ -3063,7 +3063,7 @@ static int initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) {
|
|||
idx_entry_o_data->domain_id = *zero_guid;
|
||||
err = insert_index_entry_in_res_dir_index(idx_entry_o,
|
||||
o_size, m,
|
||||
O, 2, AT_UNUSED);
|
||||
NTFS_INDEX_O, 2, AT_UNUSED);
|
||||
if (idx_entry_o) free (idx_entry_o);
|
||||
|
||||
return err;
|
||||
|
@ -3294,7 +3294,7 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent,
|
|||
idx_entry_new->key_length = fn_size;
|
||||
memcpy((char*)idx_entry_new+0x10, (char*)fn, fn_size);
|
||||
i = insert_index_entry_in_res_dir_index(idx_entry_new, idx_size + 0x10
|
||||
, m_parent, I30, 4, AT_FILE_NAME);
|
||||
, m_parent, NTFS_INDEX_I30, 4, AT_FILE_NAME);
|
||||
if (i < 0) {
|
||||
Eprintf("create_hardlink failed inserting index entry: %s\n",
|
||||
strerror(-i));
|
||||
|
@ -4966,7 +4966,7 @@ int main(int argc, char **argv)
|
|||
// update during each subsequent c&w of each system file.
|
||||
Vprintf("Syncing root directory index record.\n");
|
||||
mkntfs_sync_index_record(index_block, (MFT_RECORD*)(buf +
|
||||
5 * vol->mft_record_size), I30, 4);
|
||||
5 * vol->mft_record_size), NTFS_INDEX_I30, 4);
|
||||
|
||||
Vprintf("Syncing $Bitmap.\n");
|
||||
m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size);
|
||||
|
|
|
@ -298,7 +298,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
|
|||
if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY &&
|
||||
!stream_name_len) {
|
||||
stbuf->st_mode = S_IFDIR | (0777 & ~ctx->dmask);
|
||||
na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, I30, 4);
|
||||
na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4);
|
||||
if (na) {
|
||||
stbuf->st_size = na->data_size;
|
||||
stbuf->st_blocks = na->allocated_size >>
|
||||
|
|
|
@ -979,7 +979,7 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act)
|
|||
goto close_inode;
|
||||
}
|
||||
|
||||
naa = ntfs_attr_open (ni, AT_INDEX_ALLOCATION, I30, 4);
|
||||
naa = ntfs_attr_open (ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4);
|
||||
if (!naa) {
|
||||
if (opts.verbose > 2)
|
||||
Vprintf ("Couldn't open $INDEX_ALLOCATION\n");
|
||||
|
@ -1002,7 +1002,7 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act)
|
|||
goto close_attr_allocation;
|
||||
}
|
||||
|
||||
nab = ntfs_attr_open (ni, AT_BITMAP, I30, 4);
|
||||
nab = ntfs_attr_open (ni, AT_BITMAP, NTFS_INDEX_I30, 4);
|
||||
if (!nab) {
|
||||
Vprintf ("Couldn't open $BITMAP\n");
|
||||
Eprintf ("damaged fs: $INDEX_ALLOCATION is present, "
|
||||
|
@ -1011,7 +1011,7 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act)
|
|||
goto close_attr_allocation;
|
||||
}
|
||||
|
||||
nar = ntfs_attr_open (ni, AT_INDEX_ROOT, I30, 4);
|
||||
nar = ntfs_attr_open (ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4);
|
||||
if (!nar) {
|
||||
Vprintf ("Couldn't open $INDEX_ROOT\n");
|
||||
Eprintf ("damaged fs: $INDEX_ALLOCATION is present, but "
|
||||
|
|
|
@ -934,7 +934,7 @@ int mft_next_record (struct mft_search_ctx *ctx)
|
|||
if (ctx->flags_search & FEMR_DIR) {
|
||||
attr_ctx = ntfs_attr_get_search_ctx (ctx->inode, NULL);
|
||||
if (attr_ctx) {
|
||||
if (ntfs_attr_lookup (AT_INDEX_ROOT, I30, 4, 0, 0, NULL, 0, attr_ctx) == 0)
|
||||
if (ntfs_attr_lookup (AT_INDEX_ROOT, NTFS_INDEX_I30, 4, 0, 0, NULL, 0, attr_ctx) == 0)
|
||||
ctx->flags_match |= FEMR_DIR;
|
||||
|
||||
ntfs_attr_put_search_ctx (attr_ctx);
|
||||
|
|
Loading…
Reference in New Issue