diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-09-27 22:27:01 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-09-27 22:27:01 -0600 |
commit | 7ec97df3ee8edfd102fe573eaa61cf4e5c6284cb (patch) | |
tree | e696f30da5645cdd3cb09971d9544622e9943bcf /lib9p/include | |
parent | fa357459f88bb8f0170d1a68df66e7d068d59996 (diff) |
wip fixes
Diffstat (limited to 'lib9p/include')
-rw-r--r-- | lib9p/include/lib9p/9p.h | 14 | ||||
-rw-r--r-- | lib9p/include/lib9p/_types.h | 2 | ||||
-rw-r--r-- | lib9p/include/lib9p/srv.h | 5 |
3 files changed, 12 insertions, 9 deletions
diff --git a/lib9p/include/lib9p/9p.h b/lib9p/include/lib9p/9p.h index a55f08f..954498e 100644 --- a/lib9p/include/lib9p/9p.h +++ b/lib9p/include/lib9p/9p.h @@ -7,6 +7,9 @@ #ifndef _LIB9P_9P_H_ #define _LIB9P_9P_H_ +#include <stdbool.h> +#include <sys/types.h> /* for ssize_t */ + #include <lib9p/linux-errno.h> #include <lib9p/_types.h> @@ -14,8 +17,8 @@ #define LIB9P_NOFID ((uint32_t)~0U) struct lib9p_ctx; -enum lib9p_version lib9p_ctx_version(lib9p_ctx *); -uint32_t lib9p_ctx_max_msg_size(lib9p_ctx *); +enum lib9p_version lib9p_ctx_version(struct lib9p_ctx *); +uint32_t lib9p_ctx_max_msg_size(struct lib9p_ctx *); /** Write an static error into ctx, return -1. */ int lib9p_error(struct lib9p_ctx *ctx, uint32_t linux_errno, char const *msg); @@ -50,10 +53,9 @@ ssize_t lib9p_unmarshal_size(struct lib9p_ctx *ctx, uint8_t *net_bytes); * @return ret_typ : the mesage type * @return ret_tag : the message-ID tag * @return ret_body : the message body, must be at least lib9p_unmarshal_size() bytes - * @return the message type, or -1 on error */ -bool lib9p_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, - enum lib9p_msg_typ *ret_typ, uint16_t *ret_tag, void *ret_body); +void lib9p_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, + enum lib9p_msg_type *ret_typ, uint16_t *ret_tag, void *ret_body); /** * Marshal a `struct lib9p_msg_{typ}` structure into a byte-array. @@ -66,7 +68,7 @@ bool lib9p_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, * @return ret_bytes : the buffer to encode to, must be at be at least lib9p_ctx_max_msg_size(ctx) bytes * @return whether there was an error (false=success, true=error) */ -bool lib9p_marshal(struct lib9p_ctx *ctx, uint8_t typ, uint16_t tag, void *body, +bool lib9p_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, uint16_t tag, void *body, uint8_t *ret_bytes); #endif _LIB9P_9P_H_ diff --git a/lib9p/include/lib9p/_types.h b/lib9p/include/lib9p/_types.h index 7dcd8e2..7f320a5 100644 --- a/lib9p/include/lib9p/_types.h +++ b/lib9p/include/lib9p/_types.h @@ -3,7 +3,7 @@ #ifndef _LIB9P__TYPES_H_ #define _LIB9P__TYPES_H_ -#include <stdint.h> +#include <stdint.h> /* for uint{n}_t types */ /* versions *******************************************************************/ diff --git a/lib9p/include/lib9p/srv.h b/lib9p/include/lib9p/srv.h index 3b8b21e..a8bd9c7 100644 --- a/lib9p/include/lib9p/srv.h +++ b/lib9p/include/lib9p/srv.h @@ -2,12 +2,13 @@ #define _LIB9P_SRV_H_ #include <libcr/coroutine.h> +#include <libcr_ipc/chan.h> struct lib9p_srvreq; struct lib9p_srv { - int sockfd; - cr_chan_t(lib9p_srvreq *) reqch; + int sockfd; + cr_chan_t(struct lib9p_srvreq *) reqch; }; COROUTINE lib9p_srv_read_cr(void *_srv); |