Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Use fileID from FILE_ID_BOTH_DIR_INFO for the stat ino field on Win32 #613

Closed
isaacs opened this issue Nov 2, 2012 · 4 comments
Closed
Labels

Comments

@isaacs
Copy link

isaacs commented Nov 2, 2012

nodejs/node-v0.x-archive#2670

http://msdn.microsoft.com/en-us/library/windows/desktop/aa364226%28v=vs.85%29.aspx

@piscisaureus
Copy link

Agreed, with the following notes:

  • FILE_ID_BOTH_DIR_INFO can only be read when enumerating a directory. We can also query this information with NtQueryInformationFile using the IndexNumber field (see http://msdn.microsoft.com/en-us/library/windows/hardware/ff540318(v=vs.85).aspx)
  • A problem is that the file id is a 64-bit integer. struct stat on windows does not accommodate a 64-bit integer in the st_ino field, so we'd have to define our own struct uv_stat.
  • Javascript cannot represent 64-bit integers reliably, so for node additional creativity is needed.

@isaacs
Copy link
Author

isaacs commented Nov 2, 2012

So, it's a bit hacky... but... is the st_dev set to zero as well? Maybe the high 32 bits can be used for the st_dev, and the low 32 can be the inode? Of course, this will break programs that use the dev number to actually determine the device, but I wonder how many of those there are, actually. In reality, you can't rely on just st.st_ino anyway, you have to also consider the st_dev, since the same inode on two different devices is not the same file.

@piscisaureus
Copy link

st_dev is currently zero for the same reason.

@piscisaureus
Copy link

Fixed in 20a8e58

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants