/* Generated by `./lib9p/types.gen lib9p/9P2000.txt lib9p/9P2000.u.txt lib9p/9P2000.e.txt`.  DO NOT EDIT!  */

#include <stdbool.h>

#include <lib9p/9p.h>

#include "internal.h"

/* checksize_* (internals of unmarshal_size()) ********************************/

static inline bool _checksize_net(struct _checksize_ctx *ctx, uint32_t n) {
	if (__builtin_add_overflow(ctx->net_offset, n, &ctx->net_offset))
		/* If needed-net-size overflowed uint32_t, then
		 * there's no way that actual-net-size will live up to
		 * that.  */
		return lib9p_error(ctx->ctx, LINUX_EBADMSG, "message is too short for content");
	if (ctx->net_offset > ctx->net_size)
		return lib9p_error(ctx->ctx, LINUX_EBADMSG, "message is too short for content");
	return false;
}

static inline bool _checksize_host(struct _checksize_ctx *ctx, size_t n) {
	if (__builtin_add_overflow(ctx->host_extra, n, &ctx->host_extra))
		/* If needed-host-size overflowed size_t, then there's
		 * no way that actual-net-size will live up to
		 * that.  */
		return lib9p_error(ctx->ctx, LINUX_EBADMSG, "message is too short for content");
	return false;
}

static inline bool _checksize_list(struct _checksize_ctx *ctx,
                                   size_t cnt, _checksize_fn_t item_fn, size_t item_host_size) {
	for (size_t i = 0; i < cnt; i++)
		if (_checksize_host(ctx, item_host_size) || item_fn(ctx))
			return true;
	return false;
}

#define checksize_1(ctx) _checksize_net(ctx, 1)
#define checksize_2(ctx) _checksize_net(ctx, 2)
#define checksize_4(ctx) _checksize_net(ctx, 4)
#define checksize_8(ctx) _checksize_net(ctx, 8)

static inline bool checksize_d(struct _checksize_ctx *ctx) {
	uint32_t base_offset = ctx->net_offset;
	if (_checksize_4(ctx))
		return true;
	uint32_t len = decode_u32le(&ctx->net_bytes[base_offset]);
	return checksize_net(ctx, len) || checksize_host(ctx, len);
}

static inline bool checksize_s(struct _checksize_ctx *ctx) {
	uint32_t base_offset = ctx->net_offset;
	if (_checksize_2(ctx))
		return true;
	uint16_t len = decode_u16le(&ctx->net_bytes[base_offset]);
	if (checksize_net(ctx, len) || checksize_host(ctx, ((size_t)len)+1))
		return true;
	if (!is_valid_utf8_without_nul(&ctx->net_bytes[base_offset+2], len))
		return lib9p_error(ctx->ctx, LINUX_EBADMSG, "message contains invalid UTF-8");
	return false;
}

static inline bool checksize_qid(struct _checksize_ctx *ctx) {
	return checksize_1(ctx)
	    || checksize_4(ctx)
	    || checksize_8(ctx);
}

static inline bool checksize_stat(struct _checksize_ctx *ctx) {
	return checksize_2(ctx)
	    || checksize_2(ctx)
	    || checksize_4(ctx)
	    || checksize_qid(ctx)
	    || checksize_4(ctx)
	    || checksize_4(ctx)
	    || checksize_4(ctx)
	    || checksize_8(ctx)
	    || checksize_s(ctx)
	    || checksize_s(ctx)
	    || checksize_s(ctx)
	    || checksize_s(ctx)
	    || ( ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) && checksize_s(ctx) )
	    || ( ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) && checksize_4(ctx) )
	    || ( ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) && checksize_4(ctx) )
	    || ( ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) && checksize_4(ctx) );
}

static bool checksize_Tversion(struct _checksize_ctx *ctx) {
	return checksize_4(ctx)
	    || checksize_s(ctx);
}

static bool checksize_Rversion(struct _checksize_ctx *ctx) {
	return checksize_4(ctx)
	    || checksize_s(ctx);
}

static bool checksize_Tauth(struct _checksize_ctx *ctx) {
	return checksize_4(ctx)
	    || checksize_s(ctx)
	    || checksize_s(ctx)
	    || ( ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) && checksize_4(ctx) );
}

static bool checksize_Rauth(struct _checksize_ctx *ctx) {
	return checksize_qid(ctx);
}

static bool checksize_Tattach(struct _checksize_ctx *ctx) {
	return checksize_4(ctx)
	    || checksize_4(ctx)
	    || checksize_s(ctx)
	    || checksize_s(ctx);
}

static bool checksize_Rattach(struct _checksize_ctx *ctx) {
	return checksize_qid(ctx);
}

static bool checksize_Rerror(struct _checksize_ctx *ctx) {
	return checksize_s(ctx)
	    || ( ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) && checksize_4(ctx) );
}

static bool checksize_Tflush(struct _checksize_ctx *ctx) {
	return checksize_2(ctx);
}

static bool checksize_Rflush(struct _checksize_ctx *UNUSED(ctx)) {
	return false;
}

static bool checksize_Twalk(struct _checksize_ctx *ctx) {
	return checksize_4(ctx)
	    || checksize_4(ctx)
	    || checksize_2(ctx)
	    || _checksize_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), checksize_s, sizeof(struct lib9p_s));
}

static bool checksize_Rwalk(struct _checksize_ctx *ctx) {
	return checksize_2(ctx)
	    || _checksize_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), checksize_qid, sizeof(struct lib9p_qid));
}

static bool checksize_Topen(struct _checksize_ctx *ctx) {
	return checksize_4(ctx)
	    || checksize_1(ctx);
}

static bool checksize_Ropen(struct _checksize_ctx *ctx) {
	return checksize_qid(ctx)
	    || checksize_4(ctx);
}

static bool checksize_Tcreate(struct _checksize_ctx *ctx) {
	return checksize_4(ctx)
	    || checksize_s(ctx)
	    || checksize_4(ctx)
	    || checksize_1(ctx);
}

static bool checksize_Rcreate(struct _checksize_ctx *ctx) {
	return checksize_qid(ctx)
	    || checksize_4(ctx);
}

static bool checksize_Tread(struct _checksize_ctx *ctx) {
	return checksize_4(ctx)
	    || checksize_8(ctx)
	    || checksize_4(ctx);
}

static bool checksize_Rread(struct _checksize_ctx *ctx) {
	return checksize_d(ctx);
}

static bool checksize_Twrite(struct _checksize_ctx *ctx) {
	return checksize_4(ctx)
	    || checksize_8(ctx)
	    || checksize_d(ctx);
}

static bool checksize_Rwrite(struct _checksize_ctx *ctx) {
	return checksize_4(ctx);
}

static bool checksize_Tclunk(struct _checksize_ctx *ctx) {
	return checksize_4(ctx);
}

static bool checksize_Rclunk(struct _checksize_ctx *UNUSED(ctx)) {
	return false;
}

static bool checksize_Tremove(struct _checksize_ctx *ctx) {
	return checksize_4(ctx);
}

static bool checksize_Rremove(struct _checksize_ctx *UNUSED(ctx)) {
	return false;
}

static bool checksize_Tstat(struct _checksize_ctx *ctx) {
	return checksize_4(ctx);
}

static bool checksize_Rstat(struct _checksize_ctx *ctx) {
	return checksize_stat(ctx);
}

static bool checksize_Twstat(struct _checksize_ctx *ctx) {
	return checksize_4(ctx)
	    || checksize_stat(ctx);
}

static bool checksize_Rwstat(struct _checksize_ctx *UNUSED(ctx)) {
	return false;
}

static bool checksize_Tsession(struct _checksize_ctx *ctx) {
	return checksize_8(ctx);
}

static bool checksize_Rsession(struct _checksize_ctx *UNUSED(ctx)) {
	return false;
}

static bool checksize_Tsread(struct _checksize_ctx *ctx) {
	return checksize_4(ctx)
	    || checksize_2(ctx)
	    || _checksize_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), checksize_s, sizeof(struct lib9p_s));
}

static bool checksize_Rsread(struct _checksize_ctx *ctx) {
	return checksize_d(ctx);
}

static bool checksize_Tswrite(struct _checksize_ctx *ctx) {
	return checksize_4(ctx)
	    || checksize_2(ctx)
	    || _checksize_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), checksize_s, sizeof(struct lib9p_s))
	    || checksize_d(ctx);
}

static bool checksize_Rswrite(struct _checksize_ctx *ctx) {
	return checksize_4(ctx);
}

/* unmarshal_* ****************************************************************/

static inline vold unmarshal_1(struct _unmarshal_ctx *ctx, uint8_t *out) {
	*out = decode_u8le(&ctx->net_bytes[ctx->net_offset]);
	ctx->net_offset += 1;
}

static inline vold unmarshal_2(struct _unmarshal_ctx *ctx, uint16_t *out) {
	*out = decode_u16le(&ctx->net_bytes[ctx->net_offset]);
	ctx->net_offset += 2;
}

static inline vold unmarshal_4(struct _unmarshal_ctx *ctx, uint32_t *out) {
	*out = decode_u32le(&ctx->net_bytes[ctx->net_offset]);
	ctx->net_offset += 4;
}

static inline vold unmarshal_8(struct _unmarshal_ctx *ctx, uint64_t *out) {
	*out = decode_u64le(&ctx->net_bytes[ctx->net_offset]);
	ctx->net_offset += 8;
}

static inline void unmarshal_d(struct _unmarshal_ctx *ctx, struct lib9p_d *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->len);
		out->dat = ctx->host_extra;
	ctx->host_extra += sizeof(out->dat[0]) * out->len;
	for (typeof(out->len) i = 0; i < out->len; i++)
		unmarshal_1(ctx, &out->dat[i]);
}

static inline void unmarshal_s(struct _unmarshal_ctx *ctx, struct lib9p_s *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_2(ctx, &out->len);
		out->utf8 = ctx->host_extra;
	ctx->host_extra += sizeof(out->utf8[0]) * out->len;
	for (typeof(out->len) i = 0; i < out->len; i++)
		unmarshal_1(ctx, &out->utf8[i]);
}

static inline void unmarshal_qid(struct _unmarshal_ctx *ctx, struct lib9p_qid *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_1(ctx, &out->type);
	unmarshal_4(ctx, &out->vers);
	unmarshal_8(ctx, &out->path);
}

static inline void unmarshal_stat(struct _unmarshal_ctx *ctx, struct lib9p_stat *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_2(ctx, &out->stat_size);
	unmarshal_2(ctx, &out->kern_type);
	unmarshal_4(ctx, &out->kern_dev);
	unmarshal_qid(ctx, &out->file_qid);
	unmarshal_4(ctx, &out->file_mode);
	unmarshal_4(ctx, &out->file_atime);
	unmarshal_4(ctx, &out->file_mtime);
	unmarshal_8(ctx, &out->file_size);
	unmarshal_s(ctx, &out->file_name);
	unmarshal_s(ctx, &out->file_owner_uid);
	unmarshal_s(ctx, &out->file_owner_gid);
	unmarshal_s(ctx, &out->file_last_modified_uid);
	if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_s(ctx, &out->file_extension);
	if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->file_owner_n_uid);
	if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->file_owner_n_gid);
	if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->file_last_modified_n_uid);
}

static void unmarshal_Tversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tversion *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->max_msg_size);
	unmarshal_s(ctx, &out->version);
}

static void unmarshal_Rversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rversion *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->max_msg_size);
	unmarshal_s(ctx, &out->version);
}

static void unmarshal_Tauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tauth *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->afid);
	unmarshal_s(ctx, &out->uname);
	unmarshal_s(ctx, &out->aname);
	if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->n_uname);
}

static void unmarshal_Rauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rauth *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_qid(ctx, &out->aqid);
}

static void unmarshal_Tattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tattach *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->fid);
	unmarshal_4(ctx, &out->afid);
	unmarshal_s(ctx, &out->uname);
	unmarshal_s(ctx, &out->aname);
}

static void unmarshal_Rattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rattach *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_qid(ctx, &out->qid);
}

static void unmarshal_Rerror(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rerror *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_s(ctx, &out->ename);
	if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->errno);
}

static void unmarshal_Tflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tflush *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_2(ctx, &out->oldtag);
}

static void unmarshal_Rflush(struct _unmarshal_ctx *UNUSED(ctx), struct lib9p_msg_Rflush *UNUSED(out)) {
	memset(out, 0, sizeof(*out));
}

static void unmarshal_Twalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twalk *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->fid);
	unmarshal_4(ctx, &out->newfid);
	unmarshal_2(ctx, &out->nwname);
		out->wname = ctx->host_extra;
	ctx->host_extra += sizeof(out->wname[0]) * out->nwname;
	for (typeof(out->nwname) i = 0; i < out->nwname; i++)
		unmarshal_s(ctx, &out->wname[i]);
}

static void unmarshal_Rwalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwalk *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_2(ctx, &out->nwqid);
		out->wqid = ctx->host_extra;
	ctx->host_extra += sizeof(out->wqid[0]) * out->nwqid;
	for (typeof(out->nwqid) i = 0; i < out->nwqid; i++)
		unmarshal_qid(ctx, &out->wqid[i]);
}

static void unmarshal_Topen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Topen *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->fid);
	unmarshal_1(ctx, &out->mode);
}

static void unmarshal_Ropen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Ropen *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_qid(ctx, &out->qid);
	unmarshal_4(ctx, &out->iounit);
}

static void unmarshal_Tcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tcreate *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->fid);
	unmarshal_s(ctx, &out->name);
	unmarshal_4(ctx, &out->perm);
	unmarshal_1(ctx, &out->mode);
}

static void unmarshal_Rcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rcreate *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_qid(ctx, &out->qid);
	unmarshal_4(ctx, &out->iounit);
}

static void unmarshal_Tread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tread *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->fid);
	unmarshal_8(ctx, &out->offset);
	unmarshal_4(ctx, &out->count);
}

static void unmarshal_Rread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rread *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_d(ctx, &out->data);
}

static void unmarshal_Twrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twrite *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->fid);
	unmarshal_8(ctx, &out->offset);
	unmarshal_d(ctx, &out->data);
}

static void unmarshal_Rwrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwrite *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->count);
}

static void unmarshal_Tclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tclunk *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->fid);
}

static void unmarshal_Rclunk(struct _unmarshal_ctx *UNUSED(ctx), struct lib9p_msg_Rclunk *UNUSED(out)) {
	memset(out, 0, sizeof(*out));
}

static void unmarshal_Tremove(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tremove *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->fid);
}

static void unmarshal_Rremove(struct _unmarshal_ctx *UNUSED(ctx), struct lib9p_msg_Rremove *UNUSED(out)) {
	memset(out, 0, sizeof(*out));
}

static void unmarshal_Tstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tstat *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->fid);
}

static void unmarshal_Rstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rstat *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_stat(ctx, &out->stat);
}

static void unmarshal_Twstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twstat *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->fid);
	unmarshal_stat(ctx, &out->stat);
}

static void unmarshal_Rwstat(struct _unmarshal_ctx *UNUSED(ctx), struct lib9p_msg_Rwstat *UNUSED(out)) {
	memset(out, 0, sizeof(*out));
}

static void unmarshal_Tsession(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsession *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_8(ctx, &out->key);
}

static void unmarshal_Rsession(struct _unmarshal_ctx *UNUSED(ctx), struct lib9p_msg_Rsession *UNUSED(out)) {
	memset(out, 0, sizeof(*out));
}

static void unmarshal_Tsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsread *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->fid);
	unmarshal_2(ctx, &out->nwname);
		out->wname = ctx->host_extra;
	ctx->host_extra += sizeof(out->wname[0]) * out->nwname;
	for (typeof(out->nwname) i = 0; i < out->nwname; i++)
		unmarshal_s(ctx, &out->wname[i]);
}

static void unmarshal_Rsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsread *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_d(ctx, &out->data);
}

static void unmarshal_Tswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tswrite *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->fid);
	unmarshal_2(ctx, &out->nwname);
		out->wname = ctx->host_extra;
	ctx->host_extra += sizeof(out->wname[0]) * out->nwname;
	for (typeof(out->nwname) i = 0; i < out->nwname; i++)
		unmarshal_s(ctx, &out->wname[i]);
	unmarshal_d(ctx, &out->data);
}

static void unmarshal_Rswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rswrite *out) {
	memset(out, 0, sizeof(*out));
	unmarshal_4(ctx, &out->count);
}

/* marshal_* ******************************************************************/

static inline bool _marshal_too_large(struct _marshal_ctx *ctx) {
	lib9p_errorf(ctx->ctx, "%s too large to marshal into %s limit (limit=%"PRIu32")",
		(ctx->net_bytes[4] % 2 == 0) ? "T-message" : "R-message",
		ctx->ctx->version ? "negotiated" : ((ctx->net_bytes[4] % 2 == 0) ? "client" : "server"),
		ctx->ctx->max_msg_size));
    return true;
}

static inline bool marshal_1(struct _marshal_ctx *ctx, uint8_t *val) {
	if (ctx->net_offset + 1 > ctx->max_msg_size)
    	return _marshal_too_large(ctx);
	out_net_bytes[ctx->net_offset] = *val;
	ctx->net_offset += 1;
    return false;
}

static inline bool marshal_2(struct _marshal_ctx *ctx, uint16_t *val) {
	if (ctx->net_offset + 2 > ctx->max_msg_size)
    	return _marshal_too_large(ctx);
	encode_u16le(*val, &out_net_bytes[ctx->net_offset]);
	ctx->net_offset += 2;
    return false;
}

static inline bool marshal_4(struct _marshal_ctx *ctx, uint32_t *val) {
	if (ctx->net_offset + 4 > ctx->max_msg_size)
		return true;
	encode_u32le(*val, &out_net_bytes[ctx->net_offset]);
	ctx->net_offset += 4;
    return false;
}

static inline bool marshal_8(struct _marshal_ctx *ctx, uint64_t *val) {
	if (ctx->net_offset + 8 > ctx->max_msg_size)
		return true;
	encode_u64le(*val, &out_net_bytes[ctx->net_offset]);
	ctx->net_offset += 8;
    return false;
}

static inline bool marshal_d(struct _marshal_ctx *ctx, struct lib9p_d *val) {
	return marshal_4(ctx, &val->len)
	    || ({
	       	bool err = false;
	       	for (typeof(val->len) i = 0; i < val->len && !err; i++)
	       		err = marshal_1(ctx, &val->dat[i]));
	       	err;
	       });
}

static inline bool marshal_s(struct _marshal_ctx *ctx, struct lib9p_s *val) {
	return marshal_2(ctx, &val->len)
	    || ({
	       	bool err = false;
	       	for (typeof(val->len) i = 0; i < val->len && !err; i++)
	       		err = marshal_1(ctx, &val->utf8[i]));
	       	err;
	       });
}

static inline bool marshal_qid(struct _marshal_ctx *ctx, struct lib9p_qid *val) {
	return marshal_1(ctx, &val->type)
	    || marshal_4(ctx, &val->vers)
	    || marshal_8(ctx, &val->path);
}

static inline bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p_stat *val) {
	return marshal_2(ctx, &val->stat_size)
	    || marshal_2(ctx, &val->kern_type)
	    || marshal_4(ctx, &val->kern_dev)
	    || marshal_qid(ctx, &val->file_qid)
	    || marshal_4(ctx, &val->file_mode)
	    || marshal_4(ctx, &val->file_atime)
	    || marshal_4(ctx, &val->file_mtime)
	    || marshal_8(ctx, &val->file_size)
	    || marshal_s(ctx, &val->file_name)
	    || marshal_s(ctx, &val->file_owner_uid)
	    || marshal_s(ctx, &val->file_owner_gid)
	    || marshal_s(ctx, &val->file_last_modified_uid)
	    || marshal_s(ctx, &val->file_extension)
	    || marshal_4(ctx, &val->file_owner_n_uid)
	    || marshal_4(ctx, &val->file_owner_n_gid)
	    || marshal_4(ctx, &val->file_last_modified_n_uid);
}

static bool marshal_Tversion(struct _marshal_ctx *ctx, struct lib9p_msg_Tversion *val) {
	return marshal_4(ctx, &val->max_msg_size)
	    || marshal_s(ctx, &val->version);
}

static bool marshal_Rversion(struct _marshal_ctx *ctx, struct lib9p_msg_Rversion *val) {
	return marshal_4(ctx, &val->max_msg_size)
	    || marshal_s(ctx, &val->version);
}

static bool marshal_Tauth(struct _marshal_ctx *ctx, struct lib9p_msg_Tauth *val) {
	return marshal_4(ctx, &val->afid)
	    || marshal_s(ctx, &val->uname)
	    || marshal_s(ctx, &val->aname)
	    || marshal_4(ctx, &val->n_uname);
}

static bool marshal_Rauth(struct _marshal_ctx *ctx, struct lib9p_msg_Rauth *val) {
	return marshal_qid(ctx, &val->aqid);
}

static bool marshal_Tattach(struct _marshal_ctx *ctx, struct lib9p_msg_Tattach *val) {
	return marshal_4(ctx, &val->fid)
	    || marshal_4(ctx, &val->afid)
	    || marshal_s(ctx, &val->uname)
	    || marshal_s(ctx, &val->aname);
}

static bool marshal_Rattach(struct _marshal_ctx *ctx, struct lib9p_msg_Rattach *val) {
	return marshal_qid(ctx, &val->qid);
}

static bool marshal_Rerror(struct _marshal_ctx *ctx, struct lib9p_msg_Rerror *val) {
	return marshal_s(ctx, &val->ename)
	    || marshal_4(ctx, &val->errno);
}

static bool marshal_Tflush(struct _marshal_ctx *ctx, struct lib9p_msg_Tflush *val) {
	return marshal_2(ctx, &val->oldtag);
}

static bool marshal_Rflush(struct _marshal_ctx *UNUSED(ctx), struct lib9p_msg_Rflush *UNUSED(val)) {
	return false;
}

static bool marshal_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_Twalk *val) {
	return marshal_4(ctx, &val->fid)
	    || marshal_4(ctx, &val->newfid)
	    || marshal_2(ctx, &val->nwname)
	    || ({
	       	bool err = false;
	       	for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++)
	       		err = marshal_s(ctx, &val->wname[i]));
	       	err;
	       });
}

static bool marshal_Rwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rwalk *val) {
	return marshal_2(ctx, &val->nwqid)
	    || ({
	       	bool err = false;
	       	for (typeof(val->nwqid) i = 0; i < val->nwqid && !err; i++)
	       		err = marshal_qid(ctx, &val->wqid[i]));
	       	err;
	       });
}

static bool marshal_Topen(struct _marshal_ctx *ctx, struct lib9p_msg_Topen *val) {
	return marshal_4(ctx, &val->fid)
	    || marshal_1(ctx, &val->mode);
}

static bool marshal_Ropen(struct _marshal_ctx *ctx, struct lib9p_msg_Ropen *val) {
	return marshal_qid(ctx, &val->qid)
	    || marshal_4(ctx, &val->iounit);
}

static bool marshal_Tcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Tcreate *val) {
	return marshal_4(ctx, &val->fid)
	    || marshal_s(ctx, &val->name)
	    || marshal_4(ctx, &val->perm)
	    || marshal_1(ctx, &val->mode);
}

static bool marshal_Rcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rcreate *val) {
	return marshal_qid(ctx, &val->qid)
	    || marshal_4(ctx, &val->iounit);
}

static bool marshal_Tread(struct _marshal_ctx *ctx, struct lib9p_msg_Tread *val) {
	return marshal_4(ctx, &val->fid)
	    || marshal_8(ctx, &val->offset)
	    || marshal_4(ctx, &val->count);
}

static bool marshal_Rread(struct _marshal_ctx *ctx, struct lib9p_msg_Rread *val) {
	return marshal_d(ctx, &val->data);
}

static bool marshal_Twrite(struct _marshal_ctx *ctx, struct lib9p_msg_Twrite *val) {
	return marshal_4(ctx, &val->fid)
	    || marshal_8(ctx, &val->offset)
	    || marshal_d(ctx, &val->data);
}

static bool marshal_Rwrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rwrite *val) {
	return marshal_4(ctx, &val->count);
}

static bool marshal_Tclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Tclunk *val) {
	return marshal_4(ctx, &val->fid);
}

static bool marshal_Rclunk(struct _marshal_ctx *UNUSED(ctx), struct lib9p_msg_Rclunk *UNUSED(val)) {
	return false;
}

static bool marshal_Tremove(struct _marshal_ctx *ctx, struct lib9p_msg_Tremove *val) {
	return marshal_4(ctx, &val->fid);
}

static bool marshal_Rremove(struct _marshal_ctx *UNUSED(ctx), struct lib9p_msg_Rremove *UNUSED(val)) {
	return false;
}

static bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_Tstat *val) {
	return marshal_4(ctx, &val->fid);
}

static bool marshal_Rstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rstat *val) {
	return marshal_stat(ctx, &val->stat);
}

static bool marshal_Twstat(struct _marshal_ctx *ctx, struct lib9p_msg_Twstat *val) {
	return marshal_4(ctx, &val->fid)
	    || marshal_stat(ctx, &val->stat);
}

static bool marshal_Rwstat(struct _marshal_ctx *UNUSED(ctx), struct lib9p_msg_Rwstat *UNUSED(val)) {
	return false;
}

static bool marshal_Tsession(struct _marshal_ctx *ctx, struct lib9p_msg_Tsession *val) {
	return marshal_8(ctx, &val->key);
}

static bool marshal_Rsession(struct _marshal_ctx *UNUSED(ctx), struct lib9p_msg_Rsession *UNUSED(val)) {
	return false;
}

static bool marshal_Tsread(struct _marshal_ctx *ctx, struct lib9p_msg_Tsread *val) {
	return marshal_4(ctx, &val->fid)
	    || marshal_2(ctx, &val->nwname)
	    || ({
	       	bool err = false;
	       	for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++)
	       		err = marshal_s(ctx, &val->wname[i]));
	       	err;
	       });
}

static bool marshal_Rsread(struct _marshal_ctx *ctx, struct lib9p_msg_Rsread *val) {
	return marshal_d(ctx, &val->data);
}

static bool marshal_Tswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Tswrite *val) {
	return marshal_4(ctx, &val->fid)
	    || marshal_2(ctx, &val->nwname)
	    || ({
	       	bool err = false;
	       	for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++)
	       		err = marshal_s(ctx, &val->wname[i]));
	       	err;
	       })
	    || marshal_d(ctx, &val->data);
}

static bool marshal_Rswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rswrite *val) {
	return marshal_4(ctx, &val->count);
}

/* vtables ********************************************************************/

struct _vtable_version _lib9p_vtables[LIB9P_VER_NUM] = {
	[LIB9P_VER_UNINITIALIZED] = {
		[LIB9P_TYP_Tversion] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tversion),
			r.unmarshal_extrasize = checksize_Tversion,
			r.unmarshal           = unmarshal_Tversion,
			r.marshal             = (_marshal_fn_t)marshal_Tversion,
		},
		[LIB9P_TYP_Rversion] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rversion),
			r.unmarshal_extrasize = checksize_Rversion,
			r.unmarshal           = unmarshal_Rversion,
			r.marshal             = (_marshal_fn_t)marshal_Rversion,
		},
	},
	[LIB9P_VER_9P2000] = {
		[LIB9P_TYP_Tversion] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tversion),
			r.unmarshal_extrasize = checksize_Tversion,
			r.unmarshal           = unmarshal_Tversion,
			r.marshal             = (_marshal_fn_t)marshal_Tversion,
		},
		[LIB9P_TYP_Rversion] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rversion),
			r.unmarshal_extrasize = checksize_Rversion,
			r.unmarshal           = unmarshal_Rversion,
			r.marshal             = (_marshal_fn_t)marshal_Rversion,
		},
		[LIB9P_TYP_Tauth] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tauth),
			r.unmarshal_extrasize = checksize_Tauth,
			r.unmarshal           = unmarshal_Tauth,
			r.marshal             = (_marshal_fn_t)marshal_Tauth,
		},
		[LIB9P_TYP_Rauth] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rauth),
			r.unmarshal_extrasize = checksize_Rauth,
			r.unmarshal           = unmarshal_Rauth,
			r.marshal             = (_marshal_fn_t)marshal_Rauth,
		},
		[LIB9P_TYP_Tattach] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tattach),
			r.unmarshal_extrasize = checksize_Tattach,
			r.unmarshal           = unmarshal_Tattach,
			r.marshal             = (_marshal_fn_t)marshal_Tattach,
		},
		[LIB9P_TYP_Rattach] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rattach),
			r.unmarshal_extrasize = checksize_Rattach,
			r.unmarshal           = unmarshal_Rattach,
			r.marshal             = (_marshal_fn_t)marshal_Rattach,
		},
		[LIB9P_TYP_Rerror] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rerror),
			r.unmarshal_extrasize = checksize_Rerror,
			r.unmarshal           = unmarshal_Rerror,
			r.marshal             = (_marshal_fn_t)marshal_Rerror,
		},
		[LIB9P_TYP_Tflush] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tflush),
			r.unmarshal_extrasize = checksize_Tflush,
			r.unmarshal           = unmarshal_Tflush,
			r.marshal             = (_marshal_fn_t)marshal_Tflush,
		},
		[LIB9P_TYP_Rflush] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rflush),
			r.unmarshal_extrasize = checksize_Rflush,
			r.unmarshal           = unmarshal_Rflush,
			r.marshal             = (_marshal_fn_t)marshal_Rflush,
		},
		[LIB9P_TYP_Twalk] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Twalk),
			r.unmarshal_extrasize = checksize_Twalk,
			r.unmarshal           = unmarshal_Twalk,
			r.marshal             = (_marshal_fn_t)marshal_Twalk,
		},
		[LIB9P_TYP_Rwalk] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rwalk),
			r.unmarshal_extrasize = checksize_Rwalk,
			r.unmarshal           = unmarshal_Rwalk,
			r.marshal             = (_marshal_fn_t)marshal_Rwalk,
		},
		[LIB9P_TYP_Topen] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Topen),
			r.unmarshal_extrasize = checksize_Topen,
			r.unmarshal           = unmarshal_Topen,
			r.marshal             = (_marshal_fn_t)marshal_Topen,
		},
		[LIB9P_TYP_Ropen] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Ropen),
			r.unmarshal_extrasize = checksize_Ropen,
			r.unmarshal           = unmarshal_Ropen,
			r.marshal             = (_marshal_fn_t)marshal_Ropen,
		},
		[LIB9P_TYP_Tcreate] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tcreate),
			r.unmarshal_extrasize = checksize_Tcreate,
			r.unmarshal           = unmarshal_Tcreate,
			r.marshal             = (_marshal_fn_t)marshal_Tcreate,
		},
		[LIB9P_TYP_Rcreate] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rcreate),
			r.unmarshal_extrasize = checksize_Rcreate,
			r.unmarshal           = unmarshal_Rcreate,
			r.marshal             = (_marshal_fn_t)marshal_Rcreate,
		},
		[LIB9P_TYP_Tread] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tread),
			r.unmarshal_extrasize = checksize_Tread,
			r.unmarshal           = unmarshal_Tread,
			r.marshal             = (_marshal_fn_t)marshal_Tread,
		},
		[LIB9P_TYP_Rread] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rread),
			r.unmarshal_extrasize = checksize_Rread,
			r.unmarshal           = unmarshal_Rread,
			r.marshal             = (_marshal_fn_t)marshal_Rread,
		},
		[LIB9P_TYP_Twrite] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Twrite),
			r.unmarshal_extrasize = checksize_Twrite,
			r.unmarshal           = unmarshal_Twrite,
			r.marshal             = (_marshal_fn_t)marshal_Twrite,
		},
		[LIB9P_TYP_Rwrite] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rwrite),
			r.unmarshal_extrasize = checksize_Rwrite,
			r.unmarshal           = unmarshal_Rwrite,
			r.marshal             = (_marshal_fn_t)marshal_Rwrite,
		},
		[LIB9P_TYP_Tclunk] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tclunk),
			r.unmarshal_extrasize = checksize_Tclunk,
			r.unmarshal           = unmarshal_Tclunk,
			r.marshal             = (_marshal_fn_t)marshal_Tclunk,
		},
		[LIB9P_TYP_Rclunk] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rclunk),
			r.unmarshal_extrasize = checksize_Rclunk,
			r.unmarshal           = unmarshal_Rclunk,
			r.marshal             = (_marshal_fn_t)marshal_Rclunk,
		},
		[LIB9P_TYP_Tremove] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tremove),
			r.unmarshal_extrasize = checksize_Tremove,
			r.unmarshal           = unmarshal_Tremove,
			r.marshal             = (_marshal_fn_t)marshal_Tremove,
		},
		[LIB9P_TYP_Rremove] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rremove),
			r.unmarshal_extrasize = checksize_Rremove,
			r.unmarshal           = unmarshal_Rremove,
			r.marshal             = (_marshal_fn_t)marshal_Rremove,
		},
		[LIB9P_TYP_Tstat] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tstat),
			r.unmarshal_extrasize = checksize_Tstat,
			r.unmarshal           = unmarshal_Tstat,
			r.marshal             = (_marshal_fn_t)marshal_Tstat,
		},
		[LIB9P_TYP_Rstat] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rstat),
			r.unmarshal_extrasize = checksize_Rstat,
			r.unmarshal           = unmarshal_Rstat,
			r.marshal             = (_marshal_fn_t)marshal_Rstat,
		},
		[LIB9P_TYP_Twstat] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Twstat),
			r.unmarshal_extrasize = checksize_Twstat,
			r.unmarshal           = unmarshal_Twstat,
			r.marshal             = (_marshal_fn_t)marshal_Twstat,
		},
		[LIB9P_TYP_Rwstat] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rwstat),
			r.unmarshal_extrasize = checksize_Rwstat,
			r.unmarshal           = unmarshal_Rwstat,
			r.marshal             = (_marshal_fn_t)marshal_Rwstat,
		},
	},
	[LIB9P_VER_9P2000_e] = {
		[LIB9P_TYP_Tversion] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tversion),
			r.unmarshal_extrasize = checksize_Tversion,
			r.unmarshal           = unmarshal_Tversion,
			r.marshal             = (_marshal_fn_t)marshal_Tversion,
		},
		[LIB9P_TYP_Rversion] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rversion),
			r.unmarshal_extrasize = checksize_Rversion,
			r.unmarshal           = unmarshal_Rversion,
			r.marshal             = (_marshal_fn_t)marshal_Rversion,
		},
		[LIB9P_TYP_Tauth] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tauth),
			r.unmarshal_extrasize = checksize_Tauth,
			r.unmarshal           = unmarshal_Tauth,
			r.marshal             = (_marshal_fn_t)marshal_Tauth,
		},
		[LIB9P_TYP_Rauth] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rauth),
			r.unmarshal_extrasize = checksize_Rauth,
			r.unmarshal           = unmarshal_Rauth,
			r.marshal             = (_marshal_fn_t)marshal_Rauth,
		},
		[LIB9P_TYP_Tattach] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tattach),
			r.unmarshal_extrasize = checksize_Tattach,
			r.unmarshal           = unmarshal_Tattach,
			r.marshal             = (_marshal_fn_t)marshal_Tattach,
		},
		[LIB9P_TYP_Rattach] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rattach),
			r.unmarshal_extrasize = checksize_Rattach,
			r.unmarshal           = unmarshal_Rattach,
			r.marshal             = (_marshal_fn_t)marshal_Rattach,
		},
		[LIB9P_TYP_Rerror] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rerror),
			r.unmarshal_extrasize = checksize_Rerror,
			r.unmarshal           = unmarshal_Rerror,
			r.marshal             = (_marshal_fn_t)marshal_Rerror,
		},
		[LIB9P_TYP_Tflush] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tflush),
			r.unmarshal_extrasize = checksize_Tflush,
			r.unmarshal           = unmarshal_Tflush,
			r.marshal             = (_marshal_fn_t)marshal_Tflush,
		},
		[LIB9P_TYP_Rflush] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rflush),
			r.unmarshal_extrasize = checksize_Rflush,
			r.unmarshal           = unmarshal_Rflush,
			r.marshal             = (_marshal_fn_t)marshal_Rflush,
		},
		[LIB9P_TYP_Twalk] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Twalk),
			r.unmarshal_extrasize = checksize_Twalk,
			r.unmarshal           = unmarshal_Twalk,
			r.marshal             = (_marshal_fn_t)marshal_Twalk,
		},
		[LIB9P_TYP_Rwalk] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rwalk),
			r.unmarshal_extrasize = checksize_Rwalk,
			r.unmarshal           = unmarshal_Rwalk,
			r.marshal             = (_marshal_fn_t)marshal_Rwalk,
		},
		[LIB9P_TYP_Topen] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Topen),
			r.unmarshal_extrasize = checksize_Topen,
			r.unmarshal           = unmarshal_Topen,
			r.marshal             = (_marshal_fn_t)marshal_Topen,
		},
		[LIB9P_TYP_Ropen] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Ropen),
			r.unmarshal_extrasize = checksize_Ropen,
			r.unmarshal           = unmarshal_Ropen,
			r.marshal             = (_marshal_fn_t)marshal_Ropen,
		},
		[LIB9P_TYP_Tcreate] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tcreate),
			r.unmarshal_extrasize = checksize_Tcreate,
			r.unmarshal           = unmarshal_Tcreate,
			r.marshal             = (_marshal_fn_t)marshal_Tcreate,
		},
		[LIB9P_TYP_Rcreate] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rcreate),
			r.unmarshal_extrasize = checksize_Rcreate,
			r.unmarshal           = unmarshal_Rcreate,
			r.marshal             = (_marshal_fn_t)marshal_Rcreate,
		},
		[LIB9P_TYP_Tread] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tread),
			r.unmarshal_extrasize = checksize_Tread,
			r.unmarshal           = unmarshal_Tread,
			r.marshal             = (_marshal_fn_t)marshal_Tread,
		},
		[LIB9P_TYP_Rread] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rread),
			r.unmarshal_extrasize = checksize_Rread,
			r.unmarshal           = unmarshal_Rread,
			r.marshal             = (_marshal_fn_t)marshal_Rread,
		},
		[LIB9P_TYP_Twrite] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Twrite),
			r.unmarshal_extrasize = checksize_Twrite,
			r.unmarshal           = unmarshal_Twrite,
			r.marshal             = (_marshal_fn_t)marshal_Twrite,
		},
		[LIB9P_TYP_Rwrite] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rwrite),
			r.unmarshal_extrasize = checksize_Rwrite,
			r.unmarshal           = unmarshal_Rwrite,
			r.marshal             = (_marshal_fn_t)marshal_Rwrite,
		},
		[LIB9P_TYP_Tclunk] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tclunk),
			r.unmarshal_extrasize = checksize_Tclunk,
			r.unmarshal           = unmarshal_Tclunk,
			r.marshal             = (_marshal_fn_t)marshal_Tclunk,
		},
		[LIB9P_TYP_Rclunk] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rclunk),
			r.unmarshal_extrasize = checksize_Rclunk,
			r.unmarshal           = unmarshal_Rclunk,
			r.marshal             = (_marshal_fn_t)marshal_Rclunk,
		},
		[LIB9P_TYP_Tremove] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tremove),
			r.unmarshal_extrasize = checksize_Tremove,
			r.unmarshal           = unmarshal_Tremove,
			r.marshal             = (_marshal_fn_t)marshal_Tremove,
		},
		[LIB9P_TYP_Rremove] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rremove),
			r.unmarshal_extrasize = checksize_Rremove,
			r.unmarshal           = unmarshal_Rremove,
			r.marshal             = (_marshal_fn_t)marshal_Rremove,
		},
		[LIB9P_TYP_Tstat] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tstat),
			r.unmarshal_extrasize = checksize_Tstat,
			r.unmarshal           = unmarshal_Tstat,
			r.marshal             = (_marshal_fn_t)marshal_Tstat,
		},
		[LIB9P_TYP_Rstat] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rstat),
			r.unmarshal_extrasize = checksize_Rstat,
			r.unmarshal           = unmarshal_Rstat,
			r.marshal             = (_marshal_fn_t)marshal_Rstat,
		},
		[LIB9P_TYP_Twstat] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Twstat),
			r.unmarshal_extrasize = checksize_Twstat,
			r.unmarshal           = unmarshal_Twstat,
			r.marshal             = (_marshal_fn_t)marshal_Twstat,
		},
		[LIB9P_TYP_Rwstat] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rwstat),
			r.unmarshal_extrasize = checksize_Rwstat,
			r.unmarshal           = unmarshal_Rwstat,
			r.marshal             = (_marshal_fn_t)marshal_Rwstat,
		},
		[LIB9P_TYP_Tsession] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tsession),
			r.unmarshal_extrasize = checksize_Tsession,
			r.unmarshal           = unmarshal_Tsession,
			r.marshal             = (_marshal_fn_t)marshal_Tsession,
		},
		[LIB9P_TYP_Rsession] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rsession),
			r.unmarshal_extrasize = checksize_Rsession,
			r.unmarshal           = unmarshal_Rsession,
			r.marshal             = (_marshal_fn_t)marshal_Rsession,
		},
		[LIB9P_TYP_Tsread] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tsread),
			r.unmarshal_extrasize = checksize_Tsread,
			r.unmarshal           = unmarshal_Tsread,
			r.marshal             = (_marshal_fn_t)marshal_Tsread,
		},
		[LIB9P_TYP_Rsread] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rsread),
			r.unmarshal_extrasize = checksize_Rsread,
			r.unmarshal           = unmarshal_Rsread,
			r.marshal             = (_marshal_fn_t)marshal_Rsread,
		},
		[LIB9P_TYP_Tswrite] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tswrite),
			r.unmarshal_extrasize = checksize_Tswrite,
			r.unmarshal           = unmarshal_Tswrite,
			r.marshal             = (_marshal_fn_t)marshal_Tswrite,
		},
		[LIB9P_TYP_Rswrite] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rswrite),
			r.unmarshal_extrasize = checksize_Rswrite,
			r.unmarshal           = unmarshal_Rswrite,
			r.marshal             = (_marshal_fn_t)marshal_Rswrite,
		},
	},
	[LIB9P_VER_9P2000_u] = {
		[LIB9P_TYP_Tversion] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tversion),
			r.unmarshal_extrasize = checksize_Tversion,
			r.unmarshal           = unmarshal_Tversion,
			r.marshal             = (_marshal_fn_t)marshal_Tversion,
		},
		[LIB9P_TYP_Rversion] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rversion),
			r.unmarshal_extrasize = checksize_Rversion,
			r.unmarshal           = unmarshal_Rversion,
			r.marshal             = (_marshal_fn_t)marshal_Rversion,
		},
		[LIB9P_TYP_Tauth] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tauth),
			r.unmarshal_extrasize = checksize_Tauth,
			r.unmarshal           = unmarshal_Tauth,
			r.marshal             = (_marshal_fn_t)marshal_Tauth,
		},
		[LIB9P_TYP_Rauth] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rauth),
			r.unmarshal_extrasize = checksize_Rauth,
			r.unmarshal           = unmarshal_Rauth,
			r.marshal             = (_marshal_fn_t)marshal_Rauth,
		},
		[LIB9P_TYP_Tattach] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tattach),
			r.unmarshal_extrasize = checksize_Tattach,
			r.unmarshal           = unmarshal_Tattach,
			r.marshal             = (_marshal_fn_t)marshal_Tattach,
		},
		[LIB9P_TYP_Rattach] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rattach),
			r.unmarshal_extrasize = checksize_Rattach,
			r.unmarshal           = unmarshal_Rattach,
			r.marshal             = (_marshal_fn_t)marshal_Rattach,
		},
		[LIB9P_TYP_Rerror] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rerror),
			r.unmarshal_extrasize = checksize_Rerror,
			r.unmarshal           = unmarshal_Rerror,
			r.marshal             = (_marshal_fn_t)marshal_Rerror,
		},
		[LIB9P_TYP_Tflush] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tflush),
			r.unmarshal_extrasize = checksize_Tflush,
			r.unmarshal           = unmarshal_Tflush,
			r.marshal             = (_marshal_fn_t)marshal_Tflush,
		},
		[LIB9P_TYP_Rflush] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rflush),
			r.unmarshal_extrasize = checksize_Rflush,
			r.unmarshal           = unmarshal_Rflush,
			r.marshal             = (_marshal_fn_t)marshal_Rflush,
		},
		[LIB9P_TYP_Twalk] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Twalk),
			r.unmarshal_extrasize = checksize_Twalk,
			r.unmarshal           = unmarshal_Twalk,
			r.marshal             = (_marshal_fn_t)marshal_Twalk,
		},
		[LIB9P_TYP_Rwalk] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rwalk),
			r.unmarshal_extrasize = checksize_Rwalk,
			r.unmarshal           = unmarshal_Rwalk,
			r.marshal             = (_marshal_fn_t)marshal_Rwalk,
		},
		[LIB9P_TYP_Topen] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Topen),
			r.unmarshal_extrasize = checksize_Topen,
			r.unmarshal           = unmarshal_Topen,
			r.marshal             = (_marshal_fn_t)marshal_Topen,
		},
		[LIB9P_TYP_Ropen] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Ropen),
			r.unmarshal_extrasize = checksize_Ropen,
			r.unmarshal           = unmarshal_Ropen,
			r.marshal             = (_marshal_fn_t)marshal_Ropen,
		},
		[LIB9P_TYP_Tcreate] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tcreate),
			r.unmarshal_extrasize = checksize_Tcreate,
			r.unmarshal           = unmarshal_Tcreate,
			r.marshal             = (_marshal_fn_t)marshal_Tcreate,
		},
		[LIB9P_TYP_Rcreate] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rcreate),
			r.unmarshal_extrasize = checksize_Rcreate,
			r.unmarshal           = unmarshal_Rcreate,
			r.marshal             = (_marshal_fn_t)marshal_Rcreate,
		},
		[LIB9P_TYP_Tread] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tread),
			r.unmarshal_extrasize = checksize_Tread,
			r.unmarshal           = unmarshal_Tread,
			r.marshal             = (_marshal_fn_t)marshal_Tread,
		},
		[LIB9P_TYP_Rread] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rread),
			r.unmarshal_extrasize = checksize_Rread,
			r.unmarshal           = unmarshal_Rread,
			r.marshal             = (_marshal_fn_t)marshal_Rread,
		},
		[LIB9P_TYP_Twrite] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Twrite),
			r.unmarshal_extrasize = checksize_Twrite,
			r.unmarshal           = unmarshal_Twrite,
			r.marshal             = (_marshal_fn_t)marshal_Twrite,
		},
		[LIB9P_TYP_Rwrite] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rwrite),
			r.unmarshal_extrasize = checksize_Rwrite,
			r.unmarshal           = unmarshal_Rwrite,
			r.marshal             = (_marshal_fn_t)marshal_Rwrite,
		},
		[LIB9P_TYP_Tclunk] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tclunk),
			r.unmarshal_extrasize = checksize_Tclunk,
			r.unmarshal           = unmarshal_Tclunk,
			r.marshal             = (_marshal_fn_t)marshal_Tclunk,
		},
		[LIB9P_TYP_Rclunk] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rclunk),
			r.unmarshal_extrasize = checksize_Rclunk,
			r.unmarshal           = unmarshal_Rclunk,
			r.marshal             = (_marshal_fn_t)marshal_Rclunk,
		},
		[LIB9P_TYP_Tremove] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tremove),
			r.unmarshal_extrasize = checksize_Tremove,
			r.unmarshal           = unmarshal_Tremove,
			r.marshal             = (_marshal_fn_t)marshal_Tremove,
		},
		[LIB9P_TYP_Rremove] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rremove),
			r.unmarshal_extrasize = checksize_Rremove,
			r.unmarshal           = unmarshal_Rremove,
			r.marshal             = (_marshal_fn_t)marshal_Rremove,
		},
		[LIB9P_TYP_Tstat] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Tstat),
			r.unmarshal_extrasize = checksize_Tstat,
			r.unmarshal           = unmarshal_Tstat,
			r.marshal             = (_marshal_fn_t)marshal_Tstat,
		},
		[LIB9P_TYP_Rstat] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rstat),
			r.unmarshal_extrasize = checksize_Rstat,
			r.unmarshal           = unmarshal_Rstat,
			r.marshal             = (_marshal_fn_t)marshal_Rstat,
		},
		[LIB9P_TYP_Twstat] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Twstat),
			r.unmarshal_extrasize = checksize_Twstat,
			r.unmarshal           = unmarshal_Twstat,
			r.marshal             = (_marshal_fn_t)marshal_Twstat,
		},
		[LIB9P_TYP_Rwstat] = {
			r.unmarshal_basesize  = sizeof(struct lib9p_msg_Rwstat),
			r.unmarshal_extrasize = checksize_Rwstat,
			r.unmarshal           = unmarshal_Rwstat,
			r.marshal             = (_marshal_fn_t)marshal_Rwstat,
		},
	},
};