aboutsummaryrefslogtreecommitdiffstats
path: root/src/storage
diff options
context:
space:
mode:
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/CompositeStorage.cxx10
-rw-r--r--src/storage/CompositeStorage.hxx2
-rw-r--r--src/storage/FileInfo.hxx2
-rw-r--r--src/storage/MemoryDirectoryReader.cxx3
-rw-r--r--src/storage/MemoryDirectoryReader.hxx5
-rw-r--r--src/storage/StorageInterface.hxx8
-rw-r--r--src/storage/plugins/LocalStorage.cxx17
-rw-r--r--src/storage/plugins/NfsStorage.cxx24
-rw-r--r--src/storage/plugins/SmbclientStorage.cxx18
9 files changed, 48 insertions, 41 deletions
diff --git a/src/storage/CompositeStorage.cxx b/src/storage/CompositeStorage.cxx
index 94bbb6901..10a478c0d 100644
--- a/src/storage/CompositeStorage.cxx
+++ b/src/storage/CompositeStorage.cxx
@@ -56,7 +56,7 @@ public:
/* virtual methods from class StorageDirectoryReader */
const char *Read() override;
- bool GetInfo(bool follow, FileInfo &info, Error &error) override;
+ bool GetInfo(bool follow, StorageFileInfo &info, Error &error) override;
};
const char *
@@ -81,7 +81,7 @@ CompositeDirectoryReader::Read()
}
bool
-CompositeDirectoryReader::GetInfo(bool follow, FileInfo &info,
+CompositeDirectoryReader::GetInfo(bool follow, StorageFileInfo &info,
Error &error)
{
if (other != nullptr)
@@ -89,7 +89,7 @@ CompositeDirectoryReader::GetInfo(bool follow, FileInfo &info,
assert(current != names.end());
- info.type = FileInfo::Type::DIRECTORY;
+ info.type = StorageFileInfo::Type::DIRECTORY;
info.mtime = 0;
info.device = 0;
info.inode = 0;
@@ -275,7 +275,7 @@ CompositeStorage::FindStorage(const char *uri, Error &error) const
}
bool
-CompositeStorage::GetInfo(const char *uri, bool follow, FileInfo &info,
+CompositeStorage::GetInfo(const char *uri, bool follow, StorageFileInfo &info,
Error &error)
{
const ScopeLock protect(mutex);
@@ -288,7 +288,7 @@ CompositeStorage::GetInfo(const char *uri, bool follow, FileInfo &info,
const Directory *directory = f.directory->Find(f.uri);
if (directory != nullptr) {
error.Clear();
- info.type = FileInfo::Type::DIRECTORY;
+ info.type = StorageFileInfo::Type::DIRECTORY;
info.mtime = 0;
info.device = 0;
info.inode = 0;
diff --git a/src/storage/CompositeStorage.hxx b/src/storage/CompositeStorage.hxx
index cf27a292c..08717edef 100644
--- a/src/storage/CompositeStorage.hxx
+++ b/src/storage/CompositeStorage.hxx
@@ -122,7 +122,7 @@ public:
bool Unmount(const char *uri);
/* virtual methods from class Storage */
- bool GetInfo(const char *uri, bool follow, FileInfo &info,
+ bool GetInfo(const char *uri, bool follow, StorageFileInfo &info,
Error &error) override;
StorageDirectoryReader *OpenDirectory(const char *uri,
diff --git a/src/storage/FileInfo.hxx b/src/storage/FileInfo.hxx
index d194bd9f5..4ba842811 100644
--- a/src/storage/FileInfo.hxx
+++ b/src/storage/FileInfo.hxx
@@ -25,7 +25,7 @@
#include <time.h>
#include <stdint.h>
-struct FileInfo {
+struct StorageFileInfo {
enum class Type : uint8_t {
OTHER,
REGULAR,
diff --git a/src/storage/MemoryDirectoryReader.cxx b/src/storage/MemoryDirectoryReader.cxx
index c9563ea84..e6875435c 100644
--- a/src/storage/MemoryDirectoryReader.cxx
+++ b/src/storage/MemoryDirectoryReader.cxx
@@ -37,7 +37,8 @@ MemoryStorageDirectoryReader::Read()
}
bool
-MemoryStorageDirectoryReader::GetInfo(gcc_unused bool follow, FileInfo &info,
+MemoryStorageDirectoryReader::GetInfo(gcc_unused bool follow,
+ StorageFileInfo &info,
gcc_unused Error &error)
{
assert(!first);
diff --git a/src/storage/MemoryDirectoryReader.hxx b/src/storage/MemoryDirectoryReader.hxx
index a4d2c1f92..69299d1d4 100644
--- a/src/storage/MemoryDirectoryReader.hxx
+++ b/src/storage/MemoryDirectoryReader.hxx
@@ -36,7 +36,7 @@ public:
struct Entry {
std::string name;
- FileInfo info;
+ StorageFileInfo info;
template<typename N>
explicit Entry(N &&_name):name(std::forward<N>(_name)) {}
@@ -61,7 +61,8 @@ public:
/* virtual methods from class StorageDirectoryReader */
const char *Read() override;
- bool GetInfo(bool follow, FileInfo &info, Error &error) override;
+ bool GetInfo(bool follow, StorageFileInfo &info,
+ Error &error) override;
};
#endif
diff --git a/src/storage/StorageInterface.hxx b/src/storage/StorageInterface.hxx
index 7e73dd34b..4435bbf91 100644
--- a/src/storage/StorageInterface.hxx
+++ b/src/storage/StorageInterface.hxx
@@ -25,7 +25,7 @@
#include <string>
-struct FileInfo;
+struct StorageFileInfo;
class AllocatedPath;
class Error;
@@ -36,7 +36,8 @@ public:
virtual ~StorageDirectoryReader() {}
virtual const char *Read() = 0;
- virtual bool GetInfo(bool follow, FileInfo &info, Error &error) = 0;
+ virtual bool GetInfo(bool follow, StorageFileInfo &info,
+ Error &error) = 0;
};
class Storage {
@@ -45,7 +46,8 @@ public:
Storage(const Storage &) = delete;
virtual ~Storage() {}
- virtual bool GetInfo(const char *uri_utf8, bool follow, FileInfo &info,
+ virtual bool GetInfo(const char *uri_utf8, bool follow,
+ StorageFileInfo &info,
Error &error) = 0;
virtual StorageDirectoryReader *OpenDirectory(const char *uri_utf8,
diff --git a/src/storage/plugins/LocalStorage.cxx b/src/storage/plugins/LocalStorage.cxx
index a8e33c788..484c9c6db 100644
--- a/src/storage/plugins/LocalStorage.cxx
+++ b/src/storage/plugins/LocalStorage.cxx
@@ -46,7 +46,8 @@ public:
/* virtual methods from class StorageDirectoryReader */
const char *Read() override;
- bool GetInfo(bool follow, FileInfo &info, Error &error) override;
+ bool GetInfo(bool follow, StorageFileInfo &info,
+ Error &error) override;
};
class LocalStorage final : public Storage {
@@ -61,7 +62,7 @@ public:
}
/* virtual methods from class Storage */
- bool GetInfo(const char *uri_utf8, bool follow, FileInfo &info,
+ bool GetInfo(const char *uri_utf8, bool follow, StorageFileInfo &info,
Error &error) override;
StorageDirectoryReader *OpenDirectory(const char *uri_utf8,
@@ -78,7 +79,7 @@ private:
};
static bool
-Stat(Path path, bool follow, FileInfo &info, Error &error)
+Stat(Path path, bool follow, StorageFileInfo &info, Error &error)
{
struct stat st;
if (!StatFile(path, st, follow)) {
@@ -90,11 +91,11 @@ Stat(Path path, bool follow, FileInfo &info, Error &error)
}
if (S_ISREG(st.st_mode))
- info.type = FileInfo::Type::REGULAR;
+ info.type = StorageFileInfo::Type::REGULAR;
else if (S_ISDIR(st.st_mode))
- info.type = FileInfo::Type::DIRECTORY;
+ info.type = StorageFileInfo::Type::DIRECTORY;
else
- info.type = FileInfo::Type::OTHER;
+ info.type = StorageFileInfo::Type::OTHER;
info.size = st.st_size;
info.mtime = st.st_mtime;
@@ -142,7 +143,7 @@ LocalStorage::MapToRelativeUTF8(const char *uri_utf8) const
}
bool
-LocalStorage::GetInfo(const char *uri_utf8, bool follow, FileInfo &info,
+LocalStorage::GetInfo(const char *uri_utf8, bool follow, StorageFileInfo &info,
Error &error)
{
AllocatedPath path_fs = MapFS(uri_utf8, error);
@@ -198,7 +199,7 @@ LocalDirectoryReader::Read()
}
bool
-LocalDirectoryReader::GetInfo(bool follow, FileInfo &info, Error &error)
+LocalDirectoryReader::GetInfo(bool follow, StorageFileInfo &info, Error &error)
{
const AllocatedPath path_fs =
AllocatedPath::Build(base_fs, reader.GetEntry());
diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx
index dc9826214..6a3eeedaf 100644
--- a/src/storage/plugins/NfsStorage.cxx
+++ b/src/storage/plugins/NfsStorage.cxx
@@ -84,7 +84,7 @@ public:
}
/* virtual methods from class Storage */
- bool GetInfo(const char *uri_utf8, bool follow, FileInfo &info,
+ bool GetInfo(const char *uri_utf8, bool follow, StorageFileInfo &info,
Error &error) override;
StorageDirectoryReader *OpenDirectory(const char *uri_utf8,
@@ -245,14 +245,14 @@ NfsStorage::MapToRelativeUTF8(const char *uri_utf8) const
}
static void
-Copy(FileInfo &info, const struct stat &st)
+Copy(StorageFileInfo &info, const struct stat &st)
{
if (S_ISREG(st.st_mode))
- info.type = FileInfo::Type::REGULAR;
+ info.type = StorageFileInfo::Type::REGULAR;
else if (S_ISDIR(st.st_mode))
- info.type = FileInfo::Type::DIRECTORY;
+ info.type = StorageFileInfo::Type::DIRECTORY;
else
- info.type = FileInfo::Type::OTHER;
+ info.type = StorageFileInfo::Type::OTHER;
info.size = st.st_size;
info.mtime = st.st_mtime;
@@ -262,11 +262,11 @@ Copy(FileInfo &info, const struct stat &st)
class NfsGetInfoOperation final : public BlockingNfsOperation {
const char *const path;
- FileInfo &info;
+ StorageFileInfo &info;
public:
NfsGetInfoOperation(NfsConnection &_connection, const char *_path,
- FileInfo &_info)
+ StorageFileInfo &_info)
:BlockingNfsOperation(_connection), path(_path), info(_info) {}
protected:
@@ -281,7 +281,7 @@ protected:
bool
NfsStorage::GetInfo(const char *uri_utf8, gcc_unused bool follow,
- FileInfo &info, Error &error)
+ StorageFileInfo &info, Error &error)
{
const std::string path = UriToNfsPath(uri_utf8, error);
if (path.empty())
@@ -304,19 +304,19 @@ SkipNameFS(const char *name)
}
static void
-Copy(FileInfo &info, const struct nfsdirent &ent)
+Copy(StorageFileInfo &info, const struct nfsdirent &ent)
{
switch (ent.type) {
case NF3REG:
- info.type = FileInfo::Type::REGULAR;
+ info.type = StorageFileInfo::Type::REGULAR;
break;
case NF3DIR:
- info.type = FileInfo::Type::DIRECTORY;
+ info.type = StorageFileInfo::Type::DIRECTORY;
break;
default:
- info.type = FileInfo::Type::OTHER;
+ info.type = StorageFileInfo::Type::OTHER;
break;
}
diff --git a/src/storage/plugins/SmbclientStorage.cxx b/src/storage/plugins/SmbclientStorage.cxx
index 49c9952f2..84b212cd1 100644
--- a/src/storage/plugins/SmbclientStorage.cxx
+++ b/src/storage/plugins/SmbclientStorage.cxx
@@ -44,7 +44,8 @@ public:
/* virtual methods from class StorageDirectoryReader */
const char *Read() override;
- bool GetInfo(bool follow, FileInfo &info, Error &error) override;
+ bool GetInfo(bool follow, StorageFileInfo &info,
+ Error &error) override;
};
class SmbclientStorage final : public Storage {
@@ -63,7 +64,7 @@ public:
}
/* virtual methods from class Storage */
- bool GetInfo(const char *uri_utf8, bool follow, FileInfo &info,
+ bool GetInfo(const char *uri_utf8, bool follow, StorageFileInfo &info,
Error &error) override;
StorageDirectoryReader *OpenDirectory(const char *uri_utf8,
@@ -92,7 +93,7 @@ SmbclientStorage::MapToRelativeUTF8(const char *uri_utf8) const
}
static bool
-GetInfo(const char *path, FileInfo &info, Error &error)
+GetInfo(const char *path, StorageFileInfo &info, Error &error)
{
struct stat st;
smbclient_mutex.lock();
@@ -104,11 +105,11 @@ GetInfo(const char *path, FileInfo &info, Error &error)
}
if (S_ISREG(st.st_mode))
- info.type = FileInfo::Type::REGULAR;
+ info.type = StorageFileInfo::Type::REGULAR;
else if (S_ISDIR(st.st_mode))
- info.type = FileInfo::Type::DIRECTORY;
+ info.type = StorageFileInfo::Type::DIRECTORY;
else
- info.type = FileInfo::Type::OTHER;
+ info.type = StorageFileInfo::Type::OTHER;
info.size = st.st_size;
info.mtime = st.st_mtime;
@@ -119,7 +120,7 @@ GetInfo(const char *path, FileInfo &info, Error &error)
bool
SmbclientStorage::GetInfo(const char *uri_utf8, gcc_unused bool follow,
- FileInfo &info, Error &error)
+ StorageFileInfo &info, Error &error)
{
const std::string mapped = MapUTF8(uri_utf8);
return ::GetInfo(mapped.c_str(), info, error);
@@ -172,7 +173,8 @@ SmbclientDirectoryReader::Read()
}
bool
-SmbclientDirectoryReader::GetInfo(gcc_unused bool follow, FileInfo &info,
+SmbclientDirectoryReader::GetInfo(gcc_unused bool follow,
+ StorageFileInfo &info,
Error &error)
{
const std::string path = PathTraitsUTF8::Build(base.c_str(), name);