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

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 02:28:23 PDT 2017


labath accepted this revision.
labath added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/include/llvm/Support/FileSystem.h:167
   #endif
+  uint32_t LinkCount = 0;
   file_type Type = file_type::status_error;
----------------
sas wrote:
> 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.
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.


https://reviews.llvm.org/D31110





More information about the llvm-commits mailing list