Commit ae855f40 authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: 2.1.11 - Rename uchar_t to ntfschar.

parent 564c36d2
...@@ -31,6 +31,8 @@ ToDo: ...@@ -31,6 +31,8 @@ ToDo:
- Really final white space cleanups. - Really final white space cleanups.
- Use generic_ffs() instead of ffs() in logfile.c which allows the - Use generic_ffs() instead of ffs() in logfile.c which allows the
log_page_size variable to be optimized by gcc into a constant. log_page_size variable to be optimized by gcc into a constant.
- Rename uchar_t to ntfschar everywhere as uchar_t is unsigned 1-byte
char as defined by POSIX and as found on some systems.
2.1.10 - Force read-only (re)mounting of volumes with unsupported volume flags. 2.1.10 - Force read-only (re)mounting of volumes with unsupported volume flags.
......
...@@ -1096,13 +1096,13 @@ LCN vcn_to_lcn(const run_list_element *rl, const VCN vcn) ...@@ -1096,13 +1096,13 @@ LCN vcn_to_lcn(const run_list_element *rl, const VCN vcn)
* Warning: Never use @val when looking for attribute types which can be * Warning: Never use @val when looking for attribute types which can be
* non-resident as this most likely will result in a crash! * non-resident as this most likely will result in a crash!
*/ */
BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len, BOOL find_attr(const ATTR_TYPES type, const ntfschar *name, const u32 name_len,
const IGNORE_CASE_BOOL ic, const u8 *val, const u32 val_len, const IGNORE_CASE_BOOL ic, const u8 *val, const u32 val_len,
attr_search_context *ctx) attr_search_context *ctx)
{ {
ATTR_RECORD *a; ATTR_RECORD *a;
ntfs_volume *vol; ntfs_volume *vol;
uchar_t *upcase; ntfschar *upcase;
u32 upcase_len; u32 upcase_len;
if (ic == IGNORE_CASE) { if (ic == IGNORE_CASE) {
...@@ -1145,12 +1145,12 @@ BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len, ...@@ -1145,12 +1145,12 @@ BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
if (a->name_length) if (a->name_length)
return FALSE; return FALSE;
} else if (!ntfs_are_names_equal(name, name_len, } else if (!ntfs_are_names_equal(name, name_len,
(uchar_t*)((u8*)a + le16_to_cpu(a->name_offset)), (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)),
a->name_length, ic, upcase, upcase_len)) { a->name_length, ic, upcase, upcase_len)) {
register int rc; register int rc;
rc = ntfs_collate_names(name, name_len, rc = ntfs_collate_names(name, name_len,
(uchar_t*)((u8*)a + (ntfschar*)((u8*)a +
le16_to_cpu(a->name_offset)), le16_to_cpu(a->name_offset)),
a->name_length, 1, IGNORE_CASE, a->name_length, 1, IGNORE_CASE,
upcase, upcase_len); upcase, upcase_len);
...@@ -1164,7 +1164,7 @@ BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len, ...@@ -1164,7 +1164,7 @@ BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
if (rc) if (rc)
continue; continue;
rc = ntfs_collate_names(name, name_len, rc = ntfs_collate_names(name, name_len,
(uchar_t*)((u8*)a + (ntfschar*)((u8*)a +
le16_to_cpu(a->name_offset)), le16_to_cpu(a->name_offset)),
a->name_length, 1, CASE_SENSITIVE, a->name_length, 1, CASE_SENSITIVE,
upcase, upcase_len); upcase, upcase_len);
...@@ -1354,7 +1354,7 @@ int load_attribute_list(ntfs_volume *vol, run_list *run_list, u8 *al_start, ...@@ -1354,7 +1354,7 @@ int load_attribute_list(ntfs_volume *vol, run_list *run_list, u8 *al_start,
* and if there is not enough space, the attribute should be placed in an * and if there is not enough space, the attribute should be placed in an
* extent mft record. * extent mft record.
*/ */
static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name, static BOOL find_external_attr(const ATTR_TYPES type, const ntfschar *name,
const u32 name_len, const IGNORE_CASE_BOOL ic, const u32 name_len, const IGNORE_CASE_BOOL ic,
const VCN lowest_vcn, const u8 *val, const u32 val_len, const VCN lowest_vcn, const u8 *val, const u32 val_len,
attr_search_context *ctx) attr_search_context *ctx)
...@@ -1364,7 +1364,7 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name, ...@@ -1364,7 +1364,7 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name,
ATTR_LIST_ENTRY *al_entry, *next_al_entry; ATTR_LIST_ENTRY *al_entry, *next_al_entry;
u8 *al_start, *al_end; u8 *al_start, *al_end;
ATTR_RECORD *a; ATTR_RECORD *a;
uchar_t *al_name; ntfschar *al_name;
u32 al_name_len; u32 al_name_len;
ni = ctx->ntfs_ino; ni = ctx->ntfs_ino;
...@@ -1417,7 +1417,7 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name, ...@@ -1417,7 +1417,7 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name,
* missing, assume we want an unnamed attribute. * missing, assume we want an unnamed attribute.
*/ */
al_name_len = al_entry->name_length; al_name_len = al_entry->name_length;
al_name = (uchar_t*)((u8*)al_entry + al_entry->name_offset); al_name = (ntfschar*)((u8*)al_entry + al_entry->name_offset);
if (!name) { if (!name) {
if (al_name_len) if (al_name_len)
goto not_found; goto not_found;
...@@ -1466,7 +1466,7 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name, ...@@ -1466,7 +1466,7 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name,
sle64_to_cpu(lowest_vcn) && sle64_to_cpu(lowest_vcn) &&
next_al_entry->type == al_entry->type && next_al_entry->type == al_entry->type &&
next_al_entry->name_length == al_name_len && next_al_entry->name_length == al_name_len &&
ntfs_are_names_equal((uchar_t*)((u8*) ntfs_are_names_equal((ntfschar*)((u8*)
next_al_entry + next_al_entry +
next_al_entry->name_offset), next_al_entry->name_offset),
next_al_entry->name_length, next_al_entry->name_length,
...@@ -1539,7 +1539,7 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name, ...@@ -1539,7 +1539,7 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name,
if (name) { if (name) {
if (a->name_length != al_name_len) if (a->name_length != al_name_len)
continue; continue;
if (!ntfs_are_names_equal((uchar_t*)((u8*)a + if (!ntfs_are_names_equal((ntfschar*)((u8*)a +
le16_to_cpu(a->name_offset)), le16_to_cpu(a->name_offset)),
a->name_length, al_name, al_name_len, a->name_length, al_name, al_name_len,
CASE_SENSITIVE, vol->upcase, CASE_SENSITIVE, vol->upcase,
...@@ -1623,9 +1623,10 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name, ...@@ -1623,9 +1623,10 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name,
* being searched for, i.e. if one wants to add the attribute to the mft * being searched for, i.e. if one wants to add the attribute to the mft
* record this is the correct place to insert it into. * record this is the correct place to insert it into.
*/ */
BOOL lookup_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len, BOOL lookup_attr(const ATTR_TYPES type, const ntfschar *name,
const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val, const u32 name_len, const IGNORE_CASE_BOOL ic,
const u32 val_len, attr_search_context *ctx) const VCN lowest_vcn, const u8 *val, const u32 val_len,
attr_search_context *ctx)
{ {
ntfs_inode *base_ni; ntfs_inode *base_ni;
......
...@@ -79,13 +79,14 @@ extern int map_run_list(ntfs_inode *ni, VCN vcn); ...@@ -79,13 +79,14 @@ extern int map_run_list(ntfs_inode *ni, VCN vcn);
extern LCN vcn_to_lcn(const run_list_element *rl, const VCN vcn); extern LCN vcn_to_lcn(const run_list_element *rl, const VCN vcn);
extern BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, extern BOOL find_attr(const ATTR_TYPES type, const ntfschar *name,
const u32 name_len, const IGNORE_CASE_BOOL ic, const u8 *val, const u32 name_len, const IGNORE_CASE_BOOL ic, const u8 *val,
const u32 val_len, attr_search_context *ctx); const u32 val_len, attr_search_context *ctx);
BOOL lookup_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len, BOOL lookup_attr(const ATTR_TYPES type, const ntfschar *name,
const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val, const u32 name_len, const IGNORE_CASE_BOOL ic,
const u32 val_len, attr_search_context *ctx); const VCN lowest_vcn, const u8 *val, const u32 val_len,
attr_search_context *ctx);
extern int load_attribute_list(ntfs_volume *vol, run_list *rl, u8 *al_start, extern int load_attribute_list(ntfs_volume *vol, run_list *rl, u8 *al_start,
const s64 size, const s64 initialized_size); const s64 size, const s64 initialized_size);
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
/** /**
* The little endian Unicode string $I30 as a global constant. * The little endian Unicode string $I30 as a global constant.
*/ */
uchar_t I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'), ntfschar 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('3'), const_cpu_to_le16('0'),
const_cpu_to_le16(0) }; const_cpu_to_le16(0) };
...@@ -64,7 +64,7 @@ uchar_t I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'), ...@@ -64,7 +64,7 @@ uchar_t I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'),
* work but we don't care for how quickly one can access them. This also fixes * work but we don't care for how quickly one can access them. This also fixes
* the dcache aliasing issues. * the dcache aliasing issues.
*/ */
MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
const int uname_len, ntfs_name **res) const int uname_len, ntfs_name **res)
{ {
ntfs_volume *vol = dir_ni->vol; ntfs_volume *vol = dir_ni->vol;
...@@ -135,7 +135,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -135,7 +135,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* returning. * returning.
*/ */
if (ntfs_are_names_equal(uname, uname_len, if (ntfs_are_names_equal(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, ie->key.file_name.file_name_length,
CASE_SENSITIVE, vol->upcase, vol->upcase_len)) { CASE_SENSITIVE, vol->upcase, vol->upcase_len)) {
found_it: found_it:
...@@ -186,7 +186,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -186,7 +186,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
if (!NVolCaseSensitive(vol) && if (!NVolCaseSensitive(vol) &&
ie->key.file_name.file_name_type && ie->key.file_name.file_name_type &&
ntfs_are_names_equal(uname, uname_len, ntfs_are_names_equal(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, ie->key.file_name.file_name_length,
IGNORE_CASE, vol->upcase, vol->upcase_len)) { IGNORE_CASE, vol->upcase, vol->upcase_len)) {
int name_size = sizeof(ntfs_name); int name_size = sizeof(ntfs_name);
...@@ -206,7 +206,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -206,7 +206,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
} }
if (type != FILE_NAME_DOS) if (type != FILE_NAME_DOS)
name_size += len * sizeof(uchar_t); name_size += len * sizeof(ntfschar);
name = kmalloc(name_size, GFP_NOFS); name = kmalloc(name_size, GFP_NOFS);
if (!name) { if (!name) {
err = -ENOMEM; err = -ENOMEM;
...@@ -217,7 +217,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -217,7 +217,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
if (type != FILE_NAME_DOS) { if (type != FILE_NAME_DOS) {
name->len = len; name->len = len;
memcpy(name->name, ie->key.file_name.file_name, memcpy(name->name, ie->key.file_name.file_name,
len * sizeof(uchar_t)); len * sizeof(ntfschar));
} else } else
name->len = 0; name->len = 0;
*res = name; *res = name;
...@@ -227,7 +227,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -227,7 +227,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* know which way in the B+tree we have to go. * know which way in the B+tree we have to go.
*/ */
rc = ntfs_collate_names(uname, uname_len, rc = ntfs_collate_names(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, 1, ie->key.file_name.file_name_length, 1,
IGNORE_CASE, vol->upcase, vol->upcase_len); IGNORE_CASE, vol->upcase, vol->upcase_len);
/* /*
...@@ -246,7 +246,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -246,7 +246,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* collation. * collation.
*/ */
rc = ntfs_collate_names(uname, uname_len, rc = ntfs_collate_names(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, 1, ie->key.file_name.file_name_length, 1,
CASE_SENSITIVE, vol->upcase, vol->upcase_len); CASE_SENSITIVE, vol->upcase, vol->upcase_len);
if (rc == -1) if (rc == -1)
...@@ -395,7 +395,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -395,7 +395,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* returning. * returning.
*/ */
if (ntfs_are_names_equal(uname, uname_len, if (ntfs_are_names_equal(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, ie->key.file_name.file_name_length,
CASE_SENSITIVE, vol->upcase, vol->upcase_len)) { CASE_SENSITIVE, vol->upcase, vol->upcase_len)) {
found_it2: found_it2:
...@@ -445,7 +445,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -445,7 +445,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
if (!NVolCaseSensitive(vol) && if (!NVolCaseSensitive(vol) &&
ie->key.file_name.file_name_type && ie->key.file_name.file_name_type &&
ntfs_are_names_equal(uname, uname_len, ntfs_are_names_equal(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, ie->key.file_name.file_name_length,
IGNORE_CASE, vol->upcase, vol->upcase_len)) { IGNORE_CASE, vol->upcase, vol->upcase_len)) {
int name_size = sizeof(ntfs_name); int name_size = sizeof(ntfs_name);
...@@ -466,7 +466,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -466,7 +466,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
} }
if (type != FILE_NAME_DOS) if (type != FILE_NAME_DOS)
name_size += len * sizeof(uchar_t); name_size += len * sizeof(ntfschar);
name = kmalloc(name_size, GFP_NOFS); name = kmalloc(name_size, GFP_NOFS);
if (!name) { if (!name) {
err = -ENOMEM; err = -ENOMEM;
...@@ -477,7 +477,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -477,7 +477,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
if (type != FILE_NAME_DOS) { if (type != FILE_NAME_DOS) {
name->len = len; name->len = len;
memcpy(name->name, ie->key.file_name.file_name, memcpy(name->name, ie->key.file_name.file_name,
len * sizeof(uchar_t)); len * sizeof(ntfschar));
} else } else
name->len = 0; name->len = 0;
*res = name; *res = name;
...@@ -487,7 +487,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -487,7 +487,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* know which way in the B+tree we have to go. * know which way in the B+tree we have to go.
*/ */
rc = ntfs_collate_names(uname, uname_len, rc = ntfs_collate_names(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, 1, ie->key.file_name.file_name_length, 1,
IGNORE_CASE, vol->upcase, vol->upcase_len); IGNORE_CASE, vol->upcase, vol->upcase_len);
/* /*
...@@ -506,7 +506,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -506,7 +506,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* collation. * collation.
*/ */
rc = ntfs_collate_names(uname, uname_len, rc = ntfs_collate_names(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, 1, ie->key.file_name.file_name_length, 1,
CASE_SENSITIVE, vol->upcase, vol->upcase_len); CASE_SENSITIVE, vol->upcase, vol->upcase_len);
if (rc == -1) if (rc == -1)
...@@ -607,7 +607,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -607,7 +607,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* *
* Note, @uname_len does not include the (optional) terminating NULL character. * Note, @uname_len does not include the (optional) terminating NULL character.
*/ */
u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
const int uname_len) const int uname_len)
{ {
ntfs_volume *vol = dir_ni->vol; ntfs_volume *vol = dir_ni->vol;
...@@ -689,7 +689,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -689,7 +689,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* convert it to cpu format before returning. * convert it to cpu format before returning.
*/ */
if (ntfs_are_names_equal(uname, uname_len, if (ntfs_are_names_equal(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, ic, ie->key.file_name.file_name_length, ic,
vol->upcase, vol->upcase_len)) { vol->upcase, vol->upcase_len)) {
found_it: found_it:
...@@ -703,7 +703,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -703,7 +703,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* know which way in the B+tree we have to go. * know which way in the B+tree we have to go.
*/ */
rc = ntfs_collate_names(uname, uname_len, rc = ntfs_collate_names(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, 1, ie->key.file_name.file_name_length, 1,
IGNORE_CASE, vol->upcase, vol->upcase_len); IGNORE_CASE, vol->upcase, vol->upcase_len);
/* /*
...@@ -722,7 +722,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -722,7 +722,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* collation. * collation.
*/ */
rc = ntfs_collate_names(uname, uname_len, rc = ntfs_collate_names(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, 1, ie->key.file_name.file_name_length, 1,
CASE_SENSITIVE, vol->upcase, vol->upcase_len); CASE_SENSITIVE, vol->upcase, vol->upcase_len);
if (rc == -1) if (rc == -1)
...@@ -875,7 +875,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -875,7 +875,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* convert it to cpu format before returning. * convert it to cpu format before returning.
*/ */
if (ntfs_are_names_equal(uname, uname_len, if (ntfs_are_names_equal(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, ic, ie->key.file_name.file_name_length, ic,
vol->upcase, vol->upcase_len)) { vol->upcase, vol->upcase_len)) {
found_it2: found_it2:
...@@ -888,7 +888,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -888,7 +888,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* know which way in the B+tree we have to go. * know which way in the B+tree we have to go.
*/ */
rc = ntfs_collate_names(uname, uname_len, rc = ntfs_collate_names(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, 1, ie->key.file_name.file_name_length, 1,
IGNORE_CASE, vol->upcase, vol->upcase_len); IGNORE_CASE, vol->upcase, vol->upcase_len);
/* /*
...@@ -907,7 +907,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, ...@@ -907,7 +907,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* collation. * collation.
*/ */
rc = ntfs_collate_names(uname, uname_len, rc = ntfs_collate_names(uname, uname_len,
(uchar_t*)&ie->key.file_name.file_name, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, 1, ie->key.file_name.file_name_length, 1,
CASE_SENSITIVE, vol->upcase, vol->upcase_len); CASE_SENSITIVE, vol->upcase, vol->upcase_len);
if (rc == -1) if (rc == -1)
...@@ -1027,7 +1027,7 @@ static inline int ntfs_filldir(ntfs_volume *vol, loff_t *fpos, ...@@ -1027,7 +1027,7 @@ static inline int ntfs_filldir(ntfs_volume *vol, loff_t *fpos,
ntfs_debug("Skipping system file."); ntfs_debug("Skipping system file.");
return 0; return 0;
} }
name_len = ntfs_ucstonls(vol, (uchar_t*)&ie->key.file_name.file_name, name_len = ntfs_ucstonls(vol, (ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length, &name, ie->key.file_name.file_name_length, &name,
NTFS_MAX_NAME_LEN * NLS_MAX_CHARSET_SIZE + 1); NTFS_MAX_NAME_LEN * NLS_MAX_CHARSET_SIZE + 1);
if (name_len <= 0) { if (name_len <= 0) {
......
...@@ -34,13 +34,13 @@ typedef struct { ...@@ -34,13 +34,13 @@ typedef struct {
MFT_REF mref; MFT_REF mref;
FILE_NAME_TYPE_FLAGS type; FILE_NAME_TYPE_FLAGS type;
u8 len; u8 len;
uchar_t name[0]; ntfschar name[0];
} __attribute__ ((__packed__)) ntfs_name; } __attribute__ ((__packed__)) ntfs_name;
/* The little endian Unicode string $I30 as a global constant. */ /* The little endian Unicode string $I30 as a global constant. */
extern uchar_t I30[5]; extern ntfschar I30[5];
extern MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, extern MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni,
const uchar_t *uname, const int uname_len, ntfs_name **res); const ntfschar *uname, const int uname_len, ntfs_name **res);
#endif /* _LINUX_NTFS_FS_DIR_H */ #endif /* _LINUX_NTFS_FS_DIR_H */
...@@ -66,7 +66,7 @@ int ntfs_test_inode(struct inode *vi, ntfs_attr *na) ...@@ -66,7 +66,7 @@ int ntfs_test_inode(struct inode *vi, ntfs_attr *na)
if (ni->name_len != na->name_len) if (ni->name_len != na->name_len)
return 0; return 0;
if (na->name_len && memcmp(ni->name, na->name, if (na->name_len && memcmp(ni->name, na->name,
na->name_len * sizeof(uchar_t))) na->name_len * sizeof(ntfschar)))
return 0; return 0;
} }
/* Match! */ /* Match! */
...@@ -121,8 +121,8 @@ static int ntfs_init_locked_inode(struct inode *vi, ntfs_attr *na) ...@@ -121,8 +121,8 @@ static int ntfs_init_locked_inode(struct inode *vi, ntfs_attr *na)
if (na->name && na->name_len && na->name != I30) { if (na->name && na->name_len && na->name != I30) {
unsigned int i; unsigned int i;
i = na->name_len * sizeof(uchar_t); i = na->name_len * sizeof(ntfschar);
ni->name = (uchar_t*)kmalloc(i + sizeof(uchar_t), GFP_ATOMIC); ni->name = (ntfschar*)kmalloc(i + sizeof(ntfschar), GFP_ATOMIC);
if (!ni->name) if (!ni->name)
return -ENOMEM; return -ENOMEM;
memcpy(ni->name, na->name, i); memcpy(ni->name, na->name, i);
...@@ -206,7 +206,7 @@ struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no) ...@@ -206,7 +206,7 @@ struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no)
* obtained from PTR_ERR(). * obtained from PTR_ERR().
*/ */
struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPES type, struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPES type,
uchar_t *name, u32 name_len) ntfschar *name, u32 name_len)
{ {
struct inode *vi; struct inode *vi;
ntfs_attr na; ntfs_attr na;
......
...@@ -54,7 +54,7 @@ struct _ntfs_inode { ...@@ -54,7 +54,7 @@ struct _ntfs_inode {
* name_len = 4 for directories. * name_len = 4 for directories.
*/ */
ATTR_TYPES type; /* Attribute type of this fake inode. */ ATTR_TYPES type; /* Attribute type of this fake inode. */
uchar_t *name; /* Attribute name of this fake inode. */ ntfschar *name; /* Attribute name of this fake inode. */
u32 name_len; /* Attribute name length of this fake inode. */ u32 name_len; /* Attribute name length of this fake inode. */
run_list run_list; /* If state has the NI_NonResident bit set, run_list run_list; /* If state has the NI_NonResident bit set,
the run list of the unnamed data attribute the run list of the unnamed data attribute
...@@ -248,7 +248,7 @@ static inline struct inode *VFS_I(ntfs_inode *ni) ...@@ -248,7 +248,7 @@ static inline struct inode *VFS_I(ntfs_inode *ni)
*/ */
typedef struct { typedef struct {
unsigned long mft_no; unsigned long mft_no;
uchar_t *name; ntfschar *name;
u32 name_len; u32 name_len;
ATTR_TYPES type; ATTR_TYPES type;
} ntfs_attr; } ntfs_attr;
...@@ -259,7 +259,7 @@ extern int ntfs_test_inode(struct inode *vi, ntfs_attr *na); ...@@ -259,7 +259,7 @@ extern int ntfs_test_inode(struct inode *vi, ntfs_attr *na);
extern struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no); extern struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no);
extern struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPES type, extern struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPES type,
uchar_t *name, u32 name_len); ntfschar *name, u32 name_len);
extern struct inode *ntfs_alloc_big_inode(struct super_block *sb); extern struct inode *ntfs_alloc_big_inode(struct super_block *sb);
extern void ntfs_destroy_big_inode(struct inode *inode); extern void ntfs_destroy_big_inode(struct inode *inode);
......
...@@ -504,7 +504,7 @@ typedef enum { ...@@ -504,7 +504,7 @@ typedef enum {
*/ */
typedef struct { typedef struct {
/*hex ofs*/ /*hex ofs*/
/* 0*/ uchar_t name[0x40]; /* Unicode name of the attribute. Zero /* 0*/ ntfschar name[0x40]; /* Unicode name of the attribute. Zero
terminated. */ terminated. */
/* 80*/ ATTR_TYPES type; /* Type of the attribute. */ /* 80*/ ATTR_TYPES type; /* Type of the attribute. */
/* 84*/ u32 display_rule; /* Default display rule. /* 84*/ u32 display_rule; /* Default display rule.
...@@ -910,7 +910,7 @@ typedef struct { ...@@ -910,7 +910,7 @@ typedef struct {
attribute value. */ attribute value. */
/* 24*/ u16 instance; /* If lowest_vcn = 0, the instance of the /* 24*/ u16 instance; /* If lowest_vcn = 0, the instance of the
attribute being referenced; otherwise 0. */ attribute being referenced; otherwise 0. */
/* 26*/ uchar_t name[0]; /* Use when creating only. When reading use /* 26*/ ntfschar name[0]; /* Use when creating only. When reading use
name_offset to determine the location of the name_offset to determine the location of the
name. */ name. */
/* sizeof() = 26 + (attribute_name_length * 2) bytes */ /* sizeof() = 26 + (attribute_name_length * 2) bytes */
...@@ -994,7 +994,7 @@ typedef struct { ...@@ -994,7 +994,7 @@ typedef struct {
/* 40*/ u8 file_name_length; /* Length of file name in /* 40*/ u8 file_name_length; /* Length of file name in
(Unicode) characters. */ (Unicode) characters. */
/* 41*/ FILE_NAME_TYPE_FLAGS file_name_type; /* Namespace of the file name.*/ /* 41*/ FILE_NAME_TYPE_FLAGS file_name_type; /* Namespace of the file name.*/
/* 42*/ uchar_t file_name[0]; /* File name in Unicode. */ /* 42*/ ntfschar file_name[0]; /* File name in Unicode. */
} __attribute__ ((__packed__)) FILE_NAME_ATTR; } __attribute__ ((__packed__)) FILE_NAME_ATTR;
/* /*
...@@ -1775,7 +1775,7 @@ typedef struct { ...@@ -1775,7 +1775,7 @@ typedef struct {
* NOTE: Present only in FILE_Volume. * NOTE: Present only in FILE_Volume.
*/ */
typedef struct { typedef struct {
uchar_t name[0]; /* The name of the volume in Unicode. */ ntfschar name[0]; /* The name of the volume in Unicode. */
} __attribute__ ((__packed__)) VOLUME_NAME; } __attribute__ ((__packed__)) VOLUME_NAME;
/* /*
......
...@@ -288,7 +288,7 @@ typedef struct { ...@@ -288,7 +288,7 @@ typedef struct {
/* 22*/ u8 reserved[6]; /* Reserved/alignment. */ /* 22*/ u8 reserved[6]; /* Reserved/alignment. */
/* 28*/ u32 client_name_length; /* Length of client name in bytes. Should /* 28*/ u32 client_name_length; /* Length of client name in bytes. Should
always be 8. */ always be 8. */
/* 32*/ uchar_t client_name[64];/* Name of the client in Unicode. Should /* 32*/ ntfschar client_name[64];/* Name of the client in Unicode. Should
always be "NTFS" with the remaining bytes always be "NTFS" with the remaining bytes
set to 0. */ set to 0. */
/* sizeof() = 160 (0xa0) bytes */ /* sizeof() = 160 (0xa0) bytes */
......
...@@ -98,7 +98,7 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent, ...@@ -98,7 +98,7 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
{ {
ntfs_volume *vol = NTFS_SB(dir_ino->i_sb); ntfs_volume *vol = NTFS_SB(dir_ino->i_sb);
struct inode *dent_inode; struct inode *dent_inode;
uchar_t *uname; ntfschar *uname;
ntfs_name *name = NULL; ntfs_name *name = NULL;
MFT_REF mref; MFT_REF mref;
unsigned long dent_ino; unsigned long dent_ino;
...@@ -177,7 +177,7 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent, ...@@ -177,7 +177,7 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
nls_name.name = NULL; nls_name.name = NULL;
if (name->type != FILE_NAME_DOS) { /* Case 2. */ if (name->type != FILE_NAME_DOS) { /* Case 2. */
nls_name.len = (unsigned)ntfs_ucstonls(vol, nls_name.len = (unsigned)ntfs_ucstonls(vol,
(uchar_t*)&name->name, name->len, (ntfschar*)&name->name, name->len,
(unsigned char**)&nls_name.name, 0); (unsigned char**)&nls_name.name, 0);
kfree(name); kfree(name);
} else /* if (name->type == FILE_NAME_DOS) */ { /* Case 3. */ } else /* if (name->type == FILE_NAME_DOS) */ { /* Case 3. */
...@@ -221,14 +221,14 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent, ...@@ -221,14 +221,14 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
goto eio_err_out; goto eio_err_out;
fn = (FILE_NAME_ATTR*)((u8*)ctx->attr + le16_to_cpu( fn = (FILE_NAME_ATTR*)((u8*)ctx->attr + le16_to_cpu(
ctx->attr->data.resident.value_offset)); ctx->attr->data.resident.value_offset));
if ((u32)(fn->file_name_length * sizeof(uchar_t) + if ((u32)(fn->file_name_length * sizeof(ntfschar) +
sizeof(FILE_NAME_ATTR)) > val_len) sizeof(FILE_NAME_ATTR)) > val_len)
goto eio_err_out; goto eio_err_out;
} while (fn->file_name_type != FILE_NAME_WIN32); } while (fn->file_name_type != FILE_NAME_WIN32);
/* Convert the found WIN32 name to current NLS code page. */ /* Convert the found WIN32 name to current NLS code page. */
nls_name.len = (unsigned)ntfs_ucstonls(vol, nls_name.len = (unsigned)ntfs_ucstonls(vol,
(uchar_t*)&fn->file_name, fn->file_name_length, (ntfschar*)&fn->file_name, fn->file_name_length,
(unsigned char**)&nls_name.name, 0); (unsigned char**)&nls_name.name, 0);
put_attr_search_ctx(ctx); put_attr_search_ctx(ctx);
......
...@@ -174,31 +174,31 @@ extern int pre_write_mst_fixup(NTFS_RECORD *b, const u32 size); ...@@ -174,31 +174,31 @@ extern int pre_write_mst_fixup(NTFS_RECORD *b, const u32 size);
extern void post_write_mst_fixup(NTFS_RECORD *b); extern void post_write_mst_fixup(NTFS_RECORD *b);
/* From fs/ntfs/unistr.c */ /* From fs/ntfs/unistr.c */
extern BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len, extern BOOL ntfs_are_names_equal(const ntfschar *s1, size_t s1_len,
const uchar_t *s2, size_t s2_len, const ntfschar *s2, size_t s2_len,
const IGNORE_CASE_BOOL ic, const IGNORE_CASE_BOOL ic,
const uchar_t *upcase, const u32 upcase_size); const ntfschar *upcase, const u32 upcase_size);
extern int ntfs_collate_names(const uchar_t *name1, const u32 name1_len, extern int ntfs_collate_names(const ntfschar *name1, const u32 name1_len,
const uchar_t *name2, const u32 name2_len, const ntfschar *name2, const u32 name2_len,
const int err_val, const IGNORE_CASE_BOOL ic, const int err_val, const IGNORE_CASE_BOOL ic,
const uchar_t *upcase, const u32 upcase_len); const ntfschar *upcase, const u32 upcase_len);
extern int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n); extern int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n);
extern int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, extern int ntfs_ucsncasecmp(const ntfschar *s1, const ntfschar *s2, size_t n,
const uchar_t *upcase, const u32 upcase_size); const ntfschar *upcase, const u32 upcase_size);
extern void ntfs_upcase_name(uchar_t *name, u32 name_len, extern void ntfs_upcase_name(ntfschar *name, u32 name_len,
const uchar_t *upcase, const u32 upcase_len); const ntfschar *upcase, const u32 upcase_len);
extern void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr, extern void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr,
const uchar_t *upcase, const u32 upcase_len); const ntfschar *upcase, const u32 upcase_len);
extern int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1, extern int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1,
FILE_NAME_ATTR *file_name_attr2, FILE_NAME_ATTR *file_name_attr2,
const int err_val, const IGNORE_CASE_BOOL ic, const int err_val, const IGNORE_CASE_BOOL ic,
const uchar_t *upcase, const u32 upcase_len); const ntfschar *upcase, const u32 upcase_len);
extern int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins, extern int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins,
const int ins_len, uchar_t **outs); const int ins_len, ntfschar **outs);
extern int ntfs_ucstonls(const ntfs_volume *vol, const uchar_t *ins, extern int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins,
const int ins_len, unsigned char **outs, int outs_len); const int ins_len, unsigned char **outs, int outs_len);
/* From fs/ntfs/upcase.c */ /* From fs/ntfs/upcase.c */
extern uchar_t *generate_default_upcase(void); extern ntfschar *generate_default_upcase(void);
#endif /* _LINUX_NTFS_H */ #endif /* _LINUX_NTFS_H */
...@@ -944,12 +944,12 @@ static BOOL load_and_init_upcase(ntfs_volume *vol) ...@@ -944,12 +944,12 @@ static BOOL load_and_init_upcase(ntfs_volume *vol)
} }
/* /*
* The upcase size must not be above 64k Unicode characters, must not * The upcase size must not be above 64k Unicode characters, must not
* be zero and must be a multiple of sizeof(uchar_t). * be zero and must be a multiple of sizeof(ntfschar).
*/ */
if (!ino->i_size || ino->i_size & (sizeof(uchar_t) - 1) || if (!ino->i_size || ino->i_size & (sizeof(ntfschar) - 1) ||
ino->i_size > 64ULL * 1024 * sizeof(uchar_t)) ino->i_size > 64ULL * 1024 * sizeof(ntfschar))
goto iput_upcase_failed; goto iput_upcase_failed;
vol->upcase = (uchar_t*)ntfs_malloc_nofs(ino->i_size); vol->upcase = (ntfschar*)ntfs_malloc_nofs(ino->i_size);
if (!vol->upcase) if (!vol->upcase)
goto iput_upcase_failed; goto iput_upcase_failed;
index = 0; index = 0;
...@@ -972,7 +972,7 @@ static BOOL load_and_init_upcase(ntfs_volume *vol) ...@@ -972,7 +972,7 @@ static BOOL load_and_init_upcase(ntfs_volume *vol)
} }
vol->upcase_len = ino->i_size >> UCHAR_T_SIZE_BITS; vol->upcase_len = ino->i_size >> UCHAR_T_SIZE_BITS;
ntfs_debug("Read %llu bytes from $UpCase (expected %u bytes).", ntfs_debug("Read %llu bytes from $UpCase (expected %u bytes).",
ino->i_size, 64 * 1024 * sizeof(uchar_t)); ino->i_size, 64 * 1024 * sizeof(ntfschar));
iput(ino); iput(ino);
down(&ntfs_lock); down(&ntfs_lock);
if (!default_upcase) { if (!default_upcase) {
...@@ -2059,7 +2059,7 @@ static int __init init_ntfs_fs(void) ...@@ -2059,7 +2059,7 @@ static int __init init_ntfs_fs(void)
} }
ntfs_name_cache = kmem_cache_create(ntfs_name_cache_name, ntfs_name_cache = kmem_cache_create(ntfs_name_cache_name,
(NTFS_MAX_NAME_LEN+1) * sizeof(uchar_t), 0, (NTFS_MAX_NAME_LEN+1) * sizeof(ntfschar), 0,
SLAB_HWCACHE_ALIGN, NULL, NULL); SLAB_HWCACHE_ALIGN, NULL, NULL);
if (!ntfs_name_cache) { if (!ntfs_name_cache) {
printk(KERN_CRIT "NTFS: Failed to create %s!\n", printk(KERN_CRIT "NTFS: Failed to create %s!\n",
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define _LINUX_NTFS_TYPES_H #define _LINUX_NTFS_TYPES_H
/* 2-byte Unicode character type. */ /* 2-byte Unicode character type. */
typedef u16 uchar_t; typedef u16 ntfschar;
#define UCHAR_T_SIZE_BITS 1 #define UCHAR_T_SIZE_BITS 1
/* /*
......
...@@ -61,9 +61,9 @@ static const u8 legal_ansi_char_array[0x40] = { ...@@ -61,9 +61,9 @@ static const u8 legal_ansi_char_array[0x40] = {
* identical, or FALSE (0) if they are not identical. If @ic is IGNORE_CASE, * identical, or FALSE (0) if they are not identical. If @ic is IGNORE_CASE,
* the @upcase table is used to performa a case insensitive comparison. * the @upcase table is used to performa a case insensitive comparison.
*/ */
BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len, BOOL ntfs_are_names_equal(const ntfschar *s1, size_t s1_len,
const uchar_t *s2, size_t s2_len, const IGNORE_CASE_BOOL ic, const ntfschar *s2, size_t s2_len, const IGNORE_CASE_BOOL ic,
const uchar_t *upcase, const u32 upcase_size) const ntfschar *upcase, const u32 upcase_size)
{ {
if (s1_len != s2_len) if (s1_len != s2_len)
return FALSE; return FALSE;
...@@ -90,13 +90,13 @@ BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len, ...@@ -90,13 +90,13 @@ BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len,
* *
* The following characters are considered invalid: '"', '*', '<', '>' and '?'. * The following characters are considered invalid: '"', '*', '<', '>' and '?'.
*/ */
int ntfs_collate_names(const uchar_t *name1, const u32 name1_len, int ntfs_collate_names(const ntfschar *name1, const u32 name1_len,
const uchar_t *name2, const u32 name2_len, const ntfschar *name2, const u32 name2_len,
const int err_val, const IGNORE_CASE_BOOL ic, const int err_val, const IGNORE_CASE_BOOL ic,
const uchar_t *upcase, const u32 upcase_len) const ntfschar *upcase, const u32 upcase_len)
{ {
u32 cnt, min_len; u32 cnt, min_len;
uchar_t c1, c2; ntfschar c1, c2;
min_len = name1_len; min_len = name1_len;
if (name1_len > name2_len) if (name1_len > name2_len)
...@@ -142,9 +142,9 @@ int ntfs_collate_names(const uchar_t *name1, const u32 name1_len, ...@@ -142,9 +142,9 @@ int ntfs_collate_names(const uchar_t *name1, const u32 name1_len,
* if @s1 (or the first @n Unicode characters thereof) is found, respectively, * if @s1 (or the first @n Unicode characters thereof) is found, respectively,
* to be less than, to match, or be greater than @s2. * to be less than, to match, or be greater than @s2.
*/ */
int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n) int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n)
{ {
uchar_t c1, c2; ntfschar c1, c2;
size_t i; size_t i;
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
...@@ -178,10 +178,10 @@ int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n) ...@@ -178,10 +178,10 @@ int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n)
* if @s1 (or the first @n Unicode characters thereof) is found, respectively, * if @s1 (or the first @n Unicode characters thereof) is found, respectively,
* to be less than, to match, or be greater than @s2. * to be less than, to match, or be greater than @s2.
*/ */
int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, int ntfs_ucsncasecmp(const ntfschar *s1, const ntfschar *s2, size_t n,
const uchar_t *upcase, const u32 upcase_size) const ntfschar *upcase, const u32 upcase_size)
{ {
uchar_t c1, c2; ntfschar c1, c2;
size_t i; size_t i;
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
...@@ -199,11 +199,11 @@ int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, ...@@ -199,11 +199,11 @@ int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n,
return 0; return 0;
} }
void ntfs_upcase_name(uchar_t *name, u32 name_len, const uchar_t *upcase, void ntfs_upcase_name(ntfschar *name, u32 name_len, const ntfschar *upcase,
const u32 upcase_len) const u32 upcase_len)
{ {
u32 i; u32 i;
uchar_t u; ntfschar u;
for (i = 0; i < name_len; i++) for (i = 0; i < name_len; i++)
if ((u = le16_to_cpu(name[i])) < upcase_len) if ((u = le16_to_cpu(name[i])) < upcase_len)
...@@ -211,20 +211,20 @@ void ntfs_upcase_name(uchar_t *name, u32 name_len, const uchar_t *upcase, ...@@ -211,20 +211,20 @@ void ntfs_upcase_name(uchar_t *name, u32 name_len, const uchar_t *upcase,
} }
void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr, void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr,
const uchar_t *upcase, const u32 upcase_len) const ntfschar *upcase, const u32 upcase_len)
{ {
ntfs_upcase_name((uchar_t*)&file_name_attr->file_name, ntfs_upcase_name((ntfschar*)&file_name_attr->file_name,
file_name_attr->file_name_length, upcase, upcase_len); file_name_attr->file_name_length, upcase, upcase_len);
} }
int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1, int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1,
FILE_NAME_ATTR *file_name_attr2, FILE_NAME_ATTR *file_name_attr2,
const int err_val, const IGNORE_CASE_BOOL ic, const int err_val, const IGNORE_CASE_BOOL ic,
const uchar_t *upcase, const u32 upcase_len) const ntfschar *upcase, const u32 upcase_len)
{ {
return ntfs_collate_names((uchar_t*)&file_name_attr1->file_name, return ntfs_collate_names((ntfschar*)&file_name_attr1->file_name,
file_name_attr1->file_name_length, file_name_attr1->file_name_length,
(uchar_t*)&file_name_attr2->file_name, (ntfschar*)&file_name_attr2->file_name,
file_name_attr2->file_name_length, file_name_attr2->file_name_length,
err_val, ic, upcase, upcase_len); err_val, ic, upcase, upcase_len);
} }
...@@ -253,16 +253,16 @@ int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1, ...@@ -253,16 +253,16 @@ int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1,
* This might look a bit odd due to fast path optimization... * This might look a bit odd due to fast path optimization...
*/ */
int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins, int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins,
const int ins_len, uchar_t **outs) const int ins_len, ntfschar **outs)
{ {
struct nls_table *nls = vol->nls_map; struct nls_table *nls = vol->nls_map;
uchar_t *ucs; ntfschar *ucs;
wchar_t wc; wchar_t wc;
int i, o, wc_len; int i, o, wc_len;
/* We don't trust outside sources. */ /* We don't trust outside sources. */
if (ins) { if (ins) {
ucs = (uchar_t*)kmem_cache_alloc(ntfs_name_cache, SLAB_NOFS); ucs = (ntfschar*)kmem_cache_alloc(ntfs_name_cache, SLAB_NOFS);
if (ucs) { if (ucs) {
for (i = o = 0; i < ins_len; i += wc_len) { for (i = o = 0; i < ins_len; i += wc_len) {
wc_len = nls->char2uni(ins + i, ins_len - i, wc_len = nls->char2uni(ins + i, ins_len - i,
...@@ -318,7 +318,7 @@ int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins, ...@@ -318,7 +318,7 @@ int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins,
* *
* This might look a bit odd due to fast path optimization... * This might look a bit odd due to fast path optimization...
*/ */
int ntfs_ucstonls(const ntfs_volume *vol, const uchar_t *ins, int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins,
const int ins_len, unsigned char **outs, int outs_len) const int ins_len, unsigned char **outs, int outs_len)
{ {
struct nls_table *nls = vol->nls_map; struct nls_table *nls = vol->nls_map;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "ntfs.h" #include "ntfs.h"
uchar_t *generate_default_upcase(void) ntfschar *generate_default_upcase(void)
{ {
static const int uc_run_table[][3] = { /* Start, End, Add */ static const int uc_run_table[][3] = { /* Start, End, Add */
{0x0061, 0x007B, -32}, {0x0451, 0x045D, -80}, {0x1F70, 0x1F72, 74}, {0x0061, 0x007B, -32}, {0x0451, 0x045D, -80}, {0x1F70, 0x1F72, 74},
...@@ -68,12 +68,12 @@ uchar_t *generate_default_upcase(void) ...@@ -68,12 +68,12 @@ uchar_t *generate_default_upcase(void)
}; };
int i, r; int i, r;
uchar_t *uc; ntfschar *uc;
uc = ntfs_malloc_nofs(default_upcase_len * sizeof(uchar_t)); uc = ntfs_malloc_nofs(default_upcase_len * sizeof(ntfschar));
if (!uc) if (!uc)
return uc; return uc;
memset(uc, 0, default_upcase_len * sizeof(uchar_t)); memset(uc, 0, default_upcase_len * sizeof(ntfschar));
for (i = 0; i < default_upcase_len; i++) for (i = 0; i < default_upcase_len; i++)
uc[i] = cpu_to_le16(i); uc[i] = cpu_to_le16(i);
for (r = 0; uc_run_table[r][0]; r++) for (r = 0; uc_run_table[r][0]; r++)
......
...@@ -72,7 +72,7 @@ typedef struct { ...@@ -72,7 +72,7 @@ typedef struct {
u64 serial_no; /* The volume serial number. */ u64 serial_no; /* The volume serial number. */
/* Mount specific NTFS information. */ /* Mount specific NTFS information. */
u32 upcase_len; /* Number of entries in upcase[]. */ u32 upcase_len; /* Number of entries in upcase[]. */
uchar_t *upcase; /* The upcase table. */ ntfschar *upcase; /* The upcase table. */
LCN mft_zone_start; /* First cluster of the mft zone. */ LCN mft_zone_start; /* First cluster of the mft zone. */
LCN mft_zone_end; /* First cluster beyond the mft zone. */ LCN mft_zone_end; /* First cluster beyond the mft zone. */
struct inode *mft_ino; /* The VFS inode of $MFT. */ struct inode *mft_ino; /* The VFS inode of $MFT. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment