1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00

removed obsolete files

This commit is contained in:
Falk Werner 2022-11-20 13:36:38 +01:00
parent bd57b1a840
commit c78acee4a2
14 changed files with 0 additions and 435 deletions

View File

@ -14,11 +14,7 @@ add_library(webfuse_static STATIC
src/webfuse/filesystem/status.cpp
src/webfuse/filesystem/accessmode.cpp
src/webfuse/filesystem/openflags.cpp
src/webfuse/filesystem/userid.cpp
src/webfuse/filesystem/groupid.cpp
src/webfuse/filesystem/filemode.cpp
src/webfuse/filesystem/filetime.cpp
src/webfuse/filesystem/fileattributes.cpp
src/webfuse/filesystem/filesystem_statistics.cpp
src/webfuse/filesystem/empty_filesystem.cpp
src/webfuse/ws/config.cpp
@ -46,9 +42,6 @@ if(NOT(WITHOUT_TEST))
test-src/webfuse/filesystem/test_accessmode.cpp
test-src/webfuse/filesystem/test_openflags.cpp
test-src/webfuse/filesystem/test_filemode.cpp
test-src/webfuse/filesystem/test_userid.cpp
test-src/webfuse/filesystem/test_groupid.cpp
test-src/webfuse/filesystem/test_fileattributes.cpp
)
target_include_directories(alltests PRIVATE ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS})

View File

@ -1,46 +0,0 @@
#include "webfuse/filesystem/fileattributes.hpp"
namespace webfuse
{
file_attributes::file_attributes()
: inode(0)
, nlink(0)
, rdev(0)
, size(0)
, blocks(0)
{
}
file_attributes::file_attributes(struct stat const & other)
{
inode = static_cast<uint64_t>(other.st_ino);
nlink = static_cast<uint64_t>(other.st_nlink);
mode = filemode::from_mode(other.st_mode);
uid = user_id::from_uid(other.st_uid);
gid = group_id::from_gid(other.st_gid);
rdev = static_cast<uint64_t>(other.st_rdev);
size = static_cast<uint64_t>(other.st_size);
blocks = static_cast<uint64_t>(other.st_blocks);
atime = filetime::from_timespec(other.st_atim);
mtime = filetime::from_timespec(other.st_mtim);
ctime = filetime::from_timespec(other.st_ctim);
}
void file_attributes::to_stat(struct stat & other) const
{
other.st_ino = inode;
other.st_nlink = nlink;
other.st_mode = mode.to_mode();
other.st_uid = uid.to_uid();
other.st_gid = gid.to_gid();
other.st_rdev = rdev;
other.st_size = size;
other.st_blocks = blocks;
atime.to_timespec(other.st_atim);
mtime.to_timespec(other.st_mtim);
ctime.to_timespec(other.st_ctim);
}
}

View File

@ -1,37 +0,0 @@
#ifndef WEBFUSE_FILEATTRIBUTES_HPP
#define WEBFUSE_FILEATTRIBUTES_HPP
#include "webfuse/filesystem/filemode.hpp"
#include "webfuse/filesystem/filetime.hpp"
#include "webfuse/filesystem/userid.hpp"
#include "webfuse/filesystem/groupid.hpp"
#include <sys/stat.h>
#include <cinttypes>
namespace webfuse
{
class file_attributes
{
public:
file_attributes();
explicit file_attributes(struct stat const & other);
void to_stat(struct stat & other) const;
uint64_t inode;
uint64_t nlink;
filemode mode;
user_id uid;
group_id gid;
uint64_t rdev;
uint64_t size;
uint64_t blocks;
filetime atime;
filetime mtime;
filetime ctime;
};
}
#endif

View File

@ -1,16 +0,0 @@
#ifndef WEBFUSE_FILEHANDLE_HPP
#define WEBFUSE_FILEHANDLE_HPP
#include <cinttypes>
namespace webfuse
{
using filehandle = uint64_t;
constexpr filehandle const invalid_handle = (filehandle) -1;
}
#endif

View File

@ -1,43 +0,0 @@
#include "webfuse/filesystem/filetime.hpp"
namespace webfuse
{
filetime::filetime()
: seconds(0)
, nsec(0)
{
}
filetime filetime::from_timespec(timespec const & other)
{
filetime result;
result.seconds = static_cast<uint64_t>(other.tv_sec);
result.nsec = static_cast<uint32_t>(other.tv_nsec);
return result;
}
filetime filetime::from_time(time_t const & other)
{
filetime result;
result.seconds = static_cast<uint64_t>(other);
result.nsec = 0;
return result;
}
void filetime::to_timespec(timespec & other) const
{
other.tv_sec = seconds;
other.tv_nsec = static_cast<time_t>(nsec);
}
time_t filetime::to_time() const
{
return static_cast<time_t>(seconds);
}
}

View File

@ -1,25 +0,0 @@
#ifndef WEBFUSE_FILETIME_HPP
#define WEBFUSE_FILETIME_HPP
#include <ctime>
#include <cinttypes>
namespace webfuse
{
class filetime
{
public:
filetime();
static filetime from_timespec(timespec const & other);
static filetime from_time(time_t const & other);
void to_timespec(timespec & other) const;
time_t to_time() const;
uint64_t seconds;
uint32_t nsec;
};
}
#endif

View File

@ -1,27 +0,0 @@
#include "webfuse/filesystem/groupid.hpp"
namespace webfuse
{
group_id::group_id(uint32_t value)
: value_(value)
{
}
group_id::operator uint32_t() const
{
return value_;
}
group_id group_id::from_gid(gid_t value)
{
return group_id(static_cast<uint32_t>(value));
}
gid_t group_id::to_gid() const
{
return static_cast<gid_t>(value_);
}
}

View File

@ -1,25 +0,0 @@
#ifndef WEBFUSE_GROUPID_HPP
#define WEBFUSE_GROUPID_HPP
#include <unistd.h>
#include <cinttypes>
namespace webfuse
{
class group_id
{
public:
static constexpr uint32_t const invalid = (uint32_t) -1;
explicit group_id(uint32_t value = invalid);
operator uint32_t() const;
static group_id from_gid(gid_t value);
gid_t to_gid() const;
private:
uint32_t value_;
};
}
#endif

View File

@ -1,28 +0,0 @@
#include "webfuse/filesystem/userid.hpp"
namespace webfuse
{
user_id::user_id(uint32_t value)
: value_(value)
{
}
user_id::operator uint32_t() const
{
return value_;
}
user_id user_id::from_uid(uid_t value)
{
return user_id(static_cast<uint32_t>(value));
}
uid_t user_id::to_uid() const
{
return static_cast<uid_t>(value_);
}
}

View File

@ -1,25 +0,0 @@
#ifndef WEBFUSE_USERID_HPP
#define WEBFUSE_USERID_HPP
#include <unistd.h>
#include <cinttypes>
namespace webfuse
{
class user_id
{
public:
static constexpr uint32_t const invalid = (uint32_t) -1;
explicit user_id(uint32_t value = invalid);
operator uint32_t() const;
static user_id from_uid(uid_t value);
uid_t to_uid() const;
private:
uint32_t value_;
};
}
#endif

View File

@ -1,6 +1,5 @@
#include "webfuse/ws/messagereader.hpp"
#include "webfuse/filesystem/status.hpp"
#include "webfuse/filesystem/fileattributes.hpp"
#include "webfuse/filesystem/filemode.hpp"
#include <stdexcept>

View File

@ -1,101 +0,0 @@
#include "webfuse/filesystem/fileattributes.hpp"
#include <gtest/gtest.h>
using webfuse::file_attributes;
using webfuse::user_id;
using webfuse::group_id;
using webfuse::filemode;
TEST(file_attibutes, create_empty)
{
file_attributes attributes;
ASSERT_EQ(0, attributes.inode);
ASSERT_EQ(0, attributes.nlink);
ASSERT_EQ(0, attributes.mode);
ASSERT_EQ(user_id::invalid, attributes.uid);
ASSERT_EQ(group_id::invalid, attributes.gid);
ASSERT_EQ(0, attributes.rdev);
ASSERT_EQ(0, attributes.size);
ASSERT_EQ(0, attributes.blocks);
ASSERT_EQ(0, attributes.atime.seconds);
ASSERT_EQ(0, attributes.atime.nsec);
ASSERT_EQ(0, attributes.mtime.seconds);
ASSERT_EQ(0, attributes.mtime.nsec);
ASSERT_EQ(0, attributes.ctime.seconds);
ASSERT_EQ(0, attributes.ctime.nsec);
}
TEST(file_attibutes, from_stat)
{
struct stat info;
info.st_ino = 1;
info.st_nlink = 2;
info.st_mode = S_IFREG | 0644;
info.st_uid = 1000;
info.st_gid = 1234;
info.st_rdev = 0;
info.st_size = 21 * 1024;
info.st_blocks = 42;
info.st_atim.tv_sec = 1;
info.st_atim.tv_nsec = 2;
info.st_mtim.tv_sec = 3;
info.st_mtim.tv_nsec = 4;
info.st_ctim.tv_sec = 5;
info.st_ctim.tv_nsec = 6;
file_attributes attributes(info);
ASSERT_EQ(info.st_ino, attributes.inode);
ASSERT_EQ(info.st_nlink, attributes.nlink);
ASSERT_EQ(info.st_mode, attributes.mode.to_mode());
ASSERT_EQ(info.st_uid, attributes.uid.to_uid());
ASSERT_EQ(info.st_gid, attributes.gid.to_gid());
ASSERT_EQ(info.st_rdev, attributes.rdev);
ASSERT_EQ(info.st_size, attributes.size);
ASSERT_EQ(info.st_blocks, attributes.blocks);
ASSERT_EQ(info.st_atim.tv_sec, attributes.atime.seconds);
ASSERT_EQ(info.st_atim.tv_nsec, attributes.atime.nsec);
ASSERT_EQ(info.st_mtim.tv_sec, attributes.mtime.seconds);
ASSERT_EQ(info.st_mtim.tv_nsec, attributes.mtime.nsec);
ASSERT_EQ(info.st_ctim.tv_sec, attributes.ctime.seconds);
ASSERT_EQ(info.st_ctim.tv_nsec, attributes.ctime.nsec);
}
TEST(file_attibutes, to_stat)
{
file_attributes attributes;
attributes.inode = 1;
attributes.nlink = 2;
attributes.mode = filemode(S_IFREG | 0644);
attributes.uid = user_id(1000);
attributes.gid = group_id(1234);
attributes.rdev = 0;
attributes.size = 21 * 1024;
attributes.blocks = 42;
attributes.atime.seconds = 1;
attributes.atime.nsec = 2;
attributes.mtime.seconds = 3;
attributes.mtime.nsec = 4;
attributes.ctime.seconds = 5;
attributes.ctime.nsec = 6;
struct stat info;
attributes.to_stat(info);
ASSERT_EQ(attributes.inode, info.st_ino);
ASSERT_EQ(attributes.nlink, info.st_nlink);
ASSERT_EQ(attributes.mode.to_mode(), info.st_mode);
ASSERT_EQ(attributes.uid.to_uid(), info.st_uid);
ASSERT_EQ(attributes.gid.to_gid(), info.st_gid);
ASSERT_EQ(attributes.rdev, info.st_rdev);
ASSERT_EQ(attributes.size, info.st_size);
ASSERT_EQ(attributes.blocks, info.st_blocks);
ASSERT_EQ(attributes.atime.seconds, info.st_atim.tv_sec);
ASSERT_EQ(attributes.atime.nsec, info.st_atim.tv_nsec);
ASSERT_EQ(attributes.mtime.seconds, info.st_mtim.tv_sec);
ASSERT_EQ(attributes.mtime.nsec, info.st_mtim.tv_nsec);
ASSERT_EQ(attributes.ctime.seconds, info.st_ctim.tv_sec);
ASSERT_EQ(attributes.ctime.nsec, info.st_ctim.tv_nsec);
}

View File

@ -1,27 +0,0 @@
#include "webfuse/filesystem/groupid.hpp"
#include <gtest/gtest.h>
using webfuse::group_id;
TEST(group_id, invalid)
{
group_id invalid_group;
ASSERT_EQ(group_id::invalid, invalid_group);
}
TEST(group_id, to_gid)
{
group_id group(69);
gid_t id = group.to_gid();
ASSERT_EQ(69, id);
}
TEST(group_id, from_gid)
{
gid_t id = 99;
auto group = group_id::from_gid(id);
ASSERT_EQ(99, group);
}

View File

@ -1,27 +0,0 @@
#include "webfuse/filesystem/userid.hpp"
#include <gtest/gtest.h>
using webfuse::user_id;
TEST(user_id, invalid)
{
user_id invalid_user;
ASSERT_EQ(user_id::invalid, invalid_user);
}
TEST(user_id, to_uid)
{
user_id user(42);
uid_t id = user.to_uid();
ASSERT_EQ(42, id);
}
TEST(user_id, from_uid)
{
uid_t id = 23;
auto user = user_id::from_uid(id);
ASSERT_EQ(23, user);
}