From 735f62be0c27ce570eb984d288a9a1638f63e108 Mon Sep 17 00:00:00 2001 From: Thomas Guillem Date: Fri, 13 Nov 2015 17:12:10 +0100 Subject: [PATCH] storage/nfs: implement follow --- src/storage/plugins/NfsStorage.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx index 5dc4dc2cf..13e8e2aa2 100644 --- a/src/storage/plugins/NfsStorage.cxx +++ b/src/storage/plugins/NfsStorage.cxx @@ -267,10 +267,13 @@ Copy(StorageFileInfo &info, const struct nfs_stat_64 &st) noexcept class NfsGetInfoOperation final : public BlockingNfsOperation { const char *const path; StorageFileInfo info; + bool follow; public: - NfsGetInfoOperation(NfsConnection &_connection, const char *_path) - :BlockingNfsOperation(_connection), path(_path) {} + NfsGetInfoOperation(NfsConnection &_connection, const char *_path, + bool _follow) + :BlockingNfsOperation(_connection), path(_path), + follow(_follow) {} const StorageFileInfo &GetInfo() const { return info; @@ -278,7 +281,10 @@ public: protected: void Start() override { - connection.Stat(path, *this); + if (follow) + connection.Stat(path, *this); + else + connection.Lstat(path, *this); } void HandleResult(gcc_unused unsigned status, void *data) noexcept override { @@ -287,13 +293,13 @@ protected: }; StorageFileInfo -NfsStorage::GetInfo(const char *uri_utf8, gcc_unused bool follow) +NfsStorage::GetInfo(const char *uri_utf8, bool follow) { const std::string path = UriToNfsPath(uri_utf8); WaitConnected(); - NfsGetInfoOperation operation(*connection, path.c_str()); + NfsGetInfoOperation operation(*connection, path.c_str(), follow); operation.Run(); return operation.GetInfo(); }