github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/sysfs/ino.go (about)

     1  //go:build !windows && !plan9
     2  
     3  package sysfs
     4  
     5  import (
     6  	"io/fs"
     7  	"syscall"
     8  
     9  	experimentalsys "github.com/bananabytelabs/wazero/experimental/sys"
    10  	"github.com/bananabytelabs/wazero/sys"
    11  )
    12  
    13  func inoFromFileInfo(_ string, info fs.FileInfo) (sys.Inode, experimentalsys.Errno) {
    14  	switch v := info.Sys().(type) {
    15  	case *sys.Stat_t:
    16  		return v.Ino, 0
    17  	case *syscall.Stat_t:
    18  		return v.Ino, 0
    19  	default:
    20  		return 0, 0
    21  	}
    22  }