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
cc9bcdad
Commit
cc9bcdad
authored
Oct 22, 2020
by
Chuck Lever
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NFSD: Update the NFSv3 READ3res encode to use struct xdr_stream
Signed-off-by:
Chuck Lever
<
chuck.lever@oracle.com
>
parent
9a9c8923
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
20 deletions
+45
-20
fs/nfsd/nfs3proc.c
fs/nfsd/nfs3proc.c
+1
-0
fs/nfsd/nfs3xdr.c
fs/nfsd/nfs3xdr.c
+23
-20
fs/nfsd/xdr3.h
fs/nfsd/xdr3.h
+1
-0
include/linux/sunrpc/xdr.h
include/linux/sunrpc/xdr.h
+20
-0
No files found.
fs/nfsd/nfs3proc.c
View file @
cc9bcdad
...
...
@@ -159,6 +159,7 @@ nfsd3_proc_read(struct svc_rqst *rqstp)
v
=
0
;
len
=
argp
->
count
;
resp
->
pages
=
rqstp
->
rq_next_page
;
while
(
len
>
0
)
{
struct
page
*
page
=
*
(
rqstp
->
rq_next_page
++
);
...
...
fs/nfsd/nfs3xdr.c
View file @
cc9bcdad
...
...
@@ -1005,30 +1005,33 @@ nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p)
int
nfs3svc_encode_readres
(
struct
svc_rqst
*
rqstp
,
__be32
*
p
)
{
struct
xdr_stream
*
xdr
=
&
rqstp
->
rq_res_stream
;
struct
nfsd3_readres
*
resp
=
rqstp
->
rq_resp
;
struct
kvec
*
head
=
rqstp
->
rq_res
.
head
;
*
p
++
=
resp
->
status
;
p
=
encode_post_op_attr
(
rqstp
,
p
,
&
resp
->
fh
);
if
(
resp
->
status
==
0
)
{
*
p
++
=
htonl
(
resp
->
count
);
*
p
++
=
htonl
(
resp
->
eof
);
*
p
++
=
htonl
(
resp
->
count
);
/* xdr opaque count */
xdr_ressize_check
(
rqstp
,
p
);
/* now update rqstp->rq_res to reflect data as well */
rqstp
->
rq_res
.
page_len
=
resp
->
count
;
if
(
resp
->
count
&
3
)
{
/* need to pad the tail */
rqstp
->
rq_res
.
tail
[
0
].
iov_base
=
p
;
*
p
=
0
;
rqstp
->
rq_res
.
tail
[
0
].
iov_len
=
4
-
(
resp
->
count
&
3
);
}
if
(
svc_encode_result_payload
(
rqstp
,
head
->
iov_len
,
resp
->
count
))
if
(
!
svcxdr_encode_nfsstat3
(
xdr
,
resp
->
status
))
return
0
;
switch
(
resp
->
status
)
{
case
nfs_ok
:
if
(
!
svcxdr_encode_post_op_attr
(
rqstp
,
xdr
,
&
resp
->
fh
))
return
0
;
return
1
;
}
else
return
xdr_ressize_check
(
rqstp
,
p
);
if
(
xdr_stream_encode_u32
(
xdr
,
resp
->
count
)
<
0
)
return
0
;
if
(
xdr_stream_encode_bool
(
xdr
,
resp
->
eof
)
<
0
)
return
0
;
if
(
xdr_stream_encode_u32
(
xdr
,
resp
->
count
)
<
0
)
return
0
;
xdr_write_pages
(
xdr
,
resp
->
pages
,
rqstp
->
rq_res
.
page_base
,
resp
->
count
);
if
(
svc_encode_result_payload
(
rqstp
,
head
->
iov_len
,
resp
->
count
)
<
0
)
return
0
;
break
;
default:
if
(
!
svcxdr_encode_post_op_attr
(
rqstp
,
xdr
,
&
resp
->
fh
))
return
0
;
}
return
1
;
}
/* WRITE */
...
...
fs/nfsd/xdr3.h
View file @
cc9bcdad
...
...
@@ -145,6 +145,7 @@ struct nfsd3_readres {
struct
svc_fh
fh
;
unsigned
long
count
;
__u32
eof
;
struct
page
**
pages
;
};
struct
nfsd3_writeres
{
...
...
include/linux/sunrpc/xdr.h
View file @
cc9bcdad
...
...
@@ -394,6 +394,26 @@ static inline int xdr_stream_encode_item_absent(struct xdr_stream *xdr)
return
len
;
}
/**
* xdr_stream_encode_bool - Encode a "not present" list item
* @xdr: pointer to xdr_stream
* @n: boolean value to encode
*
* Return values:
* On success, returns length in bytes of XDR buffer consumed
* %-EMSGSIZE on XDR buffer overflow
*/
static
inline
int
xdr_stream_encode_bool
(
struct
xdr_stream
*
xdr
,
__u32
n
)
{
const
size_t
len
=
XDR_UNIT
;
__be32
*
p
=
xdr_reserve_space
(
xdr
,
len
);
if
(
unlikely
(
!
p
))
return
-
EMSGSIZE
;
*
p
=
n
?
xdr_one
:
xdr_zero
;
return
len
;
}
/**
* xdr_stream_encode_u32 - Encode a 32-bit integer
* @xdr: pointer to xdr_stream
...
...
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