func: static void v9fs_write(void *opaque) ssize_t err ; int32_t fid ; uint64_t off ; uint32_t count ; int32_t total = 0 ; size_t offset = 7 ; V9fsFidState * fidp ; V9fsPDU * pdu = opaque ; V9fsState * s = pdu -> s ; QEMUIOVector qiov_full ; QEMUIOVector qiov ; err = pdu_unmarshal ( pdu , offset , "dqd" , & fid , & off , & count ); if ( err < 0 )  offset += err; fidp = get_fid ( pdu , fid ); static V9fsFidState *get_fid(V9fsPDU *pdu, int32_t fid) int err ; V9fsFidState * f ; V9fsState * s = pdu -> s ; for (f = s->fid_list; f; f = f->next) if ( f -> fid == fid )  f -> ref ++; err = v9fs_reopen_fid ( pdu , f ); if ( err < 0 )  return NULL ; f -> flags |= FID_REFERENCED; return f ; return NULL ; if ( fidp == NULL )  err = - EINVAL; if ( fidp -> fid_type == P9_FID_FILE )  if ( fidp -> fs . fd == - 1 )  err = - EINVAL; if ( fidp -> fid_type == P9_FID_XATTR )  err = v9fs_xattr_write ( s , pdu , fidp , off , count , qiov_full . iov , qiov_full . niov ); static int v9fs_xattr_write(V9fsState *s, V9fsPDU *pdu, V9fsFidState uint64_t off, uint32_t struct iovec *sg, int cnt) int write_count ; int64_t xattr_len ; size_t offset = 7 ; xattr_len = fidp -> fs . xattr . len; write_count = xattr_len - off; if ( write_count > count )  write_count = count; if ( write_count < 0 )  err = - ENOSPC; err = pdu_marshal ( pdu , offset , "d" , write_count ); if ( err < 0 )  return err ; err += offset; return err ; err = - EINVAL; len = v9fs_co_pwritev ( pdu , fidp , qiov . iov , qiov . niov , off ); if ( len >= 0 )  off += len; total += len; while ( len == - EINTR && ! pdu -> cancelled )  if ( len < 0 )  err = len; while ( total < count && len > 0 )  offset = 7; err = pdu_marshal ( pdu , offset , "d" , total ); if ( err < 0 )  err += offset; complete_pdu ( s , pdu , err ); static void complete_pdu(V9fsState *s, V9fsPDU *pdu, ssize_t len) if ( len < 0 )  int err = - len ; if ( s -> proto_version != V9FS_PROTO_2000L )  V9fsString str ; str . data = strerror ( err ); str . size = strlen ( str . data ); len += pdu_marshal ( pdu , len , "s" , & str ); len += pdu_marshal ( pdu , len , "d" , err ); pdu_marshal ( pdu , 0 , "dbw" , ( int32_t ) len , id , pdu -> tag ); pdu -> size = len; pdu -> id = id; virtqueue_push ( s -> vq , & pdu -> elem , len ); qemu_co_queue_next ( & pdu -> complete ); free_pdu ( s , pdu ); 