Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
1a7d7787
Commit
1a7d7787
authored
Jul 15, 2004
by
Alexander Viro
Committed by
Linus Torvalds
Jul 15, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparse: iovec cleanups - cifs
cifs switched to kvec and kernel_...msg()
parent
e9b59558
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
26 deletions
+19
-26
fs/cifs/connect.c
fs/cifs/connect.c
+17
-18
fs/cifs/transport.c
fs/cifs/transport.c
+2
-8
No files found.
fs/cifs/connect.c
View file @
1a7d7787
...
@@ -189,8 +189,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -189,8 +189,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
unsigned
int
pdu_length
,
total_read
;
unsigned
int
pdu_length
,
total_read
;
struct
smb_hdr
*
smb_buffer
=
NULL
;
struct
smb_hdr
*
smb_buffer
=
NULL
;
struct
msghdr
smb_msg
;
struct
msghdr
smb_msg
;
mm_segment_t
temp_fs
;
struct
kvec
iov
;
struct
iovec
iov
;
struct
socket
*
csocket
=
server
->
ssocket
;
struct
socket
*
csocket
=
server
->
ssocket
;
struct
list_head
*
tmp
;
struct
list_head
*
tmp
;
struct
cifsSesInfo
*
ses
;
struct
cifsSesInfo
*
ses
;
...
@@ -204,9 +203,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -204,9 +203,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
server
->
tsk
=
current
;
/* save process info to wake at shutdown */
server
->
tsk
=
current
;
/* save process info to wake at shutdown */
cFYI
(
1
,
(
"Demultiplex PID: %d"
,
current
->
pid
));
cFYI
(
1
,
(
"Demultiplex PID: %d"
,
current
->
pid
));
temp_fs
=
get_fs
();
/* we must turn off socket api parm checking */
set_fs
(
get_ds
());
while
(
server
->
tcpStatus
!=
CifsExiting
)
{
while
(
server
->
tcpStatus
!=
CifsExiting
)
{
if
(
smb_buffer
==
NULL
)
if
(
smb_buffer
==
NULL
)
smb_buffer
=
cifs_buf_get
();
smb_buffer
=
cifs_buf_get
();
...
@@ -222,13 +218,12 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -222,13 +218,12 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
iov
.
iov_base
=
smb_buffer
;
iov
.
iov_base
=
smb_buffer
;
iov
.
iov_len
=
sizeof
(
struct
smb_hdr
)
-
1
;
iov
.
iov_len
=
sizeof
(
struct
smb_hdr
)
-
1
;
/* 1 byte less above since wct is not always returned in error cases */
/* 1 byte less above since wct is not always returned in error cases */
smb_msg
.
msg_iov
=
&
iov
;
smb_msg
.
msg_iovlen
=
1
;
smb_msg
.
msg_control
=
NULL
;
smb_msg
.
msg_control
=
NULL
;
smb_msg
.
msg_controllen
=
0
;
smb_msg
.
msg_controllen
=
0
;
length
=
length
=
sock_recvmsg
(
csocket
,
&
smb_msg
,
kernel_recvmsg
(
csocket
,
&
smb_msg
,
&
iov
,
1
,
sizeof
(
struct
smb_hdr
)
-
sizeof
(
struct
smb_hdr
)
-
1
/* RFC1001 header and SMB header */
,
1
/* RFC1001 header and SMB header */
,
MSG_PEEK
/* flags see socket.h */
);
MSG_PEEK
/* flags see socket.h */
);
...
@@ -276,12 +271,14 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -276,12 +271,14 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
if
(
temp
[
0
]
==
(
char
)
RFC1002_SESSION_KEEP_ALIVE
)
{
if
(
temp
[
0
]
==
(
char
)
RFC1002_SESSION_KEEP_ALIVE
)
{
iov
.
iov_base
=
smb_buffer
;
iov
.
iov_base
=
smb_buffer
;
iov
.
iov_len
=
4
;
iov
.
iov_len
=
4
;
length
=
sock_recvmsg
(
csocket
,
&
smb_msg
,
4
,
0
);
length
=
kernel_recvmsg
(
csocket
,
&
smb_msg
,
&
iov
,
1
,
4
,
0
);
cFYI
(
0
,(
"Received 4 byte keep alive packet"
));
cFYI
(
0
,(
"Received 4 byte keep alive packet"
));
}
else
if
(
temp
[
0
]
==
(
char
)
RFC1002_POSITIVE_SESSION_RESPONSE
)
{
}
else
if
(
temp
[
0
]
==
(
char
)
RFC1002_POSITIVE_SESSION_RESPONSE
)
{
iov
.
iov_base
=
smb_buffer
;
iov
.
iov_base
=
smb_buffer
;
iov
.
iov_len
=
4
;
iov
.
iov_len
=
4
;
length
=
sock_recvmsg
(
csocket
,
&
smb_msg
,
4
,
0
);
length
=
kernel_recvmsg
(
csocket
,
&
smb_msg
,
&
iov
,
1
,
4
,
0
);
cFYI
(
1
,(
"Good RFC 1002 session rsp"
));
cFYI
(
1
,(
"Good RFC 1002 session rsp"
));
}
else
if
((
temp
[
0
]
==
(
char
)
RFC1002_NEGATIVE_SESSION_RESPONSE
)
}
else
if
((
temp
[
0
]
==
(
char
)
RFC1002_NEGATIVE_SESSION_RESPONSE
)
&&
(
length
==
5
))
{
&&
(
length
==
5
))
{
...
@@ -341,7 +338,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -341,7 +338,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
for
(
total_read
=
0
;
for
(
total_read
=
0
;
total_read
<
pdu_length
;
total_read
<
pdu_length
;
total_read
+=
length
)
{
total_read
+=
length
)
{
length
=
sock_recvmsg
(
csocket
,
&
smb_msg
,
length
=
kernel_recvmsg
(
csocket
,
&
smb_msg
,
&
iov
,
1
,
pdu_length
-
total_read
,
0
);
pdu_length
-
total_read
,
0
);
if
(
length
==
0
)
{
if
(
length
==
0
)
{
cERROR
(
1
,
cERROR
(
1
,
...
@@ -392,7 +390,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -392,7 +390,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
(
"Frame less than four bytes received %d bytes long."
,
(
"Frame less than four bytes received %d bytes long."
,
length
));
length
));
if
(
length
>
0
)
{
if
(
length
>
0
)
{
length
=
sock_recvmsg
(
csocket
,
&
smb_msg
,
length
,
0
);
/* throw away junk frame */
length
=
kernel_recvmsg
(
csocket
,
&
smb_msg
,
&
iov
,
1
,
length
,
0
);
/* throw away junk frame */
cFYI
(
1
,
cFYI
(
1
,
(
" with junk 0x%x in it "
,
(
" with junk 0x%x in it "
,
*
(
__u32
*
)
smb_buffer
));
*
(
__u32
*
)
smb_buffer
));
...
@@ -418,7 +418,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -418,7 +418,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
sock_release
(
csocket
);
sock_release
(
csocket
);
server
->
ssocket
=
NULL
;
server
->
ssocket
=
NULL
;
}
}
set_fs
(
temp_fs
);
if
(
smb_buffer
)
/* buffer usually freed in free_mid - need to free it on error or exit */
if
(
smb_buffer
)
/* buffer usually freed in free_mid - need to free it on error or exit */
cifs_buf_release
(
smb_buffer
);
cifs_buf_release
(
smb_buffer
);
...
...
fs/cifs/transport.c
View file @
1a7d7787
...
@@ -122,8 +122,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
...
@@ -122,8 +122,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
int
rc
=
0
;
int
rc
=
0
;
int
i
=
0
;
int
i
=
0
;
struct
msghdr
smb_msg
;
struct
msghdr
smb_msg
;
struct
iovec
iov
;
struct
kvec
iov
;
mm_segment_t
temp_fs
;
if
(
ssocket
==
NULL
)
if
(
ssocket
==
NULL
)
return
-
ENOTSOCK
;
/* BB eventually add reconnect code here */
return
-
ENOTSOCK
;
/* BB eventually add reconnect code here */
...
@@ -132,8 +131,6 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
...
@@ -132,8 +131,6 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
smb_msg
.
msg_name
=
sin
;
smb_msg
.
msg_name
=
sin
;
smb_msg
.
msg_namelen
=
sizeof
(
struct
sockaddr
);
smb_msg
.
msg_namelen
=
sizeof
(
struct
sockaddr
);
smb_msg
.
msg_iov
=
&
iov
;
smb_msg
.
msg_iovlen
=
1
;
smb_msg
.
msg_control
=
NULL
;
smb_msg
.
msg_control
=
NULL
;
smb_msg
.
msg_controllen
=
0
;
smb_msg
.
msg_controllen
=
0
;
smb_msg
.
msg_flags
=
MSG_DONTWAIT
+
MSG_NOSIGNAL
;
/* BB add more flags?*/
smb_msg
.
msg_flags
=
MSG_DONTWAIT
+
MSG_NOSIGNAL
;
/* BB add more flags?*/
...
@@ -147,10 +144,8 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
...
@@ -147,10 +144,8 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
cFYI
(
1
,
(
"Sending smb of length %d "
,
smb_buf_length
));
cFYI
(
1
,
(
"Sending smb of length %d "
,
smb_buf_length
));
dump_smb
(
smb_buffer
,
smb_buf_length
+
4
);
dump_smb
(
smb_buffer
,
smb_buf_length
+
4
);
temp_fs
=
get_fs
();
/* we must turn off socket api parm checking */
set_fs
(
get_ds
());
while
(
iov
.
iov_len
>
0
)
{
while
(
iov
.
iov_len
>
0
)
{
rc
=
sock_sendmsg
(
ssocket
,
&
smb_msg
,
smb_buf_length
+
4
);
rc
=
kernel_sendmsg
(
ssocket
,
&
smb_msg
,
&
iov
,
1
,
smb_buf_length
+
4
);
if
((
rc
==
-
ENOSPC
)
||
(
rc
==
-
EAGAIN
))
{
if
((
rc
==
-
ENOSPC
)
||
(
rc
==
-
EAGAIN
))
{
i
++
;
i
++
;
if
(
i
>
60
)
{
if
(
i
>
60
)
{
...
@@ -169,7 +164,6 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
...
@@ -169,7 +164,6 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
iov
.
iov_base
+=
rc
;
iov
.
iov_base
+=
rc
;
iov
.
iov_len
-=
rc
;
iov
.
iov_len
-=
rc
;
}
}
set_fs
(
temp_fs
);
if
(
rc
<
0
)
{
if
(
rc
<
0
)
{
cERROR
(
1
,(
"Error %d sending data on socket to server."
,
rc
));
cERROR
(
1
,(
"Error %d sending data on socket to server."
,
rc
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment