Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
76f582a8
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
76f582a8
编写于
5月 22, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[readdir] convert ncpfs
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
e72514e7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
43 deletion
+35
-43
fs/ncpfs/dir.c
fs/ncpfs/dir.c
+35
-43
未找到文件。
fs/ncpfs/dir.c
浏览文件 @
76f582a8
...
...
@@ -23,12 +23,12 @@
#include "ncp_fs.h"
static
void
ncp_read_volume_list
(
struct
file
*
,
void
*
,
filldir_t
,
static
void
ncp_read_volume_list
(
struct
file
*
,
struct
dir_context
*
,
struct
ncp_cache_control
*
);
static
void
ncp_do_readdir
(
struct
file
*
,
void
*
,
filldir_t
,
static
void
ncp_do_readdir
(
struct
file
*
,
struct
dir_context
*
,
struct
ncp_cache_control
*
);
static
int
ncp_readdir
(
struct
file
*
,
void
*
,
filldir_t
);
static
int
ncp_readdir
(
struct
file
*
,
struct
dir_context
*
);
static
int
ncp_create
(
struct
inode
*
,
struct
dentry
*
,
umode_t
,
bool
);
static
struct
dentry
*
ncp_lookup
(
struct
inode
*
,
struct
dentry
*
,
unsigned
int
);
...
...
@@ -49,7 +49,7 @@ const struct file_operations ncp_dir_operations =
{
.
llseek
=
generic_file_llseek
,
.
read
=
generic_read_dir
,
.
readdir
=
ncp_readdir
,
.
iterate
=
ncp_readdir
,
.
unlocked_ioctl
=
ncp_ioctl
,
#ifdef CONFIG_COMPAT
.
compat_ioctl
=
ncp_compat_ioctl
,
...
...
@@ -424,9 +424,9 @@ static time_t ncp_obtain_mtime(struct dentry *dentry)
return
ncp_date_dos2unix
(
i
.
modifyTime
,
i
.
modifyDate
);
}
static
int
ncp_readdir
(
struct
file
*
fil
p
,
void
*
dirent
,
filldir_t
filldir
)
static
int
ncp_readdir
(
struct
file
*
fil
e
,
struct
dir_context
*
ctx
)
{
struct
dentry
*
dentry
=
fil
p
->
f_path
.
dentry
;
struct
dentry
*
dentry
=
fil
e
->
f_path
.
dentry
;
struct
inode
*
inode
=
dentry
->
d_inode
;
struct
page
*
page
=
NULL
;
struct
ncp_server
*
server
=
NCP_SERVER
(
inode
);
...
...
@@ -440,7 +440,7 @@ static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir)
DDPRINTK
(
"ncp_readdir: reading %s/%s, pos=%d
\n
"
,
dentry
->
d_parent
->
d_name
.
name
,
dentry
->
d_name
.
name
,
(
int
)
filp
->
f_
pos
);
(
int
)
ctx
->
pos
);
result
=
-
EIO
;
/* Do not generate '.' and '..' when server is dead. */
...
...
@@ -448,16 +448,8 @@ static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir)
goto
out
;
result
=
0
;
if
(
filp
->
f_pos
==
0
)
{
if
(
filldir
(
dirent
,
"."
,
1
,
0
,
inode
->
i_ino
,
DT_DIR
))
goto
out
;
filp
->
f_pos
=
1
;
}
if
(
filp
->
f_pos
==
1
)
{
if
(
filldir
(
dirent
,
".."
,
2
,
1
,
parent_ino
(
dentry
),
DT_DIR
))
goto
out
;
filp
->
f_pos
=
2
;
}
if
(
!
dir_emit_dots
(
file
,
ctx
))
goto
out
;
page
=
grab_cache_page
(
&
inode
->
i_data
,
0
);
if
(
!
page
)
...
...
@@ -469,7 +461,7 @@ static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
!
PageUptodate
(
page
)
||
!
ctl
.
head
.
eof
)
goto
init_cache
;
if
(
filp
->
f_
pos
==
2
)
{
if
(
ctx
->
pos
==
2
)
{
if
(
jiffies
-
ctl
.
head
.
time
>=
NCP_MAX_AGE
(
server
))
goto
init_cache
;
...
...
@@ -479,10 +471,10 @@ static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir)
goto
init_cache
;
}
if
(
filp
->
f_
pos
>
ctl
.
head
.
end
)
if
(
ctx
->
pos
>
ctl
.
head
.
end
)
goto
finished
;
ctl
.
fpos
=
filp
->
f_
pos
+
(
NCP_DIRCACHE_START
-
2
);
ctl
.
fpos
=
ctx
->
pos
+
(
NCP_DIRCACHE_START
-
2
);
ctl
.
ofs
=
ctl
.
fpos
/
NCP_DIRCACHE_SIZE
;
ctl
.
idx
=
ctl
.
fpos
%
NCP_DIRCACHE_SIZE
;
...
...
@@ -497,21 +489,21 @@ static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir)
}
while
(
ctl
.
idx
<
NCP_DIRCACHE_SIZE
)
{
struct
dentry
*
dent
;
int
res
;
bool
over
;
dent
=
ncp_dget_fpos
(
ctl
.
cache
->
dentry
[
ctl
.
idx
],
dentry
,
filp
->
f_
pos
);
dentry
,
ctx
->
pos
);
if
(
!
dent
)
goto
invalid_cache
;
res
=
filldir
(
dirent
,
dent
->
d_name
.
name
,
dent
->
d_name
.
len
,
filp
->
f_pos
,
over
=
!
dir_emit
(
ctx
,
dent
->
d_name
.
name
,
dent
->
d_name
.
len
,
dent
->
d_inode
->
i_ino
,
DT_UNKNOWN
);
dput
(
dent
);
if
(
res
)
if
(
over
)
goto
finished
;
filp
->
f_
pos
+=
1
;
ctx
->
pos
+=
1
;
ctl
.
idx
+=
1
;
if
(
filp
->
f_
pos
>
ctl
.
head
.
end
)
if
(
ctx
->
pos
>
ctl
.
head
.
end
)
goto
finished
;
}
if
(
ctl
.
page
)
{
...
...
@@ -548,9 +540,9 @@ static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir)
ctl
.
valid
=
1
;
read_really:
if
(
ncp_is_server_root
(
inode
))
{
ncp_read_volume_list
(
fil
p
,
dirent
,
filldir
,
&
ctl
);
ncp_read_volume_list
(
fil
e
,
ctx
,
&
ctl
);
}
else
{
ncp_do_readdir
(
fil
p
,
dirent
,
filldir
,
&
ctl
);
ncp_do_readdir
(
fil
e
,
ctx
,
&
ctl
);
}
ctl
.
head
.
end
=
ctl
.
fpos
-
1
;
ctl
.
head
.
eof
=
ctl
.
valid
;
...
...
@@ -573,11 +565,11 @@ static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir)
}
static
int
ncp_fill_cache
(
struct
file
*
fil
p
,
void
*
dirent
,
filldir_t
filldir
,
ncp_fill_cache
(
struct
file
*
fil
e
,
struct
dir_context
*
ctx
,
struct
ncp_cache_control
*
ctrl
,
struct
ncp_entry_info
*
entry
,
int
inval_childs
)
{
struct
dentry
*
newdent
,
*
dentry
=
fil
p
->
f_path
.
dentry
;
struct
dentry
*
newdent
,
*
dentry
=
fil
e
->
f_path
.
dentry
;
struct
inode
*
dir
=
dentry
->
d_inode
;
struct
ncp_cache_control
ctl
=
*
ctrl
;
struct
qstr
qname
;
...
...
@@ -666,15 +658,15 @@ ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
end_advance:
if
(
!
valid
)
ctl
.
valid
=
0
;
if
(
!
ctl
.
filled
&&
(
ctl
.
fpos
==
filp
->
f_
pos
))
{
if
(
!
ctl
.
filled
&&
(
ctl
.
fpos
==
ctx
->
pos
))
{
if
(
!
ino
)
ino
=
find_inode_number
(
dentry
,
&
qname
);
if
(
!
ino
)
ino
=
iunique
(
dir
->
i_sb
,
2
);
ctl
.
filled
=
filldir
(
dirent
,
qname
.
name
,
qname
.
len
,
filp
->
f_pos
,
ino
,
DT_UNKNOWN
);
ctl
.
filled
=
!
dir_emit
(
ctx
,
qname
.
name
,
qname
.
len
,
ino
,
DT_UNKNOWN
);
if
(
!
ctl
.
filled
)
filp
->
f_
pos
+=
1
;
ctx
->
pos
+=
1
;
}
ctl
.
fpos
+=
1
;
ctl
.
idx
+=
1
;
...
...
@@ -683,10 +675,10 @@ ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
}
static
void
ncp_read_volume_list
(
struct
file
*
fil
p
,
void
*
dirent
,
filldir_t
filldir
,
ncp_read_volume_list
(
struct
file
*
fil
e
,
struct
dir_context
*
ctx
,
struct
ncp_cache_control
*
ctl
)
{
struct
dentry
*
dentry
=
fil
p
->
f_path
.
dentry
;
struct
dentry
*
dentry
=
fil
e
->
f_path
.
dentry
;
struct
inode
*
inode
=
dentry
->
d_inode
;
struct
ncp_server
*
server
=
NCP_SERVER
(
inode
);
struct
ncp_volume_info
info
;
...
...
@@ -694,7 +686,7 @@ ncp_read_volume_list(struct file *filp, void *dirent, filldir_t filldir,
int
i
;
DPRINTK
(
"ncp_read_volume_list: pos=%ld
\n
"
,
(
unsigned
long
)
filp
->
f_
pos
);
(
unsigned
long
)
ctx
->
pos
);
for
(
i
=
0
;
i
<
NCP_NUMBER_OF_VOLUMES
;
i
++
)
{
int
inval_dentry
;
...
...
@@ -715,16 +707,16 @@ ncp_read_volume_list(struct file *filp, void *dirent, filldir_t filldir,
}
inval_dentry
=
ncp_update_known_namespace
(
server
,
entry
.
i
.
volNumber
,
NULL
);
entry
.
volume
=
entry
.
i
.
volNumber
;
if
(
!
ncp_fill_cache
(
fil
p
,
dirent
,
filldir
,
ctl
,
&
entry
,
inval_dentry
))
if
(
!
ncp_fill_cache
(
fil
e
,
ctx
,
ctl
,
&
entry
,
inval_dentry
))
return
;
}
}
static
void
ncp_do_readdir
(
struct
file
*
fil
p
,
void
*
dirent
,
filldir_t
filldir
,
ncp_do_readdir
(
struct
file
*
fil
e
,
struct
dir_context
*
ctx
,
struct
ncp_cache_control
*
ctl
)
{
struct
dentry
*
dentry
=
fil
p
->
f_path
.
dentry
;
struct
dentry
*
dentry
=
fil
e
->
f_path
.
dentry
;
struct
inode
*
dir
=
dentry
->
d_inode
;
struct
ncp_server
*
server
=
NCP_SERVER
(
dir
);
struct
nw_search_sequence
seq
;
...
...
@@ -736,7 +728,7 @@ ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir,
DPRINTK
(
"ncp_do_readdir: %s/%s, fpos=%ld
\n
"
,
dentry
->
d_parent
->
d_name
.
name
,
dentry
->
d_name
.
name
,
(
unsigned
long
)
filp
->
f_
pos
);
(
unsigned
long
)
ctx
->
pos
);
PPRINTK
(
"ncp_do_readdir: init %s, volnum=%d, dirent=%u
\n
"
,
dentry
->
d_name
.
name
,
NCP_FINFO
(
dir
)
->
volNumber
,
NCP_FINFO
(
dir
)
->
dirEntNum
);
...
...
@@ -778,7 +770,7 @@ ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir,
rpl
+=
onerpl
;
rpls
-=
onerpl
;
entry
.
volume
=
entry
.
i
.
volNumber
;
if
(
!
ncp_fill_cache
(
fil
p
,
dirent
,
filldir
,
ctl
,
&
entry
,
0
))
if
(
!
ncp_fill_cache
(
fil
e
,
ctx
,
ctl
,
&
entry
,
0
))
break
;
}
}
while
(
more
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录