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

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

Diff Detail

Repository
rL LLVM
zturner created this revision.Fri, Mar 17, 5:08 PM
sas added inline comments.Fri, Mar 17, 5:26 PM
llvm/include/llvm/Support/FileSystem.h
167 ↗(On Diff #92233)

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.Mon, Mar 20, 2:28 AM
labath added inline comments.
llvm/include/llvm/Support/FileSystem.h
167 ↗(On Diff #92233)

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.Mon, Mar 20, 2:28 AM
This revision was automatically updated to reflect the committed changes.