summaryrefslogtreecommitdiffhomepage
path: root/test/util/fs_util.h
diff options
context:
space:
mode:
authorAyush Ranjan <ayushranjan@google.com>2020-09-10 10:38:19 -0700
committergVisor bot <gvisor-bot@google.com>2020-09-10 10:40:35 -0700
commit50c99a86d1c6807c67cdc52102b1fc570426669f (patch)
tree17a4d2bfde09a6bc03f54e03dd97b92cc8649ce8 /test/util/fs_util.h
parent9a003835f9750630c8acef2f7453eb7c134863b1 (diff)
[vfs] Disable nlink tests for overlayfs.
Overlayfs intentionally does not compute nlink for directories (because it can be really expensive). Linux returns 1, VFS2 returns 2 and VFS1 actually calculates the correct value. PiperOrigin-RevId: 330967139
Diffstat (limited to 'test/util/fs_util.h')
-rw-r--r--test/util/fs_util.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/util/fs_util.h b/test/util/fs_util.h
index 314637de0..c99cf5eb7 100644
--- a/test/util/fs_util.h
+++ b/test/util/fs_util.h
@@ -38,6 +38,10 @@ constexpr int kOLargeFile = 00400000;
#error "Unknown architecture"
#endif
+// From linux/magic.h. For some reason, not defined in the headers for some
+// build environments.
+#define OVERLAYFS_SUPER_MAGIC 0x794c7630
+
// Returns a status or the current working directory.
PosixErrorOr<std::string> GetCWD();
@@ -184,6 +188,9 @@ PosixErrorOr<std::string> ProcessExePath(int pid);
PosixErrorOr<bool> IsTmpfs(const std::string& path);
#endif // __linux__
+// IsOverlayfs returns true if the file at path is backed by overlayfs.
+PosixErrorOr<bool> IsOverlayfs(const std::string& path);
+
namespace internal {
// Not part of the public API.
std::string JoinPathImpl(std::initializer_list<absl::string_view> paths);