|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH 3/8] lib/uk9p: Add 9P protocol core definitions
Hey Christian,where did you get your 9PFS protocol specification from? I was wondering if you derived your names, constants and API function from there. Maybe you want to add a comment with the reference within one of the headers. On 19.06.19 09:03, Cristian Banu wrote: This patch adds the 9P protocol core definitions for the structures it uses and the wire format required. Signed-off-by: Cristian Banu <cristb@xxxxxxxxx> --- lib/uk9p/include/uk/9p_core.h | 249 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 lib/uk9p/include/uk/9p_core.h diff --git a/lib/uk9p/include/uk/9p_core.h b/lib/uk9p/include/uk/9p_core.h new file mode 100644 index 000000000000..8f2cdf6b2a66 --- /dev/null +++ b/lib/uk9p/include/uk/9p_core.h @@ -0,0 +1,249 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Authors: Cristian Banu <cristb@xxxxxxxxx> + * + * Copyright (c) 2019, University Politehnica of Bucharest. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY. + */ + +#ifndef __UK_9P_CORE__ +#define __UK_9P_CORE__ + +#include <string.h> You should also include the integer definitions (uint32_t, etc.) here because you are using them in this file. Are these values treated as bits, meaning that you can have multiple of them bitwise-ORed in a uk_9p_qid_type field? See my next comment, too. Usually, we defined bits and flags with macros and used enums when you hand-over just a single value. Same here. Out of curiosity: Does 9p has something like potential difference of endianess on the wire and the host?; I mean something similar to what you find in networking protocols. If this is the case, it may make sense to add a TODO comment that we are not supporting this currently. Can you add an assertion to check that stat != NULL? + memset(stat, ~0, sizeof(struct uk_9p_stat)); + stat->name.size = 0; + stat->uid.size = 0; + stat->gid.size = 0; + stat->muid.size = 0; + stat->extension.size = 0; +} + +/** + * No tag, used by the Tversion/Rversion pair of request/reply messages. + */ +#define UK_9P_NOTAG UINT16_MAX Remember to include the header that defines the limits. + +/** + * Maximum available tag for use. + * UK_9P_NOTAG (~0) is reserved by the 9P RFC for representing no tag. + */ +#define UK_9P_MAXTAG (UINT16_MAX - 1) + +/** + * Number of possible tags, including NOTAG. + */ +#define UK_9P_NUMTAGS ((uint32_t)(UINT16_MAX) + 1) + +/** + * No fid, used to mark a fid field as unused. + */ +#define UK_9P_NOFID UINT32_MAX + +/** + * No n_uname in TATTACH requests, used to mark the field as unused. + */ +#define UK_9P_NONUNAME UINT32_MAX + +#ifdef __cplusplus +} +#endif + +#endif /* __UK_9P_CORE__ */ _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |