19f107513SAnthony Liguori #ifndef _QEMU_VIRTIO_9P_H 29f107513SAnthony Liguori #define _QEMU_VIRTIO_9P_H 39f107513SAnthony Liguori 49f107513SAnthony Liguori #include <sys/types.h> 59f107513SAnthony Liguori #include <dirent.h> 69f107513SAnthony Liguori #include <sys/time.h> 79f107513SAnthony Liguori #include <utime.h> 87a462745SAneesh Kumar K.V #include <sys/resource.h> 9ff06030fSVenkateswararao Jujjuri (JV) #include "hw/virtio.h" 10353ac78dSAneesh Kumar K.V #include "fsdev/file-op-9p.h" 11*02cb7f3aSAneesh Kumar K.V #include "qemu-thread.h" 12*02cb7f3aSAneesh Kumar K.V #include "qemu-coroutine.h" 139f107513SAnthony Liguori 149f107513SAnthony Liguori /* The feature bitmap for virtio 9P */ 159f107513SAnthony Liguori /* The mount point is specified in a config variable */ 169f107513SAnthony Liguori #define VIRTIO_9P_MOUNT_TAG 0 179f107513SAnthony Liguori 189f107513SAnthony Liguori enum { 198f4d1ca5SArun R Bharadwaj P9_TLERROR = 6, 208f4d1ca5SArun R Bharadwaj P9_RLERROR, 21be940c87SM. Mohan Kumar P9_TSTATFS = 8, 22be940c87SM. Mohan Kumar P9_RSTATFS, 23771e9d4cSM. Mohan Kumar P9_TLOPEN = 12, 24771e9d4cSM. Mohan Kumar P9_RLOPEN, 25c1568af5SVenkateswararao Jujjuri (JV) P9_TLCREATE = 14, 26c1568af5SVenkateswararao Jujjuri (JV) P9_RLCREATE, 2708c60fc9SVenkateswararao Jujjuri (JV) P9_TSYMLINK = 16, 2808c60fc9SVenkateswararao Jujjuri (JV) P9_RSYMLINK, 295268ceccSM. Mohan Kumar P9_TMKNOD = 18, 305268ceccSM. Mohan Kumar P9_RMKNOD, 31c7b4b0b3SM. Mohan Kumar P9_TRENAME = 20, 32c7b4b0b3SM. Mohan Kumar P9_RRENAME, 33df0973a4SM. Mohan Kumar P9_TREADLINK = 22, 34df0973a4SM. Mohan Kumar P9_RREADLINK, 3500ede4c2SSripathi Kodi P9_TGETATTR = 24, 3600ede4c2SSripathi Kodi P9_RGETATTR, 37c79ce737SSripathi Kodi P9_TSETATTR = 26, 38c79ce737SSripathi Kodi P9_RSETATTR, 39fa32ef88SAneesh Kumar K.V P9_TXATTRWALK = 30, 40fa32ef88SAneesh Kumar K.V P9_RXATTRWALK, 4110b468bdSAneesh Kumar K.V P9_TXATTRCREATE = 32, 4210b468bdSAneesh Kumar K.V P9_RXATTRCREATE, 43c18e2f94SSripathi Kodi P9_TREADDIR = 40, 44c18e2f94SSripathi Kodi P9_RREADDIR, 45b41e95d3SVenkateswararao Jujjuri (JV) P9_TFSYNC = 50, 46b41e95d3SVenkateswararao Jujjuri (JV) P9_RFSYNC, 4782cc3ee8SM. Mohan Kumar P9_TLOCK = 52, 4882cc3ee8SM. Mohan Kumar P9_RLOCK, 498f354003SM. Mohan Kumar P9_TGETLOCK = 54, 508f354003SM. Mohan Kumar P9_RGETLOCK, 51b2c224beSVenkateswararao Jujjuri (JV) P9_TLINK = 70, 52b2c224beSVenkateswararao Jujjuri (JV) P9_RLINK, 53b67592eaSM. Mohan Kumar P9_TMKDIR = 72, 54b67592eaSM. Mohan Kumar P9_RMKDIR, 5589bf6593SAneesh Kumar K.V P9_TRENAMEAT = 74, 5689bf6593SAneesh Kumar K.V P9_RRENAMEAT, 577834cf77SAneesh Kumar K.V P9_TUNLINKAT = 76, 587834cf77SAneesh Kumar K.V P9_RUNLINKAT, 599f107513SAnthony Liguori P9_TVERSION = 100, 609f107513SAnthony Liguori P9_RVERSION, 619f107513SAnthony Liguori P9_TAUTH = 102, 629f107513SAnthony Liguori P9_RAUTH, 639f107513SAnthony Liguori P9_TATTACH = 104, 649f107513SAnthony Liguori P9_RATTACH, 659f107513SAnthony Liguori P9_TERROR = 106, 669f107513SAnthony Liguori P9_RERROR, 679f107513SAnthony Liguori P9_TFLUSH = 108, 689f107513SAnthony Liguori P9_RFLUSH, 699f107513SAnthony Liguori P9_TWALK = 110, 709f107513SAnthony Liguori P9_RWALK, 719f107513SAnthony Liguori P9_TOPEN = 112, 729f107513SAnthony Liguori P9_ROPEN, 739f107513SAnthony Liguori P9_TCREATE = 114, 749f107513SAnthony Liguori P9_RCREATE, 759f107513SAnthony Liguori P9_TREAD = 116, 769f107513SAnthony Liguori P9_RREAD, 779f107513SAnthony Liguori P9_TWRITE = 118, 789f107513SAnthony Liguori P9_RWRITE, 799f107513SAnthony Liguori P9_TCLUNK = 120, 809f107513SAnthony Liguori P9_RCLUNK, 819f107513SAnthony Liguori P9_TREMOVE = 122, 829f107513SAnthony Liguori P9_RREMOVE, 839f107513SAnthony Liguori P9_TSTAT = 124, 849f107513SAnthony Liguori P9_RSTAT, 859f107513SAnthony Liguori P9_TWSTAT = 126, 869f107513SAnthony Liguori P9_RWSTAT, 879f107513SAnthony Liguori }; 889f107513SAnthony Liguori 899f107513SAnthony Liguori 909f107513SAnthony Liguori /* qid.types */ 919f107513SAnthony Liguori enum { 929f107513SAnthony Liguori P9_QTDIR = 0x80, 939f107513SAnthony Liguori P9_QTAPPEND = 0x40, 949f107513SAnthony Liguori P9_QTEXCL = 0x20, 959f107513SAnthony Liguori P9_QTMOUNT = 0x10, 969f107513SAnthony Liguori P9_QTAUTH = 0x08, 979f107513SAnthony Liguori P9_QTTMP = 0x04, 989f107513SAnthony Liguori P9_QTSYMLINK = 0x02, 999f107513SAnthony Liguori P9_QTLINK = 0x01, 1009f107513SAnthony Liguori P9_QTFILE = 0x00, 1019f107513SAnthony Liguori }; 1029f107513SAnthony Liguori 10384151514SM. Mohan Kumar enum p9_proto_version { 10484151514SM. Mohan Kumar V9FS_PROTO_2000U = 0x01, 10584151514SM. Mohan Kumar V9FS_PROTO_2000L = 0x02, 10684151514SM. Mohan Kumar }; 10784151514SM. Mohan Kumar 1089f107513SAnthony Liguori #define P9_NOTAG (u16)(~0) 1099f107513SAnthony Liguori #define P9_NOFID (u32)(~0) 1109f107513SAnthony Liguori #define P9_MAXWELEM 16 1117a462745SAneesh Kumar K.V 1127a462745SAneesh Kumar K.V #define FID_REFERENCED 0x1 1137a462745SAneesh Kumar K.V #define FID_NON_RECLAIMABLE 0x2 114faa44e3dSVenkateswararao Jujjuri (JV) static inline const char *rpath(FsContext *ctx, const char *path, char *buffer) 115faa44e3dSVenkateswararao Jujjuri (JV) { 116faa44e3dSVenkateswararao Jujjuri (JV) snprintf(buffer, PATH_MAX, "%s/%s", ctx->fs_root, path); 117faa44e3dSVenkateswararao Jujjuri (JV) return buffer; 118faa44e3dSVenkateswararao Jujjuri (JV) } 1199f107513SAnthony Liguori 1205e94c103SM. Mohan Kumar /* 1215e94c103SM. Mohan Kumar * ample room for Twrite/Rread header 1225e94c103SM. Mohan Kumar * size[4] Tread/Twrite tag[2] fid[4] offset[8] count[4] 1235e94c103SM. Mohan Kumar */ 1245e94c103SM. Mohan Kumar #define P9_IOHDRSZ 24 1255e94c103SM. Mohan Kumar 1269f107513SAnthony Liguori typedef struct V9fsPDU V9fsPDU; 127ff06030fSVenkateswararao Jujjuri (JV) struct V9fsState; 1289f107513SAnthony Liguori 1299f107513SAnthony Liguori struct V9fsPDU 1309f107513SAnthony Liguori { 1319f107513SAnthony Liguori uint32_t size; 1329f107513SAnthony Liguori uint16_t tag; 1339f107513SAnthony Liguori uint8_t id; 1349f107513SAnthony Liguori VirtQueueElement elem; 135ff06030fSVenkateswararao Jujjuri (JV) struct V9fsState *s; 1369f107513SAnthony Liguori QLIST_ENTRY(V9fsPDU) next; 1379f107513SAnthony Liguori }; 1389f107513SAnthony Liguori 1399f107513SAnthony Liguori 1409f107513SAnthony Liguori /* FIXME 1419f107513SAnthony Liguori * 1) change user needs to set groups and stuff 1429f107513SAnthony Liguori */ 1439f107513SAnthony Liguori 1449f107513SAnthony Liguori /* from Linux's linux/virtio_9p.h */ 1459f107513SAnthony Liguori 1469f107513SAnthony Liguori /* The ID for virtio console */ 1479f107513SAnthony Liguori #define VIRTIO_ID_9P 9 1489f107513SAnthony Liguori #define MAX_REQ 128 1499f107513SAnthony Liguori #define MAX_TAG_LEN 32 1509f107513SAnthony Liguori 1519f107513SAnthony Liguori #define BUG_ON(cond) assert(!(cond)) 1529f107513SAnthony Liguori 1539f107513SAnthony Liguori typedef struct V9fsFidState V9fsFidState; 1549f107513SAnthony Liguori 1559f107513SAnthony Liguori typedef struct V9fsString 1569f107513SAnthony Liguori { 1579f107513SAnthony Liguori int16_t size; 1589f107513SAnthony Liguori char *data; 1599f107513SAnthony Liguori } V9fsString; 1609f107513SAnthony Liguori 1619f107513SAnthony Liguori typedef struct V9fsQID 1629f107513SAnthony Liguori { 1639f107513SAnthony Liguori int8_t type; 1649f107513SAnthony Liguori int32_t version; 1659f107513SAnthony Liguori int64_t path; 1669f107513SAnthony Liguori } V9fsQID; 1679f107513SAnthony Liguori 1689f107513SAnthony Liguori typedef struct V9fsStat 1699f107513SAnthony Liguori { 1709f107513SAnthony Liguori int16_t size; 1719f107513SAnthony Liguori int16_t type; 1729f107513SAnthony Liguori int32_t dev; 1739f107513SAnthony Liguori V9fsQID qid; 1749f107513SAnthony Liguori int32_t mode; 1759f107513SAnthony Liguori int32_t atime; 1769f107513SAnthony Liguori int32_t mtime; 1779f107513SAnthony Liguori int64_t length; 1789f107513SAnthony Liguori V9fsString name; 1799f107513SAnthony Liguori V9fsString uid; 1809f107513SAnthony Liguori V9fsString gid; 1819f107513SAnthony Liguori V9fsString muid; 1829f107513SAnthony Liguori /* 9p2000.u */ 1839f107513SAnthony Liguori V9fsString extension; 1849f107513SAnthony Liguori int32_t n_uid; 1859f107513SAnthony Liguori int32_t n_gid; 1869f107513SAnthony Liguori int32_t n_muid; 1879f107513SAnthony Liguori } V9fsStat; 1889f107513SAnthony Liguori 189d62dbb51SAneesh Kumar K.V enum { 190d62dbb51SAneesh Kumar K.V P9_FID_NONE = 0, 191d62dbb51SAneesh Kumar K.V P9_FID_FILE, 192d62dbb51SAneesh Kumar K.V P9_FID_DIR, 193d62dbb51SAneesh Kumar K.V P9_FID_XATTR, 194d62dbb51SAneesh Kumar K.V }; 195d62dbb51SAneesh Kumar K.V 196d62dbb51SAneesh Kumar K.V typedef struct V9fsXattr 197d62dbb51SAneesh Kumar K.V { 198d62dbb51SAneesh Kumar K.V int64_t copied_len; 199d62dbb51SAneesh Kumar K.V int64_t len; 200d62dbb51SAneesh Kumar K.V void *value; 201d62dbb51SAneesh Kumar K.V V9fsString name; 202d62dbb51SAneesh Kumar K.V int flags; 203d62dbb51SAneesh Kumar K.V } V9fsXattr; 204d62dbb51SAneesh Kumar K.V 2059f107513SAnthony Liguori struct V9fsFidState 2069f107513SAnthony Liguori { 207d62dbb51SAneesh Kumar K.V int fid_type; 2089f107513SAnthony Liguori int32_t fid; 2099f107513SAnthony Liguori V9fsString path; 210d62dbb51SAneesh Kumar K.V union { 2119f107513SAnthony Liguori int fd; 2129f107513SAnthony Liguori DIR *dir; 213d62dbb51SAneesh Kumar K.V V9fsXattr xattr; 214d62dbb51SAneesh Kumar K.V } fs; 2157a462745SAneesh Kumar K.V union { 2167a462745SAneesh Kumar K.V int fd; 2177a462745SAneesh Kumar K.V DIR *dir; 2187a462745SAneesh Kumar K.V } fs_reclaim; 2197a462745SAneesh Kumar K.V int flags; 2207a462745SAneesh Kumar K.V int open_flags; 2219f107513SAnthony Liguori uid_t uid; 22284dfb926SAneesh Kumar K.V int ref; 22384dfb926SAneesh Kumar K.V int clunked; 2249f107513SAnthony Liguori V9fsFidState *next; 2257a462745SAneesh Kumar K.V V9fsFidState *rclm_lst; 2269f107513SAnthony Liguori }; 2279f107513SAnthony Liguori 2289f107513SAnthony Liguori typedef struct V9fsState 2299f107513SAnthony Liguori { 2309f107513SAnthony Liguori VirtIODevice vdev; 2319f107513SAnthony Liguori VirtQueue *vq; 2329f107513SAnthony Liguori V9fsPDU pdus[MAX_REQ]; 2339f107513SAnthony Liguori QLIST_HEAD(, V9fsPDU) free_list; 2349f107513SAnthony Liguori V9fsFidState *fid_list; 2359f107513SAnthony Liguori FileOperations *ops; 2369f107513SAnthony Liguori FsContext ctx; 2379f107513SAnthony Liguori uint16_t tag_len; 2389f107513SAnthony Liguori uint8_t *tag; 2399f107513SAnthony Liguori size_t config_size; 24084151514SM. Mohan Kumar enum p9_proto_version proto_version; 2415e94c103SM. Mohan Kumar int32_t msize; 242*02cb7f3aSAneesh Kumar K.V /* 243*02cb7f3aSAneesh Kumar K.V * lock ensuring atomic path update 244*02cb7f3aSAneesh Kumar K.V * on rename. 245*02cb7f3aSAneesh Kumar K.V */ 246*02cb7f3aSAneesh Kumar K.V CoRwlock rename_lock; 2479f107513SAnthony Liguori } V9fsState; 2489f107513SAnthony Liguori 249fac4f111SVenkateswararao Jujjuri (JV) typedef struct V9fsStatState { 250fac4f111SVenkateswararao Jujjuri (JV) V9fsPDU *pdu; 251fac4f111SVenkateswararao Jujjuri (JV) size_t offset; 252fac4f111SVenkateswararao Jujjuri (JV) V9fsStat v9stat; 253fac4f111SVenkateswararao Jujjuri (JV) V9fsFidState *fidp; 254fac4f111SVenkateswararao Jujjuri (JV) struct stat stbuf; 255fac4f111SVenkateswararao Jujjuri (JV) } V9fsStatState; 256fac4f111SVenkateswararao Jujjuri (JV) 25700ede4c2SSripathi Kodi typedef struct V9fsStatDotl { 25800ede4c2SSripathi Kodi uint64_t st_result_mask; 25900ede4c2SSripathi Kodi V9fsQID qid; 26000ede4c2SSripathi Kodi uint32_t st_mode; 26100ede4c2SSripathi Kodi uint32_t st_uid; 26200ede4c2SSripathi Kodi uint32_t st_gid; 26300ede4c2SSripathi Kodi uint64_t st_nlink; 26400ede4c2SSripathi Kodi uint64_t st_rdev; 26500ede4c2SSripathi Kodi uint64_t st_size; 26600ede4c2SSripathi Kodi uint64_t st_blksize; 26700ede4c2SSripathi Kodi uint64_t st_blocks; 26800ede4c2SSripathi Kodi uint64_t st_atime_sec; 26900ede4c2SSripathi Kodi uint64_t st_atime_nsec; 27000ede4c2SSripathi Kodi uint64_t st_mtime_sec; 27100ede4c2SSripathi Kodi uint64_t st_mtime_nsec; 27200ede4c2SSripathi Kodi uint64_t st_ctime_sec; 27300ede4c2SSripathi Kodi uint64_t st_ctime_nsec; 27400ede4c2SSripathi Kodi uint64_t st_btime_sec; 27500ede4c2SSripathi Kodi uint64_t st_btime_nsec; 27600ede4c2SSripathi Kodi uint64_t st_gen; 27700ede4c2SSripathi Kodi uint64_t st_data_version; 27800ede4c2SSripathi Kodi } V9fsStatDotl; 27900ede4c2SSripathi Kodi 280fac4f111SVenkateswararao Jujjuri (JV) typedef struct V9fsOpenState { 281fac4f111SVenkateswararao Jujjuri (JV) V9fsPDU *pdu; 282fac4f111SVenkateswararao Jujjuri (JV) size_t offset; 283771e9d4cSM. Mohan Kumar int32_t mode; 284fac4f111SVenkateswararao Jujjuri (JV) V9fsFidState *fidp; 285fac4f111SVenkateswararao Jujjuri (JV) V9fsQID qid; 286fac4f111SVenkateswararao Jujjuri (JV) struct stat stbuf; 2875e94c103SM. Mohan Kumar int iounit; 288fac4f111SVenkateswararao Jujjuri (JV) } V9fsOpenState; 289fac4f111SVenkateswararao Jujjuri (JV) 290fac4f111SVenkateswararao Jujjuri (JV) typedef struct V9fsReadState { 291fac4f111SVenkateswararao Jujjuri (JV) V9fsPDU *pdu; 292fac4f111SVenkateswararao Jujjuri (JV) size_t offset; 293fac4f111SVenkateswararao Jujjuri (JV) int32_t count; 294fac4f111SVenkateswararao Jujjuri (JV) int32_t total; 295fac4f111SVenkateswararao Jujjuri (JV) int64_t off; 296fac4f111SVenkateswararao Jujjuri (JV) V9fsFidState *fidp; 297fac4f111SVenkateswararao Jujjuri (JV) struct iovec iov[128]; /* FIXME: bad, bad, bad */ 298fac4f111SVenkateswararao Jujjuri (JV) struct iovec *sg; 299fac4f111SVenkateswararao Jujjuri (JV) off_t dir_pos; 300fac4f111SVenkateswararao Jujjuri (JV) struct dirent *dent; 301fac4f111SVenkateswararao Jujjuri (JV) struct stat stbuf; 302fac4f111SVenkateswararao Jujjuri (JV) V9fsString name; 303fac4f111SVenkateswararao Jujjuri (JV) V9fsStat v9stat; 304fac4f111SVenkateswararao Jujjuri (JV) int32_t len; 305fac4f111SVenkateswararao Jujjuri (JV) int32_t cnt; 306fac4f111SVenkateswararao Jujjuri (JV) int32_t max_count; 307fac4f111SVenkateswararao Jujjuri (JV) } V9fsReadState; 308fac4f111SVenkateswararao Jujjuri (JV) 309fac4f111SVenkateswararao Jujjuri (JV) typedef struct V9fsWriteState { 310fac4f111SVenkateswararao Jujjuri (JV) V9fsPDU *pdu; 311fac4f111SVenkateswararao Jujjuri (JV) size_t offset; 312fac4f111SVenkateswararao Jujjuri (JV) int32_t len; 313fac4f111SVenkateswararao Jujjuri (JV) int32_t count; 314fac4f111SVenkateswararao Jujjuri (JV) int32_t total; 315fac4f111SVenkateswararao Jujjuri (JV) int64_t off; 316fac4f111SVenkateswararao Jujjuri (JV) V9fsFidState *fidp; 317fac4f111SVenkateswararao Jujjuri (JV) struct iovec iov[128]; /* FIXME: bad, bad, bad */ 318fac4f111SVenkateswararao Jujjuri (JV) struct iovec *sg; 319fac4f111SVenkateswararao Jujjuri (JV) int cnt; 320fac4f111SVenkateswararao Jujjuri (JV) } V9fsWriteState; 321fac4f111SVenkateswararao Jujjuri (JV) 322c79ce737SSripathi Kodi typedef struct V9fsIattr 323c79ce737SSripathi Kodi { 324c79ce737SSripathi Kodi int32_t valid; 325c79ce737SSripathi Kodi int32_t mode; 326c79ce737SSripathi Kodi int32_t uid; 327c79ce737SSripathi Kodi int32_t gid; 328c79ce737SSripathi Kodi int64_t size; 329c79ce737SSripathi Kodi int64_t atime_sec; 330c79ce737SSripathi Kodi int64_t atime_nsec; 331c79ce737SSripathi Kodi int64_t mtime_sec; 332c79ce737SSripathi Kodi int64_t mtime_nsec; 333c79ce737SSripathi Kodi } V9fsIattr; 334c79ce737SSripathi Kodi 3359f107513SAnthony Liguori struct virtio_9p_config 3369f107513SAnthony Liguori { 3379f107513SAnthony Liguori /* number of characters in tag */ 3389f107513SAnthony Liguori uint16_t tag_len; 3399f107513SAnthony Liguori /* Variable size tag name */ 3409f107513SAnthony Liguori uint8_t tag[0]; 341541dc0d4SStefan Weil } QEMU_PACKED; 3429f107513SAnthony Liguori 3435268ceccSM. Mohan Kumar typedef struct V9fsMkState { 3445268ceccSM. Mohan Kumar V9fsPDU *pdu; 3455268ceccSM. Mohan Kumar size_t offset; 3465268ceccSM. Mohan Kumar V9fsQID qid; 3475268ceccSM. Mohan Kumar struct stat stbuf; 3485268ceccSM. Mohan Kumar V9fsString name; 3495268ceccSM. Mohan Kumar V9fsString fullname; 3505268ceccSM. Mohan Kumar } V9fsMkState; 3515268ceccSM. Mohan Kumar 35282cc3ee8SM. Mohan Kumar #define P9_LOCK_SUCCESS 0 35382cc3ee8SM. Mohan Kumar #define P9_LOCK_BLOCKED 1 35482cc3ee8SM. Mohan Kumar #define P9_LOCK_ERROR 2 35582cc3ee8SM. Mohan Kumar #define P9_LOCK_GRACE 3 35682cc3ee8SM. Mohan Kumar 35782cc3ee8SM. Mohan Kumar #define P9_LOCK_FLAGS_BLOCK 1 35882cc3ee8SM. Mohan Kumar #define P9_LOCK_FLAGS_RECLAIM 2 35982cc3ee8SM. Mohan Kumar 36082cc3ee8SM. Mohan Kumar typedef struct V9fsFlock 36182cc3ee8SM. Mohan Kumar { 36282cc3ee8SM. Mohan Kumar uint8_t type; 36382cc3ee8SM. Mohan Kumar uint32_t flags; 36482cc3ee8SM. Mohan Kumar uint64_t start; /* absolute offset */ 36582cc3ee8SM. Mohan Kumar uint64_t length; 36682cc3ee8SM. Mohan Kumar uint32_t proc_id; 36782cc3ee8SM. Mohan Kumar V9fsString client_id; 36882cc3ee8SM. Mohan Kumar } V9fsFlock; 36982cc3ee8SM. Mohan Kumar 3708f354003SM. Mohan Kumar typedef struct V9fsGetlock 3718f354003SM. Mohan Kumar { 3728f354003SM. Mohan Kumar uint8_t type; 3738f354003SM. Mohan Kumar uint64_t start; /* absolute offset */ 3748f354003SM. Mohan Kumar uint64_t length; 3758f354003SM. Mohan Kumar uint32_t proc_id; 3768f354003SM. Mohan Kumar V9fsString client_id; 3778f354003SM. Mohan Kumar } V9fsGetlock; 3788f354003SM. Mohan Kumar 3797a462745SAneesh Kumar K.V extern int open_fd_hw; 3807a462745SAneesh Kumar K.V extern int total_open_fd; 3817a462745SAneesh Kumar K.V 38264b85a8fSBlue Swirl size_t pdu_packunpack(void *addr, struct iovec *sg, int sg_count, 3839f107513SAnthony Liguori size_t offset, size_t size, int pack); 3849f107513SAnthony Liguori 3859f107513SAnthony Liguori static inline size_t do_pdu_unpack(void *dst, struct iovec *sg, int sg_count, 3869f107513SAnthony Liguori size_t offset, size_t size) 3879f107513SAnthony Liguori { 3889f107513SAnthony Liguori return pdu_packunpack(dst, sg, sg_count, offset, size, 0); 3899f107513SAnthony Liguori } 3909f107513SAnthony Liguori 391f4f61d27SAneesh Kumar K.V extern void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq); 3927a462745SAneesh Kumar K.V extern void virtio_9p_set_fd_limit(void); 3937a462745SAneesh Kumar K.V extern void v9fs_reclaim_fd(V9fsState *s); 39470c18fc0SAneesh Kumar K.V extern void v9fs_string_init(V9fsString *str); 39570c18fc0SAneesh Kumar K.V extern void v9fs_string_free(V9fsString *str); 39670c18fc0SAneesh Kumar K.V extern void v9fs_string_null(V9fsString *str); 39770c18fc0SAneesh Kumar K.V extern void v9fs_string_sprintf(V9fsString *str, const char *fmt, ...); 39870c18fc0SAneesh Kumar K.V extern void v9fs_string_copy(V9fsString *lhs, V9fsString *rhs); 3999f107513SAnthony Liguori #endif 400