From c78acee4a2e2b24f33655b165f89a47cb2c28a8e Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Sun, 20 Nov 2022 13:36:38 +0100 Subject: [PATCH] removed obsolete files --- CMakeLists.txt | 7 -- src/webfuse/filesystem/fileattributes.cpp | 46 -------- src/webfuse/filesystem/fileattributes.hpp | 37 ------- src/webfuse/filesystem/filehandle.hpp | 16 --- src/webfuse/filesystem/filetime.cpp | 43 -------- src/webfuse/filesystem/filetime.hpp | 25 ----- src/webfuse/filesystem/groupid.cpp | 27 ----- src/webfuse/filesystem/groupid.hpp | 25 ----- src/webfuse/filesystem/userid.cpp | 28 ----- src/webfuse/filesystem/userid.hpp | 25 ----- src/webfuse/ws/messagereader.cpp | 1 - .../filesystem/test_fileattributes.cpp | 101 ------------------ test-src/webfuse/filesystem/test_groupid.cpp | 27 ----- test-src/webfuse/filesystem/test_userid.cpp | 27 ----- 14 files changed, 435 deletions(-) delete mode 100644 src/webfuse/filesystem/fileattributes.cpp delete mode 100644 src/webfuse/filesystem/fileattributes.hpp delete mode 100644 src/webfuse/filesystem/filehandle.hpp delete mode 100644 src/webfuse/filesystem/filetime.cpp delete mode 100644 src/webfuse/filesystem/filetime.hpp delete mode 100644 src/webfuse/filesystem/groupid.cpp delete mode 100644 src/webfuse/filesystem/groupid.hpp delete mode 100644 src/webfuse/filesystem/userid.cpp delete mode 100644 src/webfuse/filesystem/userid.hpp delete mode 100644 test-src/webfuse/filesystem/test_fileattributes.cpp delete mode 100644 test-src/webfuse/filesystem/test_groupid.cpp delete mode 100644 test-src/webfuse/filesystem/test_userid.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index a30fb92..4298642 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/src/webfuse/filesystem/fileattributes.cpp b/src/webfuse/filesystem/fileattributes.cpp deleted file mode 100644 index d6fb3b7..0000000 --- a/src/webfuse/filesystem/fileattributes.cpp +++ /dev/null @@ -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(other.st_ino); - nlink = static_cast(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(other.st_rdev); - size = static_cast(other.st_size); - blocks = static_cast(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); -} - -} \ No newline at end of file diff --git a/src/webfuse/filesystem/fileattributes.hpp b/src/webfuse/filesystem/fileattributes.hpp deleted file mode 100644 index ba8f7fe..0000000 --- a/src/webfuse/filesystem/fileattributes.hpp +++ /dev/null @@ -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 -#include - -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 diff --git a/src/webfuse/filesystem/filehandle.hpp b/src/webfuse/filesystem/filehandle.hpp deleted file mode 100644 index 620074e..0000000 --- a/src/webfuse/filesystem/filehandle.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef WEBFUSE_FILEHANDLE_HPP -#define WEBFUSE_FILEHANDLE_HPP - -#include - -namespace webfuse -{ - -using filehandle = uint64_t; - -constexpr filehandle const invalid_handle = (filehandle) -1; - - -} - -#endif diff --git a/src/webfuse/filesystem/filetime.cpp b/src/webfuse/filesystem/filetime.cpp deleted file mode 100644 index a10f14e..0000000 --- a/src/webfuse/filesystem/filetime.cpp +++ /dev/null @@ -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(other.tv_sec); - result.nsec = static_cast(other.tv_nsec); - - return result; -} - -filetime filetime::from_time(time_t const & other) -{ - filetime result; - result.seconds = static_cast(other); - result.nsec = 0; - - return result; -} - -void filetime::to_timespec(timespec & other) const -{ - other.tv_sec = seconds; - other.tv_nsec = static_cast(nsec); -} - -time_t filetime::to_time() const -{ - return static_cast(seconds); -} - - -} \ No newline at end of file diff --git a/src/webfuse/filesystem/filetime.hpp b/src/webfuse/filesystem/filetime.hpp deleted file mode 100644 index 8f77ff8..0000000 --- a/src/webfuse/filesystem/filetime.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef WEBFUSE_FILETIME_HPP -#define WEBFUSE_FILETIME_HPP - -#include -#include - -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 diff --git a/src/webfuse/filesystem/groupid.cpp b/src/webfuse/filesystem/groupid.cpp deleted file mode 100644 index 84583e5..0000000 --- a/src/webfuse/filesystem/groupid.cpp +++ /dev/null @@ -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(value)); -} - -gid_t group_id::to_gid() const -{ - return static_cast(value_); -} - -} \ No newline at end of file diff --git a/src/webfuse/filesystem/groupid.hpp b/src/webfuse/filesystem/groupid.hpp deleted file mode 100644 index e3b8ac0..0000000 --- a/src/webfuse/filesystem/groupid.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef WEBFUSE_GROUPID_HPP -#define WEBFUSE_GROUPID_HPP - -#include -#include - -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 diff --git a/src/webfuse/filesystem/userid.cpp b/src/webfuse/filesystem/userid.cpp deleted file mode 100644 index 36f37f0..0000000 --- a/src/webfuse/filesystem/userid.cpp +++ /dev/null @@ -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(value)); -} - -uid_t user_id::to_uid() const -{ - return static_cast(value_); -} - - -} \ No newline at end of file diff --git a/src/webfuse/filesystem/userid.hpp b/src/webfuse/filesystem/userid.hpp deleted file mode 100644 index dc43673..0000000 --- a/src/webfuse/filesystem/userid.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef WEBFUSE_USERID_HPP -#define WEBFUSE_USERID_HPP - -#include -#include - -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 diff --git a/src/webfuse/ws/messagereader.cpp b/src/webfuse/ws/messagereader.cpp index b073cb8..9f3439b 100644 --- a/src/webfuse/ws/messagereader.cpp +++ b/src/webfuse/ws/messagereader.cpp @@ -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 diff --git a/test-src/webfuse/filesystem/test_fileattributes.cpp b/test-src/webfuse/filesystem/test_fileattributes.cpp deleted file mode 100644 index f0ecd2e..0000000 --- a/test-src/webfuse/filesystem/test_fileattributes.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include "webfuse/filesystem/fileattributes.hpp" - -#include - -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); -} \ No newline at end of file diff --git a/test-src/webfuse/filesystem/test_groupid.cpp b/test-src/webfuse/filesystem/test_groupid.cpp deleted file mode 100644 index 0b091f5..0000000 --- a/test-src/webfuse/filesystem/test_groupid.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "webfuse/filesystem/groupid.hpp" -#include - -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); -} diff --git a/test-src/webfuse/filesystem/test_userid.cpp b/test-src/webfuse/filesystem/test_userid.cpp deleted file mode 100644 index cb555d4..0000000 --- a/test-src/webfuse/filesystem/test_userid.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "webfuse/filesystem/userid.hpp" -#include - -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); -}