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
b1b410c3
Commit
b1b410c3
authored
Jul 25, 2003
by
Hirofumi Ogawa
Committed by
Linus Torvalds
Jul 25, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] signed char cleanup/fixes (10/11)
This changes a few more char type of filenames to unsigned char.
parent
0703fb8b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
66 deletions
+74
-66
fs/fat/dir.c
fs/fat/dir.c
+10
-10
fs/fat/inode.c
fs/fat/inode.c
+3
-3
fs/fat/misc.c
fs/fat/misc.c
+3
-2
fs/msdos/namei.c
fs/msdos/namei.c
+23
-23
fs/vfat/namei.c
fs/vfat/namei.c
+27
-21
include/linux/msdos_fs.h
include/linux/msdos_fs.h
+8
-7
No files found.
fs/fat/dir.c
View file @
b1b410c3
...
@@ -152,7 +152,7 @@ fat_strnicmp(struct nls_table *t, const unsigned char *s1,
...
@@ -152,7 +152,7 @@ fat_strnicmp(struct nls_table *t, const unsigned char *s1,
}
}
static
inline
int
static
inline
int
fat_shortname2uni
(
struct
nls_table
*
nls
,
char
*
buf
,
int
buf_size
,
fat_shortname2uni
(
struct
nls_table
*
nls
,
unsigned
char
*
buf
,
int
buf_size
,
wchar_t
*
uni_buf
,
unsigned
short
opt
,
int
lower
)
wchar_t
*
uni_buf
,
unsigned
short
opt
,
int
lower
)
{
{
int
len
=
0
;
int
len
=
0
;
...
@@ -176,8 +176,8 @@ fat_shortname2uni(struct nls_table *nls, char *buf, int buf_size,
...
@@ -176,8 +176,8 @@ fat_shortname2uni(struct nls_table *nls, char *buf, int buf_size,
* Return values: negative -> error, 0 -> not found, positive -> found,
* Return values: negative -> error, 0 -> not found, positive -> found,
* value is the total amount of slots, including the shortname entry.
* value is the total amount of slots, including the shortname entry.
*/
*/
int
fat_search_long
(
struct
inode
*
inode
,
const
char
*
name
,
int
name_len
,
int
fat_search_long
(
struct
inode
*
inode
,
const
unsigned
char
*
name
,
int
anycase
,
loff_t
*
spos
,
loff_t
*
lpos
)
int
name_len
,
int
anycase
,
loff_t
*
spos
,
loff_t
*
lpos
)
{
{
struct
super_block
*
sb
=
inode
->
i_sb
;
struct
super_block
*
sb
=
inode
->
i_sb
;
struct
buffer_head
*
bh
=
NULL
;
struct
buffer_head
*
bh
=
NULL
;
...
@@ -187,7 +187,7 @@ int fat_search_long(struct inode *inode, const char *name, int name_len,
...
@@ -187,7 +187,7 @@ int fat_search_long(struct inode *inode, const char *name, int name_len,
wchar_t
bufuname
[
14
];
wchar_t
bufuname
[
14
];
unsigned
char
xlate_len
,
long_slots
;
unsigned
char
xlate_len
,
long_slots
;
wchar_t
*
unicode
=
NULL
;
wchar_t
*
unicode
=
NULL
;
char
work
[
8
],
bufname
[
260
];
/* 256 + 4 */
unsigned
char
work
[
8
],
bufname
[
260
];
/* 256 + 4 */
int
uni_xlate
=
MSDOS_SB
(
sb
)
->
options
.
unicode_xlate
;
int
uni_xlate
=
MSDOS_SB
(
sb
)
->
options
.
unicode_xlate
;
int
utf8
=
MSDOS_SB
(
sb
)
->
options
.
utf8
;
int
utf8
=
MSDOS_SB
(
sb
)
->
options
.
utf8
;
unsigned
short
opt_shortname
=
MSDOS_SB
(
sb
)
->
options
.
shortname
;
unsigned
short
opt_shortname
=
MSDOS_SB
(
sb
)
->
options
.
shortname
;
...
@@ -199,7 +199,7 @@ int fat_search_long(struct inode *inode, const char *name, int name_len,
...
@@ -199,7 +199,7 @@ int fat_search_long(struct inode *inode, const char *name, int name_len,
goto
EODir
;
goto
EODir
;
parse_record:
parse_record:
long_slots
=
0
;
long_slots
=
0
;
if
(
de
->
name
[
0
]
==
(
__s8
)
DELETED_FLAG
)
if
(
de
->
name
[
0
]
==
DELETED_FLAG
)
continue
;
continue
;
if
(
de
->
attr
!=
ATTR_EXT
&&
(
de
->
attr
&
ATTR_VOLUME
))
if
(
de
->
attr
!=
ATTR_EXT
&&
(
de
->
attr
&
ATTR_VOLUME
))
continue
;
continue
;
...
@@ -258,7 +258,7 @@ int fat_search_long(struct inode *inode, const char *name, int name_len,
...
@@ -258,7 +258,7 @@ int fat_search_long(struct inode *inode, const char *name, int name_len,
if
(
ds
->
alias_checksum
!=
alias_checksum
)
if
(
ds
->
alias_checksum
!=
alias_checksum
)
goto
parse_long
;
goto
parse_long
;
}
}
if
(
de
->
name
[
0
]
==
(
__s8
)
DELETED_FLAG
)
if
(
de
->
name
[
0
]
==
DELETED_FLAG
)
continue
;
continue
;
if
(
de
->
attr
==
ATTR_EXT
)
if
(
de
->
attr
==
ATTR_EXT
)
goto
parse_long
;
goto
parse_long
;
...
@@ -351,7 +351,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
...
@@ -351,7 +351,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
wchar_t
bufuname
[
14
];
wchar_t
bufuname
[
14
];
unsigned
char
long_slots
;
unsigned
char
long_slots
;
wchar_t
*
unicode
=
NULL
;
wchar_t
*
unicode
=
NULL
;
char
c
,
work
[
8
],
bufname
[
56
],
*
ptname
=
bufname
;
unsigned
char
c
,
work
[
8
],
bufname
[
56
],
*
ptname
=
bufname
;
unsigned
long
lpos
,
dummy
,
*
furrfu
=
&
lpos
;
unsigned
long
lpos
,
dummy
,
*
furrfu
=
&
lpos
;
int
uni_xlate
=
MSDOS_SB
(
sb
)
->
options
.
unicode_xlate
;
int
uni_xlate
=
MSDOS_SB
(
sb
)
->
options
.
unicode_xlate
;
int
isvfat
=
MSDOS_SB
(
sb
)
->
options
.
isvfat
;
int
isvfat
=
MSDOS_SB
(
sb
)
->
options
.
isvfat
;
...
@@ -392,7 +392,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
...
@@ -392,7 +392,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
goto
EODir
;
goto
EODir
;
/* Check for long filename entry */
/* Check for long filename entry */
if
(
isvfat
)
{
if
(
isvfat
)
{
if
(
de
->
name
[
0
]
==
(
__s8
)
DELETED_FLAG
)
if
(
de
->
name
[
0
]
==
DELETED_FLAG
)
goto
RecEnd
;
goto
RecEnd
;
if
(
de
->
attr
!=
ATTR_EXT
&&
(
de
->
attr
&
ATTR_VOLUME
))
if
(
de
->
attr
!=
ATTR_EXT
&&
(
de
->
attr
&
ATTR_VOLUME
))
goto
RecEnd
;
goto
RecEnd
;
...
@@ -458,7 +458,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
...
@@ -458,7 +458,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
if
(
ds
->
alias_checksum
!=
alias_checksum
)
if
(
ds
->
alias_checksum
!=
alias_checksum
)
goto
ParseLong
;
goto
ParseLong
;
}
}
if
(
de
->
name
[
0
]
==
(
__s8
)
DELETED_FLAG
)
if
(
de
->
name
[
0
]
==
DELETED_FLAG
)
goto
RecEnd
;
goto
RecEnd
;
if
(
de
->
attr
==
ATTR_EXT
)
if
(
de
->
attr
==
ATTR_EXT
)
goto
ParseLong
;
goto
ParseLong
;
...
@@ -555,7 +555,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
...
@@ -555,7 +555,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
(
de
->
attr
&
ATTR_DIR
)
?
DT_DIR
:
DT_REG
)
<
0
)
(
de
->
attr
&
ATTR_DIR
)
?
DT_DIR
:
DT_REG
)
<
0
)
goto
FillFailed
;
goto
FillFailed
;
}
else
{
}
else
{
char
longname
[
275
];
unsigned
char
longname
[
275
];
int
long_len
=
utf8
int
long_len
=
utf8
?
utf8_wcstombs
(
longname
,
unicode
,
sizeof
(
longname
))
?
utf8_wcstombs
(
longname
,
unicode
,
sizeof
(
longname
))
:
uni16_to_x8
(
longname
,
unicode
,
uni_xlate
,
:
uni16_to_x8
(
longname
,
unicode
,
uni_xlate
,
...
...
fs/fat/inode.c
View file @
b1b410c3
...
@@ -734,7 +734,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
...
@@ -734,7 +734,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
struct
msdos_sb_info
*
sbi
;
struct
msdos_sb_info
*
sbi
;
int
logical_sector_size
,
fat_clusters
,
debug
,
cp
,
first
;
int
logical_sector_size
,
fat_clusters
,
debug
,
cp
,
first
;
unsigned
int
total_sectors
,
rootdir_sectors
;
unsigned
int
total_sectors
,
rootdir_sectors
;
unsigned
char
media
;
unsigned
int
media
;
long
error
;
long
error
;
char
buf
[
50
];
char
buf
[
50
];
...
@@ -1037,9 +1037,9 @@ int fat_statfs(struct super_block *sb, struct kstatfs *buf)
...
@@ -1037,9 +1037,9 @@ int fat_statfs(struct super_block *sb, struct kstatfs *buf)
return
0
;
return
0
;
}
}
static
int
is_exec
(
char
*
extension
)
static
int
is_exec
(
unsigned
char
*
extension
)
{
{
char
*
exe_extensions
=
"EXECOMBAT"
,
*
walk
;
unsigned
char
*
exe_extensions
=
"EXECOMBAT"
,
*
walk
;
for
(
walk
=
exe_extensions
;
*
walk
;
walk
+=
3
)
for
(
walk
=
exe_extensions
;
*
walk
;
walk
+=
3
)
if
(
!
strncmp
(
extension
,
walk
,
3
))
if
(
!
strncmp
(
extension
,
walk
,
3
))
...
...
fs/fat/misc.c
View file @
b1b410c3
...
@@ -346,8 +346,9 @@ int fat_subdirs(struct inode *dir)
...
@@ -346,8 +346,9 @@ int fat_subdirs(struct inode *dir)
* Scans a directory for a given file (name points to its formatted name).
* Scans a directory for a given file (name points to its formatted name).
* Returns an error code or zero.
* Returns an error code or zero.
*/
*/
int
fat_scan
(
struct
inode
*
dir
,
const
char
*
name
,
struct
buffer_head
**
bh
,
int
fat_scan
(
struct
inode
*
dir
,
const
unsigned
char
*
name
,
struct
msdos_dir_entry
**
de
,
loff_t
*
i_pos
)
struct
buffer_head
**
bh
,
struct
msdos_dir_entry
**
de
,
loff_t
*
i_pos
)
{
{
loff_t
cpos
;
loff_t
cpos
;
...
...
fs/msdos/namei.c
View file @
b1b410c3
...
@@ -14,30 +14,30 @@
...
@@ -14,30 +14,30 @@
/* MS-DOS "device special files" */
/* MS-DOS "device special files" */
static
const
char
*
reserved_names
[]
=
{
static
const
unsigned
char
*
reserved_names
[]
=
{
"CON "
,
"PRN "
,
"NUL "
,
"AUX "
,
"CON "
,
"PRN "
,
"NUL "
,
"AUX "
,
"LPT1 "
,
"LPT2 "
,
"LPT3 "
,
"LPT4 "
,
"LPT1 "
,
"LPT2 "
,
"LPT3 "
,
"LPT4 "
,
"COM1 "
,
"COM2 "
,
"COM3 "
,
"COM4 "
,
"COM1 "
,
"COM2 "
,
"COM3 "
,
"COM4 "
,
NULL
NULL
};
};
/* Characters that are undesirable in an MS-DOS file name */
/* Characters that are undesirable in an MS-DOS file name */
static
char
bad_chars
[]
=
"*?<>|
\"
"
;
static
unsigned
char
bad_chars
[]
=
"*?<>|
\"
"
;
static
char
bad_if_strict_pc
[]
=
"+=,; "
;
static
unsigned
char
bad_if_strict_pc
[]
=
"+=,; "
;
static
char
bad_if_strict_atari
[]
=
" "
;
/* GEMDOS is less restrictive */
static
unsigned
char
bad_if_strict_atari
[]
=
" "
;
/* GEMDOS is less restrictive */
#define bad_if_strict(opts) ((opts)->atari ? bad_if_strict_atari : bad_if_strict_pc)
#define bad_if_strict(opts) ((opts)->atari ? bad_if_strict_atari : bad_if_strict_pc)
/***** Formats an MS-DOS file name. Rejects invalid names. */
/***** Formats an MS-DOS file name. Rejects invalid names. */
static
int
msdos_format_name
(
const
char
*
name
,
int
len
,
static
int
msdos_format_name
(
const
unsigned
char
*
name
,
int
len
,
char
*
res
,
struct
fat_mount_options
*
opts
)
unsigned
char
*
res
,
struct
fat_mount_options
*
opts
)
/* name is the proposed name, len is its length, res is
/* name is the proposed name, len is its length, res is
* the resulting name, opts->name_check is either (r)elaxed,
* the resulting name, opts->name_check is either (r)elaxed,
* (n)ormal or (s)trict, opts->dotsOK allows dots at the
* (n)ormal or (s)trict, opts->dotsOK allows dots at the
* beginning of name (for hidden files)
* beginning of name (for hidden files)
*/
*/
{
{
char
*
walk
;
unsigned
char
*
walk
;
const
char
**
reserved
;
const
unsigned
char
**
reserved
;
unsigned
char
c
;
unsigned
char
c
;
int
space
;
int
space
;
...
@@ -112,13 +112,13 @@ static int msdos_format_name(const char *name,int len,
...
@@ -112,13 +112,13 @@ static int msdos_format_name(const char *name,int len,
}
}
/***** Locates a directory entry. Uses unformatted name. */
/***** Locates a directory entry. Uses unformatted name. */
static
int
msdos_find
(
struct
inode
*
dir
,
const
char
*
name
,
int
len
,
static
int
msdos_find
(
struct
inode
*
dir
,
const
unsigned
char
*
name
,
int
len
,
struct
buffer_head
**
bh
,
struct
msdos_dir_entry
**
de
,
struct
buffer_head
**
bh
,
struct
msdos_dir_entry
**
de
,
loff_t
*
i_pos
)
loff_t
*
i_pos
)
{
{
int
res
;
unsigned
char
msdos_name
[
MSDOS_NAME
]
;
char
dotsOK
;
char
dotsOK
;
char
msdos_name
[
MSDOS_NAME
]
;
int
res
;
dotsOK
=
MSDOS_SB
(
dir
->
i_sb
)
->
options
.
dotsOK
;
dotsOK
=
MSDOS_SB
(
dir
->
i_sb
)
->
options
.
dotsOK
;
res
=
msdos_format_name
(
name
,
len
,
msdos_name
,
&
MSDOS_SB
(
dir
->
i_sb
)
->
options
);
res
=
msdos_format_name
(
name
,
len
,
msdos_name
,
&
MSDOS_SB
(
dir
->
i_sb
)
->
options
);
...
@@ -146,8 +146,8 @@ static int msdos_find(struct inode *dir, const char *name, int len,
...
@@ -146,8 +146,8 @@ static int msdos_find(struct inode *dir, const char *name, int len,
static
int
msdos_hash
(
struct
dentry
*
dentry
,
struct
qstr
*
qstr
)
static
int
msdos_hash
(
struct
dentry
*
dentry
,
struct
qstr
*
qstr
)
{
{
struct
fat_mount_options
*
options
=
&
(
MSDOS_SB
(
dentry
->
d_sb
)
->
options
);
struct
fat_mount_options
*
options
=
&
(
MSDOS_SB
(
dentry
->
d_sb
)
->
options
);
unsigned
char
msdos_name
[
MSDOS_NAME
];
int
error
;
int
error
;
char
msdos_name
[
MSDOS_NAME
];
error
=
msdos_format_name
(
qstr
->
name
,
qstr
->
len
,
msdos_name
,
options
);
error
=
msdos_format_name
(
qstr
->
name
,
qstr
->
len
,
msdos_name
,
options
);
if
(
!
error
)
if
(
!
error
)
...
@@ -162,8 +162,8 @@ static int msdos_hash(struct dentry *dentry, struct qstr *qstr)
...
@@ -162,8 +162,8 @@ static int msdos_hash(struct dentry *dentry, struct qstr *qstr)
static
int
msdos_cmp
(
struct
dentry
*
dentry
,
struct
qstr
*
a
,
struct
qstr
*
b
)
static
int
msdos_cmp
(
struct
dentry
*
dentry
,
struct
qstr
*
a
,
struct
qstr
*
b
)
{
{
struct
fat_mount_options
*
options
=
&
(
MSDOS_SB
(
dentry
->
d_sb
)
->
options
);
struct
fat_mount_options
*
options
=
&
(
MSDOS_SB
(
dentry
->
d_sb
)
->
options
);
unsigned
char
a_msdos_name
[
MSDOS_NAME
],
b_msdos_name
[
MSDOS_NAME
];
int
error
;
int
error
;
char
a_msdos_name
[
MSDOS_NAME
],
b_msdos_name
[
MSDOS_NAME
];
error
=
msdos_format_name
(
a
->
name
,
a
->
len
,
a_msdos_name
,
options
);
error
=
msdos_format_name
(
a
->
name
,
a
->
len
,
a_msdos_name
,
options
);
if
(
error
)
if
(
error
)
...
@@ -228,7 +228,7 @@ struct dentry *msdos_lookup(struct inode *dir,struct dentry *dentry, struct name
...
@@ -228,7 +228,7 @@ struct dentry *msdos_lookup(struct inode *dir,struct dentry *dentry, struct name
}
}
/***** Creates a directory entry (name is already formatted). */
/***** Creates a directory entry (name is already formatted). */
static
int
msdos_add_entry
(
struct
inode
*
dir
,
const
char
*
name
,
static
int
msdos_add_entry
(
struct
inode
*
dir
,
const
unsigned
char
*
name
,
struct
buffer_head
**
bh
,
struct
buffer_head
**
bh
,
struct
msdos_dir_entry
**
de
,
struct
msdos_dir_entry
**
de
,
loff_t
*
i_pos
,
int
is_dir
,
int
is_hid
)
loff_t
*
i_pos
,
int
is_dir
,
int
is_hid
)
...
@@ -270,7 +270,7 @@ int msdos_create(struct inode *dir,struct dentry *dentry,int mode,
...
@@ -270,7 +270,7 @@ int msdos_create(struct inode *dir,struct dentry *dentry,int mode,
struct
inode
*
inode
;
struct
inode
*
inode
;
loff_t
i_pos
;
loff_t
i_pos
;
int
res
,
is_hid
;
int
res
,
is_hid
;
char
msdos_name
[
MSDOS_NAME
];
unsigned
char
msdos_name
[
MSDOS_NAME
];
lock_kernel
();
lock_kernel
();
res
=
msdos_format_name
(
dentry
->
d_name
.
name
,
dentry
->
d_name
.
len
,
res
=
msdos_format_name
(
dentry
->
d_name
.
name
,
dentry
->
d_name
.
len
,
...
@@ -352,7 +352,7 @@ int msdos_mkdir(struct inode *dir,struct dentry *dentry,int mode)
...
@@ -352,7 +352,7 @@ int msdos_mkdir(struct inode *dir,struct dentry *dentry,int mode)
struct
msdos_dir_entry
*
de
;
struct
msdos_dir_entry
*
de
;
struct
inode
*
inode
;
struct
inode
*
inode
;
int
res
,
is_hid
;
int
res
,
is_hid
;
char
msdos_name
[
MSDOS_NAME
];
unsigned
char
msdos_name
[
MSDOS_NAME
];
loff_t
i_pos
;
loff_t
i_pos
;
lock_kernel
();
lock_kernel
();
...
@@ -442,9 +442,9 @@ int msdos_unlink( struct inode *dir, struct dentry *dentry)
...
@@ -442,9 +442,9 @@ int msdos_unlink( struct inode *dir, struct dentry *dentry)
return
res
;
return
res
;
}
}
static
int
do_msdos_rename
(
struct
inode
*
old_dir
,
char
*
old_name
,
static
int
do_msdos_rename
(
struct
inode
*
old_dir
,
unsigned
char
*
old_name
,
struct
dentry
*
old_dentry
,
struct
dentry
*
old_dentry
,
struct
inode
*
new_dir
,
char
*
new_name
,
struct
dentry
*
new_dentry
,
struct
inode
*
new_dir
,
unsigned
char
*
new_name
,
struct
dentry
*
new_dentry
,
struct
buffer_head
*
old_bh
,
struct
buffer_head
*
old_bh
,
struct
msdos_dir_entry
*
old_de
,
loff_t
old_i_pos
,
int
is_hid
)
struct
msdos_dir_entry
*
old_de
,
loff_t
old_i_pos
,
int
is_hid
)
{
{
...
@@ -550,7 +550,7 @@ int msdos_rename(struct inode *old_dir,struct dentry *old_dentry,
...
@@ -550,7 +550,7 @@ int msdos_rename(struct inode *old_dir,struct dentry *old_dentry,
struct
msdos_dir_entry
*
old_de
;
struct
msdos_dir_entry
*
old_de
;
loff_t
old_i_pos
;
loff_t
old_i_pos
;
int
error
,
is_hid
,
old_hid
;
/* if new file and old file are hidden */
int
error
,
is_hid
,
old_hid
;
/* if new file and old file are hidden */
char
old_msdos_name
[
MSDOS_NAME
],
new_msdos_name
[
MSDOS_NAME
];
unsigned
char
old_msdos_name
[
MSDOS_NAME
],
new_msdos_name
[
MSDOS_NAME
];
lock_kernel
();
lock_kernel
();
error
=
msdos_format_name
(
old_dentry
->
d_name
.
name
,
error
=
msdos_format_name
(
old_dentry
->
d_name
.
name
,
...
...
fs/vfat/namei.c
View file @
b1b410c3
...
@@ -122,7 +122,7 @@ vfat_strnicmp(struct nls_table *t, const unsigned char *s1,
...
@@ -122,7 +122,7 @@ vfat_strnicmp(struct nls_table *t, const unsigned char *s1,
*/
*/
static
int
vfat_hash
(
struct
dentry
*
dentry
,
struct
qstr
*
qstr
)
static
int
vfat_hash
(
struct
dentry
*
dentry
,
struct
qstr
*
qstr
)
{
{
const
char
*
name
;
const
unsigned
char
*
name
;
int
len
;
int
len
;
len
=
qstr
->
len
;
len
=
qstr
->
len
;
...
@@ -144,7 +144,7 @@ static int vfat_hash(struct dentry *dentry, struct qstr *qstr)
...
@@ -144,7 +144,7 @@ static int vfat_hash(struct dentry *dentry, struct qstr *qstr)
static
int
vfat_hashi
(
struct
dentry
*
dentry
,
struct
qstr
*
qstr
)
static
int
vfat_hashi
(
struct
dentry
*
dentry
,
struct
qstr
*
qstr
)
{
{
struct
nls_table
*
t
=
MSDOS_SB
(
dentry
->
d_inode
->
i_sb
)
->
nls_io
;
struct
nls_table
*
t
=
MSDOS_SB
(
dentry
->
d_inode
->
i_sb
)
->
nls_io
;
const
char
*
name
;
const
unsigned
char
*
name
;
int
len
;
int
len
;
unsigned
long
hash
;
unsigned
long
hash
;
...
@@ -206,11 +206,11 @@ static int vfat_cmp(struct dentry *dentry, struct qstr *a, struct qstr *b)
...
@@ -206,11 +206,11 @@ static int vfat_cmp(struct dentry *dentry, struct qstr *a, struct qstr *b)
/* MS-DOS "device special files" */
/* MS-DOS "device special files" */
static
const
char
*
reserved3_names
[]
=
{
static
const
unsigned
char
*
reserved3_names
[]
=
{
"con "
,
"prn "
,
"nul "
,
"aux "
,
NULL
"con "
,
"prn "
,
"nul "
,
"aux "
,
NULL
};
};
static
const
char
*
reserved4_names
[]
=
{
static
const
unsigned
char
*
reserved4_names
[]
=
{
"com1 "
,
"com2 "
,
"com3 "
,
"com4 "
,
"com5 "
,
"com1 "
,
"com2 "
,
"com3 "
,
"com4 "
,
"com5 "
,
"com6 "
,
"com7 "
,
"com8 "
,
"com9 "
,
"com6 "
,
"com7 "
,
"com8 "
,
"com9 "
,
"lpt1 "
,
"lpt2 "
,
"lpt3 "
,
"lpt4 "
,
"lpt5 "
,
"lpt1 "
,
"lpt2 "
,
"lpt3 "
,
"lpt4 "
,
"lpt5 "
,
...
@@ -263,16 +263,20 @@ static inline int vfat_is_used_badchars(const wchar_t *s, int len)
...
@@ -263,16 +263,20 @@ static inline int vfat_is_used_badchars(const wchar_t *s, int len)
/* Returns negative number on error, 0 for a normal
/* Returns negative number on error, 0 for a normal
* return, and 1 for . or .. */
* return, and 1 for . or .. */
static
int
vfat_valid_longname
(
const
char
*
name
,
int
len
,
int
xlate
)
static
int
vfat_valid_longname
(
const
unsigned
char
*
name
,
int
len
,
int
xlate
)
{
{
const
char
**
reserved
,
*
walk
;
const
unsigned
char
**
reserved
,
*
walk
;
int
baselen
;
int
baselen
;
if
(
len
&&
name
[
len
-
1
]
==
' '
)
return
-
EINVAL
;
if
(
len
&&
name
[
len
-
1
]
==
' '
)
if
(
len
>=
256
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
len
<
3
)
return
0
;
if
(
len
>=
256
)
return
-
EINVAL
;
if
(
len
<
3
)
return
0
;
for
(
walk
=
name
;
*
walk
!=
0
&&
*
walk
!=
'.'
;
walk
++
);
for
(
walk
=
name
;
*
walk
!=
0
&&
*
walk
!=
'.'
;
walk
++
)
;
baselen
=
walk
-
name
;
baselen
=
walk
-
name
;
if
(
baselen
==
3
)
{
if
(
baselen
==
3
)
{
...
@@ -289,7 +293,7 @@ static int vfat_valid_longname(const char *name, int len, int xlate)
...
@@ -289,7 +293,7 @@ static int vfat_valid_longname(const char *name, int len, int xlate)
return
0
;
return
0
;
}
}
static
int
vfat_find_form
(
struct
inode
*
dir
,
char
*
name
)
static
int
vfat_find_form
(
struct
inode
*
dir
,
unsigned
char
*
name
)
{
{
struct
msdos_dir_entry
*
de
;
struct
msdos_dir_entry
*
de
;
struct
buffer_head
*
bh
=
NULL
;
struct
buffer_head
*
bh
=
NULL
;
...
@@ -402,7 +406,7 @@ static inline int to_shortname_char(struct nls_table *nls,
...
@@ -402,7 +406,7 @@ static inline int to_shortname_char(struct nls_table *nls,
*/
*/
static
int
vfat_create_shortname
(
struct
inode
*
dir
,
struct
nls_table
*
nls
,
static
int
vfat_create_shortname
(
struct
inode
*
dir
,
struct
nls_table
*
nls
,
wchar_t
*
uname
,
int
ulen
,
wchar_t
*
uname
,
int
ulen
,
char
*
name_res
,
unsigned
char
*
lcase
)
unsigned
char
*
name_res
,
unsigned
char
*
lcase
)
{
{
wchar_t
*
ip
,
*
ext_start
,
*
end
,
*
name_start
;
wchar_t
*
ip
,
*
ext_start
,
*
end
,
*
name_start
;
unsigned
char
base
[
9
],
ext
[
4
],
buf
[
8
],
*
p
;
unsigned
char
base
[
9
],
ext
[
4
],
buf
[
8
],
*
p
;
...
@@ -582,21 +586,22 @@ static int vfat_create_shortname(struct inode *dir, struct nls_table *nls,
...
@@ -582,21 +586,22 @@ static int vfat_create_shortname(struct inode *dir, struct nls_table *nls,
/* Translate a string, including coded sequences into Unicode */
/* Translate a string, including coded sequences into Unicode */
static
int
static
int
xlate_to_uni
(
const
char
*
name
,
int
len
,
char
*
outname
,
int
*
longlen
,
int
*
outlen
,
xlate_to_uni
(
const
unsigned
char
*
name
,
int
len
,
unsigned
char
*
outname
,
int
escape
,
int
utf8
,
struct
nls_table
*
nls
)
int
*
longlen
,
int
*
outlen
,
int
escape
,
int
utf8
,
struct
nls_table
*
nls
)
{
{
const
unsigned
char
*
ip
;
const
unsigned
char
*
ip
;
unsigned
char
nc
;
unsigned
char
nc
;
char
*
op
;
unsigned
char
*
op
;
unsigned
int
ec
;
unsigned
int
ec
;
int
i
,
k
,
fill
;
int
i
,
k
,
fill
;
int
charlen
;
int
charlen
;
if
(
utf8
)
{
if
(
utf8
)
{
*
outlen
=
utf8_mbstowcs
((
__u16
*
)
outname
,
name
,
PAGE_SIZE
);
*
outlen
=
utf8_mbstowcs
((
wchar_t
*
)
outname
,
name
,
PAGE_SIZE
);
if
(
name
[
len
-
1
]
==
'.'
)
if
(
name
[
len
-
1
]
==
'.'
)
*
outlen
-=
2
;
*
outlen
-=
2
;
op
=
&
outname
[
*
outlen
*
sizeof
(
__u16
)];
op
=
&
outname
[
*
outlen
*
sizeof
(
wchar_t
)];
}
else
{
}
else
{
if
(
name
[
len
-
1
]
==
'.'
)
if
(
name
[
len
-
1
]
==
'.'
)
len
--
;
len
--
;
...
@@ -667,8 +672,9 @@ xlate_to_uni(const char *name, int len, char *outname, int *longlen, int *outlen
...
@@ -667,8 +672,9 @@ xlate_to_uni(const char *name, int len, char *outname, int *longlen, int *outlen
return
0
;
return
0
;
}
}
static
int
vfat_build_slots
(
struct
inode
*
dir
,
const
char
*
name
,
int
len
,
static
int
vfat_build_slots
(
struct
inode
*
dir
,
const
unsigned
char
*
name
,
struct
msdos_dir_slot
*
ds
,
int
*
slots
,
int
is_dir
)
int
len
,
struct
msdos_dir_slot
*
ds
,
int
*
slots
,
int
is_dir
)
{
{
struct
msdos_sb_info
*
sbi
=
MSDOS_SB
(
dir
->
i_sb
);
struct
msdos_sb_info
*
sbi
=
MSDOS_SB
(
dir
->
i_sb
);
struct
fat_mount_options
*
opts
=
&
sbi
->
options
;
struct
fat_mount_options
*
opts
=
&
sbi
->
options
;
...
@@ -676,7 +682,7 @@ static int vfat_build_slots(struct inode *dir, const char *name, int len,
...
@@ -676,7 +682,7 @@ static int vfat_build_slots(struct inode *dir, const char *name, int len,
struct
msdos_dir_entry
*
de
;
struct
msdos_dir_entry
*
de
;
unsigned
long
page
;
unsigned
long
page
;
unsigned
char
cksum
,
lcase
;
unsigned
char
cksum
,
lcase
;
char
msdos_name
[
MSDOS_NAME
];
unsigned
char
msdos_name
[
MSDOS_NAME
];
wchar_t
*
uname
;
wchar_t
*
uname
;
int
res
,
slot
,
ulen
,
usize
,
i
;
int
res
,
slot
,
ulen
,
usize
,
i
;
loff_t
offset
;
loff_t
offset
;
...
@@ -690,7 +696,7 @@ static int vfat_build_slots(struct inode *dir, const char *name, int len,
...
@@ -690,7 +696,7 @@ static int vfat_build_slots(struct inode *dir, const char *name, int len,
return
-
ENOMEM
;
return
-
ENOMEM
;
uname
=
(
wchar_t
*
)
page
;
uname
=
(
wchar_t
*
)
page
;
res
=
xlate_to_uni
(
name
,
len
,
(
char
*
)
uname
,
&
ulen
,
&
usize
,
res
=
xlate_to_uni
(
name
,
len
,
(
unsigned
char
*
)
uname
,
&
ulen
,
&
usize
,
opts
->
unicode_xlate
,
opts
->
utf8
,
sbi
->
nls_io
);
opts
->
unicode_xlate
,
opts
->
utf8
,
sbi
->
nls_io
);
if
(
res
<
0
)
if
(
res
<
0
)
goto
out_free
;
goto
out_free
;
...
...
include/linux/msdos_fs.h
View file @
b1b410c3
...
@@ -44,7 +44,7 @@ struct statfs;
...
@@ -44,7 +44,7 @@ struct statfs;
#define CASE_LOWER_EXT 16
/* extension is lower case */
#define CASE_LOWER_EXT 16
/* extension is lower case */
#define DELETED_FLAG 0xe5
/* marks file as deleted when in name[0] */
#define DELETED_FLAG 0xe5
/* marks file as deleted when in name[0] */
#define IS_FREE(n) (!*(n) || *(
const unsigned char *) (
n) == DELETED_FLAG)
#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
#define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)
#define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)
/* valid file mode bits */
/* valid file mode bits */
...
@@ -113,8 +113,8 @@ struct statfs;
...
@@ -113,8 +113,8 @@ struct statfs;
#define CT_LE_L(v) cpu_to_le32(v)
#define CT_LE_L(v) cpu_to_le32(v)
struct
fat_boot_sector
{
struct
fat_boot_sector
{
__
s
8
ignored
[
3
];
/* Boot strap short or near jump */
__
u
8
ignored
[
3
];
/* Boot strap short or near jump */
__
s
8
system_id
[
8
];
/* Name - can be used to special case
__
u
8
system_id
[
8
];
/* Name - can be used to special case
partition manager volumes */
partition manager volumes */
__u8
sector_size
[
2
];
/* bytes per logical sector */
__u8
sector_size
[
2
];
/* bytes per logical sector */
__u8
cluster_size
;
/* sectors/cluster */
__u8
cluster_size
;
/* sectors/cluster */
...
@@ -149,7 +149,7 @@ struct fat_boot_fsinfo {
...
@@ -149,7 +149,7 @@ struct fat_boot_fsinfo {
};
};
struct
msdos_dir_entry
{
struct
msdos_dir_entry
{
__
s
8
name
[
8
],
ext
[
3
];
/* name and extension */
__
u
8
name
[
8
],
ext
[
3
];
/* name and extension */
__u8
attr
;
/* attribute bits */
__u8
attr
;
/* attribute bits */
__u8
lcase
;
/* Case for base and extension */
__u8
lcase
;
/* Case for base and extension */
__u8
ctime_ms
;
/* Creation time, milliseconds */
__u8
ctime_ms
;
/* Creation time, milliseconds */
...
@@ -243,8 +243,9 @@ extern int fat_free(struct inode *inode, int skip);
...
@@ -243,8 +243,9 @@ extern int fat_free(struct inode *inode, int skip);
/* fat/dir.c */
/* fat/dir.c */
extern
struct
file_operations
fat_dir_operations
;
extern
struct
file_operations
fat_dir_operations
;
extern
int
fat_search_long
(
struct
inode
*
inode
,
const
char
*
name
,
int
name_len
,
extern
int
fat_search_long
(
struct
inode
*
inode
,
const
unsigned
char
*
name
,
int
anycase
,
loff_t
*
spos
,
loff_t
*
lpos
);
int
name_len
,
int
anycase
,
loff_t
*
spos
,
loff_t
*
lpos
);
extern
int
fat_readdir
(
struct
file
*
filp
,
void
*
dirent
,
filldir_t
filldir
);
extern
int
fat_readdir
(
struct
file
*
filp
,
void
*
dirent
,
filldir_t
filldir
);
extern
int
fat_dir_ioctl
(
struct
inode
*
inode
,
struct
file
*
filp
,
extern
int
fat_dir_ioctl
(
struct
inode
*
inode
,
struct
file
*
filp
,
unsigned
int
cmd
,
unsigned
long
arg
);
unsigned
int
cmd
,
unsigned
long
arg
);
...
@@ -304,7 +305,7 @@ static __inline__ int fat_get_entry(struct inode *dir, loff_t *pos,
...
@@ -304,7 +305,7 @@ static __inline__ int fat_get_entry(struct inode *dir, loff_t *pos,
return
fat__get_entry
(
dir
,
pos
,
bh
,
de
,
i_pos
);
return
fat__get_entry
(
dir
,
pos
,
bh
,
de
,
i_pos
);
}
}
extern
int
fat_subdirs
(
struct
inode
*
dir
);
extern
int
fat_subdirs
(
struct
inode
*
dir
);
extern
int
fat_scan
(
struct
inode
*
dir
,
const
char
*
name
,
extern
int
fat_scan
(
struct
inode
*
dir
,
const
unsigned
char
*
name
,
struct
buffer_head
**
res_bh
,
struct
buffer_head
**
res_bh
,
struct
msdos_dir_entry
**
res_de
,
loff_t
*
i_pos
);
struct
msdos_dir_entry
**
res_de
,
loff_t
*
i_pos
);
...
...
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