func: static void v9fs_read(void *opaque) int32_t fid ; size_t offset = 7 ; uint32_t max_count ; V9fsFidState * fidp ; V9fsPDU * pdu = opaque ; err = pdu_unmarshal ( pdu , offset , "dqd" , & fid , & off , & max_count ); if ( err < 0 )  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 )  if ( fidp -> fid_type == P9_FID_DIR )  count = v9fs_do_readdir_with_stat ( pdu , fidp , max_count ); static int v9fs_do_readdir_with_stat(V9fsPDU V9fsFidState *fidp, uint32_t max_count) V9fsStat v9stat ; int32_t count = 0 ; off_t saved_dir_pos ; struct dirent * dent , * result ; saved_dir_pos = v9fs_co_telldir ( pdu , fidp ); if ( saved_dir_pos < 0 )  dent = g_malloc ( sizeof ( struct dirent ) ); while ( 1 )  err = v9fs_co_readdir_r ( pdu , fidp , dent , & result ); if ( err || ! result )  err = v9fs_co_name_to_path ( pdu , & fidp -> path , dent -> d_name , & path ); if ( err < 0 )  err = v9fs_co_lstat ( pdu , & path , & stbuf ); if ( err < 0 )  err = stat_to_v9stat ( pdu , & path , & stbuf , & v9stat ); if ( err < 0 )  len = pdu_marshal ( pdu , 11 + count , "S" , & v9stat ); if ( ( len != ( v9stat . size + 2 ) ) || ( ( count + len ) > max_count ) )  count += len; static int stat_to_v9stat(V9fsPDU *pdu, V9fsPath const struct stat V9fsStat *v9stat) memset ( v9stat , 0 , sizeof ( * v9stat ) ); stat_to_qid ( stbuf , & v9stat -> qid ); v9stat -> mode = stat_to_v9mode ( stbuf ); v9stat -> atime = stbuf -> st_atime; v9stat -> mtime = stbuf -> st_mtime; v9stat -> length = stbuf -> st_size; v9fs_string_null ( & v9stat -> uid ); v9fs_string_null ( & v9stat -> gid ); v9fs_string_null ( & v9stat -> muid ); v9stat -> n_uid = stbuf -> st_uid; v9stat -> n_gid = stbuf -> st_gid; v9stat -> n_muid = 0; v9fs_string_null ( & v9stat -> extension ); if ( v9stat -> mode & P9_STAT_MODE_SYMLINK )  err = v9fs_co_readlink ( pdu , name , & v9stat -> extension ); if ( err < 0 )  return err ; if ( v9stat -> mode & P9_STAT_MODE_DEVICE )  v9fs_string_sprintf ( & v9stat -> extension , "%c %u %u" , S_ISCHR ( stbuf -> st_mode ) ? 'c' : 'b' , major ( stbuf -> st_rdev ) , minor ( stbuf -> st_rdev ) ); v9fs_string_sprintf ( & v9stat -> extension , "%s %lu" , "HARDLINKCOUNT" , ( unsigned long ) stbuf -> st_nlink ); v9fs_string_sprintf ( & v9stat -> name , "%s" , str ); v9stat -> size = 61 + v9fs_string_size ( & v9stat -> name ) + v9fs_string_size ( & v9stat -> uid ) + v9fs_string_size ( & v9stat -> gid ) + v9fs_string_size ( & v9stat -> muid ) + v9fs_string_size ( & v9stat -> extension ); 