Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
01122e06
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
01122e06
编写于
5月 16, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[readdir] convert ubifs
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
5add2ee1
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
16 addition
and
41 deletion
+16
-41
fs/ubifs/dir.c
fs/ubifs/dir.c
+16
-41
未找到文件。
fs/ubifs/dir.c
浏览文件 @
01122e06
...
...
@@ -346,19 +346,18 @@ static unsigned int vfs_dent_type(uint8_t type)
* This means that UBIFS cannot support NFS which requires full
* 'seekdir()'/'telldir()' support.
*/
static
int
ubifs_readdir
(
struct
file
*
file
,
void
*
dirent
,
filldir_t
filldir
)
static
int
ubifs_readdir
(
struct
file
*
file
,
struct
dir_context
*
ctx
)
{
int
err
,
over
=
0
;
loff_t
pos
=
file
->
f_pos
;
int
err
;
struct
qstr
nm
;
union
ubifs_key
key
;
struct
ubifs_dent_node
*
dent
;
struct
inode
*
dir
=
file_inode
(
file
);
struct
ubifs_info
*
c
=
dir
->
i_sb
->
s_fs_info
;
dbg_gen
(
"dir ino %lu, f_pos %#llx"
,
dir
->
i_ino
,
pos
);
dbg_gen
(
"dir ino %lu, f_pos %#llx"
,
dir
->
i_ino
,
ctx
->
pos
);
if
(
pos
>
UBIFS_S_KEY_HASH_MASK
||
pos
==
2
)
if
(
ctx
->
pos
>
UBIFS_S_KEY_HASH_MASK
||
ctx
->
pos
==
2
)
/*
* The directory was seek'ed to a senseless position or there
* are no more entries.
...
...
@@ -384,19 +383,9 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
file
->
f_version
=
1
;
/* File positions 0 and 1 correspond to "." and ".." */
if
(
pos
==
0
)
{
ubifs_assert
(
!
file
->
private_data
);
over
=
filldir
(
dirent
,
"."
,
1
,
0
,
dir
->
i_ino
,
DT_DIR
);
if
(
over
)
return
0
;
file
->
f_pos
=
pos
=
1
;
}
if
(
pos
==
1
)
{
if
(
ctx
->
pos
<
2
)
{
ubifs_assert
(
!
file
->
private_data
);
over
=
filldir
(
dirent
,
".."
,
2
,
1
,
parent_ino
(
file
->
f_path
.
dentry
),
DT_DIR
);
if
(
over
)
if
(
!
dir_emit_dots
(
file
,
ctx
))
return
0
;
/* Find the first entry in TNC and save it */
...
...
@@ -408,7 +397,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
goto
out
;
}
file
->
f_pos
=
pos
=
key_hash_flash
(
c
,
&
dent
->
key
);
ctx
->
pos
=
key_hash_flash
(
c
,
&
dent
->
key
);
file
->
private_data
=
dent
;
}
...
...
@@ -416,16 +405,16 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
if
(
!
dent
)
{
/*
* The directory was seek'ed to and is now readdir'ed.
* Find the entry corresponding to @pos or the closest one.
* Find the entry corresponding to @
ctx->
pos or the closest one.
*/
dent_key_init_hash
(
c
,
&
key
,
dir
->
i_ino
,
pos
);
dent_key_init_hash
(
c
,
&
key
,
dir
->
i_ino
,
ctx
->
pos
);
nm
.
name
=
NULL
;
dent
=
ubifs_tnc_next_ent
(
c
,
&
key
,
&
nm
);
if
(
IS_ERR
(
dent
))
{
err
=
PTR_ERR
(
dent
);
goto
out
;
}
file
->
f_pos
=
pos
=
key_hash_flash
(
c
,
&
dent
->
key
);
ctx
->
pos
=
key_hash_flash
(
c
,
&
dent
->
key
);
file
->
private_data
=
dent
;
}
...
...
@@ -437,10 +426,9 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
ubifs_inode
(
dir
)
->
creat_sqnum
);
nm
.
len
=
le16_to_cpu
(
dent
->
nlen
);
over
=
filldir
(
dirent
,
dent
->
name
,
nm
.
len
,
pos
,
if
(
!
dir_emit
(
ctx
,
dent
->
name
,
nm
.
len
,
le64_to_cpu
(
dent
->
inum
),
vfs_dent_type
(
dent
->
type
));
if
(
over
)
vfs_dent_type
(
dent
->
type
)))
return
0
;
/* Switch to the next entry */
...
...
@@ -453,17 +441,9 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
}
kfree
(
file
->
private_data
);
file
->
f_pos
=
pos
=
key_hash_flash
(
c
,
&
dent
->
key
);
ctx
->
pos
=
key_hash_flash
(
c
,
&
dent
->
key
);
file
->
private_data
=
dent
;
cond_resched
();
if
(
file
->
f_version
==
0
)
/*
* The file was seek'ed meanwhile, lets return and start
* reading direntries from the new position on the next
* invocation.
*/
return
0
;
}
out:
...
...
@@ -475,15 +455,10 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
kfree
(
file
->
private_data
);
file
->
private_data
=
NULL
;
/* 2 is a special value indicating that there are no more direntries */
file
->
f_
pos
=
2
;
ctx
->
pos
=
2
;
return
0
;
}
static
loff_t
ubifs_dir_llseek
(
struct
file
*
file
,
loff_t
offset
,
int
whence
)
{
return
generic_file_llseek
(
file
,
offset
,
whence
);
}
/* Free saved readdir() state when the directory is closed */
static
int
ubifs_dir_release
(
struct
inode
*
dir
,
struct
file
*
file
)
{
...
...
@@ -1201,10 +1176,10 @@ const struct inode_operations ubifs_dir_inode_operations = {
};
const
struct
file_operations
ubifs_dir_operations
=
{
.
llseek
=
ubifs_dir
_llseek
,
.
llseek
=
generic_file
_llseek
,
.
release
=
ubifs_dir_release
,
.
read
=
generic_read_dir
,
.
readdir
=
ubifs_readdir
,
.
iterate
=
ubifs_readdir
,
.
fsync
=
ubifs_fsync
,
.
unlocked_ioctl
=
ubifs_ioctl
,
#ifdef CONFIG_COMPAT
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录