Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
ae855f40
Commit
ae855f40
authored
May 14, 2004
by
Anton Altaparmakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NTFS: 2.1.11 - Rename uchar_t to ntfschar.
parent
564c36d2
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
113 additions
and
109 deletions
+113
-109
fs/ntfs/ChangeLog
fs/ntfs/ChangeLog
+2
-0
fs/ntfs/attrib.c
fs/ntfs/attrib.c
+14
-13
fs/ntfs/attrib.h
fs/ntfs/attrib.h
+5
-4
fs/ntfs/dir.c
fs/ntfs/dir.c
+22
-22
fs/ntfs/dir.h
fs/ntfs/dir.h
+3
-3
fs/ntfs/inode.c
fs/ntfs/inode.c
+4
-4
fs/ntfs/inode.h
fs/ntfs/inode.h
+3
-3
fs/ntfs/layout.h
fs/ntfs/layout.h
+4
-4
fs/ntfs/logfile.h
fs/ntfs/logfile.h
+1
-1
fs/ntfs/namei.c
fs/ntfs/namei.c
+4
-4
fs/ntfs/ntfs.h
fs/ntfs/ntfs.h
+16
-16
fs/ntfs/super.c
fs/ntfs/super.c
+6
-6
fs/ntfs/types.h
fs/ntfs/types.h
+1
-1
fs/ntfs/unistr.c
fs/ntfs/unistr.c
+23
-23
fs/ntfs/upcase.c
fs/ntfs/upcase.c
+4
-4
fs/ntfs/volume.h
fs/ntfs/volume.h
+1
-1
No files found.
fs/ntfs/ChangeLog
View file @
ae855f40
...
...
@@ -31,6 +31,8 @@ ToDo:
- Really final white space cleanups.
- Use generic_ffs() instead of ffs() in logfile.c which allows the
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.
...
...
fs/ntfs/attrib.c
View file @
ae855f40
...
...
@@ -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
* 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
,
attr_search_context
*
ctx
)
{
ATTR_RECORD
*
a
;
ntfs_volume
*
vol
;
uchar_t
*
upcase
;
ntfschar
*
upcase
;
u32
upcase_len
;
if
(
ic
==
IGNORE_CASE
)
{
...
...
@@ -1145,12 +1145,12 @@ BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
if
(
a
->
name_length
)
return
FALSE
;
}
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
))
{
register
int
rc
;
rc
=
ntfs_collate_names
(
name
,
name_len
,
(
uchar_t
*
)((
u8
*
)
a
+
(
ntfschar
*
)((
u8
*
)
a
+
le16_to_cpu
(
a
->
name_offset
)),
a
->
name_length
,
1
,
IGNORE_CASE
,
upcase
,
upcase_len
);
...
...
@@ -1164,7 +1164,7 @@ BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
if
(
rc
)
continue
;
rc
=
ntfs_collate_names
(
name
,
name_len
,
(
uchar_t
*
)((
u8
*
)
a
+
(
ntfschar
*
)((
u8
*
)
a
+
le16_to_cpu
(
a
->
name_offset
)),
a
->
name_length
,
1
,
CASE_SENSITIVE
,
upcase
,
upcase_len
);
...
...
@@ -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
* 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
VCN
lowest_vcn
,
const
u8
*
val
,
const
u32
val_len
,
attr_search_context
*
ctx
)
...
...
@@ -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
;
u8
*
al_start
,
*
al_end
;
ATTR_RECORD
*
a
;
uchar_t
*
al_name
;
ntfschar
*
al_name
;
u32
al_name_len
;
ni
=
ctx
->
ntfs_ino
;
...
...
@@ -1417,7 +1417,7 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name,
* missing, assume we want an unnamed attribute.
*/
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
(
al_name_len
)
goto
not_found
;
...
...
@@ -1466,7 +1466,7 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name,
sle64_to_cpu
(
lowest_vcn
)
&&
next_al_entry
->
type
==
al_entry
->
type
&&
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
->
name_offset
),
next_al_entry
->
name_length
,
...
...
@@ -1539,7 +1539,7 @@ static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name,
if
(
name
)
{
if
(
a
->
name_length
!=
al_name_len
)
continue
;
if
(
!
ntfs_are_names_equal
((
uchar_t
*
)((
u8
*
)
a
+
if
(
!
ntfs_are_names_equal
((
ntfschar
*
)((
u8
*
)
a
+
le16_to_cpu
(
a
->
name_offset
)),
a
->
name_length
,
al_name
,
al_name_len
,
CASE_SENSITIVE
,
vol
->
upcase
,
...
...
@@ -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
* 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
,
const
IGNORE_CASE_BOOL
ic
,
const
VCN
lowest_vcn
,
const
u8
*
val
,
const
u32
val_len
,
attr_search_context
*
ctx
)
BOOL
lookup_attr
(
const
ATTR_TYPES
type
,
const
ntfschar
*
name
,
const
u32
name_len
,
const
IGNORE_CASE_BOOL
ic
,
const
VCN
lowest_vcn
,
const
u8
*
val
,
const
u32
val_len
,
attr_search_context
*
ctx
)
{
ntfs_inode
*
base_ni
;
...
...
fs/ntfs/attrib.h
View file @
ae855f40
...
...
@@ -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
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
val_len
,
attr_search_context
*
ctx
);
BOOL
lookup_attr
(
const
ATTR_TYPES
type
,
const
uchar_t
*
name
,
const
u32
name_len
,
const
IGNORE_CASE_BOOL
ic
,
const
VCN
lowest_vcn
,
const
u8
*
val
,
const
u32
val_len
,
attr_search_context
*
ctx
);
BOOL
lookup_attr
(
const
ATTR_TYPES
type
,
const
ntfschar
*
name
,
const
u32
name_len
,
const
IGNORE_CASE_BOOL
ic
,
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
,
const
s64
size
,
const
s64
initialized_size
);
...
...
fs/ntfs/dir.c
View file @
ae855f40
...
...
@@ -27,7 +27,7 @@
/**
* 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
(
0
)
};
...
...
@@ -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
* 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
)
{
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,
* returning.
*/
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
,
CASE_SENSITIVE
,
vol
->
upcase
,
vol
->
upcase_len
))
{
found_it:
...
...
@@ -186,7 +186,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
if
(
!
NVolCaseSensitive
(
vol
)
&&
ie
->
key
.
file_name
.
file_name_type
&&
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
,
IGNORE_CASE
,
vol
->
upcase
,
vol
->
upcase_len
))
{
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,
}
if
(
type
!=
FILE_NAME_DOS
)
name_size
+=
len
*
sizeof
(
uchar_t
);
name_size
+=
len
*
sizeof
(
ntfschar
);
name
=
kmalloc
(
name_size
,
GFP_NOFS
);
if
(
!
name
)
{
err
=
-
ENOMEM
;
...
...
@@ -217,7 +217,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
if
(
type
!=
FILE_NAME_DOS
)
{
name
->
len
=
len
;
memcpy
(
name
->
name
,
ie
->
key
.
file_name
.
file_name
,
len
*
sizeof
(
uchar_t
));
len
*
sizeof
(
ntfschar
));
}
else
name
->
len
=
0
;
*
res
=
name
;
...
...
@@ -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.
*/
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
,
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,
* collation.
*/
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
,
CASE_SENSITIVE
,
vol
->
upcase
,
vol
->
upcase_len
);
if
(
rc
==
-
1
)
...
...
@@ -395,7 +395,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
* returning.
*/
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
,
CASE_SENSITIVE
,
vol
->
upcase
,
vol
->
upcase_len
))
{
found_it2:
...
...
@@ -445,7 +445,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
if
(
!
NVolCaseSensitive
(
vol
)
&&
ie
->
key
.
file_name
.
file_name_type
&&
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
,
IGNORE_CASE
,
vol
->
upcase
,
vol
->
upcase_len
))
{
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,
}
if
(
type
!=
FILE_NAME_DOS
)
name_size
+=
len
*
sizeof
(
uchar_t
);
name_size
+=
len
*
sizeof
(
ntfschar
);
name
=
kmalloc
(
name_size
,
GFP_NOFS
);
if
(
!
name
)
{
err
=
-
ENOMEM
;
...
...
@@ -477,7 +477,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
if
(
type
!=
FILE_NAME_DOS
)
{
name
->
len
=
len
;
memcpy
(
name
->
name
,
ie
->
key
.
file_name
.
file_name
,
len
*
sizeof
(
uchar_t
));
len
*
sizeof
(
ntfschar
));
}
else
name
->
len
=
0
;
*
res
=
name
;
...
...
@@ -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.
*/
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
,
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,
* collation.
*/
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
,
CASE_SENSITIVE
,
vol
->
upcase
,
vol
->
upcase_len
);
if
(
rc
==
-
1
)
...
...
@@ -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.
*/
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)
{
ntfs_volume *vol = dir_ni->vol;
...
...
@@ -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.
*/
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,
vol->upcase, vol->upcase_len)) {
found_it:
...
...
@@ -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.
*/
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,
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,
* collation.
*/
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,
CASE_SENSITIVE, vol->upcase, vol->upcase_len);
if (rc == -1)
...
...
@@ -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.
*/
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,
vol->upcase, vol->upcase_len)) {
found_it2:
...
...
@@ -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.
*/
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,
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,
* collation.
*/
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,
CASE_SENSITIVE, vol->upcase, vol->upcase_len);
if (rc == -1)
...
...
@@ -1027,7 +1027,7 @@ static inline int ntfs_filldir(ntfs_volume *vol, loff_t *fpos,
ntfs_debug
(
"Skipping system file."
);
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
,
NTFS_MAX_NAME_LEN
*
NLS_MAX_CHARSET_SIZE
+
1
);
if
(
name_len
<=
0
)
{
...
...
fs/ntfs/dir.h
View file @
ae855f40
...
...
@@ -34,13 +34,13 @@ typedef struct {
MFT_REF
mref
;
FILE_NAME_TYPE_FLAGS
type
;
u8
len
;
uchar_t
name
[
0
];
ntfschar
name
[
0
];
}
__attribute__
((
__packed__
))
ntfs_name
;
/* 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
,
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 */
fs/ntfs/inode.c
View file @
ae855f40
...
...
@@ -66,7 +66,7 @@ int ntfs_test_inode(struct inode *vi, ntfs_attr *na)
if
(
ni
->
name_len
!=
na
->
name_len
)
return
0
;
if
(
na
->
name_len
&&
memcmp
(
ni
->
name
,
na
->
name
,
na
->
name_len
*
sizeof
(
uchar_t
)))
na
->
name_len
*
sizeof
(
ntfschar
)))
return
0
;
}
/* Match! */
...
...
@@ -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
)
{
unsigned
int
i
;
i
=
na
->
name_len
*
sizeof
(
uchar_t
);
ni
->
name
=
(
uchar_t
*
)
kmalloc
(
i
+
sizeof
(
uchar_t
),
GFP_ATOMIC
);
i
=
na
->
name_len
*
sizeof
(
ntfschar
);
ni
->
name
=
(
ntfschar
*
)
kmalloc
(
i
+
sizeof
(
ntfschar
),
GFP_ATOMIC
);
if
(
!
ni
->
name
)
return
-
ENOMEM
;
memcpy
(
ni
->
name
,
na
->
name
,
i
);
...
...
@@ -206,7 +206,7 @@ struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no)
* obtained from PTR_ERR().
*/
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
;
ntfs_attr
na
;
...
...
fs/ntfs/inode.h
View file @
ae855f40
...
...
@@ -54,7 +54,7 @@ struct _ntfs_inode {
* name_len = 4 for directories.
*/
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. */
run_list
run_list
;
/* If state has the NI_NonResident bit set,
the run list of the unnamed data attribute
...
...
@@ -248,7 +248,7 @@ static inline struct inode *VFS_I(ntfs_inode *ni)
*/
typedef
struct
{
unsigned
long
mft_no
;
uchar_t
*
name
;
ntfschar
*
name
;
u32
name_len
;
ATTR_TYPES
type
;
}
ntfs_attr
;
...
...
@@ -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_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
void
ntfs_destroy_big_inode
(
struct
inode
*
inode
);
...
...
fs/ntfs/layout.h
View file @
ae855f40
...
...
@@ -504,7 +504,7 @@ typedef enum {
*/
typedef
struct
{
/*hex ofs*/
/* 0*/
uchar_t
name
[
0x40
];
/* Unicode name of the attribute. Zero
/* 0*/
ntfschar
name
[
0x40
];
/* Unicode name of the attribute. Zero
terminated. */
/* 80*/
ATTR_TYPES
type
;
/* Type of the attribute. */
/* 84*/
u32
display_rule
;
/* Default display rule.
...
...
@@ -910,7 +910,7 @@ typedef struct {
attribute value. */
/* 24*/
u16
instance
;
/* If lowest_vcn = 0, the instance of the
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. */
/* sizeof() = 26 + (attribute_name_length * 2) bytes */
...
...
@@ -994,7 +994,7 @@ typedef struct {
/* 40*/
u8
file_name_length
;
/* Length of file name in
(Unicode) characters. */
/* 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
;
/*
...
...
@@ -1775,7 +1775,7 @@ typedef struct {
* NOTE: Present only in FILE_Volume.
*/
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
;
/*
...
...
fs/ntfs/logfile.h
View file @
ae855f40
...
...
@@ -288,7 +288,7 @@ typedef struct {
/* 22*/
u8
reserved
[
6
];
/* Reserved/alignment. */
/* 28*/
u32
client_name_length
;
/* Length of client name in bytes. Should
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
set to 0. */
/* sizeof() = 160 (0xa0) bytes */
...
...
fs/ntfs/namei.c
View file @
ae855f40
...
...
@@ -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
);
struct
inode
*
dent_inode
;
uchar_t
*
uname
;
ntfschar
*
uname
;
ntfs_name
*
name
=
NULL
;
MFT_REF
mref
;
unsigned
long
dent_ino
;
...
...
@@ -177,7 +177,7 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
nls_name
.
name
=
NULL
;
if
(
name
->
type
!=
FILE_NAME_DOS
)
{
/* Case 2. */
nls_name
.
len
=
(
unsigned
)
ntfs_ucstonls
(
vol
,
(
uchar_t
*
)
&
name
->
name
,
name
->
len
,
(
ntfschar
*
)
&
name
->
name
,
name
->
len
,
(
unsigned
char
**
)
&
nls_name
.
name
,
0
);
kfree
(
name
);
}
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,
goto
eio_err_out
;
fn
=
(
FILE_NAME_ATTR
*
)((
u8
*
)
ctx
->
attr
+
le16_to_cpu
(
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
)
goto
eio_err_out
;
}
while
(
fn
->
file_name_type
!=
FILE_NAME_WIN32
);
/* Convert the found WIN32 name to current NLS code page. */
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
);
put_attr_search_ctx
(
ctx
);
...
...
fs/ntfs/ntfs.h
View file @
ae855f40
...
...
@@ -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
);
/* From fs/ntfs/unistr.c */
extern
BOOL
ntfs_are_names_equal
(
const
uchar_t
*
s1
,
size_t
s1_len
,
const
uchar_t
*
s2
,
size_t
s2_len
,
extern
BOOL
ntfs_are_names_equal
(
const
ntfschar
*
s1
,
size_t
s1_len
,
const
ntfschar
*
s2
,
size_t
s2_len
,
const
IGNORE_CASE_BOOL
ic
,
const
uchar_t
*
upcase
,
const
u32
upcase_size
);
extern
int
ntfs_collate_names
(
const
uchar_t
*
name1
,
const
u32
name1_len
,
const
uchar_t
*
name2
,
const
u32
name2_len
,
const
ntfschar
*
upcase
,
const
u32
upcase_size
);
extern
int
ntfs_collate_names
(
const
ntfschar
*
name1
,
const
u32
name1_len
,
const
ntfschar
*
name2
,
const
u32
name2_len
,
const
int
err_val
,
const
IGNORE_CASE_BOOL
ic
,
const
uchar_t
*
upcase
,
const
u32
upcase_len
);
extern
int
ntfs_ucsncmp
(
const
uchar_t
*
s1
,
const
uchar_t
*
s2
,
size_t
n
);
extern
int
ntfs_ucsncasecmp
(
const
uchar_t
*
s1
,
const
uchar_t
*
s2
,
size_t
n
,
const
uchar_t
*
upcase
,
const
u32
upcase_size
);
extern
void
ntfs_upcase_name
(
uchar_t
*
name
,
u32
name_len
,
const
uchar_t
*
upcase
,
const
u32
upcase_len
);
const
ntfschar
*
upcase
,
const
u32
upcase_len
);
extern
int
ntfs_ucsncmp
(
const
ntfschar
*
s1
,
const
ntfschar
*
s2
,
size_t
n
);
extern
int
ntfs_ucsncasecmp
(
const
ntfschar
*
s1
,
const
ntfschar
*
s2
,
size_t
n
,
const
ntfschar
*
upcase
,
const
u32
upcase_size
);
extern
void
ntfs_upcase_name
(
ntfschar
*
name
,
u32
name_len
,
const
ntfschar
*
upcase
,
const
u32
upcase_len
);
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
,
FILE_NAME_ATTR
*
file_name_attr2
,
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
,
const
int
ins_len
,
uchar_t
**
outs
);
extern
int
ntfs_ucstonls
(
const
ntfs_volume
*
vol
,
const
uchar_t
*
ins
,
const
int
ins_len
,
ntfschar
**
outs
);
extern
int
ntfs_ucstonls
(
const
ntfs_volume
*
vol
,
const
ntfschar
*
ins
,
const
int
ins_len
,
unsigned
char
**
outs
,
int
outs_len
);
/* From fs/ntfs/upcase.c */
extern
uchar_t
*
generate_default_upcase
(
void
);
extern
ntfschar
*
generate_default_upcase
(
void
);
#endif
/* _LINUX_NTFS_H */
fs/ntfs/super.c
View file @
ae855f40
...
...
@@ -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
* 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
)
||
ino
->
i_size
>
64ULL
*
1024
*
sizeof
(
uchar_t
))
if
(
!
ino
->
i_size
||
ino
->
i_size
&
(
sizeof
(
ntfschar
)
-
1
)
||
ino
->
i_size
>
64ULL
*
1024
*
sizeof
(
ntfschar
))
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
)
goto
iput_upcase_failed
;
index
=
0
;
...
...
@@ -972,7 +972,7 @@ static BOOL load_and_init_upcase(ntfs_volume *vol)
}
vol
->
upcase_len
=
ino
->
i_size
>>
UCHAR_T_SIZE_BITS
;
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
);
down
(
&
ntfs_lock
);
if
(
!
default_upcase
)
{
...
...
@@ -2059,7 +2059,7 @@ static int __init init_ntfs_fs(void)
}
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
);
if
(
!
ntfs_name_cache
)
{
printk
(
KERN_CRIT
"NTFS: Failed to create %s!
\n
"
,
...
...
fs/ntfs/types.h
View file @
ae855f40
...
...
@@ -24,7 +24,7 @@
#define _LINUX_NTFS_TYPES_H
/* 2-byte Unicode character type. */
typedef
u16
uchar_t
;
typedef
u16
ntfschar
;
#define UCHAR_T_SIZE_BITS 1
/*
...
...
fs/ntfs/unistr.c
View file @
ae855f40
...
...
@@ -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,
* the @upcase table is used to performa a case insensitive comparison.
*/
BOOL
ntfs_are_names_equal
(
const
uchar_t
*
s1
,
size_t
s1_len
,
const
uchar_t
*
s2
,
size_t
s2_len
,
const
IGNORE_CASE_BOOL
ic
,
const
uchar_t
*
upcase
,
const
u32
upcase_size
)
BOOL
ntfs_are_names_equal
(
const
ntfschar
*
s1
,
size_t
s1_len
,
const
ntfschar
*
s2
,
size_t
s2_len
,
const
IGNORE_CASE_BOOL
ic
,
const
ntfschar
*
upcase
,
const
u32
upcase_size
)
{
if
(
s1_len
!=
s2_len
)
return
FALSE
;
...
...
@@ -90,13 +90,13 @@ BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len,
*
* The following characters are considered invalid: '"', '*', '<', '>' and '?'.
*/
int
ntfs_collate_names
(
const
uchar_t
*
name1
,
const
u32
name1_len
,
const
uchar_t
*
name2
,
const
u32
name2_len
,
int
ntfs_collate_names
(
const
ntfschar
*
name1
,
const
u32
name1_len
,
const
ntfschar
*
name2
,
const
u32
name2_len
,
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
;
uchar_t
c1
,
c2
;
ntfschar
c1
,
c2
;
min_len
=
name1_len
;
if
(
name1_len
>
name2_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,
* 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
;
for
(
i
=
0
;
i
<
n
;
++
i
)
{
...
...
@@ -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,
* 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
,
const
uchar_t
*
upcase
,
const
u32
upcase_size
)
int
ntfs_ucsncasecmp
(
const
ntfschar
*
s1
,
const
ntfschar
*
s2
,
size_t
n
,
const
ntfschar
*
upcase
,
const
u32
upcase_size
)
{
uchar_t
c1
,
c2
;
ntfschar
c1
,
c2
;
size_t
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,
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
)
{
u32
i
;
uchar_t
u
;
ntfschar
u
;
for
(
i
=
0
;
i
<
name_len
;
i
++
)
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,
}
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
);
}
int
ntfs_file_compare_values
(
FILE_NAME_ATTR
*
file_name_attr1
,
FILE_NAME_ATTR
*
file_name_attr2
,
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
,
(
uchar_t
*
)
&
file_name_attr2
->
file_name
,
(
ntfschar
*
)
&
file_name_attr2
->
file_name
,
file_name_attr2
->
file_name_length
,
err_val
,
ic
,
upcase
,
upcase_len
);
}
...
...
@@ -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...
*/
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
;
uchar_t
*
ucs
;
ntfschar
*
ucs
;
wchar_t
wc
;
int
i
,
o
,
wc_len
;
/* We don't trust outside sources. */
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
)
{
for
(
i
=
o
=
0
;
i
<
ins_len
;
i
+=
wc_len
)
{
wc_len
=
nls
->
char2uni
(
ins
+
i
,
ins_len
-
i
,
...
...
@@ -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...
*/
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
)
{
struct
nls_table
*
nls
=
vol
->
nls_map
;
...
...
fs/ntfs/upcase.c
View file @
ae855f40
...
...
@@ -26,7 +26,7 @@
#include "ntfs.h"
uchar_t
*
generate_default_upcase
(
void
)
ntfschar
*
generate_default_upcase
(
void
)
{
static
const
int
uc_run_table
[][
3
]
=
{
/* Start, End, Add */
{
0x0061
,
0x007B
,
-
32
},
{
0x0451
,
0x045D
,
-
80
},
{
0x1F70
,
0x1F72
,
74
},
...
...
@@ -68,12 +68,12 @@ uchar_t *generate_default_upcase(void)
};
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
)
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
++
)
uc
[
i
]
=
cpu_to_le16
(
i
);
for
(
r
=
0
;
uc_run_table
[
r
][
0
];
r
++
)
...
...
fs/ntfs/volume.h
View file @
ae855f40
...
...
@@ -72,7 +72,7 @@ typedef struct {
u64
serial_no
;
/* The volume serial number. */
/* Mount specific NTFS information. */
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_end
;
/* First cluster beyond the mft zone. */
struct
inode
*
mft_ino
;
/* The VFS inode of $MFT. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment