diff options
author | Christian Schoenebeck <linux_oss@crudebyte.com> | 2022-07-16 00:32:34 +0300 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2022-10-05 01:05:41 +0300 |
commit | 1effdbf94a728b74b23a24ce7b6f1d1d9a2480a4 (patch) | |
tree | 8aa0abad78d59d752febf5d29af1f082440d8174 /include/net/9p | |
parent | 58d331312bf78a10740fc3c6c370c98e8c53fa6b (diff) | |
download | linux-1effdbf94a728b74b23a24ce7b6f1d1d9a2480a4.tar.xz |
net/9p: add p9_msg_buf_size()
This new function calculates a buffer size suitable for holding the
intended 9p request or response. For rather small message types (which
applies to almost all 9p message types actually) simply use hard coded
values. For some variable-length and potentially large message types
calculate a more precise value according to what data is actually
transmitted to avoid unnecessarily huge buffers.
So p9_msg_buf_size() divides the individual 9p message types into 3
message size categories:
- dynamically calculated message size (i.e. potentially large)
- 8k hard coded message size
- 4k hard coded message size
As for the latter two hard coded message types: for most 9p message
types it is pretty obvious whether they would always fit into 4k or
8k. But for some of them it depends on the maximum directory entry
name length allowed by OS and filesystem for determining into which
of the two size categories they would fit into. Currently Linux
supports directory entry names up to NAME_MAX (255), however when
comparing the limitation of individual filesystems, ReiserFS
theoretically supports up to slightly below 4k long names. So in
order to make this code more future proof, and as revisiting it
later on is a bit tedious and has the potential to miss out details,
the decision [1] was made to take 4k as basis as for max. name length.
Link: https://lkml.kernel.org/r/bd6be891cf67e867688e8c8796d06408bfafa0d9.1657920926.git.linux_oss@crudebyte.com
Link: https://lore.kernel.org/all/5564296.oo812IJUPE@silver/ [1]
Signed-off-by: Christian Schoenebeck <linux_oss@crudebyte.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Diffstat (limited to 'include/net/9p')
0 files changed, 0 insertions, 0 deletions