diff options
Diffstat (limited to 'lib9p/include')
-rw-r--r-- | lib9p/include/lib9p/9p.generated.h | 1348 | ||||
-rw-r--r-- | lib9p/include/lib9p/9p.h | 206 | ||||
-rw-r--r-- | lib9p/include/lib9p/linux-errno.h | 139 | ||||
-rwxr-xr-x | lib9p/include/lib9p/linux-errno.h.gen | 38 | ||||
-rw-r--r-- | lib9p/include/lib9p/srv.h | 179 |
5 files changed, 0 insertions, 1910 deletions
diff --git a/lib9p/include/lib9p/9p.generated.h b/lib9p/include/lib9p/9p.generated.h deleted file mode 100644 index 7e901a3..0000000 --- a/lib9p/include/lib9p/9p.generated.h +++ /dev/null @@ -1,1348 +0,0 @@ -/* Generated by `lib9p/proto.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2003-9P2000.p9p.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2010-9P2000.L.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 -#endif - -#include <stdint.h> /* for uint{n}_t types */ - -#include <libfmt/fmt.h> /* for fmt_formatter */ -#include <libhw/generic/net.h> /* for struct iovec */ - -/* config *********************************************************************/ - -#include "config.h" - -#ifndef CONFIG_9P_ENABLE_9P2000 - #error config.h must define CONFIG_9P_ENABLE_9P2000 -#endif - -#ifndef CONFIG_9P_ENABLE_9P2000_L - #error config.h must define CONFIG_9P_ENABLE_9P2000_L -#endif - -#ifndef CONFIG_9P_ENABLE_9P2000_e - #error config.h must define CONFIG_9P_ENABLE_9P2000_e -#else - #if CONFIG_9P_ENABLE_9P2000_e - #ifndef CONFIG_9P_MAX_9P2000_e_WELEM - #error if CONFIG_9P_ENABLE_9P2000_e then config.h must define CONFIG_9P_MAX_9P2000_e_WELEM - #endif - static_assert(CONFIG_9P_MAX_9P2000_e_WELEM > 0); - #endif -#endif - -#ifndef CONFIG_9P_ENABLE_9P2000_p9p - #error config.h must define CONFIG_9P_ENABLE_9P2000_p9p -#endif - -#ifndef CONFIG_9P_ENABLE_9P2000_u - #error config.h must define CONFIG_9P_ENABLE_9P2000_u -#endif - -/* enum version ***************************************************************/ - -enum lib9p_version { - LIB9P_VER_unknown = 0, /* "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 */ - LIB9P_VER_NUM, -}; -LO_IMPLEMENTATION_H(fmt_formatter, enum lib9p_version, lib9p_version); - -/* enum msg_type **************************************************************/ - -enum lib9p_msg_type { /* uint8_t */ -#if CONFIG_9P_ENABLE_9P2000_L - LIB9P_TYP_Rlerror = 7, - LIB9P_TYP_Tstatfs = 8, - LIB9P_TYP_Rstatfs = 9, - LIB9P_TYP_Tlopen = 12, - LIB9P_TYP_Rlopen = 13, - LIB9P_TYP_Tlcreate = 14, - LIB9P_TYP_Rlcreate = 15, - LIB9P_TYP_Tsymlink = 16, - LIB9P_TYP_Rsymlink = 17, - LIB9P_TYP_Tmknod = 18, - LIB9P_TYP_Rmknod = 19, - LIB9P_TYP_Trename = 20, - LIB9P_TYP_Rrename = 21, - LIB9P_TYP_Treadlink = 22, - LIB9P_TYP_Rreadlink = 23, - LIB9P_TYP_Tgetattr = 24, - LIB9P_TYP_Rgetattr = 25, - LIB9P_TYP_Tsetattr = 26, - LIB9P_TYP_Rsetattr = 27, - LIB9P_TYP_Txattrwalk = 30, - LIB9P_TYP_Rxattrwalk = 31, - LIB9P_TYP_Txattrcreate = 32, - LIB9P_TYP_Rxattrcreate = 33, - LIB9P_TYP_Treaddir = 40, - LIB9P_TYP_Rreaddir = 41, - LIB9P_TYP_Tfsync = 50, - LIB9P_TYP_Rfsync = 51, - LIB9P_TYP_Tlock = 52, - LIB9P_TYP_Rlock = 53, - LIB9P_TYP_Tgetlock = 54, - LIB9P_TYP_Rgetlock = 55, - LIB9P_TYP_Tlink = 70, - LIB9P_TYP_Rlink = 71, - LIB9P_TYP_Tmkdir = 72, - LIB9P_TYP_Rmkdir = 73, - LIB9P_TYP_Trenameat = 74, - LIB9P_TYP_Rrenameat = 75, - LIB9P_TYP_Tunlinkat = 76, - LIB9P_TYP_Runlinkat = 77, -#endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000_p9p - LIB9P_TYP_Topenfd = 98, - LIB9P_TYP_Ropenfd = 99, -#endif /* CONFIG_9P_ENABLE_9P2000_p9p */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u - LIB9P_TYP_Tversion = 100, - LIB9P_TYP_Rversion = 101, - LIB9P_TYP_Tauth = 102, - LIB9P_TYP_Rauth = 103, - LIB9P_TYP_Tattach = 104, - LIB9P_TYP_Rattach = 105, - LIB9P_TYP_Rerror = 107, - LIB9P_TYP_Tflush = 108, - LIB9P_TYP_Rflush = 109, - LIB9P_TYP_Twalk = 110, - LIB9P_TYP_Rwalk = 111, -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u - LIB9P_TYP_Topen = 112, - LIB9P_TYP_Ropen = 113, - LIB9P_TYP_Tcreate = 114, - LIB9P_TYP_Rcreate = 115, -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u - LIB9P_TYP_Tread = 116, - LIB9P_TYP_Rread = 117, - LIB9P_TYP_Twrite = 118, - LIB9P_TYP_Rwrite = 119, - LIB9P_TYP_Tclunk = 120, - LIB9P_TYP_Rclunk = 121, - LIB9P_TYP_Tremove = 122, - LIB9P_TYP_Rremove = 123, -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u - LIB9P_TYP_Tstat = 124, - LIB9P_TYP_Rstat = 125, - LIB9P_TYP_Twstat = 126, - LIB9P_TYP_Rwstat = 127, -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_e - LIB9P_TYP_Tsession = 150, - LIB9P_TYP_Rsession = 151, - LIB9P_TYP_Tsread = 152, - LIB9P_TYP_Rsread = 153, - LIB9P_TYP_Tswrite = 154, - LIB9P_TYP_Rswrite = 155, -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -}; -LO_IMPLEMENTATION_H(fmt_formatter, enum lib9p_msg_type, lib9p_msg_type); - -/* payload types **************************************************************/ - -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* size = 2 ; max_iov = 1 ; max_copy = 2 */ -typedef uint16_t lib9p_tag_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_tag_t, lib9p_tag); -#define LIB9P_TAG_NOTAG ((lib9p_tag_t)(UINT16_MAX)) - -/* size = 4 ; max_iov = 1 ; max_copy = 4 */ -typedef uint32_t lib9p_fid_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_fid_t, lib9p_fid); -#define LIB9P_FID_NOFID ((lib9p_fid_t)(UINT32_MAX)) - -/* min_size = 2 ; exp_size = 29 ; max_size = 65,537 ; max_iov = 2 ; max_copy = 2 */ -struct lib9p_s { - uint16_t len; - [[gnu::nonstring]] char *utf8; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_s, lib9p_s); - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* size = 4 ; max_iov = 1 ; max_copy = 4 */ -typedef uint32_t lib9p_dm_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_dm_t, lib9p_dm); -/* bits */ -#define LIB9P_DM_DIR ((lib9p_dm_t)(UINT32_C(1)<<31)) -#define LIB9P_DM_APPEND ((lib9p_dm_t)(UINT32_C(1)<<30)) -#define LIB9P_DM_EXCL ((lib9p_dm_t)(UINT32_C(1)<<29)) -#define _LIB9P_DM_PLAN9_MOUNT ((lib9p_dm_t)(UINT32_C(1)<<28)) -#define LIB9P_DM_AUTH ((lib9p_dm_t)(UINT32_C(1)<<27)) -#define LIB9P_DM_TMP ((lib9p_dm_t)(UINT32_C(1)<<26)) -#define _LIB9P_DM_UNUSED_25 ((lib9p_dm_t)(UINT32_C(1)<<25)) -#define _LIB9P_DM_UNUSED_24 ((lib9p_dm_t)(UINT32_C(1)<<24)) -#if CONFIG_9P_ENABLE_9P2000_u -# define LIB9P_DM_DEVICE ((lib9p_dm_t)(UINT32_C(1)<<23)) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -#define _LIB9P_DM_UNUSED_22 ((lib9p_dm_t)(UINT32_C(1)<<22)) -#if CONFIG_9P_ENABLE_9P2000_u -# define LIB9P_DM_PIPE ((lib9p_dm_t)(UINT32_C(1)<<21)) -# define LIB9P_DM_SOCKET ((lib9p_dm_t)(UINT32_C(1)<<20)) -# define LIB9P_DM_SETUID ((lib9p_dm_t)(UINT32_C(1)<<19)) -# define LIB9P_DM_SETGID ((lib9p_dm_t)(UINT32_C(1)<<18)) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -#define _LIB9P_DM_UNUSED_17 ((lib9p_dm_t)(UINT32_C(1)<<17)) -#define _LIB9P_DM_UNUSED_16 ((lib9p_dm_t)(UINT32_C(1)<<16)) -#define _LIB9P_DM_UNUSED_15 ((lib9p_dm_t)(UINT32_C(1)<<15)) -#define _LIB9P_DM_UNUSED_14 ((lib9p_dm_t)(UINT32_C(1)<<14)) -#define _LIB9P_DM_UNUSED_13 ((lib9p_dm_t)(UINT32_C(1)<<13)) -#define _LIB9P_DM_UNUSED_12 ((lib9p_dm_t)(UINT32_C(1)<<12)) -#define _LIB9P_DM_UNUSED_11 ((lib9p_dm_t)(UINT32_C(1)<<11)) -#define _LIB9P_DM_UNUSED_10 ((lib9p_dm_t)(UINT32_C(1)<<10)) -#define _LIB9P_DM_UNUSED_9 ((lib9p_dm_t)(UINT32_C(1)<<9)) -#define LIB9P_DM_OWNER_R ((lib9p_dm_t)(UINT32_C(1)<<8)) -#define LIB9P_DM_OWNER_W ((lib9p_dm_t)(UINT32_C(1)<<7)) -#define LIB9P_DM_OWNER_X ((lib9p_dm_t)(UINT32_C(1)<<6)) -#define LIB9P_DM_GROUP_R ((lib9p_dm_t)(UINT32_C(1)<<5)) -#define LIB9P_DM_GROUP_W ((lib9p_dm_t)(UINT32_C(1)<<4)) -#define LIB9P_DM_GROUP_X ((lib9p_dm_t)(UINT32_C(1)<<3)) -#define LIB9P_DM_OTHER_R ((lib9p_dm_t)(UINT32_C(1)<<2)) -#define LIB9P_DM_OTHER_W ((lib9p_dm_t)(UINT32_C(1)<<1)) -#define LIB9P_DM_OTHER_X ((lib9p_dm_t)(UINT32_C(1)<<0)) -/* masks */ -#define LIB9P_DM_PERM_MASK ((lib9p_dm_t)(0b000000000000000000000111111111)) - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* size = 1 ; max_iov = 1 ; max_copy = 1 */ -typedef uint8_t lib9p_qt_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_qt_t, lib9p_qt); -/* bits */ -#define LIB9P_QT_DIR ((lib9p_qt_t)(UINT8_C(1)<<7)) -#define LIB9P_QT_APPEND ((lib9p_qt_t)(UINT8_C(1)<<6)) -#define LIB9P_QT_EXCL ((lib9p_qt_t)(UINT8_C(1)<<5)) -#define _LIB9P_QT_PLAN9_MOUNT ((lib9p_qt_t)(UINT8_C(1)<<4)) -#define LIB9P_QT_AUTH ((lib9p_qt_t)(UINT8_C(1)<<3)) -#define LIB9P_QT_TMP ((lib9p_qt_t)(UINT8_C(1)<<2)) -#if CONFIG_9P_ENABLE_9P2000_u -# define LIB9P_QT_SYMLINK ((lib9p_qt_t)(UINT8_C(1)<<1)) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -#define _LIB9P_QT_UNUSED_0 ((lib9p_qt_t)(UINT8_C(1)<<0)) -/* aliases */ -#define LIB9P_QT_FILE ((lib9p_qt_t)(0)) - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u -/* size = 4 ; max_iov = 1 ; max_copy = 4 */ -typedef uint32_t lib9p_nuid_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_nuid_t, lib9p_nuid); -#define LIB9P_NUID_NONUID ((lib9p_nuid_t)(UINT32_MAX)) - -#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* size = 1 ; max_iov = 1 ; max_copy = 1 */ -typedef uint8_t lib9p_o_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_o_t, lib9p_o); -/* bits */ -#define _LIB9P_O_UNUSED_7 ((lib9p_o_t)(UINT8_C(1)<<7)) -#define LIB9P_O_RCLOSE ((lib9p_o_t)(UINT8_C(1)<<6)) -#define _LIB9P_O_RESERVED_CEXEC ((lib9p_o_t)(UINT8_C(1)<<5)) -#define LIB9P_O_TRUNC ((lib9p_o_t)(UINT8_C(1)<<4)) -#define _LIB9P_O_UNUSED_3 ((lib9p_o_t)(UINT8_C(1)<<3)) -#define _LIB9P_O_UNUSED_2 ((lib9p_o_t)(UINT8_C(1)<<2)) -/* number LIB9P_O_MODE_* ((lib9p_o_t)(UINT8_C(1)<<1)) */ -/* number LIB9P_O_MODE_* ((lib9p_o_t)(UINT8_C(1)<<0)) */ -/* masks */ -#define LIB9P_O_FLAG_MASK ((lib9p_o_t)(0b11111100)) -/* number: MODE */ -#define LIB9P_O_MODE_READ ((lib9p_o_t)(0)) -#define LIB9P_O_MODE_WRITE ((lib9p_o_t)(1)) -#define LIB9P_O_MODE_RDWR ((lib9p_o_t)(2)) -#define LIB9P_O_MODE_EXEC ((lib9p_o_t)(3)) -#define LIB9P_O_MODE_MASK ((lib9p_o_t)(0b000011)) - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u -/* size = 4 ; max_iov = 1 ; max_copy = 4 */ -typedef uint32_t lib9p_errno_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_errno_t, lib9p_errno); -#define LIB9P_ERRNO_NOERROR ((lib9p_errno_t)(0)) - -#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_L -/* size = 4 ; max_iov = 1 ; max_copy = 4 */ -typedef uint32_t lib9p_super_magic_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_super_magic_t, lib9p_super_magic); -#define LIB9P_SUPER_MAGIC_V9FS_MAGIC ((lib9p_super_magic_t)(16914839)) - -/* size = 4 ; max_iov = 1 ; max_copy = 4 */ -typedef uint32_t lib9p_lo_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_lo_t, lib9p_lo); -/* bits */ -#define _LIB9P_LO_UNUSED_31 ((lib9p_lo_t)(UINT32_C(1)<<31)) -#define _LIB9P_LO_UNUSED_30 ((lib9p_lo_t)(UINT32_C(1)<<30)) -#define _LIB9P_LO_UNUSED_29 ((lib9p_lo_t)(UINT32_C(1)<<29)) -#define _LIB9P_LO_UNUSED_28 ((lib9p_lo_t)(UINT32_C(1)<<28)) -#define _LIB9P_LO_UNUSED_27 ((lib9p_lo_t)(UINT32_C(1)<<27)) -#define _LIB9P_LO_UNUSED_26 ((lib9p_lo_t)(UINT32_C(1)<<26)) -#define _LIB9P_LO_UNUSED_25 ((lib9p_lo_t)(UINT32_C(1)<<25)) -#define _LIB9P_LO_UNUSED_24 ((lib9p_lo_t)(UINT32_C(1)<<24)) -#define _LIB9P_LO_UNUSED_23 ((lib9p_lo_t)(UINT32_C(1)<<23)) -#define _LIB9P_LO_UNUSED_22 ((lib9p_lo_t)(UINT32_C(1)<<22)) -#define _LIB9P_LO_UNUSED_21 ((lib9p_lo_t)(UINT32_C(1)<<21)) -#define LIB9P_LO_SYNC ((lib9p_lo_t)(UINT32_C(1)<<20)) -#define LIB9P_LO_CLOEXEC ((lib9p_lo_t)(UINT32_C(1)<<19)) -#define LIB9P_LO_NOATIME ((lib9p_lo_t)(UINT32_C(1)<<18)) -#define LIB9P_LO_NOFOLLOW ((lib9p_lo_t)(UINT32_C(1)<<17)) -#define LIB9P_LO_DIRECTORY ((lib9p_lo_t)(UINT32_C(1)<<16)) -#define LIB9P_LO_LARGEFILE ((lib9p_lo_t)(UINT32_C(1)<<15)) -#define LIB9P_LO_DIRECT ((lib9p_lo_t)(UINT32_C(1)<<14)) -#define LIB9P_LO_BSD_FASYNC ((lib9p_lo_t)(UINT32_C(1)<<13)) -#define LIB9P_LO_DSYNC ((lib9p_lo_t)(UINT32_C(1)<<12)) -#define LIB9P_LO_NONBLOCK ((lib9p_lo_t)(UINT32_C(1)<<11)) -#define LIB9P_LO_APPEND ((lib9p_lo_t)(UINT32_C(1)<<10)) -#define LIB9P_LO_TRUNC ((lib9p_lo_t)(UINT32_C(1)<<9)) -#define LIB9P_LO_NOCTTY ((lib9p_lo_t)(UINT32_C(1)<<8)) -#define LIB9P_LO_EXCL ((lib9p_lo_t)(UINT32_C(1)<<7)) -#define LIB9P_LO_CREATE ((lib9p_lo_t)(UINT32_C(1)<<6)) -#define _LIB9P_LO_UNUSED_5 ((lib9p_lo_t)(UINT32_C(1)<<5)) -#define _LIB9P_LO_UNUSED_4 ((lib9p_lo_t)(UINT32_C(1)<<4)) -#define _LIB9P_LO_UNUSED_3 ((lib9p_lo_t)(UINT32_C(1)<<3)) -#define _LIB9P_LO_UNUSED_2 ((lib9p_lo_t)(UINT32_C(1)<<2)) -/* number LIB9P_LO_MODE_* ((lib9p_lo_t)(UINT32_C(1)<<1)) */ -/* number LIB9P_LO_MODE_* ((lib9p_lo_t)(UINT32_C(1)<<0)) */ -/* masks */ -#define LIB9P_LO_FLAG_MASK ((lib9p_lo_t)(0b000000000111111111111111000000)) -/* number: MODE */ -#define LIB9P_LO_MODE_RDONLY ((lib9p_lo_t)(0)) -#define LIB9P_LO_MODE_WRONLY ((lib9p_lo_t)(1)) -#define LIB9P_LO_MODE_RDWR ((lib9p_lo_t)(2)) -#define LIB9P_LO_MODE_NOACCESS ((lib9p_lo_t)(3)) -#define LIB9P_LO_MODE_MASK ((lib9p_lo_t)(0b000000000000000000000000000011)) - -/* size = 1 ; max_iov = 1 ; max_copy = 1 */ -typedef uint8_t lib9p_dt_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_dt_t, lib9p_dt); -#define LIB9P_DT_UNKNOWN ((lib9p_dt_t)(0)) -#define LIB9P_DT_PIPE ((lib9p_dt_t)(1)) -#define LIB9P_DT_CHAR_DEV ((lib9p_dt_t)(2)) -#define LIB9P_DT_DIRECTORY ((lib9p_dt_t)(4)) -#define LIB9P_DT_BLOCK_DEV ((lib9p_dt_t)(6)) -#define LIB9P_DT_REGULAR ((lib9p_dt_t)(8)) -#define LIB9P_DT_SYMLINK ((lib9p_dt_t)(10)) -#define LIB9P_DT_SOCKET ((lib9p_dt_t)(12)) -#define _LIB9P_DT_WHITEOUT ((lib9p_dt_t)(14)) - -/* size = 4 ; max_iov = 1 ; max_copy = 4 */ -typedef uint32_t lib9p_mode_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_mode_t, lib9p_mode); -/* bits */ -#define _LIB9P_MODE_UNUSED_31 ((lib9p_mode_t)(UINT32_C(1)<<31)) -#define _LIB9P_MODE_UNUSED_30 ((lib9p_mode_t)(UINT32_C(1)<<30)) -#define _LIB9P_MODE_UNUSED_29 ((lib9p_mode_t)(UINT32_C(1)<<29)) -#define _LIB9P_MODE_UNUSED_28 ((lib9p_mode_t)(UINT32_C(1)<<28)) -#define _LIB9P_MODE_UNUSED_27 ((lib9p_mode_t)(UINT32_C(1)<<27)) -#define _LIB9P_MODE_UNUSED_26 ((lib9p_mode_t)(UINT32_C(1)<<26)) -#define _LIB9P_MODE_UNUSED_25 ((lib9p_mode_t)(UINT32_C(1)<<25)) -#define _LIB9P_MODE_UNUSED_24 ((lib9p_mode_t)(UINT32_C(1)<<24)) -#define _LIB9P_MODE_UNUSED_23 ((lib9p_mode_t)(UINT32_C(1)<<23)) -#define _LIB9P_MODE_UNUSED_22 ((lib9p_mode_t)(UINT32_C(1)<<22)) -#define _LIB9P_MODE_UNUSED_21 ((lib9p_mode_t)(UINT32_C(1)<<21)) -#define _LIB9P_MODE_UNUSED_20 ((lib9p_mode_t)(UINT32_C(1)<<20)) -#define _LIB9P_MODE_UNUSED_19 ((lib9p_mode_t)(UINT32_C(1)<<19)) -#define _LIB9P_MODE_UNUSED_18 ((lib9p_mode_t)(UINT32_C(1)<<18)) -#define _LIB9P_MODE_UNUSED_17 ((lib9p_mode_t)(UINT32_C(1)<<17)) -#define _LIB9P_MODE_UNUSED_16 ((lib9p_mode_t)(UINT32_C(1)<<16)) -/* number LIB9P_MODE_FMT_* ((lib9p_mode_t)(UINT32_C(1)<<15)) */ -/* number LIB9P_MODE_FMT_* ((lib9p_mode_t)(UINT32_C(1)<<14)) */ -/* number LIB9P_MODE_FMT_* ((lib9p_mode_t)(UINT32_C(1)<<13)) */ -/* number LIB9P_MODE_FMT_* ((lib9p_mode_t)(UINT32_C(1)<<12)) */ -#define LIB9P_MODE_PERM_SETGROUP ((lib9p_mode_t)(UINT32_C(1)<<11)) -#define LIB9P_MODE_PERM_SETUSER ((lib9p_mode_t)(UINT32_C(1)<<10)) -#define LIB9P_MODE_PERM_STICKY ((lib9p_mode_t)(UINT32_C(1)<<9)) -#define LIB9P_MODE_PERM_OWNER_R ((lib9p_mode_t)(UINT32_C(1)<<8)) -#define LIB9P_MODE_PERM_OWNER_W ((lib9p_mode_t)(UINT32_C(1)<<7)) -#define LIB9P_MODE_PERM_OWNER_X ((lib9p_mode_t)(UINT32_C(1)<<6)) -#define LIB9P_MODE_PERM_GROUP_R ((lib9p_mode_t)(UINT32_C(1)<<5)) -#define LIB9P_MODE_PERM_GROUP_W ((lib9p_mode_t)(UINT32_C(1)<<4)) -#define LIB9P_MODE_PERM_GROUP_X ((lib9p_mode_t)(UINT32_C(1)<<3)) -#define LIB9P_MODE_PERM_OTHER_R ((lib9p_mode_t)(UINT32_C(1)<<2)) -#define LIB9P_MODE_PERM_OTHER_W ((lib9p_mode_t)(UINT32_C(1)<<1)) -#define LIB9P_MODE_PERM_OTHER_X ((lib9p_mode_t)(UINT32_C(1)<<0)) -/* masks */ -#define LIB9P_MODE_PERM_MASK ((lib9p_mode_t)(0b000000000000000000111111111111)) -/* number: FMT */ -#define LIB9P_MODE_FMT_PIPE ((lib9p_mode_t)(LIB9P_DT_PIPE << 12)) -#define LIB9P_MODE_FMT_CHAR_DEV ((lib9p_mode_t)(LIB9P_DT_CHAR_DEV << 12)) -#define LIB9P_MODE_FMT_DIRECTORY ((lib9p_mode_t)(LIB9P_DT_DIRECTORY << 12)) -#define LIB9P_MODE_FMT_BLOCK_DEV ((lib9p_mode_t)(LIB9P_DT_BLOCK_DEV << 12)) -#define LIB9P_MODE_FMT_REGULAR ((lib9p_mode_t)(LIB9P_DT_REGULAR << 12)) -#define LIB9P_MODE_FMT_SYMLINK ((lib9p_mode_t)(LIB9P_DT_SYMLINK << 12)) -#define LIB9P_MODE_FMT_SOCKET ((lib9p_mode_t)(LIB9P_DT_SOCKET << 12)) -#define LIB9P_MODE_FMT_MASK ((lib9p_mode_t)(0b000000000000001111000000000000)) - -/* size = 4 ; max_iov = 1 ; max_copy = 4 */ -typedef uint32_t lib9p_b4_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_b4_t, lib9p_b4); -#define LIB9P_B4_FALSE ((lib9p_b4_t)(0)) -#define LIB9P_B4_TRUE ((lib9p_b4_t)(1)) - -/* size = 8 ; max_iov = 1 ; max_copy = 8 */ -typedef uint64_t lib9p_getattr_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_getattr_t, lib9p_getattr); -/* bits */ -#define _LIB9P_GETATTR_UNUSED_63 ((lib9p_getattr_t)(UINT64_C(1)<<63)) -#define _LIB9P_GETATTR_UNUSED_62 ((lib9p_getattr_t)(UINT64_C(1)<<62)) -#define _LIB9P_GETATTR_UNUSED_61 ((lib9p_getattr_t)(UINT64_C(1)<<61)) -#define _LIB9P_GETATTR_UNUSED_60 ((lib9p_getattr_t)(UINT64_C(1)<<60)) -#define _LIB9P_GETATTR_UNUSED_59 ((lib9p_getattr_t)(UINT64_C(1)<<59)) -#define _LIB9P_GETATTR_UNUSED_58 ((lib9p_getattr_t)(UINT64_C(1)<<58)) -#define _LIB9P_GETATTR_UNUSED_57 ((lib9p_getattr_t)(UINT64_C(1)<<57)) -#define _LIB9P_GETATTR_UNUSED_56 ((lib9p_getattr_t)(UINT64_C(1)<<56)) -#define _LIB9P_GETATTR_UNUSED_55 ((lib9p_getattr_t)(UINT64_C(1)<<55)) -#define _LIB9P_GETATTR_UNUSED_54 ((lib9p_getattr_t)(UINT64_C(1)<<54)) -#define _LIB9P_GETATTR_UNUSED_53 ((lib9p_getattr_t)(UINT64_C(1)<<53)) -#define _LIB9P_GETATTR_UNUSED_52 ((lib9p_getattr_t)(UINT64_C(1)<<52)) -#define _LIB9P_GETATTR_UNUSED_51 ((lib9p_getattr_t)(UINT64_C(1)<<51)) -#define _LIB9P_GETATTR_UNUSED_50 ((lib9p_getattr_t)(UINT64_C(1)<<50)) -#define _LIB9P_GETATTR_UNUSED_49 ((lib9p_getattr_t)(UINT64_C(1)<<49)) -#define _LIB9P_GETATTR_UNUSED_48 ((lib9p_getattr_t)(UINT64_C(1)<<48)) -#define _LIB9P_GETATTR_UNUSED_47 ((lib9p_getattr_t)(UINT64_C(1)<<47)) -#define _LIB9P_GETATTR_UNUSED_46 ((lib9p_getattr_t)(UINT64_C(1)<<46)) -#define _LIB9P_GETATTR_UNUSED_45 ((lib9p_getattr_t)(UINT64_C(1)<<45)) -#define _LIB9P_GETATTR_UNUSED_44 ((lib9p_getattr_t)(UINT64_C(1)<<44)) -#define _LIB9P_GETATTR_UNUSED_43 ((lib9p_getattr_t)(UINT64_C(1)<<43)) -#define _LIB9P_GETATTR_UNUSED_42 ((lib9p_getattr_t)(UINT64_C(1)<<42)) -#define _LIB9P_GETATTR_UNUSED_41 ((lib9p_getattr_t)(UINT64_C(1)<<41)) -#define _LIB9P_GETATTR_UNUSED_40 ((lib9p_getattr_t)(UINT64_C(1)<<40)) -#define _LIB9P_GETATTR_UNUSED_39 ((lib9p_getattr_t)(UINT64_C(1)<<39)) -#define _LIB9P_GETATTR_UNUSED_38 ((lib9p_getattr_t)(UINT64_C(1)<<38)) -#define _LIB9P_GETATTR_UNUSED_37 ((lib9p_getattr_t)(UINT64_C(1)<<37)) -#define _LIB9P_GETATTR_UNUSED_36 ((lib9p_getattr_t)(UINT64_C(1)<<36)) -#define _LIB9P_GETATTR_UNUSED_35 ((lib9p_getattr_t)(UINT64_C(1)<<35)) -#define _LIB9P_GETATTR_UNUSED_34 ((lib9p_getattr_t)(UINT64_C(1)<<34)) -#define _LIB9P_GETATTR_UNUSED_33 ((lib9p_getattr_t)(UINT64_C(1)<<33)) -#define _LIB9P_GETATTR_UNUSED_32 ((lib9p_getattr_t)(UINT64_C(1)<<32)) -#define _LIB9P_GETATTR_UNUSED_31 ((lib9p_getattr_t)(UINT64_C(1)<<31)) -#define _LIB9P_GETATTR_UNUSED_30 ((lib9p_getattr_t)(UINT64_C(1)<<30)) -#define _LIB9P_GETATTR_UNUSED_29 ((lib9p_getattr_t)(UINT64_C(1)<<29)) -#define _LIB9P_GETATTR_UNUSED_28 ((lib9p_getattr_t)(UINT64_C(1)<<28)) -#define _LIB9P_GETATTR_UNUSED_27 ((lib9p_getattr_t)(UINT64_C(1)<<27)) -#define _LIB9P_GETATTR_UNUSED_26 ((lib9p_getattr_t)(UINT64_C(1)<<26)) -#define _LIB9P_GETATTR_UNUSED_25 ((lib9p_getattr_t)(UINT64_C(1)<<25)) -#define _LIB9P_GETATTR_UNUSED_24 ((lib9p_getattr_t)(UINT64_C(1)<<24)) -#define _LIB9P_GETATTR_UNUSED_23 ((lib9p_getattr_t)(UINT64_C(1)<<23)) -#define _LIB9P_GETATTR_UNUSED_22 ((lib9p_getattr_t)(UINT64_C(1)<<22)) -#define _LIB9P_GETATTR_UNUSED_21 ((lib9p_getattr_t)(UINT64_C(1)<<21)) -#define _LIB9P_GETATTR_UNUSED_20 ((lib9p_getattr_t)(UINT64_C(1)<<20)) -#define _LIB9P_GETATTR_UNUSED_19 ((lib9p_getattr_t)(UINT64_C(1)<<19)) -#define _LIB9P_GETATTR_UNUSED_18 ((lib9p_getattr_t)(UINT64_C(1)<<18)) -#define _LIB9P_GETATTR_UNUSED_17 ((lib9p_getattr_t)(UINT64_C(1)<<17)) -#define _LIB9P_GETATTR_UNUSED_16 ((lib9p_getattr_t)(UINT64_C(1)<<16)) -#define _LIB9P_GETATTR_UNUSED_15 ((lib9p_getattr_t)(UINT64_C(1)<<15)) -#define _LIB9P_GETATTR_UNUSED_14 ((lib9p_getattr_t)(UINT64_C(1)<<14)) -#define LIB9P_GETATTR_DATA_VERSION ((lib9p_getattr_t)(UINT64_C(1)<<13)) -#define LIB9P_GETATTR_GEN ((lib9p_getattr_t)(UINT64_C(1)<<12)) -#define LIB9P_GETATTR_BTIME ((lib9p_getattr_t)(UINT64_C(1)<<11)) -#define LIB9P_GETATTR_BLOCKS ((lib9p_getattr_t)(UINT64_C(1)<<10)) -#define LIB9P_GETATTR_SIZE ((lib9p_getattr_t)(UINT64_C(1)<<9)) -#define LIB9P_GETATTR_INO ((lib9p_getattr_t)(UINT64_C(1)<<8)) -#define LIB9P_GETATTR_CTIME ((lib9p_getattr_t)(UINT64_C(1)<<7)) -#define LIB9P_GETATTR_MTIME ((lib9p_getattr_t)(UINT64_C(1)<<6)) -#define LIB9P_GETATTR_ATIME ((lib9p_getattr_t)(UINT64_C(1)<<5)) -#define LIB9P_GETATTR_RDEV ((lib9p_getattr_t)(UINT64_C(1)<<4)) -#define LIB9P_GETATTR_GID ((lib9p_getattr_t)(UINT64_C(1)<<3)) -#define LIB9P_GETATTR_UID ((lib9p_getattr_t)(UINT64_C(1)<<2)) -#define LIB9P_GETATTR_NLINK ((lib9p_getattr_t)(UINT64_C(1)<<1)) -#define LIB9P_GETATTR_MODE ((lib9p_getattr_t)(UINT64_C(1)<<0)) -/* aliases */ -#define LIB9P_GETATTR_BASIC ((lib9p_getattr_t)(2047)) -#define LIB9P_GETATTR_ALL ((lib9p_getattr_t)(16383)) - -/* size = 4 ; max_iov = 1 ; max_copy = 4 */ -typedef uint32_t lib9p_setattr_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_setattr_t, lib9p_setattr); -/* bits */ -#define _LIB9P_SETATTR_UNUSED_31 ((lib9p_setattr_t)(UINT32_C(1)<<31)) -#define _LIB9P_SETATTR_UNUSED_30 ((lib9p_setattr_t)(UINT32_C(1)<<30)) -#define _LIB9P_SETATTR_UNUSED_29 ((lib9p_setattr_t)(UINT32_C(1)<<29)) -#define _LIB9P_SETATTR_UNUSED_28 ((lib9p_setattr_t)(UINT32_C(1)<<28)) -#define _LIB9P_SETATTR_UNUSED_27 ((lib9p_setattr_t)(UINT32_C(1)<<27)) -#define _LIB9P_SETATTR_UNUSED_26 ((lib9p_setattr_t)(UINT32_C(1)<<26)) -#define _LIB9P_SETATTR_UNUSED_25 ((lib9p_setattr_t)(UINT32_C(1)<<25)) -#define _LIB9P_SETATTR_UNUSED_24 ((lib9p_setattr_t)(UINT32_C(1)<<24)) -#define _LIB9P_SETATTR_UNUSED_23 ((lib9p_setattr_t)(UINT32_C(1)<<23)) -#define _LIB9P_SETATTR_UNUSED_22 ((lib9p_setattr_t)(UINT32_C(1)<<22)) -#define _LIB9P_SETATTR_UNUSED_21 ((lib9p_setattr_t)(UINT32_C(1)<<21)) -#define _LIB9P_SETATTR_UNUSED_20 ((lib9p_setattr_t)(UINT32_C(1)<<20)) -#define _LIB9P_SETATTR_UNUSED_19 ((lib9p_setattr_t)(UINT32_C(1)<<19)) -#define _LIB9P_SETATTR_UNUSED_18 ((lib9p_setattr_t)(UINT32_C(1)<<18)) -#define _LIB9P_SETATTR_UNUSED_17 ((lib9p_setattr_t)(UINT32_C(1)<<17)) -#define _LIB9P_SETATTR_UNUSED_16 ((lib9p_setattr_t)(UINT32_C(1)<<16)) -#define _LIB9P_SETATTR_UNUSED_15 ((lib9p_setattr_t)(UINT32_C(1)<<15)) -#define _LIB9P_SETATTR_UNUSED_14 ((lib9p_setattr_t)(UINT32_C(1)<<14)) -#define _LIB9P_SETATTR_UNUSED_13 ((lib9p_setattr_t)(UINT32_C(1)<<13)) -#define _LIB9P_SETATTR_UNUSED_12 ((lib9p_setattr_t)(UINT32_C(1)<<12)) -#define _LIB9P_SETATTR_UNUSED_11 ((lib9p_setattr_t)(UINT32_C(1)<<11)) -#define _LIB9P_SETATTR_UNUSED_10 ((lib9p_setattr_t)(UINT32_C(1)<<10)) -#define _LIB9P_SETATTR_UNUSED_9 ((lib9p_setattr_t)(UINT32_C(1)<<9)) -#define LIB9P_SETATTR_MTIME_SET ((lib9p_setattr_t)(UINT32_C(1)<<8)) -#define LIB9P_SETATTR_ATIME_SET ((lib9p_setattr_t)(UINT32_C(1)<<7)) -#define LIB9P_SETATTR_CTIME ((lib9p_setattr_t)(UINT32_C(1)<<6)) -#define LIB9P_SETATTR_MTIME ((lib9p_setattr_t)(UINT32_C(1)<<5)) -#define LIB9P_SETATTR_ATIME ((lib9p_setattr_t)(UINT32_C(1)<<4)) -#define LIB9P_SETATTR_SIZE ((lib9p_setattr_t)(UINT32_C(1)<<3)) -#define LIB9P_SETATTR_GID ((lib9p_setattr_t)(UINT32_C(1)<<2)) -#define LIB9P_SETATTR_UID ((lib9p_setattr_t)(UINT32_C(1)<<1)) -#define LIB9P_SETATTR_MODE ((lib9p_setattr_t)(UINT32_C(1)<<0)) - -/* size = 1 ; max_iov = 1 ; max_copy = 1 */ -typedef uint8_t lib9p_lock_type_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_lock_type_t, lib9p_lock_type); -#define LIB9P_LOCK_TYPE_RDLCK ((lib9p_lock_type_t)(0)) -#define LIB9P_LOCK_TYPE_WRLCK ((lib9p_lock_type_t)(1)) -#define LIB9P_LOCK_TYPE_UNLCK ((lib9p_lock_type_t)(2)) - -/* size = 4 ; max_iov = 1 ; max_copy = 4 */ -typedef uint32_t lib9p_lock_flags_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_lock_flags_t, lib9p_lock_flags); -/* bits */ -#define _LIB9P_LOCK_FLAGS_UNUSED_31 ((lib9p_lock_flags_t)(UINT32_C(1)<<31)) -#define _LIB9P_LOCK_FLAGS_UNUSED_30 ((lib9p_lock_flags_t)(UINT32_C(1)<<30)) -#define _LIB9P_LOCK_FLAGS_UNUSED_29 ((lib9p_lock_flags_t)(UINT32_C(1)<<29)) -#define _LIB9P_LOCK_FLAGS_UNUSED_28 ((lib9p_lock_flags_t)(UINT32_C(1)<<28)) -#define _LIB9P_LOCK_FLAGS_UNUSED_27 ((lib9p_lock_flags_t)(UINT32_C(1)<<27)) -#define _LIB9P_LOCK_FLAGS_UNUSED_26 ((lib9p_lock_flags_t)(UINT32_C(1)<<26)) -#define _LIB9P_LOCK_FLAGS_UNUSED_25 ((lib9p_lock_flags_t)(UINT32_C(1)<<25)) -#define _LIB9P_LOCK_FLAGS_UNUSED_24 ((lib9p_lock_flags_t)(UINT32_C(1)<<24)) -#define _LIB9P_LOCK_FLAGS_UNUSED_23 ((lib9p_lock_flags_t)(UINT32_C(1)<<23)) -#define _LIB9P_LOCK_FLAGS_UNUSED_22 ((lib9p_lock_flags_t)(UINT32_C(1)<<22)) -#define _LIB9P_LOCK_FLAGS_UNUSED_21 ((lib9p_lock_flags_t)(UINT32_C(1)<<21)) -#define _LIB9P_LOCK_FLAGS_UNUSED_20 ((lib9p_lock_flags_t)(UINT32_C(1)<<20)) -#define _LIB9P_LOCK_FLAGS_UNUSED_19 ((lib9p_lock_flags_t)(UINT32_C(1)<<19)) -#define _LIB9P_LOCK_FLAGS_UNUSED_18 ((lib9p_lock_flags_t)(UINT32_C(1)<<18)) -#define _LIB9P_LOCK_FLAGS_UNUSED_17 ((lib9p_lock_flags_t)(UINT32_C(1)<<17)) -#define _LIB9P_LOCK_FLAGS_UNUSED_16 ((lib9p_lock_flags_t)(UINT32_C(1)<<16)) -#define _LIB9P_LOCK_FLAGS_UNUSED_15 ((lib9p_lock_flags_t)(UINT32_C(1)<<15)) -#define _LIB9P_LOCK_FLAGS_UNUSED_14 ((lib9p_lock_flags_t)(UINT32_C(1)<<14)) -#define _LIB9P_LOCK_FLAGS_UNUSED_13 ((lib9p_lock_flags_t)(UINT32_C(1)<<13)) -#define _LIB9P_LOCK_FLAGS_UNUSED_12 ((lib9p_lock_flags_t)(UINT32_C(1)<<12)) -#define _LIB9P_LOCK_FLAGS_UNUSED_11 ((lib9p_lock_flags_t)(UINT32_C(1)<<11)) -#define _LIB9P_LOCK_FLAGS_UNUSED_10 ((lib9p_lock_flags_t)(UINT32_C(1)<<10)) -#define _LIB9P_LOCK_FLAGS_UNUSED_9 ((lib9p_lock_flags_t)(UINT32_C(1)<<9)) -#define _LIB9P_LOCK_FLAGS_UNUSED_8 ((lib9p_lock_flags_t)(UINT32_C(1)<<8)) -#define _LIB9P_LOCK_FLAGS_UNUSED_7 ((lib9p_lock_flags_t)(UINT32_C(1)<<7)) -#define _LIB9P_LOCK_FLAGS_UNUSED_6 ((lib9p_lock_flags_t)(UINT32_C(1)<<6)) -#define _LIB9P_LOCK_FLAGS_UNUSED_5 ((lib9p_lock_flags_t)(UINT32_C(1)<<5)) -#define _LIB9P_LOCK_FLAGS_UNUSED_4 ((lib9p_lock_flags_t)(UINT32_C(1)<<4)) -#define _LIB9P_LOCK_FLAGS_UNUSED_3 ((lib9p_lock_flags_t)(UINT32_C(1)<<3)) -#define _LIB9P_LOCK_FLAGS_UNUSED_2 ((lib9p_lock_flags_t)(UINT32_C(1)<<2)) -#define LIB9P_LOCK_FLAGS_RECLAIM ((lib9p_lock_flags_t)(UINT32_C(1)<<1)) -#define LIB9P_LOCK_FLAGS_BLOCK ((lib9p_lock_flags_t)(UINT32_C(1)<<0)) - -/* size = 1 ; max_iov = 1 ; max_copy = 1 */ -typedef uint8_t lib9p_lock_status_t; -LO_IMPLEMENTATION_H(fmt_formatter, lib9p_lock_status_t, lib9p_lock_status); -#define LIB9P_LOCK_STATUS_SUCCESS ((lib9p_lock_status_t)(0)) -#define LIB9P_LOCK_STATUS_BLOCKED ((lib9p_lock_status_t)(1)) -#define LIB9P_LOCK_STATUS_ERROR ((lib9p_lock_status_t)(2)) -#define LIB9P_LOCK_STATUS_GRACE ((lib9p_lock_status_t)(3)) - -#endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* size = 9 ; max_iov = 1 ; max_copy = 9 */ -struct lib9p_msg_Tflush { - lib9p_tag_t tag; - uint16_t oldtag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tflush, lib9p_msg_Tflush); - -/* size = 7 ; max_iov = 1 ; max_copy = 7 */ -struct lib9p_msg_Rflush { - lib9p_tag_t tag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rflush, lib9p_msg_Rflush); - -/* min_size = 11 ; exp_size = 8,203 ; max_size = 2,147,483,658 ; max_iov = 2 ; max_copy = 11 */ -struct lib9p_msg_Rread { - lib9p_tag_t tag; - uint32_t count; - [[gnu::nonstring]] char *data; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rread, lib9p_msg_Rread); - -/* size = 11 ; max_iov = 1 ; max_copy = 11 */ -struct lib9p_msg_Rwrite { - lib9p_tag_t tag; - uint32_t count; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rwrite, lib9p_msg_Rwrite); - -/* size = 7 ; max_iov = 1 ; max_copy = 7 */ -struct lib9p_msg_Rclunk { - lib9p_tag_t tag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rclunk, lib9p_msg_Rclunk); - -/* size = 7 ; max_iov = 1 ; max_copy = 7 */ -struct lib9p_msg_Rremove { - lib9p_tag_t tag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rremove, lib9p_msg_Rremove); - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* size = 7 ; max_iov = 1 ; max_copy = 7 */ -struct lib9p_msg_Rwstat { - lib9p_tag_t tag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rwstat, lib9p_msg_Rwstat); - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_L -/* size = 7 ; max_iov = 1 ; max_copy = 7 */ -struct lib9p_msg_Rrename { - lib9p_tag_t tag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rrename, lib9p_msg_Rrename); - -/* size = 7 ; max_iov = 1 ; max_copy = 7 */ -struct lib9p_msg_Rsetattr { - lib9p_tag_t tag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rsetattr, lib9p_msg_Rsetattr); - -/* size = 15 ; max_iov = 1 ; max_copy = 15 */ -struct lib9p_msg_Rxattrwalk { - lib9p_tag_t tag; - uint64_t attr_size; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rxattrwalk, lib9p_msg_Rxattrwalk); - -/* size = 7 ; max_iov = 1 ; max_copy = 7 */ -struct lib9p_msg_Rxattrcreate { - lib9p_tag_t tag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rxattrcreate, lib9p_msg_Rxattrcreate); - -/* min_size = 11 ; exp_size = 8,203 ; max_size = 4,294,967,306 (warning: >UINT32_MAX) ; max_iov = 2 ; max_copy = 11 */ -struct lib9p_msg_Rreaddir { - lib9p_tag_t tag; - uint32_t count; - [[gnu::nonstring]] char *data; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rreaddir, lib9p_msg_Rreaddir); - -/* size = 7 ; max_iov = 1 ; max_copy = 7 */ -struct lib9p_msg_Rfsync { - lib9p_tag_t tag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rfsync, lib9p_msg_Rfsync); - -/* size = 7 ; max_iov = 1 ; max_copy = 7 */ -struct lib9p_msg_Rlink { - lib9p_tag_t tag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rlink, lib9p_msg_Rlink); - -/* size = 7 ; max_iov = 1 ; max_copy = 7 */ -struct lib9p_msg_Rrenameat { - lib9p_tag_t tag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rrenameat, lib9p_msg_Rrenameat); - -/* size = 7 ; max_iov = 1 ; max_copy = 7 */ -struct lib9p_msg_Runlinkat { - lib9p_tag_t tag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Runlinkat, lib9p_msg_Runlinkat); - -#endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000_e -/* size = 15 ; max_iov = 1 ; max_copy = 15 */ -struct lib9p_msg_Tsession { - lib9p_tag_t tag; - uint64_t key; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tsession, lib9p_msg_Tsession); - -/* size = 7 ; max_iov = 1 ; max_copy = 7 */ -struct lib9p_msg_Rsession { - lib9p_tag_t tag; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rsession, lib9p_msg_Rsession); - -/* min_size = 11 ; exp_size = 8,203 ; max_size = 4,294,967,306 (warning: >UINT32_MAX) ; max_iov = 2 ; max_copy = 11 */ -struct lib9p_msg_Rsread { - lib9p_tag_t tag; - uint32_t count; - [[gnu::nonstring]] char *data; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rsread, lib9p_msg_Rsread); - -/* size = 11 ; max_iov = 1 ; max_copy = 11 */ -struct lib9p_msg_Rswrite { - lib9p_tag_t tag; - uint32_t count; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rswrite, lib9p_msg_Rswrite); - -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* size = 23 ; max_iov = 1 ; max_copy = 23 */ -struct lib9p_msg_Tread { - lib9p_tag_t tag; - lib9p_fid_t fid; - uint64_t offset; - uint32_t count; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tread, lib9p_msg_Tread); - -/* min_size = 23 ; exp_size = 8,215 ; max_size = 2,147,483,670 ; max_iov = 2 ; max_copy = 23 */ -struct lib9p_msg_Twrite { - lib9p_tag_t tag; - lib9p_fid_t fid; - uint64_t offset; - uint32_t count; - [[gnu::nonstring]] char *data; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Twrite, lib9p_msg_Twrite); - -/* size = 11 ; max_iov = 1 ; max_copy = 11 */ -struct lib9p_msg_Tclunk { - lib9p_tag_t tag; - lib9p_fid_t fid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tclunk, lib9p_msg_Tclunk); - -/* size = 11 ; max_iov = 1 ; max_copy = 11 */ -struct lib9p_msg_Tremove { - lib9p_tag_t tag; - lib9p_fid_t fid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tremove, lib9p_msg_Tremove); - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* size = 11 ; max_iov = 1 ; max_copy = 11 */ -struct lib9p_msg_Tstat { - lib9p_tag_t tag; - lib9p_fid_t fid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tstat, lib9p_msg_Tstat); - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_L -/* size = 11 ; max_iov = 1 ; max_copy = 11 */ -struct lib9p_msg_Tstatfs { - lib9p_tag_t tag; - lib9p_fid_t fid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tstatfs, lib9p_msg_Tstatfs); - -/* size = 11 ; max_iov = 1 ; max_copy = 11 */ -struct lib9p_msg_Treadlink { - lib9p_tag_t tag; - lib9p_fid_t fid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Treadlink, lib9p_msg_Treadlink); - -/* size = 23 ; max_iov = 1 ; max_copy = 23 */ -struct lib9p_msg_Treaddir { - lib9p_tag_t tag; - lib9p_fid_t fid; - uint64_t offset; - uint32_t count; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Treaddir, lib9p_msg_Treaddir); - -#endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* min_size = 13 ; exp_size = 40 ; max_size = 65,548 ; max_iov = 2 ; max_copy = 13 */ -struct lib9p_msg_Tversion { - lib9p_tag_t tag; - uint32_t max_msg_size; - struct lib9p_s version; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tversion, lib9p_msg_Tversion); - -/* min_size = 13 ; exp_size = 40 ; max_size = 65,548 ; max_iov = 2 ; max_copy = 13 */ -struct lib9p_msg_Rversion { - lib9p_tag_t tag; - uint32_t max_msg_size; - struct lib9p_s version; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rversion, lib9p_msg_Rversion); - -/* min_size = 17 ; exp_size = 481 ; max_size = 1,048,609 ; max_iov = 32 ; max_copy = 49 */ -struct lib9p_msg_Twalk { - lib9p_tag_t tag; - lib9p_fid_t fid; - lib9p_fid_t newfid; - uint16_t nwname; - struct lib9p_s *wname; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Twalk, lib9p_msg_Twalk); - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_L -/* min_size = 17 ; exp_size = 44 ; max_size = 65,552 ; max_iov = 2 ; max_copy = 17 */ -struct lib9p_msg_Trename { - lib9p_tag_t tag; - lib9p_fid_t fid; - lib9p_fid_t dfid; - struct lib9p_s name; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Trename, lib9p_msg_Trename); - -/* min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ -struct lib9p_msg_Rreadlink { - lib9p_tag_t tag; - struct lib9p_s target; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rreadlink, lib9p_msg_Rreadlink); - -/* min_size = 17 ; exp_size = 44 ; max_size = 65,552 ; max_iov = 2 ; max_copy = 17 */ -struct lib9p_msg_Txattrwalk { - lib9p_tag_t tag; - lib9p_fid_t fid; - lib9p_fid_t newfid; - struct lib9p_s name; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Txattrwalk, lib9p_msg_Txattrwalk); - -/* min_size = 25 ; exp_size = 52 ; max_size = 65,560 ; max_iov = 3 ; max_copy = 25 */ -struct lib9p_msg_Txattrcreate { - lib9p_tag_t tag; - lib9p_fid_t fid; - struct lib9p_s name; - uint64_t attr_size; - uint32_t flags; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Txattrcreate, lib9p_msg_Txattrcreate); - -/* min_size = 17 ; exp_size = 44 ; max_size = 65,552 ; max_iov = 2 ; max_copy = 17 */ -struct lib9p_msg_Tlink { - lib9p_tag_t tag; - lib9p_fid_t dfid; - lib9p_fid_t fid; - struct lib9p_s name; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tlink, lib9p_msg_Tlink); - -/* min_size = 19 ; exp_size = 73 ; max_size = 131,089 ; max_iov = 4 ; max_copy = 19 */ -struct lib9p_msg_Trenameat { - lib9p_tag_t tag; - lib9p_fid_t olddirfid; - struct lib9p_s oldname; - lib9p_fid_t newdirfid; - struct lib9p_s newname; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Trenameat, lib9p_msg_Trenameat); - -/* min_size = 17 ; exp_size = 44 ; max_size = 65,552 ; max_iov = 3 ; max_copy = 17 */ -struct lib9p_msg_Tunlinkat { - lib9p_tag_t tag; - lib9p_fid_t dirfd; - struct lib9p_s name; - uint32_t flags; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tunlinkat, lib9p_msg_Tunlinkat); - -#endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000_e -/* min_size = 13 ; exp_size = 477 ; max_size = 4,294,967,308 (warning: >UINT32_MAX) ; max_iov = 0 + (CONFIG_9P_MAX_9P2000_e_WELEM * 2) ; max_copy = 13 + (CONFIG_9P_MAX_9P2000_e_WELEM * 2) */ -struct lib9p_msg_Tsread { - lib9p_tag_t tag; - uint32_t fid; - uint16_t nwname; - struct lib9p_s *wname; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tsread, lib9p_msg_Tsread); - -/* min_size = 17 ; exp_size = 8,673 ; max_size = 8,589,934,607 (warning: >UINT32_MAX) ; max_iov = 2 + (CONFIG_9P_MAX_9P2000_e_WELEM * 2) ; max_copy = 17 + (CONFIG_9P_MAX_9P2000_e_WELEM * 2) */ -struct lib9p_msg_Tswrite { - lib9p_tag_t tag; - uint32_t fid; - uint16_t nwname; - struct lib9p_s *wname; - uint32_t count; - [[gnu::nonstring]] char *data; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tswrite, lib9p_msg_Tswrite); - -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* size = 13 ; max_iov = 1 ; max_copy = 13 */ -struct lib9p_qid { - lib9p_qt_t type; - uint32_t vers; - uint64_t path; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_qid, lib9p_qid); - -/* LIB9P_VER_9P2000 : min_size = 15 ; exp_size = 69 ; max_size = 131,085 ; max_iov = 4 ; max_copy = 15 */ -/* LIB9P_VER_9P2000_L : min_size = 19 ; exp_size = 73 ; max_size = 131,089 ; max_iov = 5 ; max_copy = 19 */ -/* LIB9P_VER_9P2000_e : min_size = 15 ; exp_size = 69 ; max_size = 131,085 ; max_iov = 4 ; max_copy = 15 */ -/* LIB9P_VER_9P2000_p9p: min_size = 15 ; exp_size = 69 ; max_size = 131,085 ; max_iov = 4 ; max_copy = 15 */ -/* LIB9P_VER_9P2000_u : min_size = 19 ; exp_size = 73 ; max_size = 131,089 ; max_iov = 5 ; max_copy = 19 */ -struct lib9p_msg_Tauth { - lib9p_tag_t tag; - lib9p_fid_t afid; - struct lib9p_s uname; - struct lib9p_s aname; -#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u - lib9p_nuid_t n_uid; -#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tauth, lib9p_msg_Tauth); - -/* LIB9P_VER_9P2000 : min_size = 19 ; exp_size = 73 ; max_size = 131,089 ; max_iov = 4 ; max_copy = 19 */ -/* LIB9P_VER_9P2000_L : min_size = 23 ; exp_size = 77 ; max_size = 131,093 ; max_iov = 5 ; max_copy = 23 */ -/* LIB9P_VER_9P2000_e : min_size = 19 ; exp_size = 73 ; max_size = 131,089 ; max_iov = 4 ; max_copy = 19 */ -/* LIB9P_VER_9P2000_p9p: min_size = 19 ; exp_size = 73 ; max_size = 131,089 ; max_iov = 4 ; max_copy = 19 */ -/* LIB9P_VER_9P2000_u : min_size = 23 ; exp_size = 77 ; max_size = 131,093 ; max_iov = 5 ; max_copy = 23 */ -struct lib9p_msg_Tattach { - lib9p_tag_t tag; - lib9p_fid_t fid; - lib9p_fid_t afid; - struct lib9p_s uname; - struct lib9p_s aname; -#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u - lib9p_nuid_t n_uid; -#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tattach, lib9p_msg_Tattach); - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_L -/* min_size = 19 ; exp_size = 73 ; max_size = 131,089 ; max_iov = 5 ; max_copy = 19 */ -struct lib9p_msg_Tsymlink { - lib9p_tag_t tag; - lib9p_fid_t fid; - struct lib9p_s name; - struct lib9p_s symtgt; - lib9p_nuid_t gid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tsymlink, lib9p_msg_Tsymlink); - -#endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* size = 12 ; max_iov = 1 ; max_copy = 12 */ -struct lib9p_msg_Topen { - lib9p_tag_t tag; - lib9p_fid_t fid; - lib9p_o_t mode; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Topen, lib9p_msg_Topen); - -/* min_size = 18 ; exp_size = 45 ; max_size = 65,553 ; max_iov = 3 ; max_copy = 18 */ -struct lib9p_msg_Tcreate { - lib9p_tag_t tag; - lib9p_fid_t fid; - struct lib9p_s name; - lib9p_dm_t perm; - lib9p_o_t mode; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tcreate, lib9p_msg_Tcreate); - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_p9p -/* size = 12 ; max_iov = 1 ; max_copy = 12 */ -struct lib9p_msg_Topenfd { - lib9p_tag_t tag; - lib9p_fid_t fid; - lib9p_o_t mode; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Topenfd, lib9p_msg_Topenfd); - -#endif /* CONFIG_9P_ENABLE_9P2000_p9p */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* LIB9P_VER_9P2000 : min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ -/* LIB9P_VER_9P2000_L : min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ -/* LIB9P_VER_9P2000_e : min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ -/* LIB9P_VER_9P2000_p9p: min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ -/* LIB9P_VER_9P2000_u : min_size = 13 ; exp_size = 40 ; max_size = 65,548 ; max_iov = 3 ; max_copy = 13 */ -struct lib9p_msg_Rerror { - lib9p_tag_t tag; - struct lib9p_s ename; -#if CONFIG_9P_ENABLE_9P2000_u - lib9p_errno_t errno; -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rerror, lib9p_msg_Rerror); - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_L -/* size = 11 ; max_iov = 1 ; max_copy = 11 */ -struct lib9p_msg_Rlerror { - lib9p_tag_t tag; - lib9p_errno_t ecode; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rlerror, lib9p_msg_Rlerror); - -/* size = 67 ; max_iov = 1 ; max_copy = 67 */ -struct lib9p_msg_Rstatfs { - lib9p_tag_t tag; - lib9p_super_magic_t type; - uint32_t bsize; - uint64_t blocks; - uint64_t bfree; - uint64_t bavail; - uint64_t files; - uint64_t ffree; - uint64_t fsid; - uint32_t namelen; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rstatfs, lib9p_msg_Rstatfs); - -/* size = 15 ; max_iov = 1 ; max_copy = 15 */ -struct lib9p_msg_Tlopen { - lib9p_tag_t tag; - lib9p_fid_t fid; - lib9p_lo_t flags; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tlopen, lib9p_msg_Tlopen); - -/* min_size = 25 ; exp_size = 52 ; max_size = 65,560 ; max_iov = 3 ; max_copy = 25 */ -struct lib9p_msg_Tlcreate { - lib9p_tag_t tag; - lib9p_fid_t fid; - struct lib9p_s name; - lib9p_lo_t flags; - lib9p_mode_t mode; - lib9p_nuid_t gid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tlcreate, lib9p_msg_Tlcreate); - -/* min_size = 29 ; exp_size = 56 ; max_size = 65,564 ; max_iov = 3 ; max_copy = 29 */ -struct lib9p_msg_Tmknod { - lib9p_tag_t tag; - lib9p_fid_t dfid; - struct lib9p_s name; - lib9p_mode_t mode; - uint32_t major; - uint32_t minor; - lib9p_nuid_t gid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tmknod, lib9p_msg_Tmknod); - -/* min_size = 21 ; exp_size = 48 ; max_size = 65,556 ; max_iov = 3 ; max_copy = 21 */ -struct lib9p_msg_Tmkdir { - lib9p_tag_t tag; - lib9p_fid_t dfid; - struct lib9p_s name; - lib9p_mode_t mode; - lib9p_nuid_t gid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tmkdir, lib9p_msg_Tmkdir); - -/* size = 15 ; max_iov = 1 ; max_copy = 15 */ -struct lib9p_msg_Tfsync { - lib9p_tag_t tag; - lib9p_fid_t fid; - lib9p_b4_t datasync; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tfsync, lib9p_msg_Tfsync); - -/* size = 19 ; max_iov = 1 ; max_copy = 19 */ -struct lib9p_msg_Tgetattr { - lib9p_tag_t tag; - lib9p_fid_t fid; - lib9p_getattr_t request_mask; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tgetattr, lib9p_msg_Tgetattr); - -/* size = 67 ; max_iov = 1 ; max_copy = 67 */ -struct lib9p_msg_Tsetattr { - lib9p_tag_t tag; - lib9p_fid_t fid; - lib9p_setattr_t valid; - lib9p_mode_t mode; - lib9p_nuid_t uid; - lib9p_nuid_t gid; - uint64_t filesize; - uint64_t atime_sec; - uint64_t atime_nsec; - uint64_t mtime_sec; - uint64_t mtime_nsec; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tsetattr, lib9p_msg_Tsetattr); - -/* min_size = 34 ; exp_size = 61 ; max_size = 65,569 ; max_iov = 2 ; max_copy = 34 */ -struct lib9p_msg_Tgetlock { - lib9p_tag_t tag; - lib9p_fid_t fid; - lib9p_lock_type_t type; - uint64_t start; - uint64_t length; - uint32_t proc_id; - struct lib9p_s client_id; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tgetlock, lib9p_msg_Tgetlock); - -/* min_size = 30 ; exp_size = 57 ; max_size = 65,565 ; max_iov = 2 ; max_copy = 30 */ -struct lib9p_msg_Rgetlock { - lib9p_tag_t tag; - lib9p_lock_type_t type; - uint64_t start; - uint64_t length; - uint32_t proc_id; - struct lib9p_s client_id; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rgetlock, lib9p_msg_Rgetlock); - -/* min_size = 38 ; exp_size = 65 ; max_size = 65,573 ; max_iov = 2 ; max_copy = 38 */ -struct lib9p_msg_Tlock { - lib9p_tag_t tag; - lib9p_fid_t fid; - lib9p_lock_type_t type; - lib9p_lock_flags_t flags; - uint64_t start; - uint64_t length; - uint32_t proc_id; - struct lib9p_s client_id; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tlock, lib9p_msg_Tlock); - -/* size = 8 ; max_iov = 1 ; max_copy = 8 */ -struct lib9p_msg_Rlock { - lib9p_tag_t tag; - lib9p_lock_status_t status; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rlock, lib9p_msg_Rlock); - -#endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* LIB9P_VER_9P2000 : min_size = 49 ; exp_size = 157 ; max_size = 262,189 ; max_iov = 8 ; max_copy = 49 */ -/* LIB9P_VER_9P2000_e : min_size = 49 ; exp_size = 157 ; max_size = 262,189 ; max_iov = 8 ; max_copy = 49 */ -/* LIB9P_VER_9P2000_p9p: min_size = 49 ; exp_size = 157 ; max_size = 262,189 ; max_iov = 8 ; max_copy = 49 */ -/* LIB9P_VER_9P2000_u : min_size = 63 ; exp_size = 198 ; max_size = 327,738 ; max_iov = 11 ; max_copy = 63 */ -struct lib9p_stat { - uint16_t kern_type; - uint32_t kern_dev; - struct lib9p_qid file_qid; - lib9p_dm_t file_mode; - uint32_t file_atime; - uint32_t file_mtime; - uint64_t file_size; - struct lib9p_s file_name; - struct lib9p_s file_owner_uid; - struct lib9p_s file_owner_gid; - struct lib9p_s file_last_modified_uid; -#if CONFIG_9P_ENABLE_9P2000_u - struct lib9p_s file_extension; - lib9p_nuid_t file_owner_n_uid; - lib9p_nuid_t file_owner_n_gid; - lib9p_nuid_t file_last_modified_n_uid; -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_stat, lib9p_stat); - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* size = 20 ; max_iov = 1 ; max_copy = 20 */ -struct lib9p_msg_Rauth { - lib9p_tag_t tag; - struct lib9p_qid aqid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rauth, lib9p_msg_Rauth); - -/* size = 20 ; max_iov = 1 ; max_copy = 20 */ -struct lib9p_msg_Rattach { - lib9p_tag_t tag; - struct lib9p_qid qid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rattach, lib9p_msg_Rattach); - -/* min_size = 9 ; exp_size = 217 ; max_size = 217 ; max_iov = 1 ; max_copy = 217 */ -struct lib9p_msg_Rwalk { - lib9p_tag_t tag; - uint16_t nwqid; - struct lib9p_qid *wqid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rwalk, lib9p_msg_Rwalk); - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* size = 24 ; max_iov = 1 ; max_copy = 24 */ -struct lib9p_msg_Ropen { - lib9p_tag_t tag; - struct lib9p_qid qid; - uint32_t iounit; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Ropen, lib9p_msg_Ropen); - -/* size = 24 ; max_iov = 1 ; max_copy = 24 */ -struct lib9p_msg_Rcreate { - lib9p_tag_t tag; - struct lib9p_qid qid; - uint32_t iounit; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rcreate, lib9p_msg_Rcreate); - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_p9p -/* size = 28 ; max_iov = 1 ; max_copy = 28 */ -struct lib9p_msg_Ropenfd { - lib9p_tag_t tag; - struct lib9p_qid qid; - uint32_t iounit; - uint32_t unixfd; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Ropenfd, lib9p_msg_Ropenfd); - -#endif /* CONFIG_9P_ENABLE_9P2000_p9p */ -#if CONFIG_9P_ENABLE_9P2000_L -/* size = 24 ; max_iov = 1 ; max_copy = 24 */ -struct lib9p_msg_Rlopen { - lib9p_tag_t tag; - struct lib9p_qid qid; - uint32_t iounit; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rlopen, lib9p_msg_Rlopen); - -/* size = 24 ; max_iov = 1 ; max_copy = 24 */ -struct lib9p_msg_Rlcreate { - lib9p_tag_t tag; - struct lib9p_qid qid; - uint32_t iounit; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rlcreate, lib9p_msg_Rlcreate); - -/* size = 20 ; max_iov = 1 ; max_copy = 20 */ -struct lib9p_msg_Rsymlink { - lib9p_tag_t tag; - struct lib9p_qid qid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rsymlink, lib9p_msg_Rsymlink); - -/* size = 20 ; max_iov = 1 ; max_copy = 20 */ -struct lib9p_msg_Rmknod { - lib9p_tag_t tag; - struct lib9p_qid qid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rmknod, lib9p_msg_Rmknod); - -/* size = 160 ; max_iov = 1 ; max_copy = 160 */ -struct lib9p_msg_Rgetattr { - lib9p_tag_t tag; - lib9p_getattr_t valid; - struct lib9p_qid qid; - lib9p_mode_t mode; - lib9p_nuid_t uid; - lib9p_nuid_t gid; - uint64_t nlink; - uint64_t rdev; - uint64_t filesize; - uint64_t blksize; - uint64_t blocks; - uint64_t atime_sec; - uint64_t atime_nsec; - uint64_t mtime_sec; - uint64_t mtime_nsec; - uint64_t ctime_sec; - uint64_t ctime_nsec; - uint64_t btime_sec; - uint64_t btime_nsec; - uint64_t gen; - uint64_t data_version; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rgetattr, lib9p_msg_Rgetattr); - -/* size = 20 ; max_iov = 1 ; max_copy = 20 */ -struct lib9p_msg_Rmkdir { - lib9p_tag_t tag; - struct lib9p_qid qid; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rmkdir, lib9p_msg_Rmkdir); - -#endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -/* LIB9P_VER_9P2000 : min_size = 58 ; exp_size = 166 ; max_size = 262,198 ; max_iov = 8 ; max_copy = 58 */ -/* LIB9P_VER_9P2000_e : min_size = 58 ; exp_size = 166 ; max_size = 262,198 ; max_iov = 8 ; max_copy = 58 */ -/* LIB9P_VER_9P2000_p9p: min_size = 58 ; exp_size = 166 ; max_size = 262,198 ; max_iov = 8 ; max_copy = 58 */ -/* LIB9P_VER_9P2000_u : min_size = 72 ; exp_size = 207 ; max_size = 327,747 ; max_iov = 11 ; max_copy = 72 */ -struct lib9p_msg_Rstat { - lib9p_tag_t tag; - struct lib9p_stat stat; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rstat, lib9p_msg_Rstat); - -/* LIB9P_VER_9P2000 : min_size = 62 ; exp_size = 170 ; max_size = 262,202 ; max_iov = 8 ; max_copy = 62 */ -/* LIB9P_VER_9P2000_e : min_size = 62 ; exp_size = 170 ; max_size = 262,202 ; max_iov = 8 ; max_copy = 62 */ -/* LIB9P_VER_9P2000_p9p: min_size = 62 ; exp_size = 170 ; max_size = 262,202 ; max_iov = 8 ; max_copy = 62 */ -/* LIB9P_VER_9P2000_u : min_size = 76 ; exp_size = 211 ; max_size = 327,751 ; max_iov = 11 ; max_copy = 76 */ -struct lib9p_msg_Twstat { - lib9p_tag_t tag; - lib9p_fid_t fid; - struct lib9p_stat stat; -}; -LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Twstat, lib9p_msg_Twstat); -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ - -/* containers *****************************************************************/ - -#define _LIB9P_MAX(a, b) ((a) > (b)) ? (a) : (b) - -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u - #if CONFIG_9P_ENABLE_9P2000_e - #define LIB9P_TMSG_MAX_IOV _LIB9P_MAX(32, 2 + (CONFIG_9P_MAX_9P2000_e_WELEM * 2)) - #else - #define LIB9P_TMSG_MAX_IOV 32 - #endif -#endif - -#if CONFIG_9P_ENABLE_9P2000_u - #if CONFIG_9P_ENABLE_9P2000_e - #define LIB9P_TMSG_MAX_COPY _LIB9P_MAX(76, 17 + (CONFIG_9P_MAX_9P2000_e_WELEM * 2)) - #else - #define LIB9P_TMSG_MAX_COPY 76 - #endif -#elif CONFIG_9P_ENABLE_9P2000_L - #if CONFIG_9P_ENABLE_9P2000_e - #define LIB9P_TMSG_MAX_COPY _LIB9P_MAX(67, 17 + (CONFIG_9P_MAX_9P2000_e_WELEM * 2)) - #else - #define LIB9P_TMSG_MAX_COPY 67 - #endif -#elif CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p - #if CONFIG_9P_ENABLE_9P2000_e - #define LIB9P_TMSG_MAX_COPY _LIB9P_MAX(62, 17 + (CONFIG_9P_MAX_9P2000_e_WELEM * 2)) - #else - #define LIB9P_TMSG_MAX_COPY 62 - #endif -#endif - -#if CONFIG_9P_ENABLE_9P2000_u - #define LIB9P_RMSG_MAX_IOV 11 -#elif CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p - #define LIB9P_RMSG_MAX_IOV 8 -#elif CONFIG_9P_ENABLE_9P2000_L - #define LIB9P_RMSG_MAX_IOV 2 -#endif - -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u - #define LIB9P_RMSG_MAX_COPY 217 -#endif - -struct lib9p_Tmsg_send_buf { - size_t iov_cnt; - struct iovec iov[LIB9P_TMSG_MAX_IOV]; - uint8_t copied[LIB9P_TMSG_MAX_COPY]; -}; - -struct lib9p_Rmsg_send_buf { - size_t iov_cnt; - struct iovec iov[LIB9P_RMSG_MAX_IOV]; - uint8_t copied[LIB9P_RMSG_MAX_COPY]; -}; diff --git a/lib9p/include/lib9p/9p.h b/lib9p/include/lib9p/9p.h deleted file mode 100644 index 5919260..0000000 --- a/lib9p/include/lib9p/9p.h +++ /dev/null @@ -1,206 +0,0 @@ -/* lib9p/9p.h - Base 9P protocol definitions for both clients and servers - * - * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -#ifndef _LIB9P_9P_H_ -#define _LIB9P_9P_H_ - -#include <stdbool.h> -#include <sys/types.h> /* for ssize_t */ - -#include <libmisc/assert.h> - -#include <lib9p/linux-errno.h> -#include <lib9p/9p.generated.h> - -#ifndef CONFIG_9P_MAX_ERR_SIZE - #error config.h must define CONFIG_9P_MAX_ERR_SIZE -#endif -static_assert(CONFIG_9P_MAX_ERR_SIZE <= UINT16_MAX); - -/* constants ******************************************************************/ - -enum { - LIB9P_DEFAULT_PORT_9FS = 564, - LIB9P_DEFAULT_PORT_STYX = 6666, -}; - -/* strings ********************************************************************/ - -const char *lib9p_version_str(enum lib9p_version); -const char *lib9p_msgtype_str(enum lib9p_version, enum lib9p_msg_type); - -struct lib9p_s lib9p_str(char *s); -struct lib9p_s lib9p_strn(char *s, size_t maxlen); -struct lib9p_s lib9p_str_slice(struct lib9p_s s, uint16_t beg, uint16_t end); -#define lib9p_str_sliceleft(s, beg) lib9p_str_slice(s, beg, (s).len) -bool lib9p_str_eq(struct lib9p_s a, struct lib9p_s b); - -/* ctx ************************************************************************/ - -struct lib9p_ctx { - /* negotiated */ - enum lib9p_version version; - uint32_t max_msg_size; - - /* state */ -#ifdef CONFIG_9P_ENABLE_9P2000_u - lib9p_errno_t err_num; -#endif - [[gnu::nonstring]] char err_msg[CONFIG_9P_MAX_ERR_SIZE]; -}; - -void lib9p_ctx_clear_error(struct lib9p_ctx *ctx); - -bool lib9p_ctx_has_error(struct lib9p_ctx *ctx); - -/** Write an static error into ctx, return -1. */ -int lib9p_error(struct lib9p_ctx *ctx, lib9p_errno_t linux_errno, char const *msg); -/** Write a printf-style error into ctx, return -1. */ -int lib9p_errorf(struct lib9p_ctx *ctx, lib9p_errno_t linux_errno, char const *fmt, ...) [[gnu::format(printf, 3, 4)]]; - -/* misc utilities *************************************************************/ - -uint32_t lib9p_version_min_msg_size(enum lib9p_version); - -lo_interface fmt_formatter lo_box_lib9p_msg_as_fmt_formatter(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body); - -/* main T-message functions ***************************************************/ - -/** - * Validate a message's structure; its size, string encodings, enums, - * and bitfields. - * - * Return how much space the message will take when unmarshaled. This - * number may be larger than net_bytes due to (1) struct padding, (2) - * array pointers. - * - * Emits an error (return -1, set ctx->err_num and ctx->err_msg) if - * either the message type is unknown, or if net_bytes is too short - * for that message type, or if an invalid string (invalid UTF-8, - * contains a nul-byte) is encountered. - * - * @param net_bytes : the complete request, starting with the "size[4]" - * - * @return required size, or -1 on error - * - * @errno LINUX_EOPNOTSUPP: message is an R-message - * @errno LINUX_EOPNOTSUPP: message has unknown type - * @errno LINUX_EBADMSG: message is wrong size for content - * @errno LINUX_EBADMSG: message contains invalid UTF-8 - * @errno LINUX_EBADMSG: message contains a bitfield with unknown bits - * @errno LINUX_EMSGSIZE: would-be return value overflows SSIZE_MAX - */ -ssize_t lib9p_Tmsg_validate(struct lib9p_ctx *ctx, uint8_t *net_bytes); - -/** - * Unmarshal the 9P message `net_bytes` into the C struct `ret_body`. - * - * lib9p_Tmsg_unmarshal does no validation; you must run - * lib9p_Tmsg_validate() first. - * - * @param ctx : negotiated protocol parameters - * @param net_bytes : the complete message, starting with the "size[4]" - * - * @return ret_typ : the mesage type - * @return ret_body : the message body, must be at least lib9p_Tmsg_validate() bytes - */ -void lib9p_Tmsg_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, - enum lib9p_msg_type *ret_typ, void *ret_body); - -/** - * Marshal a `struct lib9p_msg_{typ}` structure into a byte-array. - * - * lib9p_Tmsg_marshal does no validation; it trusts that the - * programmer 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 msg : the message to encode - * - * @return ret_bytes : the buffer to encode to, must be at be at least ctx->max_msg_size bytes - * @return whether there was an error (false=success, true=error) - * - * @errno LINUX_ERANGE: reply does not fit in ctx->max_msg_size - */ -bool lib9p_Tmsg_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body, - struct lib9p_Tmsg_send_buf *ret); - -/* main R-message functions ***************************************************/ - -/** Same as above, but for R-messages instead of T-messages. */ - -ssize_t lib9p_Rmsg_validate(struct lib9p_ctx *ctx, uint8_t *net_bytes); -void lib9p_Rmsg_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, - enum lib9p_msg_type *ret_typ, void *ret_body); -bool lib9p_Rmsg_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body, - struct lib9p_Rmsg_send_buf *ret); - - -/* `struct lib9p_stat` helpers ************************************************/ - -/** Assert that a `struct lib9p_stat` object looks valid. */ -static inline void lib9p_stat_assert(struct lib9p_stat stat) { - assert( ((bool)(stat.file_mode & LIB9P_DM_DIR )) == ((bool)(stat.file_qid.type & LIB9P_QT_DIR )) ); - assert( ((bool)(stat.file_mode & LIB9P_DM_APPEND)) == ((bool)(stat.file_qid.type & LIB9P_QT_APPEND)) ); - assert( ((bool)(stat.file_mode & LIB9P_DM_EXCL )) == ((bool)(stat.file_qid.type & LIB9P_QT_EXCL )) ); - assert( ((bool)(stat.file_mode & LIB9P_DM_AUTH )) == ((bool)(stat.file_qid.type & LIB9P_QT_AUTH )) ); - assert( ((bool)(stat.file_mode & LIB9P_DM_TMP )) == ((bool)(stat.file_qid.type & LIB9P_QT_TMP )) ); - assert( (stat.file_size == 0) || !(stat.file_mode & LIB9P_DM_DIR) ); -} - -/** - * Validate a message's `stat` structure. - * - * @param ctx : negotiated protocol parameters, where to record errors - * @param net_bytes : network-encoded stat structure - * @param net_size : the number of net_bytes that may be read - * - * @return ret_net_size : number of bytes consumed; <=net_size - * @return ret_host_size : number of bytes that lib9p_stat_unmarshal would take - * @return whether there was an error - */ -bool lib9p_stat_validate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes, - uint32_t *ret_net_size, ssize_t *ret_host_size); - -/** - * Unmarshal the 9P `net_bytes` into the C struct `ret_obj`. - * - * lib9p_stat_unmarshal does no validation; you must run - * lib9p_stat_validate() first. - * - * @param ctx : negotiated protocol parameters - * @param net_bytes : network-encoded stat structure - * - * @return ret : the stat object, must be at least lib9p_stat_validate()->ret_net_size bytes - */ -void lib9p_stat_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, - struct lib9p_stat *ret); - -/** - * Marhsal a `struct lib9p_stat` structure into a byte-array. - * - * lib9p_Tmsg_marshal does no validation; it trusts that the - * programmer 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 max_net_size : the maximum network-encoded size to allow - * @param obj : the message to encode - * - * @return ret_bytes: the buffer to encode into - * @return the number of bytes written, or 0 if the stat object does not fit in max_net_size - * - * @errno LINUX_ERANGE: reply does not fit in max_net_size - */ -uint32_t lib9p_stat_marshal(struct lib9p_ctx *ctx, uint32_t max_net_size, struct lib9p_stat *obj, - uint8_t *ret_bytes); - -#endif /* _LIB9P_9P_H_ */ diff --git a/lib9p/include/lib9p/linux-errno.h b/lib9p/include/lib9p/linux-errno.h deleted file mode 100644 index e7c74f5..0000000 --- a/lib9p/include/lib9p/linux-errno.h +++ /dev/null @@ -1,139 +0,0 @@ -/* lib9p/linux-errno.h - Generated by `lib9p/include/lib9p/linux-errno.h.gen 3rd-party/linux-errno.txt`. DO NOT EDIT! */ -/* 3rd-party/linux-errno.txt - Generated from build-aux/linux-errno.txt.gen and linux.git v6.7. DO NOT EDIT! */ - -#ifndef _LIB9P_LINUX_ERRNO_H_ -#define _LIB9P_LINUX_ERRNO_H_ - -#define LINUX_EPERM 1 /* Operation not permitted */ -#define LINUX_ENOENT 2 /* No such file or directory */ -#define LINUX_ESRCH 3 /* No such process */ -#define LINUX_EINTR 4 /* Interrupted system call */ -#define LINUX_EIO 5 /* I/O error */ -#define LINUX_ENXIO 6 /* No such device or address */ -#define LINUX_E2BIG 7 /* Argument list too long */ -#define LINUX_ENOEXEC 8 /* Exec format error */ -#define LINUX_EBADF 9 /* Bad file number */ -#define LINUX_ECHILD 10 /* No child processes */ -#define LINUX_EAGAIN 11 /* Try again */ -#define LINUX_ENOMEM 12 /* Out of memory */ -#define LINUX_EACCES 13 /* Permission denied */ -#define LINUX_EFAULT 14 /* Bad address */ -#define LINUX_ENOTBLK 15 /* Block device required */ -#define LINUX_EBUSY 16 /* Device or resource busy */ -#define LINUX_EEXIST 17 /* File exists */ -#define LINUX_EXDEV 18 /* Cross-device link */ -#define LINUX_ENODEV 19 /* No such device */ -#define LINUX_ENOTDIR 20 /* Not a directory */ -#define LINUX_EISDIR 21 /* Is a directory */ -#define LINUX_EINVAL 22 /* Invalid argument */ -#define LINUX_ENFILE 23 /* File table overflow */ -#define LINUX_EMFILE 24 /* Too many open files */ -#define LINUX_ENOTTY 25 /* Not a typewriter */ -#define LINUX_ETXTBSY 26 /* Text file busy */ -#define LINUX_EFBIG 27 /* File too large */ -#define LINUX_ENOSPC 28 /* No space left on device */ -#define LINUX_ESPIPE 29 /* Illegal seek */ -#define LINUX_EROFS 30 /* Read-only file system */ -#define LINUX_EMLINK 31 /* Too many links */ -#define LINUX_EPIPE 32 /* Broken pipe */ -#define LINUX_EDOM 33 /* Math argument out of domain of func */ -#define LINUX_ERANGE 34 /* Math result not representable */ -#define LINUX_EDEADLK 35 /* Resource deadlock would occur */ -#define LINUX_ENAMETOOLONG 36 /* File name too long */ -#define LINUX_ENOLCK 37 /* No record locks available */ -#define LINUX_ENOSYS 38 /* Invalid system call number */ -#define LINUX_ENOTEMPTY 39 /* Directory not empty */ -#define LINUX_ELOOP 40 /* Too many symbolic links encountered */ -#define LINUX_ENOMSG 42 /* No message of desired type */ -#define LINUX_EIDRM 43 /* Identifier removed */ -#define LINUX_ECHRNG 44 /* Channel number out of range */ -#define LINUX_EL2NSYNC 45 /* Level 2 not synchronized */ -#define LINUX_EL3HLT 46 /* Level 3 halted */ -#define LINUX_EL3RST 47 /* Level 3 reset */ -#define LINUX_ELNRNG 48 /* Link number out of range */ -#define LINUX_EUNATCH 49 /* Protocol driver not attached */ -#define LINUX_ENOCSI 50 /* No CSI structure available */ -#define LINUX_EL2HLT 51 /* Level 2 halted */ -#define LINUX_EBADE 52 /* Invalid exchange */ -#define LINUX_EBADR 53 /* Invalid request descriptor */ -#define LINUX_EXFULL 54 /* Exchange full */ -#define LINUX_ENOANO 55 /* No anode */ -#define LINUX_EBADRQC 56 /* Invalid request code */ -#define LINUX_EBADSLT 57 /* Invalid slot */ -#define LINUX_EBFONT 59 /* Bad font file format */ -#define LINUX_ENOSTR 60 /* Device not a stream */ -#define LINUX_ENODATA 61 /* No data available */ -#define LINUX_ETIME 62 /* Timer expired */ -#define LINUX_ENOSR 63 /* Out of streams resources */ -#define LINUX_ENONET 64 /* Machine is not on the network */ -#define LINUX_ENOPKG 65 /* Package not installed */ -#define LINUX_EREMOTE 66 /* Object is remote */ -#define LINUX_ENOLINK 67 /* Link has been severed */ -#define LINUX_EADV 68 /* Advertise error */ -#define LINUX_ESRMNT 69 /* Srmount error */ -#define LINUX_ECOMM 70 /* Communication error on send */ -#define LINUX_EPROTO 71 /* Protocol error */ -#define LINUX_EMULTIHOP 72 /* Multihop attempted */ -#define LINUX_EDOTDOT 73 /* RFS specific error */ -#define LINUX_EBADMSG 74 /* Not a data message */ -#define LINUX_EOVERFLOW 75 /* Value too large for defined data type */ -#define LINUX_ENOTUNIQ 76 /* Name not unique on network */ -#define LINUX_EBADFD 77 /* File descriptor in bad state */ -#define LINUX_EREMCHG 78 /* Remote address changed */ -#define LINUX_ELIBACC 79 /* Can not access a needed shared library */ -#define LINUX_ELIBBAD 80 /* Accessing a corrupted shared library */ -#define LINUX_ELIBSCN 81 /* .lib section in a.out corrupted */ -#define LINUX_ELIBMAX 82 /* Attempting to link in too many shared libraries */ -#define LINUX_ELIBEXEC 83 /* Cannot exec a shared library directly */ -#define LINUX_EILSEQ 84 /* Illegal byte sequence */ -#define LINUX_ERESTART 85 /* Interrupted system call should be restarted */ -#define LINUX_ESTRPIPE 86 /* Streams pipe error */ -#define LINUX_EUSERS 87 /* Too many users */ -#define LINUX_ENOTSOCK 88 /* Socket operation on non-socket */ -#define LINUX_EDESTADDRREQ 89 /* Destination address required */ -#define LINUX_EMSGSIZE 90 /* Message too long */ -#define LINUX_EPROTOTYPE 91 /* Protocol wrong type for socket */ -#define LINUX_ENOPROTOOPT 92 /* Protocol not available */ -#define LINUX_EPROTONOSUPPORT 93 /* Protocol not supported */ -#define LINUX_ESOCKTNOSUPPORT 94 /* Socket type not supported */ -#define LINUX_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ -#define LINUX_EPFNOSUPPORT 96 /* Protocol family not supported */ -#define LINUX_EAFNOSUPPORT 97 /* Address family not supported by protocol */ -#define LINUX_EADDRINUSE 98 /* Address already in use */ -#define LINUX_EADDRNOTAVAIL 99 /* Cannot assign requested address */ -#define LINUX_ENETDOWN 100 /* Network is down */ -#define LINUX_ENETUNREACH 101 /* Network is unreachable */ -#define LINUX_ENETRESET 102 /* Network dropped connection because of reset */ -#define LINUX_ECONNABORTED 103 /* Software caused connection abort */ -#define LINUX_ECONNRESET 104 /* Connection reset by peer */ -#define LINUX_ENOBUFS 105 /* No buffer space available */ -#define LINUX_EISCONN 106 /* Transport endpoint is already connected */ -#define LINUX_ENOTCONN 107 /* Transport endpoint is not connected */ -#define LINUX_ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ -#define LINUX_ETOOMANYREFS 109 /* Too many references: cannot splice */ -#define LINUX_ETIMEDOUT 110 /* Connection timed out */ -#define LINUX_ECONNREFUSED 111 /* Connection refused */ -#define LINUX_EHOSTDOWN 112 /* Host is down */ -#define LINUX_EHOSTUNREACH 113 /* No route to host */ -#define LINUX_EALREADY 114 /* Operation already in progress */ -#define LINUX_EINPROGRESS 115 /* Operation now in progress */ -#define LINUX_ESTALE 116 /* Stale file handle */ -#define LINUX_EUCLEAN 117 /* Structure needs cleaning */ -#define LINUX_ENOTNAM 118 /* Not a XENIX named type file */ -#define LINUX_ENAVAIL 119 /* No XENIX semaphores available */ -#define LINUX_EISNAM 120 /* Is a named type file */ -#define LINUX_EREMOTEIO 121 /* Remote I/O error */ -#define LINUX_EDQUOT 122 /* Quota exceeded */ -#define LINUX_ENOMEDIUM 123 /* No medium found */ -#define LINUX_EMEDIUMTYPE 124 /* Wrong medium type */ -#define LINUX_ECANCELED 125 /* Operation Canceled */ -#define LINUX_ENOKEY 126 /* Required key not available */ -#define LINUX_EKEYEXPIRED 127 /* Key has expired */ -#define LINUX_EKEYREVOKED 128 /* Key has been revoked */ -#define LINUX_EKEYREJECTED 129 /* Key was rejected by service */ -#define LINUX_EOWNERDEAD 130 /* Owner died */ -#define LINUX_ENOTRECOVERABLE 131 /* State not recoverable */ -#define LINUX_ERFKILL 132 /* Operation not possible due to RF-kill */ -#define LINUX_EHWPOISON 133 /* Memory page has hardware error */ - -#endif /* _LIB9P_LINUX_ERRNO_H_ */ diff --git a/lib9p/include/lib9p/linux-errno.h.gen b/lib9p/include/lib9p/linux-errno.h.gen deleted file mode 100755 index 2c736a2..0000000 --- a/lib9p/include/lib9p/linux-errno.h.gen +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python -# lib9p/linux-errno.h.gen - Generate a C header from a list of errno numbers -# -# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> -# SPDX-License-Identifier: AGPL-3.0-or-later - -import sys - - -def print_errnos() -> None: - print( - f"/* lib9p/linux-errno.h - Generated by `{' '.join(sys.argv)}`. DO NOT EDIT! */" - ) - errnos: dict[str, tuple[int, str]] = {} - for txtlist in sys.argv[1:]: - with open(txtlist, "r", encoding="utf-8") as fh: - for line in fh: - if line.startswith("#"): - print(f"/* {line[1:].strip()} */") - continue - _num, name, desc = line.split(maxsplit=2) - num = int(_num) - desc = desc.strip() - errnos[name] = (num, desc) - print() - print("#ifndef _LIB9P_LINUX_ERRNO_H_") - print("#define _LIB9P_LINUX_ERRNO_H_") - print() - namelen = max(len(name) for name in errnos) - numlen = max(len(str(num)) for (num, desc) in errnos.values()) - for name, [num, msg] in errnos.items(): - print(f"#define LINUX_{name:<{namelen}} {num:>{numlen}} /* {msg} */") - print() - print("#endif /* _LIB9P_LINUX_ERRNO_H_ */") - - -if __name__ == "__main__": - print_errnos() diff --git a/lib9p/include/lib9p/srv.h b/lib9p/include/lib9p/srv.h deleted file mode 100644 index ff5ebdc..0000000 --- a/lib9p/include/lib9p/srv.h +++ /dev/null @@ -1,179 +0,0 @@ -/* lib9p/srv.h - 9P server - * - * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -#ifndef _LIB9P_SRV_H_ -#define _LIB9P_SRV_H_ - -#include <libcr/coroutine.h> -#include <libcr_ipc/rpc.h> -#include <libcr_ipc/chan.h> -#include <libhw/generic/net.h> -#include <libmisc/assert.h> -#include <libmisc/private.h> -#include <libobj/obj.h> - -#include <lib9p/9p.h> - -/* context ********************************************************************/ - -CR_CHAN_DECLARE(_lib9p_srv_flushch, bool) - -struct lib9p_srv_ctx { - struct lib9p_ctx basectx; - uint32_t uid; - struct lib9p_s uname; - - BEGIN_PRIVATE(LIB9P_SRV_H) - _lib9p_srv_flushch_t _flushch; - END_PRIVATE(LIB9P_SRV_H) -}; - -bool lib9p_srv_flush_requested(struct lib9p_srv_ctx *ctx); - -int lib9p_srv_acknowledge_flush(struct lib9p_srv_ctx *ctx); - -/* interface definitions ******************************************************/ - -lo_interface lib9p_srv_fio; -lo_interface lib9p_srv_dio; - -/* FIXME: I don't like that the pointers returned by stat() and - * pread() have to remain live after they return. Perhaps a - * `respond()`-callback? But that just reads as gross in C. - * - * FIXME: It would be nice if pread() could return more than 1 iovec. - */ -#define lib9p_srv_file_LO_IFACE \ - /* resource management **********************************************/ \ - \ - /** \ - * free() is be called when all FIDs associated with the file are \ - * clunked. \ - * \ - * free() MUST NOT error. \ - */ \ - LO_FUNC(void , free ) \ - \ - /** \ - * qid() is called frequently and returns the current QID of the file. \ - * The .path field MUST never change, the .type field may change in \ - * response to wstat() calls (but the QT_DIR bit MUST NOT change), and \ - * the .vers field may change frequently in response to any number of \ - * things (wstat(), write(), or non-9P events). \ - * \ - * qid() MUST NOT error. \ - */ \ - LO_FUNC(struct lib9p_qid , qid ) \ - \ - /* non-"opened" generic I/O *****************************************/ \ - \ - LO_FUNC(struct lib9p_stat , stat , struct lib9p_srv_ctx *) \ - LO_FUNC(void , wstat , struct lib9p_srv_ctx *, \ - struct lib9p_stat new) \ - LO_FUNC(void , remove , struct lib9p_srv_ctx *) \ - \ - /* non-"opened" directory I/O ***************************************/ \ - \ - LO_FUNC(lo_interface lib9p_srv_file, dwalk , struct lib9p_srv_ctx *, \ - struct lib9p_s childname) \ - LO_FUNC(lo_interface lib9p_srv_file, dcreate, struct lib9p_srv_ctx *, \ - struct lib9p_s childname, \ - lib9p_dm_t perm, \ - lib9p_o_t flags) \ - \ - /* open() for I/O ***************************************************/ \ - \ - LO_FUNC(lo_interface lib9p_srv_fio , fopen , struct lib9p_srv_ctx *, \ - bool rd, bool wr, \ - bool trunc) \ - LO_FUNC(lo_interface lib9p_srv_dio , dopen , struct lib9p_srv_ctx *) -LO_INTERFACE(lib9p_srv_file); - -#define lib9p_srv_fio_LO_IFACE \ - LO_FUNC(struct lib9p_qid , qid ) \ - LO_FUNC(void , iofree ) \ - LO_FUNC(uint32_t , iounit ) \ - LO_FUNC(void , pread , struct lib9p_srv_ctx *, \ - uint32_t byte_count, \ - uint64_t byte_offset, \ - struct iovec *ret) \ - LO_FUNC(uint32_t , pwrite , struct lib9p_srv_ctx *, \ - void *buf, \ - uint32_t byte_count, \ - uint64_t byte_offset) -LO_INTERFACE(lib9p_srv_fio); - -/* FIXME: The dio interface just feels clunky. I'm not in a rush to - * change it because util9p_static_dir is already implemented and I - * don't anticipate the sbc-harness needing another dio - * implementation. But if I wanted lib9p to be used outside of - * sbc-harness, this is one of the first things that I'd want to - * change. - */ -#define lib9p_srv_dio_LO_IFACE \ - LO_FUNC(struct lib9p_qid , qid ) \ - LO_FUNC(void , iofree ) \ - LO_FUNC(size_t /* <- obj cnt */ , dread , struct lib9p_srv_ctx *, \ - uint8_t *buf, \ - /* num bytes -> */ uint32_t byte_count, \ - /* starting at this object -> */ size_t obj_offset) -LO_INTERFACE(lib9p_srv_dio); - -#define LIB9P_SRV_NOTDIR(TYP, NAM) \ - static lo_interface lib9p_srv_file NAM##_dwalk (TYP *, struct lib9p_srv_ctx *, struct lib9p_s) { assert_notreached("not a directory"); } \ - static lo_interface lib9p_srv_file NAM##_dcreate(TYP *, struct lib9p_srv_ctx *, struct lib9p_s, lib9p_dm_t, lib9p_o_t) { assert_notreached("not a directory"); } \ - static lo_interface lib9p_srv_dio NAM##_dopen (TYP *, struct lib9p_srv_ctx *) { assert_notreached("not a directory"); } - -#define LIB9P_SRV_NOTFILE(TYP, NAM) \ - static lo_interface lib9p_srv_fio NAM##_fopen (TYP *, struct lib9p_srv_ctx *, bool, bool, bool) { assert_notreached("not a file"); } - -/* main server entrypoints ****************************************************/ - -CR_RPC_DECLARE(_lib9p_srv_reqch, struct _lib9p_srv_req *, bool) - -struct lib9p_srv { - /* Things you provide */ - void /*TODO*/ (*auth )(struct lib9p_srv_ctx *, struct lib9p_s treename); /* optional */ - lo_interface lib9p_srv_file (*rootdir)(struct lib9p_srv_ctx *, struct lib9p_s treename); - - /* For internal use */ - BEGIN_PRIVATE(LIB9P_SRV_H) - unsigned int readers; - unsigned int writers; - _lib9p_srv_reqch_t _reqch; - END_PRIVATE(LIB9P_SRV_H) -}; - -/** - * In an infinite loop, accept a connection and read messages from it until - * close; dispatching requests to a pool of lib9p_srv_write_cr() coroutines - * with the same `srv`. - * - * Will just close the connection if a T-message has a size[4] <7. - * - * @param srv: The server configuration and state; has an associated pool of - * lib9p_srv_write_cr() coroutines. - * @param listener: The listener object to accept connections from. - * - * @errno LINUX_EMSGSIZE T-message has size[4] bigger than max_msg_size - * @errno LINUX_EDOM Tversion specified an impossibly small max_msg_size - * @errno LINUX_EOPNOTSUPP T-message has an R-message type, or an unrecognized T-message type - * @errno LINUX_EBADMSG T-message has wrong size[4] for its content, or has invalid UTF-8 - * @errno LINUX_ERANGE R-message does not fit into max_msg_size - */ -[[noreturn]] void lib9p_srv_read_cr(struct lib9p_srv *srv, lo_interface net_stream_listener listener); - -/** - * Service requests to the `struct lib9p_srv *srv` argument that have been - * read by lib9p_srv_read_cr(). - * - * @param struct lib9p_srv *srv: The server configuration and state; has an - * associated pool of lib9p_srv_read_cr() - * coroutines. - */ -COROUTINE lib9p_srv_write_cr(void *_srv); - -#endif /* _LIB9P_SRV_H_ */ |