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
8b704498
Commit
8b704498
authored
Nov 06, 2020
by
Chuck Lever
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NFSD: Update the NFSv3 FSSTAT3res encoder to use struct xdr_stream
Signed-off-by:
Chuck Lever
<
chuck.lever@oracle.com
>
parent
4d74380a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
14 deletions
+44
-14
fs/nfsd/nfs3xdr.c
fs/nfsd/nfs3xdr.c
+44
-14
No files found.
fs/nfsd/nfs3xdr.c
View file @
8b704498
...
...
@@ -17,6 +17,13 @@
#define NFSDDBG_FACILITY NFSDDBG_XDR
/*
* Force construction of an empty post-op attr
*/
static
const
struct
svc_fh
nfs3svc_null_fh
=
{
.
fh_no_wcc
=
true
,
};
/*
* Mapping of S_IF* types to NFS file types
*/
...
...
@@ -1392,27 +1399,50 @@ nfs3svc_encode_entry_plus(void *cd, const char *name,
return
encode_entry
(
cd
,
name
,
namlen
,
offset
,
ino
,
d_type
,
1
);
}
static
bool
svcxdr_encode_fsstat3resok
(
struct
xdr_stream
*
xdr
,
const
struct
nfsd3_fsstatres
*
resp
)
{
const
struct
kstatfs
*
s
=
&
resp
->
stats
;
u64
bs
=
s
->
f_bsize
;
__be32
*
p
;
p
=
xdr_reserve_space
(
xdr
,
XDR_UNIT
*
13
);
if
(
!
p
)
return
false
;
p
=
xdr_encode_hyper
(
p
,
bs
*
s
->
f_blocks
);
/* total bytes */
p
=
xdr_encode_hyper
(
p
,
bs
*
s
->
f_bfree
);
/* free bytes */
p
=
xdr_encode_hyper
(
p
,
bs
*
s
->
f_bavail
);
/* user available bytes */
p
=
xdr_encode_hyper
(
p
,
s
->
f_files
);
/* total inodes */
p
=
xdr_encode_hyper
(
p
,
s
->
f_ffree
);
/* free inodes */
p
=
xdr_encode_hyper
(
p
,
s
->
f_ffree
);
/* user available inodes */
*
p
=
cpu_to_be32
(
resp
->
invarsec
);
/* mean unchanged time */
return
true
;
}
/* FSSTAT */
int
nfs3svc_encode_fsstatres
(
struct
svc_rqst
*
rqstp
,
__be32
*
p
)
{
struct
xdr_stream
*
xdr
=
&
rqstp
->
rq_res_stream
;
struct
nfsd3_fsstatres
*
resp
=
rqstp
->
rq_resp
;
struct
kstatfs
*
s
=
&
resp
->
stats
;
u64
bs
=
s
->
f_bsize
;
*
p
++
=
resp
->
status
;
*
p
++
=
xdr_zero
;
/* no post_op_attr */
if
(
resp
->
status
==
0
)
{
p
=
xdr_encode_hyper
(
p
,
bs
*
s
->
f_blocks
);
/* total bytes */
p
=
xdr_encode_hyper
(
p
,
bs
*
s
->
f_bfree
);
/* free bytes */
p
=
xdr_encode_hyper
(
p
,
bs
*
s
->
f_bavail
);
/* user available bytes */
p
=
xdr_encode_hyper
(
p
,
s
->
f_files
);
/* total inodes */
p
=
xdr_encode_hyper
(
p
,
s
->
f_ffree
);
/* free inodes */
p
=
xdr_encode_hyper
(
p
,
s
->
f_ffree
);
/* user available inodes */
*
p
++
=
htonl
(
resp
->
invarsec
);
/* mean unchanged time */
if
(
!
svcxdr_encode_nfsstat3
(
xdr
,
resp
->
status
))
return
0
;
switch
(
resp
->
status
)
{
case
nfs_ok
:
if
(
!
svcxdr_encode_post_op_attr
(
rqstp
,
xdr
,
&
nfs3svc_null_fh
))
return
0
;
if
(
!
svcxdr_encode_fsstat3resok
(
xdr
,
resp
))
return
0
;
break
;
default:
if
(
!
svcxdr_encode_post_op_attr
(
rqstp
,
xdr
,
&
nfs3svc_null_fh
))
return
0
;
}
return
xdr_ressize_check
(
rqstp
,
p
);
return
1
;
}
/* FSINFO */
...
...
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