github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/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/wasilibs/wazerox/experimental/sys"
    10  	"github.com/wasilibs/wazerox/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  }