Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
0312fa7c
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0312fa7c
编写于
5月 17, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[readdir] convert jffs2
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
6f7f231e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
36 deletion
+16
-36
fs/jffs2/dir.c
fs/jffs2/dir.c
+16
-36
未找到文件。
fs/jffs2/dir.c
浏览文件 @
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
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录