From cf1b57e86ef4677d54eee3d85f05e4d1d295eb0c Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Sun, 10 Feb 2019 14:19:15 +0100 Subject: [PATCH] project structure changed --- CMakeLists.txt | 67 ++++++++++--------- {src/app => example}/main.c | 0 {src/app => example}/www/index.html | 0 {src/app => example}/www/js/connection.js | 0 .../app => example}/www/js/connection_view.js | 0 {src/app => example}/www/js/filesystem.js | 0 .../www/js/filesystem_handler.js | 0 {src/app => example}/www/js/startup.js | 0 {src/app => example}/www/style/main.css | 0 {inc => include}/wsfs.h | 0 {inc => include}/wsfs/api.h | 0 {inc => include}/wsfs/server.h | 0 {inc => include}/wsfs/server_config.h | 0 {inc => include}/wsfs/server_protocol.h | 0 {src => lib}/wsfs/filesystem.c | 0 {src => lib}/wsfs/filesystem.h | 0 {src => lib}/wsfs/fuse_wrapper.h | 0 {src => lib}/wsfs/jsonrpc/method.c | 0 {src => lib}/wsfs/jsonrpc/method.h | 0 {src => lib}/wsfs/jsonrpc/method_intern.h | 0 {src => lib}/wsfs/jsonrpc/request.c | 0 {src => lib}/wsfs/jsonrpc/request.h | 0 {src => lib}/wsfs/jsonrpc/response.c | 0 {src => lib}/wsfs/jsonrpc/response.h | 0 {src => lib}/wsfs/jsonrpc/server.c | 0 {src => lib}/wsfs/jsonrpc/server.h | 0 {src => lib}/wsfs/jsonrpc/util.c | 0 {src => lib}/wsfs/jsonrpc/util.h | 0 {src => lib}/wsfs/message.c | 0 {src => lib}/wsfs/message.h | 0 {src => lib}/wsfs/message_queue.c | 0 {src => lib}/wsfs/message_queue.h | 0 {src => lib}/wsfs/operation/close.c | 0 {src => lib}/wsfs/operation/getattr.c | 0 {src => lib}/wsfs/operation/lookup.c | 0 {src => lib}/wsfs/operation/open.c | 0 {src => lib}/wsfs/operation/read.c | 0 {src => lib}/wsfs/operation/readdir.c | 0 {src => lib}/wsfs/operations.h | 0 {src => lib}/wsfs/server.c | 0 {src => lib}/wsfs/server_config.c | 0 {src => lib}/wsfs/server_protocol.c | 0 {src => lib}/wsfs/server_protocol_intern.h | 0 {src => lib}/wsfs/status.c | 0 {src => lib}/wsfs/status.h | 0 {src => lib}/wsfs/time/timeout_manager.c | 0 {src => lib}/wsfs/time/timeout_manager.h | 0 .../wsfs/time/timeout_manager_intern.h | 0 {src => lib}/wsfs/time/timepoint.c | 0 {src => lib}/wsfs/time/timepoint.h | 0 {src => lib}/wsfs/time/timer.c | 0 {src => lib}/wsfs/time/timer.h | 0 {src => lib}/wsfs/time/timer_intern.h | 0 {src => lib}/wsfs/util.h | 0 {test-src => test}/test_fuse_req.cc | 0 {test-src => test}/test_response_parser.cc | 0 {test-src => test}/test_server.cc | 0 {test-src => test}/test_timepoint.cc | 0 {test-src => test}/test_timer.cc | 0 59 files changed, 36 insertions(+), 31 deletions(-) rename {src/app => example}/main.c (100%) rename {src/app => example}/www/index.html (100%) rename {src/app => example}/www/js/connection.js (100%) rename {src/app => example}/www/js/connection_view.js (100%) rename {src/app => example}/www/js/filesystem.js (100%) rename {src/app => example}/www/js/filesystem_handler.js (100%) rename {src/app => example}/www/js/startup.js (100%) rename {src/app => example}/www/style/main.css (100%) rename {inc => include}/wsfs.h (100%) rename {inc => include}/wsfs/api.h (100%) rename {inc => include}/wsfs/server.h (100%) rename {inc => include}/wsfs/server_config.h (100%) rename {inc => include}/wsfs/server_protocol.h (100%) rename {src => lib}/wsfs/filesystem.c (100%) rename {src => lib}/wsfs/filesystem.h (100%) rename {src => lib}/wsfs/fuse_wrapper.h (100%) rename {src => lib}/wsfs/jsonrpc/method.c (100%) rename {src => lib}/wsfs/jsonrpc/method.h (100%) rename {src => lib}/wsfs/jsonrpc/method_intern.h (100%) rename {src => lib}/wsfs/jsonrpc/request.c (100%) rename {src => lib}/wsfs/jsonrpc/request.h (100%) rename {src => lib}/wsfs/jsonrpc/response.c (100%) rename {src => lib}/wsfs/jsonrpc/response.h (100%) rename {src => lib}/wsfs/jsonrpc/server.c (100%) rename {src => lib}/wsfs/jsonrpc/server.h (100%) rename {src => lib}/wsfs/jsonrpc/util.c (100%) rename {src => lib}/wsfs/jsonrpc/util.h (100%) rename {src => lib}/wsfs/message.c (100%) rename {src => lib}/wsfs/message.h (100%) rename {src => lib}/wsfs/message_queue.c (100%) rename {src => lib}/wsfs/message_queue.h (100%) rename {src => lib}/wsfs/operation/close.c (100%) rename {src => lib}/wsfs/operation/getattr.c (100%) rename {src => lib}/wsfs/operation/lookup.c (100%) rename {src => lib}/wsfs/operation/open.c (100%) rename {src => lib}/wsfs/operation/read.c (100%) rename {src => lib}/wsfs/operation/readdir.c (100%) rename {src => lib}/wsfs/operations.h (100%) rename {src => lib}/wsfs/server.c (100%) rename {src => lib}/wsfs/server_config.c (100%) rename {src => lib}/wsfs/server_protocol.c (100%) rename {src => lib}/wsfs/server_protocol_intern.h (100%) rename {src => lib}/wsfs/status.c (100%) rename {src => lib}/wsfs/status.h (100%) rename {src => lib}/wsfs/time/timeout_manager.c (100%) rename {src => lib}/wsfs/time/timeout_manager.h (100%) rename {src => lib}/wsfs/time/timeout_manager_intern.h (100%) rename {src => lib}/wsfs/time/timepoint.c (100%) rename {src => lib}/wsfs/time/timepoint.h (100%) rename {src => lib}/wsfs/time/timer.c (100%) rename {src => lib}/wsfs/time/timer.h (100%) rename {src => lib}/wsfs/time/timer_intern.h (100%) rename {src => lib}/wsfs/util.h (100%) rename {test-src => test}/test_fuse_req.cc (100%) rename {test-src => test}/test_response_parser.cc (100%) rename {test-src => test}/test_server.cc (100%) rename {test-src => test}/test_timepoint.cc (100%) rename {test-src => test}/test_timer.cc (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index bfa3056..b1e3fbc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_minimum_required (VERSION 3.1) project(fuse-wsfs VERSION 0.1.0 DESCRIPTION "Websocket filesystem based on libfuse") -option(WITH_TESTS "enable unit tests" OFF) +option(WITH_TESTS "enable unit tests" OFF) +option(WITH_EXAMPLE "enable example" OFF) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) @@ -18,7 +19,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(C_WARNINGS -Wall -Wextra) set(EXTRA_INCLUDE_DIRS - "inc" + "include" ${FUSE3_INCLUDE_DIRS} ${LWS_INCLUDE_DIRS} ${JANSSON_INCLUDE_DIRS} @@ -44,27 +45,27 @@ set(EXTRA_CFLAGS # libfuse-wsfs set(FUSE_WSFS_SOURCES - src/wsfs/status.c - src/wsfs/filesystem.c - src/wsfs/server.c - src/wsfs/message.c - src/wsfs/message_queue.c - src/wsfs/time/timepoint.c - src/wsfs/time/timer.c - src/wsfs/time/timeout_manager.c - src/wsfs/operation/lookup.c - src/wsfs/operation/getattr.c - src/wsfs/operation/readdir.c - src/wsfs/operation/open.c - src/wsfs/operation/close.c - src/wsfs/operation/read.c - src/wsfs/server_config.c - src/wsfs/server_protocol.c - src/wsfs/jsonrpc/server.c - src/wsfs/jsonrpc/method.c - src/wsfs/jsonrpc/request.c - src/wsfs/jsonrpc/response.c - src/wsfs/jsonrpc/util.c + lib/wsfs/status.c + lib/wsfs/filesystem.c + lib/wsfs/server.c + lib/wsfs/message.c + lib/wsfs/message_queue.c + lib/wsfs/time/timepoint.c + lib/wsfs/time/timer.c + lib/wsfs/time/timeout_manager.c + lib/wsfs/operation/lookup.c + lib/wsfs/operation/getattr.c + lib/wsfs/operation/readdir.c + lib/wsfs/operation/open.c + lib/wsfs/operation/close.c + lib/wsfs/operation/read.c + lib/wsfs/server_config.c + lib/wsfs/server_protocol.c + lib/wsfs/jsonrpc/server.c + lib/wsfs/jsonrpc/method.c + lib/wsfs/jsonrpc/request.c + lib/wsfs/jsonrpc/response.c + lib/wsfs/jsonrpc/util.c ) add_library(fuse-wsfs SHARED ${FUSE_WSFS_SOURCES}) @@ -74,27 +75,31 @@ set_target_properties(fuse-wsfs PROPERTIES SOVERSION 0) set_target_properties(fuse-wsfs PROPERTIES C_VISIBILITY_PRESET hidden) set_target_properties(fuse-wsfs PROPERTIES COMPILE_DEFINITIONS "WSFS_API=WSFS_EXPORT") -target_include_directories(fuse-wsfs PUBLIC src ${EXTRA_INCLUDE_DIRS}) +target_include_directories(fuse-wsfs PUBLIC lib ${EXTRA_INCLUDE_DIRS}) target_compile_options(fuse-wsfs PUBLIC ${EXTRA_CFLAGS}) add_library(fuse-wsfs-static STATIC ${FUSE_WSFS_SOURCES}) set_target_properties(fuse-wsfs-static PROPERTIES OUTPUT_NAME fuse-wsfs) -target_include_directories(fuse-wsfs-static PUBLIC src ${EXTRA_INCLUDE_DIRS}) +target_include_directories(fuse-wsfs-static PUBLIC lib ${EXTRA_INCLUDE_DIRS}) target_compile_options(fuse-wsfs-static PUBLIC ${EXTRA_CFLAGS}) # app +if(WITH_EXAMPLE) + add_executable(wsfs - src/app/main.c + example/main.c ) target_link_libraries(wsfs PUBLIC fuse-wsfs ${EXTRA_LIBS}) target_include_directories(wsfs PUBLIC ${EXTRA_INCLUDE_DIRS}) target_compile_options(wsfs PUBLIC ${EXTRA_CFLAGS}) +endif(WITH_EXAMPLE) + # tests if(WITH_TESTS) @@ -102,14 +107,14 @@ if(WITH_TESTS) pkg_check_modules(GTEST gtest_main) add_executable(alltests - test-src/test_response_parser.cc - test-src/test_server.cc - test-src/test_timepoint.cc - test-src/test_timer.cc + test/test_response_parser.cc + test/test_server.cc + test/test_timepoint.cc + test/test_timer.cc ) target_link_libraries(alltests PUBLIC fuse-wsfs-static ${EXTRA_LIBS} ${GTEST_LIBRARIES}) -target_include_directories(alltests PUBLIC src ${EXTRA_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}) +target_include_directories(alltests PUBLIC lib ${EXTRA_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}) target_compile_options(alltests PUBLIC ${EXTRA_CFLAGS} ${GTEST_CFLAGS}) enable_testing() diff --git a/src/app/main.c b/example/main.c similarity index 100% rename from src/app/main.c rename to example/main.c diff --git a/src/app/www/index.html b/example/www/index.html similarity index 100% rename from src/app/www/index.html rename to example/www/index.html diff --git a/src/app/www/js/connection.js b/example/www/js/connection.js similarity index 100% rename from src/app/www/js/connection.js rename to example/www/js/connection.js diff --git a/src/app/www/js/connection_view.js b/example/www/js/connection_view.js similarity index 100% rename from src/app/www/js/connection_view.js rename to example/www/js/connection_view.js diff --git a/src/app/www/js/filesystem.js b/example/www/js/filesystem.js similarity index 100% rename from src/app/www/js/filesystem.js rename to example/www/js/filesystem.js diff --git a/src/app/www/js/filesystem_handler.js b/example/www/js/filesystem_handler.js similarity index 100% rename from src/app/www/js/filesystem_handler.js rename to example/www/js/filesystem_handler.js diff --git a/src/app/www/js/startup.js b/example/www/js/startup.js similarity index 100% rename from src/app/www/js/startup.js rename to example/www/js/startup.js diff --git a/src/app/www/style/main.css b/example/www/style/main.css similarity index 100% rename from src/app/www/style/main.css rename to example/www/style/main.css diff --git a/inc/wsfs.h b/include/wsfs.h similarity index 100% rename from inc/wsfs.h rename to include/wsfs.h diff --git a/inc/wsfs/api.h b/include/wsfs/api.h similarity index 100% rename from inc/wsfs/api.h rename to include/wsfs/api.h diff --git a/inc/wsfs/server.h b/include/wsfs/server.h similarity index 100% rename from inc/wsfs/server.h rename to include/wsfs/server.h diff --git a/inc/wsfs/server_config.h b/include/wsfs/server_config.h similarity index 100% rename from inc/wsfs/server_config.h rename to include/wsfs/server_config.h diff --git a/inc/wsfs/server_protocol.h b/include/wsfs/server_protocol.h similarity index 100% rename from inc/wsfs/server_protocol.h rename to include/wsfs/server_protocol.h diff --git a/src/wsfs/filesystem.c b/lib/wsfs/filesystem.c similarity index 100% rename from src/wsfs/filesystem.c rename to lib/wsfs/filesystem.c diff --git a/src/wsfs/filesystem.h b/lib/wsfs/filesystem.h similarity index 100% rename from src/wsfs/filesystem.h rename to lib/wsfs/filesystem.h diff --git a/src/wsfs/fuse_wrapper.h b/lib/wsfs/fuse_wrapper.h similarity index 100% rename from src/wsfs/fuse_wrapper.h rename to lib/wsfs/fuse_wrapper.h diff --git a/src/wsfs/jsonrpc/method.c b/lib/wsfs/jsonrpc/method.c similarity index 100% rename from src/wsfs/jsonrpc/method.c rename to lib/wsfs/jsonrpc/method.c diff --git a/src/wsfs/jsonrpc/method.h b/lib/wsfs/jsonrpc/method.h similarity index 100% rename from src/wsfs/jsonrpc/method.h rename to lib/wsfs/jsonrpc/method.h diff --git a/src/wsfs/jsonrpc/method_intern.h b/lib/wsfs/jsonrpc/method_intern.h similarity index 100% rename from src/wsfs/jsonrpc/method_intern.h rename to lib/wsfs/jsonrpc/method_intern.h diff --git a/src/wsfs/jsonrpc/request.c b/lib/wsfs/jsonrpc/request.c similarity index 100% rename from src/wsfs/jsonrpc/request.c rename to lib/wsfs/jsonrpc/request.c diff --git a/src/wsfs/jsonrpc/request.h b/lib/wsfs/jsonrpc/request.h similarity index 100% rename from src/wsfs/jsonrpc/request.h rename to lib/wsfs/jsonrpc/request.h diff --git a/src/wsfs/jsonrpc/response.c b/lib/wsfs/jsonrpc/response.c similarity index 100% rename from src/wsfs/jsonrpc/response.c rename to lib/wsfs/jsonrpc/response.c diff --git a/src/wsfs/jsonrpc/response.h b/lib/wsfs/jsonrpc/response.h similarity index 100% rename from src/wsfs/jsonrpc/response.h rename to lib/wsfs/jsonrpc/response.h diff --git a/src/wsfs/jsonrpc/server.c b/lib/wsfs/jsonrpc/server.c similarity index 100% rename from src/wsfs/jsonrpc/server.c rename to lib/wsfs/jsonrpc/server.c diff --git a/src/wsfs/jsonrpc/server.h b/lib/wsfs/jsonrpc/server.h similarity index 100% rename from src/wsfs/jsonrpc/server.h rename to lib/wsfs/jsonrpc/server.h diff --git a/src/wsfs/jsonrpc/util.c b/lib/wsfs/jsonrpc/util.c similarity index 100% rename from src/wsfs/jsonrpc/util.c rename to lib/wsfs/jsonrpc/util.c diff --git a/src/wsfs/jsonrpc/util.h b/lib/wsfs/jsonrpc/util.h similarity index 100% rename from src/wsfs/jsonrpc/util.h rename to lib/wsfs/jsonrpc/util.h diff --git a/src/wsfs/message.c b/lib/wsfs/message.c similarity index 100% rename from src/wsfs/message.c rename to lib/wsfs/message.c diff --git a/src/wsfs/message.h b/lib/wsfs/message.h similarity index 100% rename from src/wsfs/message.h rename to lib/wsfs/message.h diff --git a/src/wsfs/message_queue.c b/lib/wsfs/message_queue.c similarity index 100% rename from src/wsfs/message_queue.c rename to lib/wsfs/message_queue.c diff --git a/src/wsfs/message_queue.h b/lib/wsfs/message_queue.h similarity index 100% rename from src/wsfs/message_queue.h rename to lib/wsfs/message_queue.h diff --git a/src/wsfs/operation/close.c b/lib/wsfs/operation/close.c similarity index 100% rename from src/wsfs/operation/close.c rename to lib/wsfs/operation/close.c diff --git a/src/wsfs/operation/getattr.c b/lib/wsfs/operation/getattr.c similarity index 100% rename from src/wsfs/operation/getattr.c rename to lib/wsfs/operation/getattr.c diff --git a/src/wsfs/operation/lookup.c b/lib/wsfs/operation/lookup.c similarity index 100% rename from src/wsfs/operation/lookup.c rename to lib/wsfs/operation/lookup.c diff --git a/src/wsfs/operation/open.c b/lib/wsfs/operation/open.c similarity index 100% rename from src/wsfs/operation/open.c rename to lib/wsfs/operation/open.c diff --git a/src/wsfs/operation/read.c b/lib/wsfs/operation/read.c similarity index 100% rename from src/wsfs/operation/read.c rename to lib/wsfs/operation/read.c diff --git a/src/wsfs/operation/readdir.c b/lib/wsfs/operation/readdir.c similarity index 100% rename from src/wsfs/operation/readdir.c rename to lib/wsfs/operation/readdir.c diff --git a/src/wsfs/operations.h b/lib/wsfs/operations.h similarity index 100% rename from src/wsfs/operations.h rename to lib/wsfs/operations.h diff --git a/src/wsfs/server.c b/lib/wsfs/server.c similarity index 100% rename from src/wsfs/server.c rename to lib/wsfs/server.c diff --git a/src/wsfs/server_config.c b/lib/wsfs/server_config.c similarity index 100% rename from src/wsfs/server_config.c rename to lib/wsfs/server_config.c diff --git a/src/wsfs/server_protocol.c b/lib/wsfs/server_protocol.c similarity index 100% rename from src/wsfs/server_protocol.c rename to lib/wsfs/server_protocol.c diff --git a/src/wsfs/server_protocol_intern.h b/lib/wsfs/server_protocol_intern.h similarity index 100% rename from src/wsfs/server_protocol_intern.h rename to lib/wsfs/server_protocol_intern.h diff --git a/src/wsfs/status.c b/lib/wsfs/status.c similarity index 100% rename from src/wsfs/status.c rename to lib/wsfs/status.c diff --git a/src/wsfs/status.h b/lib/wsfs/status.h similarity index 100% rename from src/wsfs/status.h rename to lib/wsfs/status.h diff --git a/src/wsfs/time/timeout_manager.c b/lib/wsfs/time/timeout_manager.c similarity index 100% rename from src/wsfs/time/timeout_manager.c rename to lib/wsfs/time/timeout_manager.c diff --git a/src/wsfs/time/timeout_manager.h b/lib/wsfs/time/timeout_manager.h similarity index 100% rename from src/wsfs/time/timeout_manager.h rename to lib/wsfs/time/timeout_manager.h diff --git a/src/wsfs/time/timeout_manager_intern.h b/lib/wsfs/time/timeout_manager_intern.h similarity index 100% rename from src/wsfs/time/timeout_manager_intern.h rename to lib/wsfs/time/timeout_manager_intern.h diff --git a/src/wsfs/time/timepoint.c b/lib/wsfs/time/timepoint.c similarity index 100% rename from src/wsfs/time/timepoint.c rename to lib/wsfs/time/timepoint.c diff --git a/src/wsfs/time/timepoint.h b/lib/wsfs/time/timepoint.h similarity index 100% rename from src/wsfs/time/timepoint.h rename to lib/wsfs/time/timepoint.h diff --git a/src/wsfs/time/timer.c b/lib/wsfs/time/timer.c similarity index 100% rename from src/wsfs/time/timer.c rename to lib/wsfs/time/timer.c diff --git a/src/wsfs/time/timer.h b/lib/wsfs/time/timer.h similarity index 100% rename from src/wsfs/time/timer.h rename to lib/wsfs/time/timer.h diff --git a/src/wsfs/time/timer_intern.h b/lib/wsfs/time/timer_intern.h similarity index 100% rename from src/wsfs/time/timer_intern.h rename to lib/wsfs/time/timer_intern.h diff --git a/src/wsfs/util.h b/lib/wsfs/util.h similarity index 100% rename from src/wsfs/util.h rename to lib/wsfs/util.h diff --git a/test-src/test_fuse_req.cc b/test/test_fuse_req.cc similarity index 100% rename from test-src/test_fuse_req.cc rename to test/test_fuse_req.cc diff --git a/test-src/test_response_parser.cc b/test/test_response_parser.cc similarity index 100% rename from test-src/test_response_parser.cc rename to test/test_response_parser.cc diff --git a/test-src/test_server.cc b/test/test_server.cc similarity index 100% rename from test-src/test_server.cc rename to test/test_server.cc diff --git a/test-src/test_timepoint.cc b/test/test_timepoint.cc similarity index 100% rename from test-src/test_timepoint.cc rename to test/test_timepoint.cc diff --git a/test-src/test_timer.cc b/test/test_timer.cc similarity index 100% rename from test-src/test_timer.cc rename to test/test_timer.cc