This is an archive of the discontinued LLVM Phabricator instance.

[FileSystem] Make file_status store link count and add a file_status::getLinkCount() method.
ClosedPublic

Authored by zturner on Mar 17 2017, 5:08 PM.

Diff Detail

Event Timeline

zturner created this revision.Mar 17 2017, 5:08 PM
sas added inline comments.Mar 17 2017, 5:26 PM
llvm/include/llvm/Support/FileSystem.h
167

It seems like system types are used here when LLVM_ON_UNIX is defined, so you should probably define LinkCount as nlink_t fs_st_nlink; for POSIX and uint32_t LinkCount; only for the Windows case (which means you'll also have to have two separate getters down below).

I'll let someone more knowledgeable with this code confirm what the right thing to do is.

labath accepted this revision.Mar 20 2017, 2:28 AM
labath added inline comments.
llvm/include/llvm/Support/FileSystem.h
167

That certainly seems to be the pattern, although I am not really sure why. I am personally fine with having a single field if it is big enough to hold the value in all circumstances -- which means the type should be 64-bit as that's the type of nlink_t on 64-bit (linux) systems.

This revision is now accepted and ready to land.Mar 20 2017, 2:28 AM
This revision was automatically updated to reflect the committed changes.