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

     1  package sysfs
     2  
     3  import (
     4  	"io/fs"
     5  	"path"
     6  
     7  	experimentalsys "github.com/bananabytelabs/wazero/experimental/sys"
     8  	"github.com/bananabytelabs/wazero/sys"
     9  )
    10  
    11  // inoFromFileInfo uses stat to get the inode information of the file.
    12  func inoFromFileInfo(dirPath string, info fs.FileInfo) (ino sys.Inode, errno experimentalsys.Errno) {
    13  	if v, ok := info.Sys().(*sys.Stat_t); ok {
    14  		return v.Ino, 0
    15  	}
    16  	if dirPath == "" {
    17  		// This is a FS.File backed implementation which doesn't have access to
    18  		// the original file path.
    19  		return
    20  	}
    21  	// Ino is no not in Win32FileAttributeData
    22  	inoPath := path.Clean(path.Join(dirPath, info.Name()))
    23  	var st sys.Stat_t
    24  	if st, errno = lstat(inoPath); errno == 0 {
    25  		ino = st.Ino
    26  	}
    27  	return
    28  }