diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-09 17:01:06 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-09 17:01:06 -0600 |
commit | bb5afed7a0eeaf361be1e29b3a3ab8ace2865b39 (patch) | |
tree | d311d7c8a658079ee5280d5d057203a5d501091c /lib9p/include | |
parent | cb8893dd08b7b359f45ef225acd2f6e103d38bba (diff) |
lib9p: finish refactor
Diffstat (limited to 'lib9p/include')
-rw-r--r-- | lib9p/include/lib9p/9p.generated.h | 2 | ||||
-rw-r--r-- | lib9p/include/lib9p/9p.h | 17 |
2 files changed, 12 insertions, 7 deletions
diff --git a/lib9p/include/lib9p/9p.generated.h b/lib9p/include/lib9p/9p.generated.h index 2fb7a3e..6248ec7 100644 --- a/lib9p/include/lib9p/9p.generated.h +++ b/lib9p/include/lib9p/9p.generated.h @@ -1,4 +1,4 @@ -/* Generated by `./lib9p/idl.gen lib9p/idl/01-9P2000.9p lib9p/idl/02-9P2000.e.9p lib9p/idl/02-9P2000.u.9p`. DO NOT EDIT! */ +/* Generated by `./lib9p/idl.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */ #ifndef _LIB9P_9P_H_ # error Do not include <lib9p/9p.generated.h> directly; include <lib9p/9p.h> instead diff --git a/lib9p/include/lib9p/9p.h b/lib9p/include/lib9p/9p.h index 616a0e1..3ad52f1 100644 --- a/lib9p/include/lib9p/9p.h +++ b/lib9p/include/lib9p/9p.h @@ -11,7 +11,6 @@ #include <stdbool.h> #include <sys/types.h> /* for ssize_t */ -#include <lib9p/9p.generated.h> #include <lib9p/linux-errno.h> /* configuration **************************************************************/ @@ -21,9 +20,14 @@ #ifndef CONFIG_9P_MAX_ERR_SIZE # error config.h must define CONFIG_9P_MAX_ERR_SIZE #endif +#ifndef CONFIG_9P_ENABLE_9P2000 +# define CONFIG_9P_ENABLE_9P2000 +#endif /******************************************************************************/ +#include <lib9p/9p.generated.h> /* *after* config.h */ + #define LIB9P_NOTAG ((uint16_t)~0U) #define LIB9P_NOFID ((uint32_t)~0U) @@ -85,21 +89,22 @@ ssize_t lib9p_validate(struct lib9p_ctx *ctx, uint8_t *net_bytes); * @param net_bytes : the complete message, starting with the "size[4]" * * @return ret_typ : the mesage type - * @return ret_tag : the message-ID tag * @return ret_body : the message body, must be at least lib9p_validate() bytes */ void lib9p_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, - enum lib9p_msg_type *ret_typ, uint16_t *ret_tag, void *ret_body); + enum lib9p_msg_type *ret_typ, void *ret_body); /** * Marshal a `struct lib9p_msg_{typ}` structure into a byte-array. * * lib9p_marshal does no validation; it trusts that the programmer - * won't give it garbage input. + * won't give it garbage input. However, just as it doesn't marshal + * struct fields that aren't in ctx->version, it won't marshal + * bitfield bits that aren't in ctx->version; it applies a + * version-specific mask to bitfields. * * @param ctx : negotiated protocol parameters, where to record errors * @param typ : the message type - * @param tag : the message-ID tag * @param msg : the message to encode * * @return ret_bytes : the buffer to encode to, must be at be at least lib9p_ctx_max_msg_size(ctx) bytes @@ -107,7 +112,7 @@ void lib9p_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, * * @errno LINUX_ERANGE: reply does not fit in ctx->max_msg_size */ -bool lib9p_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, uint16_t tag, void *body, +bool lib9p_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body, uint8_t *ret_bytes); #endif _LIB9P_9P_H_ |