Commit Graph

3 Commits

Author SHA1 Message Date
Xavier Deguillard
a7a8778dcf nfs: add a serializedSize to XdrTrait
Summary:
This simplifies a handful of tests and will make writing the READDIR RPC a bit
less magic when computing the amount of memory needed per entry.

Reviewed By: chadaustin

Differential Revision: D26802312

fbshipit-source-id: fc66cb68f721ed34c8f9879cdda2cd8db6ed8daa
2021-03-18 10:08:50 -07:00
Xavier Deguillard
8125e2e115 nfs: de-duplicate some common test functions
Summary:
The ser, de and roundtrip are duplicated 3 times in the various tests, let's
move them into a common library.

Reviewed By: chadaustin

Differential Revision: D26675989

fbshipit-source-id: 1da0bc33429795a889b72c76fa18e5fa3cb7df6f
2021-03-04 09:59:46 -08:00
Xavier Deguillard
9f1662031c nfs: de-dup XdrVariant<nfsstat3, ...> code
Summary:
The NFS RPC description is filled with variant over nfsstat3 with only 2 cases:
NFS3_OK, and the default one. I was feeling bad having to write the same code
again and again for the deserialize part of the XdrTrait, and thus came up with
a template solution that enables us to remove all of the boilerplate code.

The only drawback is that this moves the variant one additional layer down, and
that means an extra layer of brace when initializing it. From what I know,
this is caused by the -Wmissing-braces warning, maybe we could remove that
warning?

Reviewed By: kmancini

Differential Revision: D26627163

fbshipit-source-id: ab56dee42273f180b2edf4f529221a15154ac2fb
2021-02-26 08:01:25 -08:00