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
e4ccfe30
Commit
e4ccfe30
authored
Oct 22, 2020
by
Chuck Lever
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NFSD: Update the NFSv3 READDIR3res encoder to use struct xdr_stream
Signed-off-by:
Chuck Lever
<
chuck.lever@oracle.com
>
parent
a1409e2d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
20 deletions
+38
-20
fs/nfsd/nfs3proc.c
fs/nfsd/nfs3proc.c
+2
-1
fs/nfsd/nfs3xdr.c
fs/nfsd/nfs3xdr.c
+35
-19
fs/nfsd/xdr3.h
fs/nfsd/xdr3.h
+1
-0
No files found.
fs/nfsd/nfs3proc.c
View file @
e4ccfe30
...
...
@@ -447,7 +447,8 @@ static void nfsd3_init_dirlist_pages(struct svc_rqst *rqstp,
* and reserve room for the NULL ptr & eof flag (-2 words) */
resp
->
buflen
=
(
count
>>
2
)
-
2
;
resp
->
buffer
=
page_address
(
*
rqstp
->
rq_next_page
);
resp
->
pages
=
rqstp
->
rq_next_page
;
resp
->
buffer
=
page_address
(
*
resp
->
pages
);
while
(
count
>
0
)
{
rqstp
->
rq_next_page
++
;
count
-=
PAGE_SIZE
;
...
...
fs/nfsd/nfs3xdr.c
View file @
e4ccfe30
...
...
@@ -158,6 +158,19 @@ encode_fh(__be32 *p, struct svc_fh *fhp)
return
p
+
XDR_QUADLEN
(
size
);
}
static
bool
svcxdr_encode_cookieverf3
(
struct
xdr_stream
*
xdr
,
const
__be32
*
verf
)
{
__be32
*
p
;
p
=
xdr_reserve_space
(
xdr
,
NFS3_COOKIEVERFSIZE
);
if
(
!
p
)
return
false
;
memcpy
(
p
,
verf
,
NFS3_COOKIEVERFSIZE
);
return
true
;
}
static
bool
svcxdr_encode_writeverf3
(
struct
xdr_stream
*
xdr
,
const
__be32
*
verf
)
{
...
...
@@ -1124,27 +1137,30 @@ nfs3svc_encode_linkres(struct svc_rqst *rqstp, __be32 *p)
int
nfs3svc_encode_readdirres
(
struct
svc_rqst
*
rqstp
,
__be32
*
p
)
{
struct
xdr_stream
*
xdr
=
&
rqstp
->
rq_res_stream
;
struct
nfsd3_readdirres
*
resp
=
rqstp
->
rq_resp
;
*
p
++
=
resp
->
status
;
p
=
encode_post_op_attr
(
rqstp
,
p
,
&
resp
->
fh
);
if
(
resp
->
status
==
0
)
{
/* stupid readdir cookie */
memcpy
(
p
,
resp
->
verf
,
8
);
p
+=
2
;
xdr_ressize_check
(
rqstp
,
p
);
if
(
rqstp
->
rq_res
.
head
[
0
].
iov_len
+
(
2
<<
2
)
>
PAGE_SIZE
)
return
1
;
/*No room for trailer */
rqstp
->
rq_res
.
page_len
=
(
resp
->
count
)
<<
2
;
/* add the 'tail' to the end of the 'head' page - page 0. */
rqstp
->
rq_res
.
tail
[
0
].
iov_base
=
p
;
*
p
++
=
0
;
/* no more entries */
*
p
++
=
htonl
(
resp
->
common
.
err
==
nfserr_eof
);
rqstp
->
rq_res
.
tail
[
0
].
iov_len
=
2
<<
2
;
return
1
;
}
else
return
xdr_ressize_check
(
rqstp
,
p
);
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
;
if
(
!
svcxdr_encode_cookieverf3
(
xdr
,
resp
->
verf
))
return
0
;
xdr_write_pages
(
xdr
,
resp
->
pages
,
0
,
resp
->
count
<<
2
);
/* no more entries */
if
(
xdr_stream_encode_item_absent
(
xdr
)
<
0
)
return
0
;
if
(
xdr_stream_encode_bool
(
xdr
,
resp
->
common
.
err
==
nfserr_eof
)
<
0
)
return
0
;
break
;
default:
if
(
!
svcxdr_encode_post_op_attr
(
rqstp
,
xdr
,
&
resp
->
fh
))
return
0
;
}
return
1
;
}
static
__be32
*
...
...
fs/nfsd/xdr3.h
View file @
e4ccfe30
...
...
@@ -176,6 +176,7 @@ struct nfsd3_readdirres {
struct
svc_fh
scratch
;
int
count
;
__be32
verf
[
2
];
struct
page
**
pages
;
struct
readdir_cd
common
;
__be32
*
buffer
;
...
...
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