Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22b970497
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22b970497
Commits
0312fa7c
Commit
0312fa7c
authored
11 years ago
by
Al Viro
Browse files
Options
Downloads
Patches
Plain Diff
[readdir] convert jffs2
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
6f7f231e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fs/jffs2/dir.c
+16
-36
16 additions, 36 deletions
fs/jffs2/dir.c
with
16 additions
and
36 deletions
fs/jffs2/dir.c
+
16
−
36
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
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment