Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
a2d03aac
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a2d03aac
编写于
4月 18, 2018
作者:
C
Christoph Hellwig
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
atm: switch to proc_create_seq_private
And remove proc boilerplate code. Signed-off-by:
N
Christoph Hellwig
<
hch@lst.de
>
上级
ce9fe438
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
59 deletion
+13
-59
net/atm/proc.c
net/atm/proc.c
+13
-59
未找到文件。
net/atm/proc.c
浏览文件 @
a2d03aac
...
...
@@ -68,7 +68,6 @@ static void atm_dev_info(struct seq_file *seq, const struct atm_dev *dev)
struct
vcc_state
{
int
bucket
;
struct
sock
*
sk
;
int
family
;
};
static
inline
int
compare_family
(
struct
sock
*
sk
,
int
family
)
...
...
@@ -106,23 +105,13 @@ static int __vcc_walk(struct sock **sock, int family, int *bucket, loff_t l)
return
(
l
<
0
);
}
static
inline
void
*
vcc_walk
(
struct
vcc_state
*
state
,
loff_t
l
)
static
inline
void
*
vcc_walk
(
struct
seq_file
*
seq
,
loff_t
l
)
{
return
__vcc_walk
(
&
state
->
sk
,
state
->
family
,
&
state
->
bucket
,
l
)
?
state
:
NULL
;
}
static
int
__vcc_seq_open
(
struct
inode
*
inode
,
struct
file
*
file
,
int
family
,
const
struct
seq_operations
*
ops
)
{
struct
vcc_state
*
state
;
state
=
__seq_open_private
(
file
,
ops
,
sizeof
(
*
state
));
if
(
state
==
NULL
)
return
-
ENOMEM
;
struct
vcc_state
*
state
=
seq
->
private
;
int
family
=
(
uintptr_t
)(
PDE_DATA
(
file_inode
(
seq
->
file
)));
state
->
family
=
family
;
return
0
;
return
__vcc_walk
(
&
state
->
sk
,
family
,
&
state
->
bucket
,
l
)
?
state
:
NULL
;
}
static
void
*
vcc_seq_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
...
...
@@ -133,7 +122,7 @@ static void *vcc_seq_start(struct seq_file *seq, loff_t *pos)
read_lock
(
&
vcc_sklist_lock
);
state
->
sk
=
SEQ_START_TOKEN
;
return
left
?
vcc_walk
(
s
tate
,
left
)
:
SEQ_START_TOKEN
;
return
left
?
vcc_walk
(
s
eq
,
left
)
:
SEQ_START_TOKEN
;
}
static
void
vcc_seq_stop
(
struct
seq_file
*
seq
,
void
*
v
)
...
...
@@ -144,9 +133,7 @@ static void vcc_seq_stop(struct seq_file *seq, void *v)
static
void
*
vcc_seq_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
)
{
struct
vcc_state
*
state
=
seq
->
private
;
v
=
vcc_walk
(
state
,
1
);
v
=
vcc_walk
(
seq
,
1
);
*
pos
+=
!!
PTR_ERR
(
v
);
return
v
;
}
...
...
@@ -280,18 +267,6 @@ static const struct seq_operations pvc_seq_ops = {
.
show
=
pvc_seq_show
,
};
static
int
pvc_seq_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
__vcc_seq_open
(
inode
,
file
,
PF_ATMPVC
,
&
pvc_seq_ops
);
}
static
const
struct
file_operations
pvc_seq_fops
=
{
.
open
=
pvc_seq_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release_private
,
};
static
int
vcc_seq_show
(
struct
seq_file
*
seq
,
void
*
v
)
{
if
(
v
==
SEQ_START_TOKEN
)
{
...
...
@@ -314,18 +289,6 @@ static const struct seq_operations vcc_seq_ops = {
.
show
=
vcc_seq_show
,
};
static
int
vcc_seq_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
__vcc_seq_open
(
inode
,
file
,
0
,
&
vcc_seq_ops
);
}
static
const
struct
file_operations
vcc_seq_fops
=
{
.
open
=
vcc_seq_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release_private
,
};
static
int
svc_seq_show
(
struct
seq_file
*
seq
,
void
*
v
)
{
static
const
char
atm_svc_banner
[]
=
...
...
@@ -349,18 +312,6 @@ static const struct seq_operations svc_seq_ops = {
.
show
=
svc_seq_show
,
};
static
int
svc_seq_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
__vcc_seq_open
(
inode
,
file
,
PF_ATMSVC
,
&
svc_seq_ops
);
}
static
const
struct
file_operations
svc_seq_fops
=
{
.
open
=
svc_seq_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release_private
,
};
static
ssize_t
proc_dev_atm_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
pos
)
{
...
...
@@ -434,9 +385,12 @@ int __init atm_proc_init(void)
if
(
!
atm_proc_root
)
return
-
ENOMEM
;
proc_create_seq
(
"devices"
,
0444
,
atm_proc_root
,
&
atm_dev_seq_ops
);
proc_create
(
"pvc"
,
0444
,
atm_proc_root
,
&
pvc_seq_fops
);
proc_create
(
"svc"
,
0444
,
atm_proc_root
,
&
svc_seq_fops
);
proc_create
(
"vc"
,
0444
,
atm_proc_root
,
&
vcc_seq_fops
);
proc_create_seq_private
(
"pvc"
,
0444
,
atm_proc_root
,
&
pvc_seq_ops
,
sizeof
(
struct
vcc_state
),
(
void
*
)(
uintptr_t
)
PF_ATMPVC
);
proc_create_seq_private
(
"svc"
,
0444
,
atm_proc_root
,
&
svc_seq_ops
,
sizeof
(
struct
vcc_state
),
(
void
*
)(
uintptr_t
)
PF_ATMSVC
);
proc_create_seq_private
(
"vc"
,
0444
,
atm_proc_root
,
&
vcc_seq_ops
,
sizeof
(
struct
vcc_state
),
NULL
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录