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
Kirill Smelkov
linux
Commits
7e7742ee
Commit
7e7742ee
authored
Jan 31, 2010
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sanitize signedness/const for pointers to char in hpfs a bit
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
1f707137
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
97 additions
and
82 deletions
+97
-82
fs/hpfs/anode.c
fs/hpfs/anode.c
+1
-1
fs/hpfs/dentry.c
fs/hpfs/dentry.c
+8
-6
fs/hpfs/dir.c
fs/hpfs/dir.c
+7
-7
fs/hpfs/dnode.c
fs/hpfs/dnode.c
+13
-8
fs/hpfs/ea.c
fs/hpfs/ea.c
+4
-3
fs/hpfs/hpfs_fn.h
fs/hpfs/hpfs_fn.h
+18
-12
fs/hpfs/inode.c
fs/hpfs/inode.c
+2
-2
fs/hpfs/map.c
fs/hpfs/map.c
+3
-3
fs/hpfs/name.c
fs/hpfs/name.c
+11
-10
fs/hpfs/namei.c
fs/hpfs/namei.c
+30
-30
No files found.
fs/hpfs/anode.c
View file @
7e7742ee
...
@@ -353,7 +353,7 @@ int hpfs_ea_read(struct super_block *s, secno a, int ano, unsigned pos,
...
@@ -353,7 +353,7 @@ int hpfs_ea_read(struct super_block *s, secno a, int ano, unsigned pos,
}
}
int
hpfs_ea_write
(
struct
super_block
*
s
,
secno
a
,
int
ano
,
unsigned
pos
,
int
hpfs_ea_write
(
struct
super_block
*
s
,
secno
a
,
int
ano
,
unsigned
pos
,
unsigned
len
,
char
*
buf
)
unsigned
len
,
c
onst
c
har
*
buf
)
{
{
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
char
*
data
;
char
*
data
;
...
...
fs/hpfs/dentry.c
View file @
7e7742ee
...
@@ -20,8 +20,8 @@ static int hpfs_hash_dentry(struct dentry *dentry, struct qstr *qstr)
...
@@ -20,8 +20,8 @@ static int hpfs_hash_dentry(struct dentry *dentry, struct qstr *qstr)
if
(
l
==
1
)
if
(
qstr
->
name
[
0
]
==
'.'
)
goto
x
;
if
(
l
==
1
)
if
(
qstr
->
name
[
0
]
==
'.'
)
goto
x
;
if
(
l
==
2
)
if
(
qstr
->
name
[
0
]
==
'.'
||
qstr
->
name
[
1
]
==
'.'
)
goto
x
;
if
(
l
==
2
)
if
(
qstr
->
name
[
0
]
==
'.'
||
qstr
->
name
[
1
]
==
'.'
)
goto
x
;
hpfs_adjust_length
(
(
char
*
)
qstr
->
name
,
&
l
);
hpfs_adjust_length
(
qstr
->
name
,
&
l
);
/*if (hpfs_chk_name(
(char *)
qstr->name,&l))*/
/*if (hpfs_chk_name(qstr->name,&l))*/
/*return -ENAMETOOLONG;*/
/*return -ENAMETOOLONG;*/
/*return -ENOENT;*/
/*return -ENOENT;*/
x:
x:
...
@@ -38,14 +38,16 @@ static int hpfs_compare_dentry(struct dentry *dentry, struct qstr *a, struct qst
...
@@ -38,14 +38,16 @@ static int hpfs_compare_dentry(struct dentry *dentry, struct qstr *a, struct qst
{
{
unsigned
al
=
a
->
len
;
unsigned
al
=
a
->
len
;
unsigned
bl
=
b
->
len
;
unsigned
bl
=
b
->
len
;
hpfs_adjust_length
(
(
char
*
)
a
->
name
,
&
al
);
hpfs_adjust_length
(
a
->
name
,
&
al
);
/*hpfs_adjust_length(
(char *)
b->name, &bl);*/
/*hpfs_adjust_length(b->name, &bl);*/
/* 'a' is the qstr of an already existing dentry, so the name
/* 'a' is the qstr of an already existing dentry, so the name
* must be valid. 'b' must be validated first.
* must be valid. 'b' must be validated first.
*/
*/
if
(
hpfs_chk_name
((
char
*
)
b
->
name
,
&
bl
))
return
1
;
if
(
hpfs_chk_name
(
b
->
name
,
&
bl
))
if
(
hpfs_compare_names
(
dentry
->
d_sb
,
(
char
*
)
a
->
name
,
al
,
(
char
*
)
b
->
name
,
bl
,
0
))
return
1
;
return
1
;
if
(
hpfs_compare_names
(
dentry
->
d_sb
,
a
->
name
,
al
,
b
->
name
,
bl
,
0
))
return
1
;
return
0
;
return
0
;
}
}
...
...
fs/hpfs/dir.c
View file @
7e7742ee
...
@@ -59,7 +59,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -59,7 +59,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
struct
hpfs_dirent
*
de
;
struct
hpfs_dirent
*
de
;
int
lc
;
int
lc
;
long
old_pos
;
long
old_pos
;
char
*
tempname
;
unsigned
char
*
tempname
;
int
c1
,
c2
=
0
;
int
c1
,
c2
=
0
;
int
ret
=
0
;
int
ret
=
0
;
...
@@ -158,11 +158,11 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -158,11 +158,11 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
tempname
=
hpfs_translate_name
(
inode
->
i_sb
,
de
->
name
,
de
->
namelen
,
lc
,
de
->
not_8x3
);
tempname
=
hpfs_translate_name
(
inode
->
i_sb
,
de
->
name
,
de
->
namelen
,
lc
,
de
->
not_8x3
);
if
(
filldir
(
dirent
,
tempname
,
de
->
namelen
,
old_pos
,
de
->
fnode
,
DT_UNKNOWN
)
<
0
)
{
if
(
filldir
(
dirent
,
tempname
,
de
->
namelen
,
old_pos
,
de
->
fnode
,
DT_UNKNOWN
)
<
0
)
{
filp
->
f_pos
=
old_pos
;
filp
->
f_pos
=
old_pos
;
if
(
tempname
!=
(
char
*
)
de
->
name
)
kfree
(
tempname
);
if
(
tempname
!=
de
->
name
)
kfree
(
tempname
);
hpfs_brelse4
(
&
qbh
);
hpfs_brelse4
(
&
qbh
);
goto
out
;
goto
out
;
}
}
if
(
tempname
!=
(
char
*
)
de
->
name
)
kfree
(
tempname
);
if
(
tempname
!=
de
->
name
)
kfree
(
tempname
);
hpfs_brelse4
(
&
qbh
);
hpfs_brelse4
(
&
qbh
);
}
}
out:
out:
...
@@ -187,7 +187,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -187,7 +187,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
struct
dentry
*
hpfs_lookup
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
struct
nameidata
*
nd
)
struct
dentry
*
hpfs_lookup
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
struct
nameidata
*
nd
)
{
{
const
char
*
name
=
dentry
->
d_name
.
name
;
const
unsigned
char
*
name
=
dentry
->
d_name
.
name
;
unsigned
len
=
dentry
->
d_name
.
len
;
unsigned
len
=
dentry
->
d_name
.
len
;
struct
quad_buffer_head
qbh
;
struct
quad_buffer_head
qbh
;
struct
hpfs_dirent
*
de
;
struct
hpfs_dirent
*
de
;
...
@@ -197,7 +197,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
...
@@ -197,7 +197,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
struct
hpfs_inode_info
*
hpfs_result
;
struct
hpfs_inode_info
*
hpfs_result
;
lock_kernel
();
lock_kernel
();
if
((
err
=
hpfs_chk_name
(
(
char
*
)
name
,
&
len
)))
{
if
((
err
=
hpfs_chk_name
(
name
,
&
len
)))
{
if
(
err
==
-
ENAMETOOLONG
)
{
if
(
err
==
-
ENAMETOOLONG
)
{
unlock_kernel
();
unlock_kernel
();
return
ERR_PTR
(
-
ENAMETOOLONG
);
return
ERR_PTR
(
-
ENAMETOOLONG
);
...
@@ -209,7 +209,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
...
@@ -209,7 +209,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
* '.' and '..' will never be passed here.
* '.' and '..' will never be passed here.
*/
*/
de
=
map_dirent
(
dir
,
hpfs_i
(
dir
)
->
i_dno
,
(
char
*
)
name
,
len
,
NULL
,
&
qbh
);
de
=
map_dirent
(
dir
,
hpfs_i
(
dir
)
->
i_dno
,
name
,
len
,
NULL
,
&
qbh
);
/*
/*
* This is not really a bailout, just means file not found.
* This is not really a bailout, just means file not found.
...
@@ -250,7 +250,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
...
@@ -250,7 +250,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
hpfs_result
=
hpfs_i
(
result
);
hpfs_result
=
hpfs_i
(
result
);
if
(
!
de
->
directory
)
hpfs_result
->
i_parent_dir
=
dir
->
i_ino
;
if
(
!
de
->
directory
)
hpfs_result
->
i_parent_dir
=
dir
->
i_ino
;
hpfs_decide_conv
(
result
,
(
char
*
)
name
,
len
);
hpfs_decide_conv
(
result
,
name
,
len
);
if
(
de
->
has_acl
||
de
->
has_xtd_perm
)
if
(
!
(
dir
->
i_sb
->
s_flags
&
MS_RDONLY
))
{
if
(
de
->
has_acl
||
de
->
has_xtd_perm
)
if
(
!
(
dir
->
i_sb
->
s_flags
&
MS_RDONLY
))
{
hpfs_error
(
result
->
i_sb
,
"ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures"
);
hpfs_error
(
result
->
i_sb
,
"ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures"
);
...
...
fs/hpfs/dnode.c
View file @
7e7742ee
...
@@ -158,7 +158,8 @@ static void set_last_pointer(struct super_block *s, struct dnode *d, dnode_secno
...
@@ -158,7 +158,8 @@ static void set_last_pointer(struct super_block *s, struct dnode *d, dnode_secno
/* Add an entry to dnode and don't care if it grows over 2048 bytes */
/* Add an entry to dnode and don't care if it grows over 2048 bytes */
struct
hpfs_dirent
*
hpfs_add_de
(
struct
super_block
*
s
,
struct
dnode
*
d
,
unsigned
char
*
name
,
struct
hpfs_dirent
*
hpfs_add_de
(
struct
super_block
*
s
,
struct
dnode
*
d
,
const
unsigned
char
*
name
,
unsigned
namelen
,
secno
down_ptr
)
unsigned
namelen
,
secno
down_ptr
)
{
{
struct
hpfs_dirent
*
de
;
struct
hpfs_dirent
*
de
;
...
@@ -223,7 +224,7 @@ static void fix_up_ptrs(struct super_block *s, struct dnode *d)
...
@@ -223,7 +224,7 @@ static void fix_up_ptrs(struct super_block *s, struct dnode *d)
/* Add an entry to dnode and do dnode splitting if required */
/* Add an entry to dnode and do dnode splitting if required */
static
int
hpfs_add_to_dnode
(
struct
inode
*
i
,
dnode_secno
dno
,
static
int
hpfs_add_to_dnode
(
struct
inode
*
i
,
dnode_secno
dno
,
unsigned
char
*
name
,
unsigned
namelen
,
const
unsigned
char
*
name
,
unsigned
namelen
,
struct
hpfs_dirent
*
new_de
,
dnode_secno
down_ptr
)
struct
hpfs_dirent
*
new_de
,
dnode_secno
down_ptr
)
{
{
struct
quad_buffer_head
qbh
,
qbh1
,
qbh2
;
struct
quad_buffer_head
qbh
,
qbh1
,
qbh2
;
...
@@ -231,7 +232,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
...
@@ -231,7 +232,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
dnode_secno
adno
,
rdno
;
dnode_secno
adno
,
rdno
;
struct
hpfs_dirent
*
de
;
struct
hpfs_dirent
*
de
;
struct
hpfs_dirent
nde
;
struct
hpfs_dirent
nde
;
char
*
nname
;
unsigned
char
*
nname
;
int
h
;
int
h
;
int
pos
;
int
pos
;
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
...
@@ -305,7 +306,9 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
...
@@ -305,7 +306,9 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
pos
++
;
pos
++
;
}
}
copy_de
(
new_de
=
&
nde
,
de
);
copy_de
(
new_de
=
&
nde
,
de
);
memcpy
(
name
=
nname
,
de
->
name
,
namelen
=
de
->
namelen
);
memcpy
(
nname
,
de
->
name
,
de
->
namelen
);
name
=
nname
;
namelen
=
de
->
namelen
;
for_all_poss
(
i
,
hpfs_pos_subst
,
((
loff_t
)
dno
<<
4
)
|
pos
,
4
);
for_all_poss
(
i
,
hpfs_pos_subst
,
((
loff_t
)
dno
<<
4
)
|
pos
,
4
);
down_ptr
=
adno
;
down_ptr
=
adno
;
set_last_pointer
(
i
->
i_sb
,
ad
,
de
->
down
?
de_down_pointer
(
de
)
:
0
);
set_last_pointer
(
i
->
i_sb
,
ad
,
de
->
down
?
de_down_pointer
(
de
)
:
0
);
...
@@ -368,7 +371,8 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
...
@@ -368,7 +371,8 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
* I hope, now it's finally bug-free.
* I hope, now it's finally bug-free.
*/
*/
int
hpfs_add_dirent
(
struct
inode
*
i
,
unsigned
char
*
name
,
unsigned
namelen
,
int
hpfs_add_dirent
(
struct
inode
*
i
,
const
unsigned
char
*
name
,
unsigned
namelen
,
struct
hpfs_dirent
*
new_de
,
int
cdepth
)
struct
hpfs_dirent
*
new_de
,
int
cdepth
)
{
{
struct
hpfs_inode_info
*
hpfs_inode
=
hpfs_i
(
i
);
struct
hpfs_inode_info
*
hpfs_inode
=
hpfs_i
(
i
);
...
@@ -897,7 +901,8 @@ struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp,
...
@@ -897,7 +901,8 @@ struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp,
/* Find a dirent in tree */
/* Find a dirent in tree */
struct
hpfs_dirent
*
map_dirent
(
struct
inode
*
inode
,
dnode_secno
dno
,
char
*
name
,
unsigned
len
,
struct
hpfs_dirent
*
map_dirent
(
struct
inode
*
inode
,
dnode_secno
dno
,
const
unsigned
char
*
name
,
unsigned
len
,
dnode_secno
*
dd
,
struct
quad_buffer_head
*
qbh
)
dnode_secno
*
dd
,
struct
quad_buffer_head
*
qbh
)
{
{
struct
dnode
*
dnode
;
struct
dnode
*
dnode
;
...
@@ -988,8 +993,8 @@ void hpfs_remove_dtree(struct super_block *s, dnode_secno dno)
...
@@ -988,8 +993,8 @@ void hpfs_remove_dtree(struct super_block *s, dnode_secno dno)
struct
hpfs_dirent
*
map_fnode_dirent
(
struct
super_block
*
s
,
fnode_secno
fno
,
struct
hpfs_dirent
*
map_fnode_dirent
(
struct
super_block
*
s
,
fnode_secno
fno
,
struct
fnode
*
f
,
struct
quad_buffer_head
*
qbh
)
struct
fnode
*
f
,
struct
quad_buffer_head
*
qbh
)
{
{
char
*
name1
;
unsigned
char
*
name1
;
char
*
name2
;
unsigned
char
*
name2
;
int
name1len
,
name2len
;
int
name1len
,
name2len
;
struct
dnode
*
d
;
struct
dnode
*
d
;
dnode_secno
dno
,
downd
;
dnode_secno
dno
,
downd
;
...
...
fs/hpfs/ea.c
View file @
7e7742ee
...
@@ -62,8 +62,8 @@ static char *get_indirect_ea(struct super_block *s, int ano, secno a, int size)
...
@@ -62,8 +62,8 @@ static char *get_indirect_ea(struct super_block *s, int ano, secno a, int size)
return
ret
;
return
ret
;
}
}
static
void
set_indirect_ea
(
struct
super_block
*
s
,
int
ano
,
secno
a
,
char
*
data
,
static
void
set_indirect_ea
(
struct
super_block
*
s
,
int
ano
,
secno
a
,
int
size
)
const
char
*
data
,
int
size
)
{
{
hpfs_ea_write
(
s
,
a
,
ano
,
0
,
size
,
data
);
hpfs_ea_write
(
s
,
a
,
ano
,
0
,
size
,
data
);
}
}
...
@@ -186,7 +186,8 @@ char *hpfs_get_ea(struct super_block *s, struct fnode *fnode, char *key, int *si
...
@@ -186,7 +186,8 @@ char *hpfs_get_ea(struct super_block *s, struct fnode *fnode, char *key, int *si
* This driver can't change sizes of eas ('cause I just don't need it).
* This driver can't change sizes of eas ('cause I just don't need it).
*/
*/
void
hpfs_set_ea
(
struct
inode
*
inode
,
struct
fnode
*
fnode
,
char
*
key
,
char
*
data
,
int
size
)
void
hpfs_set_ea
(
struct
inode
*
inode
,
struct
fnode
*
fnode
,
const
char
*
key
,
const
char
*
data
,
int
size
)
{
{
fnode_secno
fno
=
inode
->
i_ino
;
fnode_secno
fno
=
inode
->
i_ino
;
struct
super_block
*
s
=
inode
->
i_sb
;
struct
super_block
*
s
=
inode
->
i_sb
;
...
...
fs/hpfs/hpfs_fn.h
View file @
7e7742ee
...
@@ -215,7 +215,7 @@ secno hpfs_bplus_lookup(struct super_block *, struct inode *, struct bplus_heade
...
@@ -215,7 +215,7 @@ secno hpfs_bplus_lookup(struct super_block *, struct inode *, struct bplus_heade
secno
hpfs_add_sector_to_btree
(
struct
super_block
*
,
secno
,
int
,
unsigned
);
secno
hpfs_add_sector_to_btree
(
struct
super_block
*
,
secno
,
int
,
unsigned
);
void
hpfs_remove_btree
(
struct
super_block
*
,
struct
bplus_header
*
);
void
hpfs_remove_btree
(
struct
super_block
*
,
struct
bplus_header
*
);
int
hpfs_ea_read
(
struct
super_block
*
,
secno
,
int
,
unsigned
,
unsigned
,
char
*
);
int
hpfs_ea_read
(
struct
super_block
*
,
secno
,
int
,
unsigned
,
unsigned
,
char
*
);
int
hpfs_ea_write
(
struct
super_block
*
,
secno
,
int
,
unsigned
,
unsigned
,
char
*
);
int
hpfs_ea_write
(
struct
super_block
*
,
secno
,
int
,
unsigned
,
unsigned
,
c
onst
c
har
*
);
void
hpfs_ea_remove
(
struct
super_block
*
,
secno
,
int
,
unsigned
);
void
hpfs_ea_remove
(
struct
super_block
*
,
secno
,
int
,
unsigned
);
void
hpfs_truncate_btree
(
struct
super_block
*
,
secno
,
int
,
unsigned
);
void
hpfs_truncate_btree
(
struct
super_block
*
,
secno
,
int
,
unsigned
);
void
hpfs_remove_fnode
(
struct
super_block
*
,
fnode_secno
fno
);
void
hpfs_remove_fnode
(
struct
super_block
*
,
fnode_secno
fno
);
...
@@ -244,13 +244,17 @@ extern const struct file_operations hpfs_dir_ops;
...
@@ -244,13 +244,17 @@ extern const struct file_operations hpfs_dir_ops;
void
hpfs_add_pos
(
struct
inode
*
,
loff_t
*
);
void
hpfs_add_pos
(
struct
inode
*
,
loff_t
*
);
void
hpfs_del_pos
(
struct
inode
*
,
loff_t
*
);
void
hpfs_del_pos
(
struct
inode
*
,
loff_t
*
);
struct
hpfs_dirent
*
hpfs_add_de
(
struct
super_block
*
,
struct
dnode
*
,
unsigned
char
*
,
unsigned
,
secno
);
struct
hpfs_dirent
*
hpfs_add_de
(
struct
super_block
*
,
struct
dnode
*
,
int
hpfs_add_dirent
(
struct
inode
*
,
unsigned
char
*
,
unsigned
,
struct
hpfs_dirent
*
,
int
);
const
unsigned
char
*
,
unsigned
,
secno
);
int
hpfs_add_dirent
(
struct
inode
*
,
const
unsigned
char
*
,
unsigned
,
struct
hpfs_dirent
*
,
int
);
int
hpfs_remove_dirent
(
struct
inode
*
,
dnode_secno
,
struct
hpfs_dirent
*
,
struct
quad_buffer_head
*
,
int
);
int
hpfs_remove_dirent
(
struct
inode
*
,
dnode_secno
,
struct
hpfs_dirent
*
,
struct
quad_buffer_head
*
,
int
);
void
hpfs_count_dnodes
(
struct
super_block
*
,
dnode_secno
,
int
*
,
int
*
,
int
*
);
void
hpfs_count_dnodes
(
struct
super_block
*
,
dnode_secno
,
int
*
,
int
*
,
int
*
);
dnode_secno
hpfs_de_as_down_as_possible
(
struct
super_block
*
,
dnode_secno
dno
);
dnode_secno
hpfs_de_as_down_as_possible
(
struct
super_block
*
,
dnode_secno
dno
);
struct
hpfs_dirent
*
map_pos_dirent
(
struct
inode
*
,
loff_t
*
,
struct
quad_buffer_head
*
);
struct
hpfs_dirent
*
map_pos_dirent
(
struct
inode
*
,
loff_t
*
,
struct
quad_buffer_head
*
);
struct
hpfs_dirent
*
map_dirent
(
struct
inode
*
,
dnode_secno
,
char
*
,
unsigned
,
dnode_secno
*
,
struct
quad_buffer_head
*
);
struct
hpfs_dirent
*
map_dirent
(
struct
inode
*
,
dnode_secno
,
const
unsigned
char
*
,
unsigned
,
dnode_secno
*
,
struct
quad_buffer_head
*
);
void
hpfs_remove_dtree
(
struct
super_block
*
,
dnode_secno
);
void
hpfs_remove_dtree
(
struct
super_block
*
,
dnode_secno
);
struct
hpfs_dirent
*
map_fnode_dirent
(
struct
super_block
*
,
fnode_secno
,
struct
fnode
*
,
struct
quad_buffer_head
*
);
struct
hpfs_dirent
*
map_fnode_dirent
(
struct
super_block
*
,
fnode_secno
,
struct
fnode
*
,
struct
quad_buffer_head
*
);
...
@@ -259,7 +263,8 @@ struct hpfs_dirent *map_fnode_dirent(struct super_block *, fnode_secno, struct f
...
@@ -259,7 +263,8 @@ struct hpfs_dirent *map_fnode_dirent(struct super_block *, fnode_secno, struct f
void
hpfs_ea_ext_remove
(
struct
super_block
*
,
secno
,
int
,
unsigned
);
void
hpfs_ea_ext_remove
(
struct
super_block
*
,
secno
,
int
,
unsigned
);
int
hpfs_read_ea
(
struct
super_block
*
,
struct
fnode
*
,
char
*
,
char
*
,
int
);
int
hpfs_read_ea
(
struct
super_block
*
,
struct
fnode
*
,
char
*
,
char
*
,
int
);
char
*
hpfs_get_ea
(
struct
super_block
*
,
struct
fnode
*
,
char
*
,
int
*
);
char
*
hpfs_get_ea
(
struct
super_block
*
,
struct
fnode
*
,
char
*
,
int
*
);
void
hpfs_set_ea
(
struct
inode
*
,
struct
fnode
*
,
char
*
,
char
*
,
int
);
void
hpfs_set_ea
(
struct
inode
*
,
struct
fnode
*
,
const
char
*
,
const
char
*
,
int
);
/* file.c */
/* file.c */
...
@@ -282,7 +287,7 @@ void hpfs_delete_inode(struct inode *);
...
@@ -282,7 +287,7 @@ void hpfs_delete_inode(struct inode *);
unsigned
*
hpfs_map_dnode_bitmap
(
struct
super_block
*
,
struct
quad_buffer_head
*
);
unsigned
*
hpfs_map_dnode_bitmap
(
struct
super_block
*
,
struct
quad_buffer_head
*
);
unsigned
*
hpfs_map_bitmap
(
struct
super_block
*
,
unsigned
,
struct
quad_buffer_head
*
,
char
*
);
unsigned
*
hpfs_map_bitmap
(
struct
super_block
*
,
unsigned
,
struct
quad_buffer_head
*
,
char
*
);
char
*
hpfs_load_code_page
(
struct
super_block
*
,
secno
);
unsigned
char
*
hpfs_load_code_page
(
struct
super_block
*
,
secno
);
secno
*
hpfs_load_bitmap_directory
(
struct
super_block
*
,
secno
bmp
);
secno
*
hpfs_load_bitmap_directory
(
struct
super_block
*
,
secno
bmp
);
struct
fnode
*
hpfs_map_fnode
(
struct
super_block
*
s
,
ino_t
,
struct
buffer_head
**
);
struct
fnode
*
hpfs_map_fnode
(
struct
super_block
*
s
,
ino_t
,
struct
buffer_head
**
);
struct
anode
*
hpfs_map_anode
(
struct
super_block
*
s
,
anode_secno
,
struct
buffer_head
**
);
struct
anode
*
hpfs_map_anode
(
struct
super_block
*
s
,
anode_secno
,
struct
buffer_head
**
);
...
@@ -292,12 +297,13 @@ dnode_secno hpfs_fnode_dno(struct super_block *s, ino_t ino);
...
@@ -292,12 +297,13 @@ dnode_secno hpfs_fnode_dno(struct super_block *s, ino_t ino);
/* name.c */
/* name.c */
unsigned
char
hpfs_upcase
(
unsigned
char
*
,
unsigned
char
);
unsigned
char
hpfs_upcase
(
unsigned
char
*
,
unsigned
char
);
int
hpfs_chk_name
(
unsigned
char
*
,
unsigned
*
);
int
hpfs_chk_name
(
const
unsigned
char
*
,
unsigned
*
);
char
*
hpfs_translate_name
(
struct
super_block
*
,
unsigned
char
*
,
unsigned
,
int
,
int
);
unsigned
char
*
hpfs_translate_name
(
struct
super_block
*
,
unsigned
char
*
,
unsigned
,
int
,
int
);
int
hpfs_compare_names
(
struct
super_block
*
,
unsigned
char
*
,
unsigned
,
unsigned
char
*
,
unsigned
,
int
);
int
hpfs_compare_names
(
struct
super_block
*
,
const
unsigned
char
*
,
unsigned
,
int
hpfs_is_name_long
(
unsigned
char
*
,
unsigned
);
const
unsigned
char
*
,
unsigned
,
int
);
void
hpfs_adjust_length
(
unsigned
char
*
,
unsigned
*
);
int
hpfs_is_name_long
(
const
unsigned
char
*
,
unsigned
);
void
hpfs_decide_conv
(
struct
inode
*
,
unsigned
char
*
,
unsigned
);
void
hpfs_adjust_length
(
const
unsigned
char
*
,
unsigned
*
);
void
hpfs_decide_conv
(
struct
inode
*
,
const
unsigned
char
*
,
unsigned
);
/* namei.c */
/* namei.c */
...
...
fs/hpfs/inode.c
View file @
7e7742ee
...
@@ -46,7 +46,7 @@ void hpfs_read_inode(struct inode *i)
...
@@ -46,7 +46,7 @@ void hpfs_read_inode(struct inode *i)
struct
fnode
*
fnode
;
struct
fnode
*
fnode
;
struct
super_block
*
sb
=
i
->
i_sb
;
struct
super_block
*
sb
=
i
->
i_sb
;
struct
hpfs_inode_info
*
hpfs_inode
=
hpfs_i
(
i
);
struct
hpfs_inode_info
*
hpfs_inode
=
hpfs_i
(
i
);
unsigned
char
*
ea
;
void
*
ea
;
int
ea_size
;
int
ea_size
;
if
(
!
(
fnode
=
hpfs_map_fnode
(
sb
,
i
->
i_ino
,
&
bh
)))
{
if
(
!
(
fnode
=
hpfs_map_fnode
(
sb
,
i
->
i_ino
,
&
bh
)))
{
...
@@ -112,7 +112,7 @@ void hpfs_read_inode(struct inode *i)
...
@@ -112,7 +112,7 @@ void hpfs_read_inode(struct inode *i)
}
}
}
}
if
(
fnode
->
dirflag
)
{
if
(
fnode
->
dirflag
)
{
unsigned
n_dnodes
,
n_subdirs
;
int
n_dnodes
,
n_subdirs
;
i
->
i_mode
|=
S_IFDIR
;
i
->
i_mode
|=
S_IFDIR
;
i
->
i_op
=
&
hpfs_dir_iops
;
i
->
i_op
=
&
hpfs_dir_iops
;
i
->
i_fop
=
&
hpfs_dir_ops
;
i
->
i_fop
=
&
hpfs_dir_ops
;
...
...
fs/hpfs/map.c
View file @
7e7742ee
...
@@ -35,7 +35,7 @@ unsigned int *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block,
...
@@ -35,7 +35,7 @@ unsigned int *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block,
* lowercasing table
* lowercasing table
*/
*/
char
*
hpfs_load_code_page
(
struct
super_block
*
s
,
secno
cps
)
unsigned
char
*
hpfs_load_code_page
(
struct
super_block
*
s
,
secno
cps
)
{
{
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
secno
cpds
;
secno
cpds
;
...
@@ -71,7 +71,7 @@ char *hpfs_load_code_page(struct super_block *s, secno cps)
...
@@ -71,7 +71,7 @@ char *hpfs_load_code_page(struct super_block *s, secno cps)
brelse
(
bh
);
brelse
(
bh
);
return
NULL
;
return
NULL
;
}
}
ptr
=
(
char
*
)
cpd
+
cpd
->
offs
[
cpi
]
+
6
;
ptr
=
(
unsigned
char
*
)
cpd
+
cpd
->
offs
[
cpi
]
+
6
;
if
(
!
(
cp_table
=
kmalloc
(
256
,
GFP_KERNEL
)))
{
if
(
!
(
cp_table
=
kmalloc
(
256
,
GFP_KERNEL
)))
{
printk
(
"HPFS: out of memory for code page table
\n
"
);
printk
(
"HPFS: out of memory for code page table
\n
"
);
brelse
(
bh
);
brelse
(
bh
);
...
@@ -217,7 +217,7 @@ struct dnode *hpfs_map_dnode(struct super_block *s, unsigned secno,
...
@@ -217,7 +217,7 @@ struct dnode *hpfs_map_dnode(struct super_block *s, unsigned secno,
if
((
dnode
=
hpfs_map_4sectors
(
s
,
secno
,
qbh
,
DNODE_RD_AHEAD
)))
if
((
dnode
=
hpfs_map_4sectors
(
s
,
secno
,
qbh
,
DNODE_RD_AHEAD
)))
if
(
hpfs_sb
(
s
)
->
sb_chk
)
{
if
(
hpfs_sb
(
s
)
->
sb_chk
)
{
unsigned
p
,
pp
=
0
;
unsigned
p
,
pp
=
0
;
unsigned
char
*
d
=
(
char
*
)
dnode
;
unsigned
char
*
d
=
(
unsigned
char
*
)
dnode
;
int
b
=
0
;
int
b
=
0
;
if
(
dnode
->
magic
!=
DNODE_MAGIC
)
{
if
(
dnode
->
magic
!=
DNODE_MAGIC
)
{
hpfs_error
(
s
,
"bad magic on dnode %08x"
,
secno
);
hpfs_error
(
s
,
"bad magic on dnode %08x"
,
secno
);
...
...
fs/hpfs/name.c
View file @
7e7742ee
...
@@ -8,16 +8,16 @@
...
@@ -8,16 +8,16 @@
#include "hpfs_fn.h"
#include "hpfs_fn.h"
static
char
*
text_postfix
[]
=
{
static
c
onst
c
har
*
text_postfix
[]
=
{
".ASM"
,
".BAS"
,
".BAT"
,
".C"
,
".CC"
,
".CFG"
,
".CMD"
,
".CON"
,
".CPP"
,
".DEF"
,
".ASM"
,
".BAS"
,
".BAT"
,
".C"
,
".CC"
,
".CFG"
,
".CMD"
,
".CON"
,
".CPP"
,
".DEF"
,
".DOC"
,
".DPR"
,
".ERX"
,
".H"
,
".HPP"
,
".HTM"
,
".HTML"
,
".JAVA"
,
".LOG"
,
".PAS"
,
".DOC"
,
".DPR"
,
".ERX"
,
".H"
,
".HPP"
,
".HTM"
,
".HTML"
,
".JAVA"
,
".LOG"
,
".PAS"
,
".RC"
,
".TEX"
,
".TXT"
,
".Y"
,
""
};
".RC"
,
".TEX"
,
".TXT"
,
".Y"
,
""
};
static
char
*
text_prefix
[]
=
{
static
c
onst
c
har
*
text_prefix
[]
=
{
"AUTOEXEC."
,
"CHANGES"
,
"COPYING"
,
"CONFIG."
,
"CREDITS"
,
"FAQ"
,
"FILE_ID.DIZ"
,
"AUTOEXEC."
,
"CHANGES"
,
"COPYING"
,
"CONFIG."
,
"CREDITS"
,
"FAQ"
,
"FILE_ID.DIZ"
,
"MAKEFILE"
,
"READ.ME"
,
"README"
,
"TERMCAP"
,
""
};
"MAKEFILE"
,
"READ.ME"
,
"README"
,
"TERMCAP"
,
""
};
void
hpfs_decide_conv
(
struct
inode
*
inode
,
unsigned
char
*
name
,
unsigned
len
)
void
hpfs_decide_conv
(
struct
inode
*
inode
,
const
unsigned
char
*
name
,
unsigned
len
)
{
{
struct
hpfs_inode_info
*
hpfs_inode
=
hpfs_i
(
inode
);
struct
hpfs_inode_info
*
hpfs_inode
=
hpfs_i
(
inode
);
int
i
;
int
i
;
...
@@ -71,7 +71,7 @@ static inline unsigned char locase(unsigned char *dir, unsigned char a)
...
@@ -71,7 +71,7 @@ static inline unsigned char locase(unsigned char *dir, unsigned char a)
return
dir
[
a
];
return
dir
[
a
];
}
}
int
hpfs_chk_name
(
unsigned
char
*
name
,
unsigned
*
len
)
int
hpfs_chk_name
(
const
unsigned
char
*
name
,
unsigned
*
len
)
{
{
int
i
;
int
i
;
if
(
*
len
>
254
)
return
-
ENAMETOOLONG
;
if
(
*
len
>
254
)
return
-
ENAMETOOLONG
;
...
@@ -83,10 +83,10 @@ int hpfs_chk_name(unsigned char *name, unsigned *len)
...
@@ -83,10 +83,10 @@ int hpfs_chk_name(unsigned char *name, unsigned *len)
return
0
;
return
0
;
}
}
char
*
hpfs_translate_name
(
struct
super_block
*
s
,
unsigned
char
*
from
,
unsigned
char
*
hpfs_translate_name
(
struct
super_block
*
s
,
unsigned
char
*
from
,
unsigned
len
,
int
lc
,
int
lng
)
unsigned
len
,
int
lc
,
int
lng
)
{
{
char
*
to
;
unsigned
char
*
to
;
int
i
;
int
i
;
if
(
hpfs_sb
(
s
)
->
sb_chk
>=
2
)
if
(
hpfs_is_name_long
(
from
,
len
)
!=
lng
)
{
if
(
hpfs_sb
(
s
)
->
sb_chk
>=
2
)
if
(
hpfs_is_name_long
(
from
,
len
)
!=
lng
)
{
printk
(
"HPFS: Long name flag mismatch - name "
);
printk
(
"HPFS: Long name flag mismatch - name "
);
...
@@ -103,8 +103,9 @@ char *hpfs_translate_name(struct super_block *s, unsigned char *from,
...
@@ -103,8 +103,9 @@ char *hpfs_translate_name(struct super_block *s, unsigned char *from,
return
to
;
return
to
;
}
}
int
hpfs_compare_names
(
struct
super_block
*
s
,
unsigned
char
*
n1
,
unsigned
l1
,
int
hpfs_compare_names
(
struct
super_block
*
s
,
unsigned
char
*
n2
,
unsigned
l2
,
int
last
)
const
unsigned
char
*
n1
,
unsigned
l1
,
const
unsigned
char
*
n2
,
unsigned
l2
,
int
last
)
{
{
unsigned
l
=
l1
<
l2
?
l1
:
l2
;
unsigned
l
=
l1
<
l2
?
l1
:
l2
;
unsigned
i
;
unsigned
i
;
...
@@ -120,7 +121,7 @@ int hpfs_compare_names(struct super_block *s, unsigned char *n1, unsigned l1,
...
@@ -120,7 +121,7 @@ int hpfs_compare_names(struct super_block *s, unsigned char *n1, unsigned l1,
return
0
;
return
0
;
}
}
int
hpfs_is_name_long
(
unsigned
char
*
name
,
unsigned
len
)
int
hpfs_is_name_long
(
const
unsigned
char
*
name
,
unsigned
len
)
{
{
int
i
,
j
;
int
i
,
j
;
for
(
i
=
0
;
i
<
len
&&
name
[
i
]
!=
'.'
;
i
++
)
for
(
i
=
0
;
i
<
len
&&
name
[
i
]
!=
'.'
;
i
++
)
...
@@ -134,7 +135,7 @@ int hpfs_is_name_long(unsigned char *name, unsigned len)
...
@@ -134,7 +135,7 @@ int hpfs_is_name_long(unsigned char *name, unsigned len)
/* OS/2 clears dots and spaces at the end of file name, so we have to */
/* OS/2 clears dots and spaces at the end of file name, so we have to */
void
hpfs_adjust_length
(
unsigned
char
*
name
,
unsigned
*
len
)
void
hpfs_adjust_length
(
const
unsigned
char
*
name
,
unsigned
*
len
)
{
{
if
(
!*
len
)
return
;
if
(
!*
len
)
return
;
if
(
*
len
==
1
&&
name
[
0
]
==
'.'
)
return
;
if
(
*
len
==
1
&&
name
[
0
]
==
'.'
)
return
;
...
...
fs/hpfs/namei.c
View file @
7e7742ee
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
static
int
hpfs_mkdir
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
int
mode
)
static
int
hpfs_mkdir
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
int
mode
)
{
{
const
char
*
name
=
dentry
->
d_name
.
name
;
const
unsigned
char
*
name
=
dentry
->
d_name
.
name
;
unsigned
len
=
dentry
->
d_name
.
len
;
unsigned
len
=
dentry
->
d_name
.
len
;
struct
quad_buffer_head
qbh0
;
struct
quad_buffer_head
qbh0
;
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
...
@@ -24,7 +24,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
...
@@ -24,7 +24,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
int
r
;
int
r
;
struct
hpfs_dirent
dee
;
struct
hpfs_dirent
dee
;
int
err
;
int
err
;
if
((
err
=
hpfs_chk_name
(
(
char
*
)
name
,
&
len
)))
return
err
==-
ENOENT
?
-
EINVAL
:
err
;
if
((
err
=
hpfs_chk_name
(
name
,
&
len
)))
return
err
==-
ENOENT
?
-
EINVAL
:
err
;
lock_kernel
();
lock_kernel
();
err
=
-
ENOSPC
;
err
=
-
ENOSPC
;
fnode
=
hpfs_alloc_fnode
(
dir
->
i_sb
,
hpfs_i
(
dir
)
->
i_dno
,
&
fno
,
&
bh
);
fnode
=
hpfs_alloc_fnode
(
dir
->
i_sb
,
hpfs_i
(
dir
)
->
i_dno
,
&
fno
,
&
bh
);
...
@@ -62,7 +62,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
...
@@ -62,7 +62,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
result
->
i_mode
&=
~
0222
;
result
->
i_mode
&=
~
0222
;
mutex_lock
(
&
hpfs_i
(
dir
)
->
i_mutex
);
mutex_lock
(
&
hpfs_i
(
dir
)
->
i_mutex
);
r
=
hpfs_add_dirent
(
dir
,
(
char
*
)
name
,
len
,
&
dee
,
0
);
r
=
hpfs_add_dirent
(
dir
,
name
,
len
,
&
dee
,
0
);
if
(
r
==
1
)
if
(
r
==
1
)
goto
bail3
;
goto
bail3
;
if
(
r
==
-
1
)
{
if
(
r
==
-
1
)
{
...
@@ -121,7 +121,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
...
@@ -121,7 +121,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
static
int
hpfs_create
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
int
mode
,
struct
nameidata
*
nd
)
static
int
hpfs_create
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
int
mode
,
struct
nameidata
*
nd
)
{
{
const
char
*
name
=
dentry
->
d_name
.
name
;
const
unsigned
char
*
name
=
dentry
->
d_name
.
name
;
unsigned
len
=
dentry
->
d_name
.
len
;
unsigned
len
=
dentry
->
d_name
.
len
;
struct
inode
*
result
=
NULL
;
struct
inode
*
result
=
NULL
;
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
...
@@ -130,7 +130,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc
...
@@ -130,7 +130,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc
int
r
;
int
r
;
struct
hpfs_dirent
dee
;
struct
hpfs_dirent
dee
;
int
err
;
int
err
;
if
((
err
=
hpfs_chk_name
(
(
char
*
)
name
,
&
len
)))
if
((
err
=
hpfs_chk_name
(
name
,
&
len
)))
return
err
==-
ENOENT
?
-
EINVAL
:
err
;
return
err
==-
ENOENT
?
-
EINVAL
:
err
;
lock_kernel
();
lock_kernel
();
err
=
-
ENOSPC
;
err
=
-
ENOSPC
;
...
@@ -155,7 +155,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc
...
@@ -155,7 +155,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc
result
->
i_op
=
&
hpfs_file_iops
;
result
->
i_op
=
&
hpfs_file_iops
;
result
->
i_fop
=
&
hpfs_file_ops
;
result
->
i_fop
=
&
hpfs_file_ops
;
result
->
i_nlink
=
1
;
result
->
i_nlink
=
1
;
hpfs_decide_conv
(
result
,
(
char
*
)
name
,
len
);
hpfs_decide_conv
(
result
,
name
,
len
);
hpfs_i
(
result
)
->
i_parent_dir
=
dir
->
i_ino
;
hpfs_i
(
result
)
->
i_parent_dir
=
dir
->
i_ino
;
result
->
i_ctime
.
tv_sec
=
result
->
i_mtime
.
tv_sec
=
result
->
i_atime
.
tv_sec
=
local_to_gmt
(
dir
->
i_sb
,
dee
.
creation_date
);
result
->
i_ctime
.
tv_sec
=
result
->
i_mtime
.
tv_sec
=
result
->
i_atime
.
tv_sec
=
local_to_gmt
(
dir
->
i_sb
,
dee
.
creation_date
);
result
->
i_ctime
.
tv_nsec
=
0
;
result
->
i_ctime
.
tv_nsec
=
0
;
...
@@ -170,7 +170,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc
...
@@ -170,7 +170,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc
hpfs_i
(
result
)
->
mmu_private
=
0
;
hpfs_i
(
result
)
->
mmu_private
=
0
;
mutex_lock
(
&
hpfs_i
(
dir
)
->
i_mutex
);
mutex_lock
(
&
hpfs_i
(
dir
)
->
i_mutex
);
r
=
hpfs_add_dirent
(
dir
,
(
char
*
)
name
,
len
,
&
dee
,
0
);
r
=
hpfs_add_dirent
(
dir
,
name
,
len
,
&
dee
,
0
);
if
(
r
==
1
)
if
(
r
==
1
)
goto
bail2
;
goto
bail2
;
if
(
r
==
-
1
)
{
if
(
r
==
-
1
)
{
...
@@ -211,7 +211,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc
...
@@ -211,7 +211,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc
static
int
hpfs_mknod
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
int
mode
,
dev_t
rdev
)
static
int
hpfs_mknod
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
int
mode
,
dev_t
rdev
)
{
{
const
char
*
name
=
dentry
->
d_name
.
name
;
const
unsigned
char
*
name
=
dentry
->
d_name
.
name
;
unsigned
len
=
dentry
->
d_name
.
len
;
unsigned
len
=
dentry
->
d_name
.
len
;
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
struct
fnode
*
fnode
;
struct
fnode
*
fnode
;
...
@@ -220,7 +220,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t
...
@@ -220,7 +220,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t
struct
hpfs_dirent
dee
;
struct
hpfs_dirent
dee
;
struct
inode
*
result
=
NULL
;
struct
inode
*
result
=
NULL
;
int
err
;
int
err
;
if
((
err
=
hpfs_chk_name
(
(
char
*
)
name
,
&
len
)))
return
err
==-
ENOENT
?
-
EINVAL
:
err
;
if
((
err
=
hpfs_chk_name
(
name
,
&
len
)))
return
err
==-
ENOENT
?
-
EINVAL
:
err
;
if
(
hpfs_sb
(
dir
->
i_sb
)
->
sb_eas
<
2
)
return
-
EPERM
;
if
(
hpfs_sb
(
dir
->
i_sb
)
->
sb_eas
<
2
)
return
-
EPERM
;
if
(
!
new_valid_dev
(
rdev
))
if
(
!
new_valid_dev
(
rdev
))
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -256,7 +256,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t
...
@@ -256,7 +256,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t
init_special_inode
(
result
,
mode
,
rdev
);
init_special_inode
(
result
,
mode
,
rdev
);
mutex_lock
(
&
hpfs_i
(
dir
)
->
i_mutex
);
mutex_lock
(
&
hpfs_i
(
dir
)
->
i_mutex
);
r
=
hpfs_add_dirent
(
dir
,
(
char
*
)
name
,
len
,
&
dee
,
0
);
r
=
hpfs_add_dirent
(
dir
,
name
,
len
,
&
dee
,
0
);
if
(
r
==
1
)
if
(
r
==
1
)
goto
bail2
;
goto
bail2
;
if
(
r
==
-
1
)
{
if
(
r
==
-
1
)
{
...
@@ -289,7 +289,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t
...
@@ -289,7 +289,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t
static
int
hpfs_symlink
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
const
char
*
symlink
)
static
int
hpfs_symlink
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
const
char
*
symlink
)
{
{
const
char
*
name
=
dentry
->
d_name
.
name
;
const
unsigned
char
*
name
=
dentry
->
d_name
.
name
;
unsigned
len
=
dentry
->
d_name
.
len
;
unsigned
len
=
dentry
->
d_name
.
len
;
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
struct
fnode
*
fnode
;
struct
fnode
*
fnode
;
...
@@ -298,7 +298,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
...
@@ -298,7 +298,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
struct
hpfs_dirent
dee
;
struct
hpfs_dirent
dee
;
struct
inode
*
result
;
struct
inode
*
result
;
int
err
;
int
err
;
if
((
err
=
hpfs_chk_name
(
(
char
*
)
name
,
&
len
)))
return
err
==-
ENOENT
?
-
EINVAL
:
err
;
if
((
err
=
hpfs_chk_name
(
name
,
&
len
)))
return
err
==-
ENOENT
?
-
EINVAL
:
err
;
lock_kernel
();
lock_kernel
();
if
(
hpfs_sb
(
dir
->
i_sb
)
->
sb_eas
<
2
)
{
if
(
hpfs_sb
(
dir
->
i_sb
)
->
sb_eas
<
2
)
{
unlock_kernel
();
unlock_kernel
();
...
@@ -335,7 +335,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
...
@@ -335,7 +335,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
result
->
i_data
.
a_ops
=
&
hpfs_symlink_aops
;
result
->
i_data
.
a_ops
=
&
hpfs_symlink_aops
;
mutex_lock
(
&
hpfs_i
(
dir
)
->
i_mutex
);
mutex_lock
(
&
hpfs_i
(
dir
)
->
i_mutex
);
r
=
hpfs_add_dirent
(
dir
,
(
char
*
)
name
,
len
,
&
dee
,
0
);
r
=
hpfs_add_dirent
(
dir
,
name
,
len
,
&
dee
,
0
);
if
(
r
==
1
)
if
(
r
==
1
)
goto
bail2
;
goto
bail2
;
if
(
r
==
-
1
)
{
if
(
r
==
-
1
)
{
...
@@ -345,7 +345,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
...
@@ -345,7 +345,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
fnode
->
len
=
len
;
fnode
->
len
=
len
;
memcpy
(
fnode
->
name
,
name
,
len
>
15
?
15
:
len
);
memcpy
(
fnode
->
name
,
name
,
len
>
15
?
15
:
len
);
fnode
->
up
=
dir
->
i_ino
;
fnode
->
up
=
dir
->
i_ino
;
hpfs_set_ea
(
result
,
fnode
,
"SYMLINK"
,
(
char
*
)
symlink
,
strlen
(
symlink
));
hpfs_set_ea
(
result
,
fnode
,
"SYMLINK"
,
symlink
,
strlen
(
symlink
));
mark_buffer_dirty
(
bh
);
mark_buffer_dirty
(
bh
);
brelse
(
bh
);
brelse
(
bh
);
...
@@ -369,7 +369,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
...
@@ -369,7 +369,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
static
int
hpfs_unlink
(
struct
inode
*
dir
,
struct
dentry
*
dentry
)
static
int
hpfs_unlink
(
struct
inode
*
dir
,
struct
dentry
*
dentry
)
{
{
const
char
*
name
=
dentry
->
d_name
.
name
;
const
unsigned
char
*
name
=
dentry
->
d_name
.
name
;
unsigned
len
=
dentry
->
d_name
.
len
;
unsigned
len
=
dentry
->
d_name
.
len
;
struct
quad_buffer_head
qbh
;
struct
quad_buffer_head
qbh
;
struct
hpfs_dirent
*
de
;
struct
hpfs_dirent
*
de
;
...
@@ -381,12 +381,12 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry)
...
@@ -381,12 +381,12 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry)
int
err
;
int
err
;
lock_kernel
();
lock_kernel
();
hpfs_adjust_length
(
(
char
*
)
name
,
&
len
);
hpfs_adjust_length
(
name
,
&
len
);
again:
again:
mutex_lock
(
&
hpfs_i
(
inode
)
->
i_parent_mutex
);
mutex_lock
(
&
hpfs_i
(
inode
)
->
i_parent_mutex
);
mutex_lock
(
&
hpfs_i
(
dir
)
->
i_mutex
);
mutex_lock
(
&
hpfs_i
(
dir
)
->
i_mutex
);
err
=
-
ENOENT
;
err
=
-
ENOENT
;
de
=
map_dirent
(
dir
,
hpfs_i
(
dir
)
->
i_dno
,
(
char
*
)
name
,
len
,
&
dno
,
&
qbh
);
de
=
map_dirent
(
dir
,
hpfs_i
(
dir
)
->
i_dno
,
name
,
len
,
&
dno
,
&
qbh
);
if
(
!
de
)
if
(
!
de
)
goto
out
;
goto
out
;
...
@@ -451,7 +451,7 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry)
...
@@ -451,7 +451,7 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry)
static
int
hpfs_rmdir
(
struct
inode
*
dir
,
struct
dentry
*
dentry
)
static
int
hpfs_rmdir
(
struct
inode
*
dir
,
struct
dentry
*
dentry
)
{
{
const
char
*
name
=
dentry
->
d_name
.
name
;
const
unsigned
char
*
name
=
dentry
->
d_name
.
name
;
unsigned
len
=
dentry
->
d_name
.
len
;
unsigned
len
=
dentry
->
d_name
.
len
;
struct
quad_buffer_head
qbh
;
struct
quad_buffer_head
qbh
;
struct
hpfs_dirent
*
de
;
struct
hpfs_dirent
*
de
;
...
@@ -462,12 +462,12 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
...
@@ -462,12 +462,12 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
int
err
;
int
err
;
int
r
;
int
r
;
hpfs_adjust_length
(
(
char
*
)
name
,
&
len
);
hpfs_adjust_length
(
name
,
&
len
);
lock_kernel
();
lock_kernel
();
mutex_lock
(
&
hpfs_i
(
inode
)
->
i_parent_mutex
);
mutex_lock
(
&
hpfs_i
(
inode
)
->
i_parent_mutex
);
mutex_lock
(
&
hpfs_i
(
dir
)
->
i_mutex
);
mutex_lock
(
&
hpfs_i
(
dir
)
->
i_mutex
);
err
=
-
ENOENT
;
err
=
-
ENOENT
;
de
=
map_dirent
(
dir
,
hpfs_i
(
dir
)
->
i_dno
,
(
char
*
)
name
,
len
,
&
dno
,
&
qbh
);
de
=
map_dirent
(
dir
,
hpfs_i
(
dir
)
->
i_dno
,
name
,
len
,
&
dno
,
&
qbh
);
if
(
!
de
)
if
(
!
de
)
goto
out
;
goto
out
;
...
@@ -546,10 +546,10 @@ const struct address_space_operations hpfs_symlink_aops = {
...
@@ -546,10 +546,10 @@ const struct address_space_operations hpfs_symlink_aops = {
static
int
hpfs_rename
(
struct
inode
*
old_dir
,
struct
dentry
*
old_dentry
,
static
int
hpfs_rename
(
struct
inode
*
old_dir
,
struct
dentry
*
old_dentry
,
struct
inode
*
new_dir
,
struct
dentry
*
new_dentry
)
struct
inode
*
new_dir
,
struct
dentry
*
new_dentry
)
{
{
c
har
*
old_name
=
(
char
*
)
old_dentry
->
d_name
.
name
;
c
onst
unsigned
char
*
old_name
=
old_dentry
->
d_name
.
name
;
int
old_len
=
old_dentry
->
d_name
.
len
;
unsigned
old_len
=
old_dentry
->
d_name
.
len
;
c
har
*
new_name
=
(
char
*
)
new_dentry
->
d_name
.
name
;
c
onst
unsigned
char
*
new_name
=
new_dentry
->
d_name
.
name
;
int
new_len
=
new_dentry
->
d_name
.
len
;
unsigned
new_len
=
new_dentry
->
d_name
.
len
;
struct
inode
*
i
=
old_dentry
->
d_inode
;
struct
inode
*
i
=
old_dentry
->
d_inode
;
struct
inode
*
new_inode
=
new_dentry
->
d_inode
;
struct
inode
*
new_inode
=
new_dentry
->
d_inode
;
struct
quad_buffer_head
qbh
,
qbh1
;
struct
quad_buffer_head
qbh
,
qbh1
;
...
@@ -560,9 +560,9 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
...
@@ -560,9 +560,9 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
struct
fnode
*
fnode
;
struct
fnode
*
fnode
;
int
err
;
int
err
;
if
((
err
=
hpfs_chk_name
(
(
char
*
)
new_name
,
&
new_len
)))
return
err
;
if
((
err
=
hpfs_chk_name
(
new_name
,
&
new_len
)))
return
err
;
err
=
0
;
err
=
0
;
hpfs_adjust_length
(
(
char
*
)
old_name
,
&
old_len
);
hpfs_adjust_length
(
old_name
,
&
old_len
);
lock_kernel
();
lock_kernel
();
/* order doesn't matter, due to VFS exclusion */
/* order doesn't matter, due to VFS exclusion */
...
@@ -579,7 +579,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
...
@@ -579,7 +579,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
goto
end1
;
goto
end1
;
}
}
if
(
!
(
dep
=
map_dirent
(
old_dir
,
hpfs_i
(
old_dir
)
->
i_dno
,
(
char
*
)
old_name
,
old_len
,
&
dno
,
&
qbh
)))
{
if
(
!
(
dep
=
map_dirent
(
old_dir
,
hpfs_i
(
old_dir
)
->
i_dno
,
old_name
,
old_len
,
&
dno
,
&
qbh
)))
{
hpfs_error
(
i
->
i_sb
,
"lookup succeeded but map dirent failed"
);
hpfs_error
(
i
->
i_sb
,
"lookup succeeded but map dirent failed"
);
err
=
-
ENOENT
;
err
=
-
ENOENT
;
goto
end1
;
goto
end1
;
...
@@ -590,7 +590,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
...
@@ -590,7 +590,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
if
(
new_inode
)
{
if
(
new_inode
)
{
int
r
;
int
r
;
if
((
r
=
hpfs_remove_dirent
(
old_dir
,
dno
,
dep
,
&
qbh
,
1
))
!=
2
)
{
if
((
r
=
hpfs_remove_dirent
(
old_dir
,
dno
,
dep
,
&
qbh
,
1
))
!=
2
)
{
if
((
nde
=
map_dirent
(
new_dir
,
hpfs_i
(
new_dir
)
->
i_dno
,
(
char
*
)
new_name
,
new_len
,
NULL
,
&
qbh1
)))
{
if
((
nde
=
map_dirent
(
new_dir
,
hpfs_i
(
new_dir
)
->
i_dno
,
new_name
,
new_len
,
NULL
,
&
qbh1
)))
{
clear_nlink
(
new_inode
);
clear_nlink
(
new_inode
);
copy_de
(
nde
,
&
de
);
copy_de
(
nde
,
&
de
);
memcpy
(
nde
->
name
,
new_name
,
new_len
);
memcpy
(
nde
->
name
,
new_name
,
new_len
);
...
@@ -618,7 +618,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
...
@@ -618,7 +618,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
}
}
if
(
new_dir
==
old_dir
)
if
(
new_dir
==
old_dir
)
if
(
!
(
dep
=
map_dirent
(
old_dir
,
hpfs_i
(
old_dir
)
->
i_dno
,
(
char
*
)
old_name
,
old_len
,
&
dno
,
&
qbh
)))
{
if
(
!
(
dep
=
map_dirent
(
old_dir
,
hpfs_i
(
old_dir
)
->
i_dno
,
old_name
,
old_len
,
&
dno
,
&
qbh
)))
{
hpfs_unlock_creation
(
i
->
i_sb
);
hpfs_unlock_creation
(
i
->
i_sb
);
hpfs_error
(
i
->
i_sb
,
"lookup succeeded but map dirent failed at #2"
);
hpfs_error
(
i
->
i_sb
,
"lookup succeeded but map dirent failed at #2"
);
err
=
-
ENOENT
;
err
=
-
ENOENT
;
...
@@ -648,7 +648,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
...
@@ -648,7 +648,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
brelse
(
bh
);
brelse
(
bh
);
}
}
hpfs_i
(
i
)
->
i_conv
=
hpfs_sb
(
i
->
i_sb
)
->
sb_conv
;
hpfs_i
(
i
)
->
i_conv
=
hpfs_sb
(
i
->
i_sb
)
->
sb_conv
;
hpfs_decide_conv
(
i
,
(
char
*
)
new_name
,
new_len
);
hpfs_decide_conv
(
i
,
new_name
,
new_len
);
end1:
end1:
if
(
old_dir
!=
new_dir
)
if
(
old_dir
!=
new_dir
)
mutex_unlock
(
&
hpfs_i
(
new_dir
)
->
i_mutex
);
mutex_unlock
(
&
hpfs_i
(
new_dir
)
->
i_mutex
);
...
...
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