Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
002f8bec
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看板
提交
002f8bec
编写于
5月 22, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[readdir] convert hfs
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
f0f49ef5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
26 deletion
+23
-26
fs/hfs/dir.c
fs/hfs/dir.c
+23
-26
未找到文件。
fs/hfs/dir.c
浏览文件 @
002f8bec
...
...
@@ -51,9 +51,9 @@ static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry,
/*
* hfs_readdir
*/
static
int
hfs_readdir
(
struct
file
*
fil
p
,
void
*
dirent
,
filldir_t
filldir
)
static
int
hfs_readdir
(
struct
file
*
fil
e
,
struct
dir_context
*
ctx
)
{
struct
inode
*
inode
=
file_inode
(
fil
p
);
struct
inode
*
inode
=
file_inode
(
fil
e
);
struct
super_block
*
sb
=
inode
->
i_sb
;
int
len
,
err
;
char
strbuf
[
HFS_MAX_NAMELEN
];
...
...
@@ -62,7 +62,7 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
struct
hfs_readdir_data
*
rd
;
u16
type
;
if
(
filp
->
f_
pos
>=
inode
->
i_size
)
if
(
ctx
->
pos
>=
inode
->
i_size
)
return
0
;
err
=
hfs_find_init
(
HFS_SB
(
sb
)
->
cat_tree
,
&
fd
);
...
...
@@ -73,14 +73,13 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
err
)
goto
out
;
switch
((
u32
)
filp
->
f_pos
)
{
case
0
:
if
(
ctx
->
pos
==
0
)
{
/* This is completely artificial... */
if
(
filldir
(
dirent
,
"."
,
1
,
0
,
inode
->
i_ino
,
DT_DIR
))
if
(
!
dir_emit_dot
(
file
,
ctx
))
goto
out
;
filp
->
f_pos
++
;
/* fall through */
case
1
:
ctx
->
pos
=
1
;
}
if
(
ctx
->
pos
==
1
)
{
if
(
fd
.
entrylength
>
sizeof
(
entry
)
||
fd
.
entrylength
<
0
)
{
err
=
-
EIO
;
goto
out
;
...
...
@@ -97,18 +96,16 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
// err = -EIO;
// goto out;
//}
if
(
filldir
(
dirent
,
".."
,
2
,
1
,
if
(
!
dir_emit
(
ctx
,
".."
,
2
,
be32_to_cpu
(
entry
.
thread
.
ParID
),
DT_DIR
))
goto
out
;
filp
->
f_pos
++
;
/* fall through */
default:
if
(
filp
->
f_pos
>=
inode
->
i_size
)
goto
out
;
err
=
hfs_brec_goto
(
&
fd
,
filp
->
f_pos
-
1
);
if
(
err
)
goto
out
;
ctx
->
pos
=
2
;
}
if
(
ctx
->
pos
>=
inode
->
i_size
)
goto
out
;
err
=
hfs_brec_goto
(
&
fd
,
ctx
->
pos
-
1
);
if
(
err
)
goto
out
;
for
(;;)
{
if
(
be32_to_cpu
(
fd
.
key
->
cat
.
ParID
)
!=
inode
->
i_ino
)
{
...
...
@@ -131,7 +128,7 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
err
=
-
EIO
;
goto
out
;
}
if
(
filldir
(
dirent
,
strbuf
,
len
,
filp
->
f_pos
,
if
(
!
dir_emit
(
ctx
,
strbuf
,
len
,
be32_to_cpu
(
entry
.
dir
.
DirID
),
DT_DIR
))
break
;
}
else
if
(
type
==
HFS_CDR_FIL
)
{
...
...
@@ -140,7 +137,7 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
err
=
-
EIO
;
goto
out
;
}
if
(
filldir
(
dirent
,
strbuf
,
len
,
filp
->
f_pos
,
if
(
!
dir_emit
(
ctx
,
strbuf
,
len
,
be32_to_cpu
(
entry
.
file
.
FlNum
),
DT_REG
))
break
;
}
else
{
...
...
@@ -148,22 +145,22 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
err
=
-
EIO
;
goto
out
;
}
filp
->
f_
pos
++
;
if
(
filp
->
f_
pos
>=
inode
->
i_size
)
ctx
->
pos
++
;
if
(
ctx
->
pos
>=
inode
->
i_size
)
goto
out
;
err
=
hfs_brec_goto
(
&
fd
,
1
);
if
(
err
)
goto
out
;
}
rd
=
fil
p
->
private_data
;
rd
=
fil
e
->
private_data
;
if
(
!
rd
)
{
rd
=
kmalloc
(
sizeof
(
struct
hfs_readdir_data
),
GFP_KERNEL
);
if
(
!
rd
)
{
err
=
-
ENOMEM
;
goto
out
;
}
fil
p
->
private_data
=
rd
;
rd
->
file
=
fil
p
;
fil
e
->
private_data
=
rd
;
rd
->
file
=
fil
e
;
list_add
(
&
rd
->
list
,
&
HFS_I
(
inode
)
->
open_dir_list
);
}
memcpy
(
&
rd
->
key
,
&
fd
.
key
,
sizeof
(
struct
hfs_cat_key
));
...
...
@@ -306,7 +303,7 @@ static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry,
const
struct
file_operations
hfs_dir_operations
=
{
.
read
=
generic_read_dir
,
.
readdir
=
hfs_readdir
,
.
iterate
=
hfs_readdir
,
.
llseek
=
generic_file_llseek
,
.
release
=
hfs_dir_release
,
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录