diff options
Diffstat (limited to 'lib9p/9p.generated.c')
-rw-r--r-- | lib9p/9p.generated.c | 448 |
1 files changed, 214 insertions, 234 deletions
diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c index 8819458..49bab14 100644 --- a/lib9p/9p.generated.c +++ b/lib9p/9p.generated.c @@ -6,10 +6,12 @@ #include <string.h> /* for memset() */ #include <libmisc/assert.h> +#include <libmisc/endian.h> #include <lib9p/9p.h> -#include "internal.h" +#include "tables.h" +#include "utf8.h" /* utilities ******************************************************************/ #if CONFIG_9P_ENABLE_9P2000 @@ -46,230 +48,6 @@ */ #define is_ver(ctx, ver) _is_ver_##ver((ctx)->version) -/* strings ********************************************************************/ - -const char *const _lib9p_table_ver_name[LIB9P_VER_NUM] = { - [LIB9P_VER_unknown] = "unknown", -#if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = "9P2000", -#endif /* CONFIG_9P_ENABLE_9P2000 */ -#if CONFIG_9P_ENABLE_9P2000_L - [LIB9P_VER_9P2000_L] = "9P2000.L", -#endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = "9P2000.e", -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000_p9p - [LIB9P_VER_9P2000_p9p] = "9P2000.p9p", -#endif /* CONFIG_9P_ENABLE_9P2000_p9p */ -#if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = "9P2000.u", -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -}; - -#define _MSG_NAME(typ) [LIB9P_TYP_##typ] = #typ -const char *const _lib9p_table_msg_name[LIB9P_VER_NUM][0x100] = { - [LIB9P_VER_unknown] = { - _MSG_NAME(Tversion), - _MSG_NAME(Rversion), - _MSG_NAME(Rerror), - }, -#if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = { - _MSG_NAME(Tversion), - _MSG_NAME(Rversion), - _MSG_NAME(Tauth), - _MSG_NAME(Rauth), - _MSG_NAME(Tattach), - _MSG_NAME(Rattach), - _MSG_NAME(Rerror), - _MSG_NAME(Tflush), - _MSG_NAME(Rflush), - _MSG_NAME(Twalk), - _MSG_NAME(Rwalk), - _MSG_NAME(Topen), - _MSG_NAME(Ropen), - _MSG_NAME(Tcreate), - _MSG_NAME(Rcreate), - _MSG_NAME(Tread), - _MSG_NAME(Rread), - _MSG_NAME(Twrite), - _MSG_NAME(Rwrite), - _MSG_NAME(Tclunk), - _MSG_NAME(Rclunk), - _MSG_NAME(Tremove), - _MSG_NAME(Rremove), - _MSG_NAME(Tstat), - _MSG_NAME(Rstat), - _MSG_NAME(Twstat), - _MSG_NAME(Rwstat), - }, -#endif /* CONFIG_9P_ENABLE_9P2000 */ -#if CONFIG_9P_ENABLE_9P2000_L - [LIB9P_VER_9P2000_L] = { - _MSG_NAME(Rlerror), - _MSG_NAME(Tstatfs), - _MSG_NAME(Rstatfs), - _MSG_NAME(Tlopen), - _MSG_NAME(Rlopen), - _MSG_NAME(Tlcreate), - _MSG_NAME(Rlcreate), - _MSG_NAME(Tsymlink), - _MSG_NAME(Rsymlink), - _MSG_NAME(Tmknod), - _MSG_NAME(Rmknod), - _MSG_NAME(Trename), - _MSG_NAME(Rrename), - _MSG_NAME(Treadlink), - _MSG_NAME(Rreadlink), - _MSG_NAME(Tgetattr), - _MSG_NAME(Rgetattr), - _MSG_NAME(Tsetattr), - _MSG_NAME(Rsetattr), - _MSG_NAME(Txattrwalk), - _MSG_NAME(Rxattrwalk), - _MSG_NAME(Txattrcreate), - _MSG_NAME(Rxattrcreate), - _MSG_NAME(Treaddir), - _MSG_NAME(Rreaddir), - _MSG_NAME(Tfsync), - _MSG_NAME(Rfsync), - _MSG_NAME(Tlock), - _MSG_NAME(Rlock), - _MSG_NAME(Tgetlock), - _MSG_NAME(Rgetlock), - _MSG_NAME(Tlink), - _MSG_NAME(Rlink), - _MSG_NAME(Tmkdir), - _MSG_NAME(Rmkdir), - _MSG_NAME(Trenameat), - _MSG_NAME(Rrenameat), - _MSG_NAME(Tunlinkat), - _MSG_NAME(Runlinkat), - _MSG_NAME(Tversion), - _MSG_NAME(Rversion), - _MSG_NAME(Tauth), - _MSG_NAME(Rauth), - _MSG_NAME(Tattach), - _MSG_NAME(Rattach), - _MSG_NAME(Rerror), - _MSG_NAME(Tflush), - _MSG_NAME(Rflush), - _MSG_NAME(Twalk), - _MSG_NAME(Rwalk), - _MSG_NAME(Tread), - _MSG_NAME(Rread), - _MSG_NAME(Twrite), - _MSG_NAME(Rwrite), - _MSG_NAME(Tclunk), - _MSG_NAME(Rclunk), - _MSG_NAME(Tremove), - _MSG_NAME(Rremove), - }, -#endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = { - _MSG_NAME(Tversion), - _MSG_NAME(Rversion), - _MSG_NAME(Tauth), - _MSG_NAME(Rauth), - _MSG_NAME(Tattach), - _MSG_NAME(Rattach), - _MSG_NAME(Rerror), - _MSG_NAME(Tflush), - _MSG_NAME(Rflush), - _MSG_NAME(Twalk), - _MSG_NAME(Rwalk), - _MSG_NAME(Topen), - _MSG_NAME(Ropen), - _MSG_NAME(Tcreate), - _MSG_NAME(Rcreate), - _MSG_NAME(Tread), - _MSG_NAME(Rread), - _MSG_NAME(Twrite), - _MSG_NAME(Rwrite), - _MSG_NAME(Tclunk), - _MSG_NAME(Rclunk), - _MSG_NAME(Tremove), - _MSG_NAME(Rremove), - _MSG_NAME(Tstat), - _MSG_NAME(Rstat), - _MSG_NAME(Twstat), - _MSG_NAME(Rwstat), - _MSG_NAME(Tsession), - _MSG_NAME(Rsession), - _MSG_NAME(Tsread), - _MSG_NAME(Rsread), - _MSG_NAME(Tswrite), - _MSG_NAME(Rswrite), - }, -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000_p9p - [LIB9P_VER_9P2000_p9p] = { - _MSG_NAME(Topenfd), - _MSG_NAME(Ropenfd), - _MSG_NAME(Tversion), - _MSG_NAME(Rversion), - _MSG_NAME(Tauth), - _MSG_NAME(Rauth), - _MSG_NAME(Tattach), - _MSG_NAME(Rattach), - _MSG_NAME(Rerror), - _MSG_NAME(Tflush), - _MSG_NAME(Rflush), - _MSG_NAME(Twalk), - _MSG_NAME(Rwalk), - _MSG_NAME(Topen), - _MSG_NAME(Ropen), - _MSG_NAME(Tcreate), - _MSG_NAME(Rcreate), - _MSG_NAME(Tread), - _MSG_NAME(Rread), - _MSG_NAME(Twrite), - _MSG_NAME(Rwrite), - _MSG_NAME(Tclunk), - _MSG_NAME(Rclunk), - _MSG_NAME(Tremove), - _MSG_NAME(Rremove), - _MSG_NAME(Tstat), - _MSG_NAME(Rstat), - _MSG_NAME(Twstat), - _MSG_NAME(Rwstat), - }, -#endif /* CONFIG_9P_ENABLE_9P2000_p9p */ -#if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = { - _MSG_NAME(Tversion), - _MSG_NAME(Rversion), - _MSG_NAME(Tauth), - _MSG_NAME(Rauth), - _MSG_NAME(Tattach), - _MSG_NAME(Rattach), - _MSG_NAME(Rerror), - _MSG_NAME(Tflush), - _MSG_NAME(Rflush), - _MSG_NAME(Twalk), - _MSG_NAME(Rwalk), - _MSG_NAME(Topen), - _MSG_NAME(Ropen), - _MSG_NAME(Tcreate), - _MSG_NAME(Rcreate), - _MSG_NAME(Tread), - _MSG_NAME(Rread), - _MSG_NAME(Twrite), - _MSG_NAME(Rwrite), - _MSG_NAME(Tclunk), - _MSG_NAME(Rclunk), - _MSG_NAME(Tremove), - _MSG_NAME(Rremove), - _MSG_NAME(Tstat), - _MSG_NAME(Rstat), - _MSG_NAME(Twstat), - _MSG_NAME(Rwstat), - }, -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -}; - /* bitmasks *******************************************************************/ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u @@ -4743,29 +4521,231 @@ static bool marshal_Rswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rswrite *val } #endif /* CONFIG_9P_ENABLE_9P2000_e */ -/* function tables ************************************************************/ +/* tables.h *******************************************************************/ + +const struct _lib9p_ver_tentry _lib9p_table_ver[LIB9P_VER_NUM] = { + [LIB9P_VER_unknown] = {.name="unknown", .min_msg_size=9}, +#if CONFIG_9P_ENABLE_9P2000 + [LIB9P_VER_9P2000] = {.name="9P2000", .min_msg_size=9}, +#endif /* CONFIG_9P_ENABLE_9P2000 */ +#if CONFIG_9P_ENABLE_9P2000_L + [LIB9P_VER_9P2000_L] = {.name="9P2000.L", .min_msg_size=9}, +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000_e + [LIB9P_VER_9P2000_e] = {.name="9P2000.e", .min_msg_size=9}, +#endif /* CONFIG_9P_ENABLE_9P2000_e */ +#if CONFIG_9P_ENABLE_9P2000_p9p + [LIB9P_VER_9P2000_p9p] = {.name="9P2000.p9p", .min_msg_size=9}, +#endif /* CONFIG_9P_ENABLE_9P2000_p9p */ +#if CONFIG_9P_ENABLE_9P2000_u + [LIB9P_VER_9P2000_u] = {.name="9P2000.u", .min_msg_size=13}, +#endif /* CONFIG_9P_ENABLE_9P2000_u */ +}; -const uint32_t _lib9p_table_msg_min_size[LIB9P_VER_NUM] = { - [LIB9P_VER_unknown] = 9, +#define _MSG(typ) [LIB9P_TYP_##typ] = {.name=#typ} +const struct _lib9p_msg_tentry _lib9p_table_msg[LIB9P_VER_NUM][0x100] = { + [LIB9P_VER_unknown] = { + _MSG(Tversion), + _MSG(Rversion), + _MSG(Rerror), + }, #if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = 9, + [LIB9P_VER_9P2000] = { + _MSG(Tversion), + _MSG(Rversion), + _MSG(Tauth), + _MSG(Rauth), + _MSG(Tattach), + _MSG(Rattach), + _MSG(Rerror), + _MSG(Tflush), + _MSG(Rflush), + _MSG(Twalk), + _MSG(Rwalk), + _MSG(Topen), + _MSG(Ropen), + _MSG(Tcreate), + _MSG(Rcreate), + _MSG(Tread), + _MSG(Rread), + _MSG(Twrite), + _MSG(Rwrite), + _MSG(Tclunk), + _MSG(Rclunk), + _MSG(Tremove), + _MSG(Rremove), + _MSG(Tstat), + _MSG(Rstat), + _MSG(Twstat), + _MSG(Rwstat), + }, #endif /* CONFIG_9P_ENABLE_9P2000 */ #if CONFIG_9P_ENABLE_9P2000_L - [LIB9P_VER_9P2000_L] = 9, + [LIB9P_VER_9P2000_L] = { + _MSG(Rlerror), + _MSG(Tstatfs), + _MSG(Rstatfs), + _MSG(Tlopen), + _MSG(Rlopen), + _MSG(Tlcreate), + _MSG(Rlcreate), + _MSG(Tsymlink), + _MSG(Rsymlink), + _MSG(Tmknod), + _MSG(Rmknod), + _MSG(Trename), + _MSG(Rrename), + _MSG(Treadlink), + _MSG(Rreadlink), + _MSG(Tgetattr), + _MSG(Rgetattr), + _MSG(Tsetattr), + _MSG(Rsetattr), + _MSG(Txattrwalk), + _MSG(Rxattrwalk), + _MSG(Txattrcreate), + _MSG(Rxattrcreate), + _MSG(Treaddir), + _MSG(Rreaddir), + _MSG(Tfsync), + _MSG(Rfsync), + _MSG(Tlock), + _MSG(Rlock), + _MSG(Tgetlock), + _MSG(Rgetlock), + _MSG(Tlink), + _MSG(Rlink), + _MSG(Tmkdir), + _MSG(Rmkdir), + _MSG(Trenameat), + _MSG(Rrenameat), + _MSG(Tunlinkat), + _MSG(Runlinkat), + _MSG(Tversion), + _MSG(Rversion), + _MSG(Tauth), + _MSG(Rauth), + _MSG(Tattach), + _MSG(Rattach), + _MSG(Rerror), + _MSG(Tflush), + _MSG(Rflush), + _MSG(Twalk), + _MSG(Rwalk), + _MSG(Tread), + _MSG(Rread), + _MSG(Twrite), + _MSG(Rwrite), + _MSG(Tclunk), + _MSG(Rclunk), + _MSG(Tremove), + _MSG(Rremove), + }, #endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = 9, + [LIB9P_VER_9P2000_e] = { + _MSG(Tversion), + _MSG(Rversion), + _MSG(Tauth), + _MSG(Rauth), + _MSG(Tattach), + _MSG(Rattach), + _MSG(Rerror), + _MSG(Tflush), + _MSG(Rflush), + _MSG(Twalk), + _MSG(Rwalk), + _MSG(Topen), + _MSG(Ropen), + _MSG(Tcreate), + _MSG(Rcreate), + _MSG(Tread), + _MSG(Rread), + _MSG(Twrite), + _MSG(Rwrite), + _MSG(Tclunk), + _MSG(Rclunk), + _MSG(Tremove), + _MSG(Rremove), + _MSG(Tstat), + _MSG(Rstat), + _MSG(Twstat), + _MSG(Rwstat), + _MSG(Tsession), + _MSG(Rsession), + _MSG(Tsread), + _MSG(Rsread), + _MSG(Tswrite), + _MSG(Rswrite), + }, #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000_p9p - [LIB9P_VER_9P2000_p9p] = 9, + [LIB9P_VER_9P2000_p9p] = { + _MSG(Topenfd), + _MSG(Ropenfd), + _MSG(Tversion), + _MSG(Rversion), + _MSG(Tauth), + _MSG(Rauth), + _MSG(Tattach), + _MSG(Rattach), + _MSG(Rerror), + _MSG(Tflush), + _MSG(Rflush), + _MSG(Twalk), + _MSG(Rwalk), + _MSG(Topen), + _MSG(Ropen), + _MSG(Tcreate), + _MSG(Rcreate), + _MSG(Tread), + _MSG(Rread), + _MSG(Twrite), + _MSG(Rwrite), + _MSG(Tclunk), + _MSG(Rclunk), + _MSG(Tremove), + _MSG(Rremove), + _MSG(Tstat), + _MSG(Rstat), + _MSG(Twstat), + _MSG(Rwstat), + }, #endif /* CONFIG_9P_ENABLE_9P2000_p9p */ #if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = 13, + [LIB9P_VER_9P2000_u] = { + _MSG(Tversion), + _MSG(Rversion), + _MSG(Tauth), + _MSG(Rauth), + _MSG(Tattach), + _MSG(Rattach), + _MSG(Rerror), + _MSG(Tflush), + _MSG(Rflush), + _MSG(Twalk), + _MSG(Rwalk), + _MSG(Topen), + _MSG(Ropen), + _MSG(Tcreate), + _MSG(Rcreate), + _MSG(Tread), + _MSG(Rread), + _MSG(Twrite), + _MSG(Rwrite), + _MSG(Tclunk), + _MSG(Rclunk), + _MSG(Tremove), + _MSG(Rremove), + _MSG(Tstat), + _MSG(Rstat), + _MSG(Twstat), + _MSG(Rwstat), + }, #endif /* CONFIG_9P_ENABLE_9P2000_u */ }; #define _MSG_RECV(typ) [LIB9P_TYP_##typ/2] = { \ - .basesize = sizeof(struct lib9p_msg_##typ), \ .validate = validate_##typ, \ .unmarshal = (_unmarshal_fn_t)unmarshal_##typ, \ } |