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
568f8f5e
Commit
568f8f5e
authored
May 18, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[readdir] convert hpfs
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
cd62cdae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
27 deletions
+29
-27
fs/hpfs/dir.c
fs/hpfs/dir.c
+29
-27
No files found.
fs/hpfs/dir.c
View file @
568f8f5e
...
...
@@ -57,14 +57,14 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
return
-
ESPIPE
;
}
static
int
hpfs_readdir
(
struct
file
*
fil
p
,
void
*
dirent
,
filldir_t
filldir
)
static
int
hpfs_readdir
(
struct
file
*
fil
e
,
struct
dir_context
*
ctx
)
{
struct
inode
*
inode
=
file_inode
(
fil
p
);
struct
inode
*
inode
=
file_inode
(
fil
e
);
struct
hpfs_inode_info
*
hpfs_inode
=
hpfs_i
(
inode
);
struct
quad_buffer_head
qbh
;
struct
hpfs_dirent
*
de
;
int
lc
;
lo
ng
old
_pos
;
lo
ff_t
next
_pos
;
unsigned
char
*
tempname
;
int
c1
,
c2
=
0
;
int
ret
=
0
;
...
...
@@ -105,11 +105,11 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
}
}
lc
=
hpfs_sb
(
inode
->
i_sb
)
->
sb_lowercase
;
if
(
filp
->
f_
pos
==
12
)
{
/* diff -r requires this (note, that diff -r */
filp
->
f_
pos
=
13
;
/* also fails on msdos filesystem in 2.0) */
if
(
ctx
->
pos
==
12
)
{
/* diff -r requires this (note, that diff -r */
ctx
->
pos
=
13
;
/* also fails on msdos filesystem in 2.0) */
goto
out
;
}
if
(
filp
->
f_
pos
==
13
)
{
if
(
ctx
->
pos
==
13
)
{
ret
=
-
ENOENT
;
goto
out
;
}
...
...
@@ -120,33 +120,34 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
accepted by filldir, but what can I do?
maybe killall -9 ls helps */
if
(
hpfs_sb
(
inode
->
i_sb
)
->
sb_chk
)
if
(
hpfs_stop_cycles
(
inode
->
i_sb
,
filp
->
f_
pos
,
&
c1
,
&
c2
,
"hpfs_readdir"
))
{
if
(
hpfs_stop_cycles
(
inode
->
i_sb
,
ctx
->
pos
,
&
c1
,
&
c2
,
"hpfs_readdir"
))
{
ret
=
-
EFSERROR
;
goto
out
;
}
if
(
filp
->
f_
pos
==
12
)
if
(
ctx
->
pos
==
12
)
goto
out
;
if
(
filp
->
f_pos
==
3
||
filp
->
f_pos
==
4
||
filp
->
f_
pos
==
5
)
{
printk
(
"HPFS: warning: pos==%d
\n
"
,(
int
)
filp
->
f_
pos
);
if
(
ctx
->
pos
==
3
||
ctx
->
pos
==
4
||
ctx
->
pos
==
5
)
{
printk
(
"HPFS: warning: pos==%d
\n
"
,(
int
)
ctx
->
pos
);
goto
out
;
}
if
(
filp
->
f_
pos
==
0
)
{
if
(
filldir
(
dirent
,
"."
,
1
,
filp
->
f_pos
,
inode
->
i_ino
,
DT_DIR
)
<
0
)
if
(
ctx
->
pos
==
0
)
{
if
(
!
dir_emit_dot
(
file
,
ctx
)
)
goto
out
;
filp
->
f_
pos
=
11
;
ctx
->
pos
=
11
;
}
if
(
filp
->
f_
pos
==
11
)
{
if
(
filldir
(
dirent
,
".."
,
2
,
filp
->
f_pos
,
hpfs_inode
->
i_parent_dir
,
DT_DIR
)
<
0
)
if
(
ctx
->
pos
==
11
)
{
if
(
!
dir_emit
(
ctx
,
".."
,
2
,
hpfs_inode
->
i_parent_dir
,
DT_DIR
)
)
goto
out
;
filp
->
f_
pos
=
1
;
ctx
->
pos
=
1
;
}
if
(
filp
->
f_
pos
==
1
)
{
filp
->
f_
pos
=
((
loff_t
)
hpfs_de_as_down_as_possible
(
inode
->
i_sb
,
hpfs_inode
->
i_dno
)
<<
4
)
+
1
;
hpfs_add_pos
(
inode
,
&
fil
p
->
f_pos
);
fil
p
->
f_version
=
inode
->
i_version
;
if
(
ctx
->
pos
==
1
)
{
ctx
->
pos
=
((
loff_t
)
hpfs_de_as_down_as_possible
(
inode
->
i_sb
,
hpfs_inode
->
i_dno
)
<<
4
)
+
1
;
hpfs_add_pos
(
inode
,
&
fil
e
->
f_pos
);
fil
e
->
f_version
=
inode
->
i_version
;
}
old_pos
=
filp
->
f_pos
;
if
(
!
(
de
=
map_pos_dirent
(
inode
,
&
filp
->
f_pos
,
&
qbh
)))
{
next_pos
=
ctx
->
pos
;
if
(
!
(
de
=
map_pos_dirent
(
inode
,
&
next_pos
,
&
qbh
)))
{
ctx
->
pos
=
next_pos
;
ret
=
-
EIOERROR
;
goto
out
;
}
...
...
@@ -154,20 +155,21 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
hpfs_sb
(
inode
->
i_sb
)
->
sb_chk
)
{
if
(
de
->
first
&&
!
de
->
last
&&
(
de
->
namelen
!=
2
||
de
->
name
[
0
]
!=
1
||
de
->
name
[
1
]
!=
1
))
hpfs_error
(
inode
->
i_sb
,
"hpfs_readdir: bad ^A^A entry; pos = %08lx"
,
old_
pos
);
hpfs_error
(
inode
->
i_sb
,
"hpfs_readdir: bad ^A^A entry; pos = %08lx"
,
(
unsigned
long
)
ctx
->
pos
);
if
(
de
->
last
&&
(
de
->
namelen
!=
1
||
de
->
name
[
0
]
!=
255
))
hpfs_error
(
inode
->
i_sb
,
"hpfs_readdir: bad
\\
377 entry; pos = %08lx"
,
old_
pos
);
hpfs_error
(
inode
->
i_sb
,
"hpfs_readdir: bad
\\
377 entry; pos = %08lx"
,
(
unsigned
long
)
ctx
->
pos
);
}
hpfs_brelse4
(
&
qbh
);
ctx
->
pos
=
next_pos
;
goto
again
;
}
tempname
=
hpfs_translate_name
(
inode
->
i_sb
,
de
->
name
,
de
->
namelen
,
lc
,
de
->
not_8x3
);
if
(
filldir
(
dirent
,
tempname
,
de
->
namelen
,
old_pos
,
le32_to_cpu
(
de
->
fnode
),
DT_UNKNOWN
)
<
0
)
{
filp
->
f_pos
=
old_pos
;
if
(
!
dir_emit
(
ctx
,
tempname
,
de
->
namelen
,
le32_to_cpu
(
de
->
fnode
),
DT_UNKNOWN
))
{
if
(
tempname
!=
de
->
name
)
kfree
(
tempname
);
hpfs_brelse4
(
&
qbh
);
goto
out
;
}
ctx
->
pos
=
next_pos
;
if
(
tempname
!=
de
->
name
)
kfree
(
tempname
);
hpfs_brelse4
(
&
qbh
);
}
...
...
@@ -322,7 +324,7 @@ const struct file_operations hpfs_dir_ops =
{
.
llseek
=
hpfs_dir_lseek
,
.
read
=
generic_read_dir
,
.
readdir
=
hpfs_readdir
,
.
iterate
=
hpfs_readdir
,
.
release
=
hpfs_dir_release
,
.
fsync
=
hpfs_file_fsync
,
};
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