Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
6f7f231e
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看板
提交
6f7f231e
编写于
5月 17, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[readdir] convert f2fs
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
8f29843a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
35 deletion
+22
-35
fs/cramfs/inode.c
fs/cramfs/inode.c
+8
-13
fs/f2fs/dir.c
fs/f2fs/dir.c
+14
-22
未找到文件。
fs/cramfs/inode.c
浏览文件 @
6f7f231e
...
...
@@ -349,18 +349,17 @@ static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf)
/*
* Read a cramfs directory entry.
*/
static
int
cramfs_readdir
(
struct
file
*
fil
p
,
void
*
dirent
,
filldir_t
filldir
)
static
int
cramfs_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
;
char
*
buf
;
unsigned
int
offset
;
int
copied
;
/* Offset within the thing. */
offset
=
filp
->
f_pos
;
if
(
offset
>=
inode
->
i_size
)
if
(
ctx
->
pos
>=
inode
->
i_size
)
return
0
;
offset
=
ctx
->
pos
;
/* Directory entries are always 4-byte aligned */
if
(
offset
&
3
)
return
-
EINVAL
;
...
...
@@ -369,14 +368,13 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
!
buf
)
return
-
ENOMEM
;
copied
=
0
;
while
(
offset
<
inode
->
i_size
)
{
struct
cramfs_inode
*
de
;
unsigned
long
nextoffset
;
char
*
name
;
ino_t
ino
;
umode_t
mode
;
int
namelen
,
error
;
int
namelen
;
mutex_lock
(
&
read_mutex
);
de
=
cramfs_read
(
sb
,
OFFSET
(
inode
)
+
offset
,
sizeof
(
*
de
)
+
CRAMFS_MAXPATHLEN
);
...
...
@@ -402,13 +400,10 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
break
;
namelen
--
;
}
error
=
filldir
(
dirent
,
buf
,
namelen
,
offset
,
ino
,
mode
>>
12
);
if
(
error
)
if
(
!
dir_emit
(
ctx
,
buf
,
namelen
,
ino
,
mode
>>
12
))
break
;
offset
=
nextoffset
;
filp
->
f_pos
=
offset
;
copied
++
;
ctx
->
pos
=
offset
=
nextoffset
;
}
kfree
(
buf
);
return
0
;
...
...
@@ -547,7 +542,7 @@ static const struct address_space_operations cramfs_aops = {
static
const
struct
file_operations
cramfs_directory_operations
=
{
.
llseek
=
generic_file_llseek
,
.
read
=
generic_read_dir
,
.
readdir
=
cramfs_readdir
,
.
iterate
=
cramfs_readdir
,
};
static
const
struct
inode_operations
cramfs_dir_inode_operations
=
{
...
...
fs/f2fs/dir.c
浏览文件 @
6f7f231e
...
...
@@ -591,24 +591,19 @@ bool f2fs_empty_dir(struct inode *dir)
return
true
;
}
static
int
f2fs_readdir
(
struct
file
*
file
,
void
*
dirent
,
filldir_t
filldir
)
static
int
f2fs_readdir
(
struct
file
*
file
,
struct
dir_context
*
ctx
)
{
unsigned
long
pos
=
file
->
f_pos
;
struct
inode
*
inode
=
file_inode
(
file
);
unsigned
long
npages
=
dir_blocks
(
inode
);
unsigned
char
*
types
=
NULL
;
unsigned
int
bit_pos
=
0
,
start_bit_pos
=
0
;
int
over
=
0
;
struct
f2fs_dentry_block
*
dentry_blk
=
NULL
;
struct
f2fs_dir_entry
*
de
=
NULL
;
struct
page
*
dentry_page
=
NULL
;
unsigned
int
n
=
0
;
unsigned
int
n
=
((
unsigned
long
)
ctx
->
pos
/
NR_DENTRY_IN_BLOCK
)
;
unsigned
char
d_type
=
DT_UNKNOWN
;
int
slots
;
types
=
f2fs_filetype_table
;
bit_pos
=
(
pos
%
NR_DENTRY_IN_BLOCK
);
n
=
(
pos
/
NR_DENTRY_IN_BLOCK
);
bit_pos
=
((
unsigned
long
)
ctx
->
pos
%
NR_DENTRY_IN_BLOCK
);
for
(
;
n
<
npages
;
n
++
)
{
dentry_page
=
get_lock_data_page
(
inode
,
n
);
...
...
@@ -618,31 +613,28 @@ static int f2fs_readdir(struct file *file, void *dirent, filldir_t filldir)
start_bit_pos
=
bit_pos
;
dentry_blk
=
kmap
(
dentry_page
);
while
(
bit_pos
<
NR_DENTRY_IN_BLOCK
)
{
d_type
=
DT_UNKNOWN
;
bit_pos
=
find_next_bit_le
(
&
dentry_blk
->
dentry_bitmap
,
NR_DENTRY_IN_BLOCK
,
bit_pos
);
if
(
bit_pos
>=
NR_DENTRY_IN_BLOCK
)
break
;
ctx
->
pos
+=
bit_pos
-
start_bit_pos
;
de
=
&
dentry_blk
->
dentry
[
bit_pos
];
if
(
types
&&
de
->
file_type
<
F2FS_FT_MAX
)
d_type
=
types
[
de
->
file_type
];
over
=
filldir
(
dirent
,
dentry_blk
->
filename
[
bit_pos
],
le16_to_cpu
(
de
->
name_len
),
(
n
*
NR_DENTRY_IN_BLOCK
)
+
bit_pos
,
le32_to_cpu
(
de
->
ino
),
d_type
);
if
(
over
)
{
file
->
f_pos
+=
bit_pos
-
start_bit_pos
;
if
(
de
->
file_type
<
F2FS_FT_MAX
)
d_type
=
f2fs_filetype_table
[
de
->
file_type
];
else
d_type
=
DT_UNKNOWN
;
if
(
!
dir_emit
(
ctx
,
dentry_blk
->
filename
[
bit_pos
],
le16_to_cpu
(
de
->
name_len
),
le32_to_cpu
(
de
->
ino
),
d_type
))
goto
success
;
}
slots
=
GET_DENTRY_SLOTS
(
le16_to_cpu
(
de
->
name_len
));
bit_pos
+=
slots
;
}
bit_pos
=
0
;
file
->
f_
pos
=
(
n
+
1
)
*
NR_DENTRY_IN_BLOCK
;
ctx
->
pos
=
(
n
+
1
)
*
NR_DENTRY_IN_BLOCK
;
kunmap
(
dentry_page
);
f2fs_put_page
(
dentry_page
,
1
);
dentry_page
=
NULL
;
...
...
@@ -659,7 +651,7 @@ static int f2fs_readdir(struct file *file, void *dirent, filldir_t filldir)
const
struct
file_operations
f2fs_dir_operations
=
{
.
llseek
=
generic_file_llseek
,
.
read
=
generic_read_dir
,
.
readdir
=
f2fs_readdir
,
.
iterate
=
f2fs_readdir
,
.
fsync
=
f2fs_sync_file
,
.
unlocked_ioctl
=
f2fs_ioctl
,
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录