Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
964ea96e
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看板
提交
964ea96e
编写于
3月 05, 2014
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
usbip: don't open-code sockfd_lookup/sockfd_put
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
c7999c36
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
9 addition
and
35 deletion
+9
-35
drivers/staging/usbip/stub_dev.c
drivers/staging/usbip/stub_dev.c
+4
-4
drivers/staging/usbip/usbip_common.c
drivers/staging/usbip/usbip_common.c
+0
-25
drivers/staging/usbip/usbip_common.h
drivers/staging/usbip/usbip_common.h
+0
-1
drivers/staging/usbip/vhci_hcd.c
drivers/staging/usbip/vhci_hcd.c
+2
-2
drivers/staging/usbip/vhci_sysfs.c
drivers/staging/usbip/vhci_sysfs.c
+3
-3
未找到文件。
drivers/staging/usbip/stub_dev.c
浏览文件 @
964ea96e
...
...
@@ -86,7 +86,6 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
struct
stub_device
*
sdev
=
dev_get_drvdata
(
dev
);
int
sockfd
=
0
;
struct
socket
*
socket
;
ssize_t
err
=
-
EINVAL
;
if
(
!
sdev
)
{
dev_err
(
dev
,
"sdev is null
\n
"
);
...
...
@@ -96,6 +95,7 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
sscanf
(
buf
,
"%d"
,
&
sockfd
);
if
(
sockfd
!=
-
1
)
{
int
err
;
dev_info
(
dev
,
"stub up
\n
"
);
spin_lock_irq
(
&
sdev
->
ud
.
lock
);
...
...
@@ -105,7 +105,7 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
goto
err
;
}
socket
=
sockfd_
to_socket
(
sockfd
);
socket
=
sockfd_
lookup
(
sockfd
,
&
err
);
if
(
!
socket
)
goto
err
;
...
...
@@ -138,7 +138,7 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
err:
spin_unlock_irq
(
&
sdev
->
ud
.
lock
);
return
err
;
return
-
EINVAL
;
}
static
DEVICE_ATTR
(
usbip_sockfd
,
S_IWUSR
,
NULL
,
store_sockfd
);
...
...
@@ -208,7 +208,7 @@ static void stub_shutdown_connection(struct usbip_device *ud)
* not touch NULL socket.
*/
if
(
ud
->
tcp_socket
)
{
fput
(
ud
->
tcp_socket
->
file
);
sockfd_put
(
ud
->
tcp_socket
);
ud
->
tcp_socket
=
NULL
;
}
...
...
drivers/staging/usbip/usbip_common.c
浏览文件 @
964ea96e
...
...
@@ -400,31 +400,6 @@ int usbip_recv(struct socket *sock, void *buf, int size)
}
EXPORT_SYMBOL_GPL
(
usbip_recv
);
struct
socket
*
sockfd_to_socket
(
unsigned
int
sockfd
)
{
struct
socket
*
socket
;
struct
file
*
file
;
struct
inode
*
inode
;
file
=
fget
(
sockfd
);
if
(
!
file
)
{
pr_err
(
"invalid sockfd
\n
"
);
return
NULL
;
}
inode
=
file_inode
(
file
);
if
(
!
inode
||
!
S_ISSOCK
(
inode
->
i_mode
))
{
fput
(
file
);
return
NULL
;
}
socket
=
SOCKET_I
(
inode
);
return
socket
;
}
EXPORT_SYMBOL_GPL
(
sockfd_to_socket
);
/* there may be more cases to tweak the flags. */
static
unsigned
int
tweak_transfer_flags
(
unsigned
int
flags
)
{
...
...
drivers/staging/usbip/usbip_common.h
浏览文件 @
964ea96e
...
...
@@ -314,7 +314,6 @@ void usbip_dump_urb(struct urb *purb);
void
usbip_dump_header
(
struct
usbip_header
*
pdu
);
int
usbip_recv
(
struct
socket
*
sock
,
void
*
buf
,
int
size
);
struct
socket
*
sockfd_to_socket
(
unsigned
int
sockfd
);
void
usbip_pack_pdu
(
struct
usbip_header
*
pdu
,
struct
urb
*
urb
,
int
cmd
,
int
pack
);
...
...
drivers/staging/usbip/vhci_hcd.c
浏览文件 @
964ea96e
...
...
@@ -789,7 +789,7 @@ static void vhci_shutdown_connection(struct usbip_device *ud)
/* active connection is closed */
if
(
vdev
->
ud
.
tcp_socket
)
{
fput
(
vdev
->
ud
.
tcp_socket
->
file
);
sockfd_put
(
vdev
->
ud
.
tcp_socket
);
vdev
->
ud
.
tcp_socket
=
NULL
;
}
pr_info
(
"release socket
\n
"
);
...
...
@@ -836,7 +836,7 @@ static void vhci_device_reset(struct usbip_device *ud)
vdev
->
udev
=
NULL
;
if
(
ud
->
tcp_socket
)
{
fput
(
ud
->
tcp_socket
->
file
);
sockfd_put
(
ud
->
tcp_socket
);
ud
->
tcp_socket
=
NULL
;
}
ud
->
status
=
VDEV_ST_NULL
;
...
...
drivers/staging/usbip/vhci_sysfs.c
浏览文件 @
964ea96e
...
...
@@ -175,6 +175,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr,
struct
socket
*
socket
;
int
sockfd
=
0
;
__u32
rhport
=
0
,
devid
=
0
,
speed
=
0
;
int
err
;
/*
* @rhport: port number of vhci_hcd
...
...
@@ -192,8 +193,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr,
return
-
EINVAL
;
/* Extract socket from fd. */
/* The correct way to clean this up is to fput(socket->file). */
socket
=
sockfd_to_socket
(
sockfd
);
socket
=
sockfd_lookup
(
sockfd
,
&
err
);
if
(
!
socket
)
return
-
EINVAL
;
...
...
@@ -209,7 +209,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr,
spin_unlock
(
&
vdev
->
ud
.
lock
);
spin_unlock
(
&
the_controller
->
lock
);
fput
(
socket
->
file
);
sockfd_put
(
socket
);
dev_err
(
dev
,
"port %d already used
\n
"
,
rhport
);
return
-
EINVAL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录