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
0312fa7c
Commit
0312fa7c
authored
May 17, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[readdir] convert jffs2
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
6f7f231e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
36 deletions
+16
-36
fs/jffs2/dir.c
fs/jffs2/dir.c
+16
-36
No files found.
fs/jffs2/dir.c
View file @
0312fa7c
...
...
@@ -22,7 +22,7 @@
#include <linux/time.h>
#include "nodelist.h"
static
int
jffs2_readdir
(
struct
file
*
,
void
*
,
filldir_t
);
static
int
jffs2_readdir
(
struct
file
*
,
struct
dir_context
*
);
static
int
jffs2_create
(
struct
inode
*
,
struct
dentry
*
,
umode_t
,
bool
);
...
...
@@ -40,7 +40,7 @@ static int jffs2_rename (struct inode *, struct dentry *,
const
struct
file_operations
jffs2_dir_operations
=
{
.
read
=
generic_read_dir
,
.
readdir
=
jffs2_readdir
,
.
iterate
=
jffs2_readdir
,
.
unlocked_ioctl
=
jffs2_ioctl
,
.
fsync
=
jffs2_fsync
,
.
llseek
=
generic_file_llseek
,
...
...
@@ -114,60 +114,40 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target,
/***********************************************************************/
static
int
jffs2_readdir
(
struct
file
*
fil
p
,
void
*
dirent
,
filldir_t
filldir
)
static
int
jffs2_readdir
(
struct
file
*
fil
e
,
struct
dir_context
*
ctx
)
{
struct
jffs2_inode_info
*
f
;
struct
inode
*
inode
=
file_inode
(
filp
);
struct
inode
*
inode
=
file_inode
(
file
)
;
struct
jffs2_inode_info
*
f
=
JFFS2_INODE_INFO
(
inode
);
struct
jffs2_full_dirent
*
fd
;
unsigned
long
offset
,
curofs
;
unsigned
long
curofs
=
1
;
jffs2_dbg
(
1
,
"jffs2_readdir() for dir_i #%lu
\n
"
,
file_inode
(
filp
)
->
i_ino
);
jffs2_dbg
(
1
,
"jffs2_readdir() for dir_i #%lu
\n
"
,
inode
->
i_ino
);
f
=
JFFS2_INODE_INFO
(
inode
);
offset
=
filp
->
f_pos
;
if
(
offset
==
0
)
{
jffs2_dbg
(
1
,
"Dirent 0:
\"
.
\"
, ino #%lu
\n
"
,
inode
->
i_ino
);
if
(
filldir
(
dirent
,
"."
,
1
,
0
,
inode
->
i_ino
,
DT_DIR
)
<
0
)
goto
out
;
offset
++
;
}
if
(
offset
==
1
)
{
unsigned
long
pino
=
parent_ino
(
filp
->
f_path
.
dentry
);
jffs2_dbg
(
1
,
"Dirent 1:
\"
..
\"
, ino #%lu
\n
"
,
pino
);
if
(
filldir
(
dirent
,
".."
,
2
,
1
,
pino
,
DT_DIR
)
<
0
)
goto
out
;
offset
++
;
}
if
(
!
dir_emit_dots
(
file
,
ctx
))
return
0
;
curofs
=
1
;
mutex_lock
(
&
f
->
sem
);
for
(
fd
=
f
->
dents
;
fd
;
fd
=
fd
->
next
)
{
curofs
++
;
/* First loop: curofs = 2;
offset
= 2 */
if
(
curofs
<
offset
)
{
/* First loop: curofs = 2;
pos
= 2 */
if
(
curofs
<
ctx
->
pos
)
{
jffs2_dbg
(
2
,
"Skipping dirent:
\"
%s
\"
, ino #%u, type %d, because curofs %ld < offset %ld
\n
"
,
fd
->
name
,
fd
->
ino
,
fd
->
type
,
curofs
,
offset
);
fd
->
name
,
fd
->
ino
,
fd
->
type
,
curofs
,
(
unsigned
long
)
ctx
->
pos
);
continue
;
}
if
(
!
fd
->
ino
)
{
jffs2_dbg
(
2
,
"Skipping deletion dirent
\"
%s
\"\n
"
,
fd
->
name
);
offset
++
;
ctx
->
pos
++
;
continue
;
}
jffs2_dbg
(
2
,
"Dirent %ld:
\"
%s
\"
, ino #%u, type %d
\n
"
,
offset
,
fd
->
name
,
fd
->
ino
,
fd
->
type
);
if
(
filldir
(
dirent
,
fd
->
name
,
strlen
(
fd
->
name
),
offset
,
fd
->
ino
,
fd
->
type
)
<
0
)
(
unsigned
long
)
ctx
->
pos
,
fd
->
name
,
fd
->
ino
,
fd
->
type
);
if
(
!
dir_emit
(
ctx
,
fd
->
name
,
strlen
(
fd
->
name
),
fd
->
ino
,
fd
->
type
)
)
break
;
offset
++
;
ctx
->
pos
++
;
}
mutex_unlock
(
&
f
->
sem
);
out:
filp
->
f_pos
=
offset
;
return
0
;
}
...
...
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