Commit 735f62be authored by Thomas Guillem's avatar Thomas Guillem Committed by Max Kellermann

storage/nfs: implement follow

parent a04e01d5
...@@ -267,10 +267,13 @@ Copy(StorageFileInfo &info, const struct nfs_stat_64 &st) noexcept ...@@ -267,10 +267,13 @@ Copy(StorageFileInfo &info, const struct nfs_stat_64 &st) noexcept
class NfsGetInfoOperation final : public BlockingNfsOperation { class NfsGetInfoOperation final : public BlockingNfsOperation {
const char *const path; const char *const path;
StorageFileInfo info; StorageFileInfo info;
bool follow;
public: public:
NfsGetInfoOperation(NfsConnection &_connection, const char *_path) NfsGetInfoOperation(NfsConnection &_connection, const char *_path,
:BlockingNfsOperation(_connection), path(_path) {} bool _follow)
:BlockingNfsOperation(_connection), path(_path),
follow(_follow) {}
const StorageFileInfo &GetInfo() const { const StorageFileInfo &GetInfo() const {
return info; return info;
...@@ -278,7 +281,10 @@ public: ...@@ -278,7 +281,10 @@ public:
protected: protected:
void Start() override { 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 { void HandleResult(gcc_unused unsigned status, void *data) noexcept override {
...@@ -287,13 +293,13 @@ protected: ...@@ -287,13 +293,13 @@ protected:
}; };
StorageFileInfo 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); const std::string path = UriToNfsPath(uri_utf8);
WaitConnected(); WaitConnected();
NfsGetInfoOperation operation(*connection, path.c_str()); NfsGetInfoOperation operation(*connection, path.c_str(), follow);
operation.Run(); operation.Run();
return operation.GetInfo(); return operation.GetInfo();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment