From d856c0bf8f317f6e951fa029a5e94aac0adbfb65 Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Wed, 2 Jun 2021 01:57:23 +0100 Subject: [PATCH 01/15] moved the declaration of a variable closer to where it is used --- src/fuse_local.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/fuse_local.c b/src/fuse_local.c index a427dac..8e22e95 100644 --- a/src/fuse_local.c +++ b/src/fuse_local.c @@ -120,7 +120,6 @@ static int fs_readdir(const char *path, void *buf, fuse_fill_dir_t dir_add, (void) offset; (void) fi; - Link *link; LinkTable *linktbl; if (!strcmp(path, "/")) { @@ -136,7 +135,7 @@ static int fs_readdir(const char *path, void *buf, fuse_fill_dir_t dir_add, dir_add(buf, ".", NULL, 0); dir_add(buf, "..", NULL, 0); for (int i = 1; i < linktbl->num; i++) { - link = linktbl->links[i]; + Link *link = linktbl->links[i]; if (link->type != LINK_INVALID) { dir_add(buf, link->linkname, NULL, 0); } From 3d55e451bc2c4683fea214229f8900a6cc3e13f9 Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Wed, 2 Jun 2021 02:05:50 +0100 Subject: [PATCH 02/15] added some more comments --- src/fuse_local.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fuse_local.c b/src/fuse_local.c index 8e22e95..c2003d8 100644 --- a/src/fuse_local.c +++ b/src/fuse_local.c @@ -113,7 +113,12 @@ static int fs_open(const char *path, struct fuse_file_info *fi) return 0; } -/** \brief read the directory indicated by the path*/ +/** + * \brief read the directory indicated by the path + * \note releasedir() is not implemented, because I don't see why anybody want + * the LinkTables to be evicted from the memory during the runtime of this + * program. If you want to evict LinkTables, just unmount the filesystem. + */ static int fs_readdir(const char *path, void *buf, fuse_fill_dir_t dir_add, off_t offset, struct fuse_file_info *fi) { From f0b919a1e5d947987276bf53820dc057e258921c Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Wed, 2 Jun 2021 02:20:33 +0100 Subject: [PATCH 03/15] more comments --- src/fuse_local.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fuse_local.c b/src/fuse_local.c index c2003d8..0948897 100644 --- a/src/fuse_local.c +++ b/src/fuse_local.c @@ -115,9 +115,14 @@ static int fs_open(const char *path, struct fuse_file_info *fi) /** * \brief read the directory indicated by the path - * \note releasedir() is not implemented, because I don't see why anybody want + * \note + * - releasedir() is not implemented, because I don't see why anybody want * the LinkTables to be evicted from the memory during the runtime of this * program. If you want to evict LinkTables, just unmount the filesystem. + * - There is no real need to associate the LinkTable with the fi of each + * directory data structure. If you want a deep level directory, you need to + * generate the LinkTables for previous level directories. We might + * as well maintain our own tree structure. */ static int fs_readdir(const char *path, void *buf, fuse_fill_dir_t dir_add, off_t offset, struct fuse_file_info *fi) From 83c3d946d3564b82ad6259209caa41c1fa027298 Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Wed, 2 Jun 2021 02:28:46 +0100 Subject: [PATCH 04/15] removed .kateproject, update Doxyfile --- .gitignore | 1 + .kateproject | 4 ---- Doxyfile | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) delete mode 100644 .kateproject diff --git a/.gitignore b/.gitignore index 8a9ef0f..9446f81 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ httpdirfs .depend doc/html +.vscode diff --git a/.kateproject b/.kateproject deleted file mode 100644 index 57e2b55..0000000 --- a/.kateproject +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "HTTPDirFS", - "files": [ { "git": 1 } ] -} diff --git a/Doxyfile b/Doxyfile index 56a01a6..44b100e 100644 --- a/Doxyfile +++ b/Doxyfile @@ -901,7 +901,7 @@ EXCLUDE_PATTERNS = # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* -EXCLUDE_SYMBOLS = +EXCLUDE_SYMBOLS = CALLOC exit_failure # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include From ead94af1c6236aadc2835c9b3635992e585c5a7b Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Wed, 2 Jun 2021 23:10:36 +0100 Subject: [PATCH 05/15] starting splitting the binary to httpdirfs and sonicfs --- .kateproject | 4 ++ Makefile | 5 ++- src/httpdirfs.c | 87 +++++++++++++++++++++++++++++++++++++++++ src/main.c | 102 ++++-------------------------------------------- src/main.h | 20 ++++++++++ src/sonicfs.c | 0 6 files changed, 122 insertions(+), 96 deletions(-) create mode 100644 .kateproject create mode 100644 src/httpdirfs.c create mode 100644 src/main.h create mode 100644 src/sonicfs.c diff --git a/.kateproject b/.kateproject new file mode 100644 index 0000000..57e2b55 --- /dev/null +++ b/.kateproject @@ -0,0 +1,4 @@ +{ + "name": "HTTPDirFS", + "files": [ { "git": 1 } ] +} diff --git a/Makefile b/Makefile index 65a66cd..1837655 100644 --- a/Makefile +++ b/Makefile @@ -28,9 +28,12 @@ all: httpdirfs %.o: src/%.c $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c -o $@ $< -httpdirfs: $(COBJS) +httpdirfs: httpdirfs.o $(COBJS) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) +# sonicfs: sonicfs.o $(COBJS) +# $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + install: ifeq ($(OS),Linux) install -m 755 -D httpdirfs \ diff --git a/src/httpdirfs.c b/src/httpdirfs.c new file mode 100644 index 0000000..2938798 --- /dev/null +++ b/src/httpdirfs.c @@ -0,0 +1,87 @@ + +#include "main.h" + +#include "util.h" +#include "fuse_local.h" +#include "network.h" + +#include +#include +#include + +int main(int argc, char **argv) +{ + /* Automatically print help if not enough arguments are supplied */ + if (argc < 2) { + print_help(argv[0], 0); + fprintf(stderr, "For more information, run \"%s --help.\"\n", argv[0]); + exit(EXIT_FAILURE); + } + + /* These are passed into fuse initialiser */ + char **fuse_argv = NULL; + int fuse_argc = 0; + /* These are the combined argument with the config file */ + char **all_argv = NULL; + int all_argc = 0; + + /*--- Add the program's name to the combined argument list ---*/ + add_arg(&all_argv, &all_argc, argv[0]); + /*--- FUSE expects the first initialisation to be the program's name ---*/ + add_arg(&fuse_argv, &fuse_argc, argv[0]); + + /* initialise network configuration struct */ + Config_init(); + + /* initialise network subsystem */ + NetworkSystem_init(); + + /* Copy the command line argument list to the combined argument list */ + for (int i = 1; i < argc; i++) { + add_arg(&all_argv, &all_argc, argv[i]); + if (!strcmp(argv[i], "--config")) { + config_path = strdup(argv[i+1]); + } + } + + /* parse the config file, if it exists, store it in all_argv and all_argc */ + parse_config_file(&all_argv, &all_argc); + + /* parse the combined argument list */ + if (parse_arg_list(all_argc, all_argv, &fuse_argv, &fuse_argc)) { + /* + * The user basically didn't supply enough arguments, if we reach here + * The point is to print some error messages + */ + goto fuse_start; + } + + /*--- Add the last remaining argument, which is the mountpoint ---*/ + add_arg(&fuse_argv, &fuse_argc, argv[argc-1]); + + /* The second last remaining argument is the URL */ + char *base_url = argv[argc-2]; + if (strncmp(base_url, "http://", 7) && strncmp(base_url, "https://", 8)) { + fprintf(stderr, "Error: Please supply a valid URL.\n"); + print_help(argv[0], 0); + exit(EXIT_FAILURE); + } else { + if (CONFIG.sonic_username && CONFIG.sonic_password) { + CONFIG.sonic_mode = 1; + } else if (CONFIG.sonic_username || CONFIG.sonic_password) { + fprintf(stderr, + "Error: You have to supply both username and password to \ +activate Sonic mode.\n"); + exit(EXIT_FAILURE); + } + if(!LinkSystem_init(base_url)) { + fprintf(stderr, "Error: Network initialisation failed.\n"); + exit(EXIT_FAILURE); + } + } + + fuse_start: + fuse_local_init(fuse_argc, fuse_argv); + + return 0; +} diff --git a/src/main.c b/src/main.c index 154f052..10a8276 100644 --- a/src/main.c +++ b/src/main.c @@ -1,3 +1,5 @@ +#include "main.h" + #include "cache.h" #include "fuse_local.h" #include "network.h" @@ -6,92 +8,7 @@ #include #include -void add_arg(char ***fuse_argv_ptr, int *fuse_argc, char *opt_string); -static void print_help(char *program_name, int long_help); -static void print_version(); -static void print_long_help(); -static int -parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc); -void parse_config_file(char ***argv, int *argc); - -static char *config_path = NULL; - -int main(int argc, char **argv) -{ - /* Automatically print help if not enough arguments are supplied */ - if (argc < 2) { - print_help(argv[0], 0); - fprintf(stderr, "For more information, run \"%s --help.\"\n", argv[0]); - exit(EXIT_FAILURE); - } - - /* These are passed into fuse initialiser */ - char **fuse_argv = NULL; - int fuse_argc = 0; - /* These are the combined argument with the config file */ - char **all_argv = NULL; - int all_argc = 0; - - /*--- Add the program's name to the combined argument list ---*/ - add_arg(&all_argv, &all_argc, argv[0]); - /*--- FUSE expects the first initialisation to be the program's name ---*/ - add_arg(&fuse_argv, &fuse_argc, argv[0]); - - /* initialise network configuration struct */ - Config_init(); - - /* initialise network subsystem */ - NetworkSystem_init(); - - /* Copy the command line argument list to the combined argument list */ - for (int i = 1; i < argc; i++) { - add_arg(&all_argv, &all_argc, argv[i]); - if (!strcmp(argv[i], "--config")) { - config_path = strdup(argv[i+1]); - } - } - - /* parse the config file, if it exists, store it in all_argv and all_argc */ - parse_config_file(&all_argv, &all_argc); - - /* parse the combined argument list */ - if (parse_arg_list(all_argc, all_argv, &fuse_argv, &fuse_argc)) { - /* - * The user basically didn't supply enough arguments, if we reach here - * The point is to print some error messages - */ - goto fuse_start; - } - - /*--- Add the last remaining argument, which is the mountpoint ---*/ - add_arg(&fuse_argv, &fuse_argc, argv[argc-1]); - - /* The second last remaining argument is the URL */ - char *base_url = argv[argc-2]; - if (strncmp(base_url, "http://", 7) && strncmp(base_url, "https://", 8)) { - fprintf(stderr, "Error: Please supply a valid URL.\n"); - print_help(argv[0], 0); - exit(EXIT_FAILURE); - } else { - if (CONFIG.sonic_username && CONFIG.sonic_password) { - CONFIG.sonic_mode = 1; - } else if (CONFIG.sonic_username || CONFIG.sonic_password) { - fprintf(stderr, - "Error: You have to supply both username and password to \ -activate Sonic mode.\n"); - exit(EXIT_FAILURE); - } - if(!LinkSystem_init(base_url)) { - fprintf(stderr, "Error: Network initialisation failed.\n"); - exit(EXIT_FAILURE); - } - } - - fuse_start: - fuse_local_init(fuse_argc, fuse_argv); - - return 0; -} +char *config_path = NULL; void parse_config_file(char ***argv, int *argc) { @@ -136,8 +53,7 @@ void parse_config_file(char ***argv, int *argc) } } -static int -parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc) +int parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc) { char c; int long_index = 0; @@ -267,10 +183,6 @@ parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc) return 0; } -/** - * \brief add an argument to an argv array - * \details This is basically how you add a string to an array of string - */ void add_arg(char ***fuse_argv_ptr, int *fuse_argc, char *opt_string) { (*fuse_argc)++; @@ -279,7 +191,7 @@ void add_arg(char ***fuse_argv_ptr, int *fuse_argc, char *opt_string) fuse_argv[*fuse_argc - 1] = strdup(opt_string); } -static void print_help(char *program_name, int long_help) +void print_help(char *program_name, int long_help) { fprintf(stderr, "usage: %s [options] URL mountpoint\n", program_name); @@ -288,7 +200,7 @@ static void print_help(char *program_name, int long_help) } } -static void print_version() +void print_version() { fprintf(stderr, "HTTPDirFS version " VERSION "\n"); /* --------- Print off SSL engine version --------- */ @@ -296,7 +208,7 @@ static void print_version() fprintf(stderr, "libcurl SSL engine: %s\n", data->ssl_version); } -static void print_long_help() +void print_long_help() { fprintf(stderr, "\n\ diff --git a/src/main.h b/src/main.h new file mode 100644 index 0000000..f9202f6 --- /dev/null +++ b/src/main.h @@ -0,0 +1,20 @@ +#ifndef MAIN_H +#define MAIN_H +extern char *config_path; + +void parse_config_file(char ***argv, int *argc); +int parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc); + +/** + * \brief add an argument to an argv array + * \details This is basically how you add a string to an array of string + */ +void add_arg(char ***fuse_argv_ptr, int *fuse_argc, char *opt_string); + +void print_help(char *program_name, int long_help); + +void print_version(); + +void print_long_help(); + +#endif \ No newline at end of file diff --git a/src/sonicfs.c b/src/sonicfs.c new file mode 100644 index 0000000..e69de29 From a30315ced096d92f62f0690bb2a7650eb9cd6f12 Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Thu, 3 Jun 2021 01:05:43 +0100 Subject: [PATCH 06/15] moved out sonic help text --- src/main.c | 10 ++++++++-- src/main.h | 26 +++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 10a8276..a17b1ec 100644 --- a/src/main.c +++ b/src/main.c @@ -245,7 +245,13 @@ HTTPDirFS options:\n\ for HTTP range requests\n\ --insecure_tls Disable licurl TLS certificate verification by\n\ setting CURLOPT_SSL_VERIFYHOST to 0\n\ -\n\ +\n"); +} + +void print_sonic_help() +{ + fprintf(stderr, +"\n\ For mounting a Airsonic / Subsonic server:\n\ --sonic-username The username for your Airsonic / Subsonic server\n\ --sonic-password The password for your Airsonic / Subsonic server\n\ @@ -255,4 +261,4 @@ HTTPDirFS options:\n\ using the insecure username / hex encoded password\n\ scheme\n\ \n"); -} +} \ No newline at end of file diff --git a/src/main.h b/src/main.h index f9202f6..13f516e 100644 --- a/src/main.h +++ b/src/main.h @@ -1,20 +1,44 @@ #ifndef MAIN_H #define MAIN_H + +/** + * \brief Configuration path + */ extern char *config_path; +/** + * \brief Parse the configuration file + */ void parse_config_file(char ***argv, int *argc); + +/** + * \brief Parse argument list + */ int parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc); /** - * \brief add an argument to an argv array + * \brief Add an argument to an argv array * \details This is basically how you add a string to an array of string */ void add_arg(char ***fuse_argv_ptr, int *fuse_argc, char *opt_string); +/** + * \brief Print short help information + */ void print_help(char *program_name, int long_help); +/** + * \brief Print version number + */ void print_version(); +/** + * \brief Print long help information + */ void print_long_help(); +/** + * \brief Print Sonic server related help information + */ +void print_sonic_help(); #endif \ No newline at end of file From 1d2271c1f6560fc2f2c2043bc9d3a3c0688faeaf Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Sat, 5 Jun 2021 02:47:14 +0100 Subject: [PATCH 07/15] moving toward a common main() function --- src/httpdirfs.c | 83 ++----------------------------------------------- src/main.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++ src/main.h | 2 ++ 3 files changed, 84 insertions(+), 81 deletions(-) diff --git a/src/httpdirfs.c b/src/httpdirfs.c index 2938798..50efa1a 100644 --- a/src/httpdirfs.c +++ b/src/httpdirfs.c @@ -1,87 +1,8 @@ #include "main.h" -#include "util.h" -#include "fuse_local.h" -#include "network.h" - -#include -#include -#include - int main(int argc, char **argv) { - /* Automatically print help if not enough arguments are supplied */ - if (argc < 2) { - print_help(argv[0], 0); - fprintf(stderr, "For more information, run \"%s --help.\"\n", argv[0]); - exit(EXIT_FAILURE); - } - - /* These are passed into fuse initialiser */ - char **fuse_argv = NULL; - int fuse_argc = 0; - /* These are the combined argument with the config file */ - char **all_argv = NULL; - int all_argc = 0; - - /*--- Add the program's name to the combined argument list ---*/ - add_arg(&all_argv, &all_argc, argv[0]); - /*--- FUSE expects the first initialisation to be the program's name ---*/ - add_arg(&fuse_argv, &fuse_argc, argv[0]); - - /* initialise network configuration struct */ - Config_init(); - - /* initialise network subsystem */ - NetworkSystem_init(); - - /* Copy the command line argument list to the combined argument list */ - for (int i = 1; i < argc; i++) { - add_arg(&all_argv, &all_argc, argv[i]); - if (!strcmp(argv[i], "--config")) { - config_path = strdup(argv[i+1]); - } - } - - /* parse the config file, if it exists, store it in all_argv and all_argc */ - parse_config_file(&all_argv, &all_argc); - - /* parse the combined argument list */ - if (parse_arg_list(all_argc, all_argv, &fuse_argv, &fuse_argc)) { - /* - * The user basically didn't supply enough arguments, if we reach here - * The point is to print some error messages - */ - goto fuse_start; - } - - /*--- Add the last remaining argument, which is the mountpoint ---*/ - add_arg(&fuse_argv, &fuse_argc, argv[argc-1]); - - /* The second last remaining argument is the URL */ - char *base_url = argv[argc-2]; - if (strncmp(base_url, "http://", 7) && strncmp(base_url, "https://", 8)) { - fprintf(stderr, "Error: Please supply a valid URL.\n"); - print_help(argv[0], 0); - exit(EXIT_FAILURE); - } else { - if (CONFIG.sonic_username && CONFIG.sonic_password) { - CONFIG.sonic_mode = 1; - } else if (CONFIG.sonic_username || CONFIG.sonic_password) { - fprintf(stderr, - "Error: You have to supply both username and password to \ -activate Sonic mode.\n"); - exit(EXIT_FAILURE); - } - if(!LinkSystem_init(base_url)) { - fprintf(stderr, "Error: Network initialisation failed.\n"); - exit(EXIT_FAILURE); - } - } - - fuse_start: - fuse_local_init(fuse_argc, fuse_argv); - - return 0; + return common_main(&argc, &argv); } + diff --git a/src/main.c b/src/main.c index a17b1ec..7838d35 100644 --- a/src/main.c +++ b/src/main.c @@ -261,4 +261,84 @@ void print_sonic_help() using the insecure username / hex encoded password\n\ scheme\n\ \n"); +} + +int common_main(int *argc_in, char ***argv_in) +{ + int argc = *argc_in; + char **argv = *argv_in; + + /* Automatically print help if not enough arguments are supplied */ + if (argc < 2) { + print_help(argv[0], 0); + fprintf(stderr, "For more information, run \"%s --help.\"\n", argv[0]); + exit(EXIT_FAILURE); + } + + /* These are passed into fuse initialiser */ + char **fuse_argv = NULL; + int fuse_argc = 0; + /* These are the combined argument with the config file */ + char **all_argv = NULL; + int all_argc = 0; + + /*--- Add the program's name to the combined argument list ---*/ + add_arg(&all_argv, &all_argc, argv[0]); + /*--- FUSE expects the first initialisation to be the program's name ---*/ + add_arg(&fuse_argv, &fuse_argc, argv[0]); + + /* initialise network configuration struct */ + Config_init(); + + /* initialise network subsystem */ + NetworkSystem_init(); + + /* Copy the command line argument list to the combined argument list */ + for (int i = 1; i < argc; i++) { + add_arg(&all_argv, &all_argc, argv[i]); + if (!strcmp(argv[i], "--config")) { + config_path = strdup(argv[i+1]); + } + } + + /* parse the config file, if it exists, store it in all_argv and all_argc */ + parse_config_file(&all_argv, &all_argc); + + /* parse the combined argument list */ + if (parse_arg_list(all_argc, all_argv, &fuse_argv, &fuse_argc)) { + /* + * The user basically didn't supply enough arguments, if we reach here + * The point is to print some error messages + */ + goto fuse_start; + } + + /*--- Add the last remaining argument, which is the mountpoint ---*/ + add_arg(&fuse_argv, &fuse_argc, argv[argc-1]); + + /* The second last remaining argument is the URL */ + char *base_url = argv[argc-2]; + if (strncmp(base_url, "http://", 7) && strncmp(base_url, "https://", 8)) { + fprintf(stderr, "Error: Please supply a valid URL.\n"); + print_help(argv[0], 0); + exit(EXIT_FAILURE); + } else { + if (CONFIG.sonic_username && CONFIG.sonic_password) { + CONFIG.sonic_mode = 1; + } else if (CONFIG.sonic_username || CONFIG.sonic_password) { + fprintf(stderr, + "Error: You have to supply both username and password to \ +activate Sonic mode.\n"); + exit(EXIT_FAILURE); + } + if(!LinkSystem_init(base_url)) { + fprintf(stderr, "Error: Network initialisation failed.\n"); + exit(EXIT_FAILURE); + } + } + + fuse_start: + fuse_local_init(fuse_argc, fuse_argv); + + return 0; } \ No newline at end of file diff --git a/src/main.h b/src/main.h index 13f516e..65972b3 100644 --- a/src/main.h +++ b/src/main.h @@ -41,4 +41,6 @@ void print_long_help(); * \brief Print Sonic server related help information */ void print_sonic_help(); + +int common_main(int *argc_in, char ***argv_in); #endif \ No newline at end of file From a733ee3fdb743a94b8fa6c353ff86bc639307dbb Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Sat, 5 Jun 2021 04:31:29 +0100 Subject: [PATCH 08/15] now generate a separate sonicfs binary --- .gitignore | 1 + Makefile | 19 +++++++++++-------- src/httpdirfs.c | 4 +--- src/main.c | 41 +++++++++++++++++++++++++---------------- src/main.h | 3 +++ src/sonicfs.c | 9 +++++++++ src/util.c | 2 -- src/util.h | 5 ----- 8 files changed, 50 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 9446f81..525d2b5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ httpdirfs .depend doc/html .vscode +sonicfs diff --git a/Makefile b/Makefile index 0641bce..eafde42 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ endif prefix ?= /usr/local -all: httpdirfs +all: httpdirfs sonicfs %.o: src/%.c $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c -o $@ $< @@ -31,18 +31,18 @@ all: httpdirfs httpdirfs: httpdirfs.o $(COBJS) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) -# sonicfs: sonicfs.o $(COBJS) -# $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) +sonicfs: sonicfs.o $(COBJS) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) install: ifeq ($(OS),Linux) - install -m 755 -D httpdirfs \ + install -m 755 -D httpdirfs sonicfs \ $(DESTDIR)$(prefix)/bin/httpdirfs install -m 644 -D doc/man/httpdirfs.1 \ $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1 endif ifeq ($(OS),FreeBSD) - install -m 755 httpdirfs \ + install -m 755 httpdirfs sonicfs\ $(DESTDIR)$(prefix)/bin/httpdirfs gzip -f -k doc/man/httpdirfs.1 install -m 644 doc/man/httpdirfs.1.gz \ @@ -50,7 +50,7 @@ ifeq ($(OS),FreeBSD) endif ifeq ($(OS),Darwin) install -d $(DESTDIR)$(prefix)/bin - install -m 755 httpdirfs \ + install -m 755 httpdirfs sonicfs\ $(DESTDIR)$(prefix)/bin/httpdirfs install -d $(DESTDIR)$(prefix)/share/man/man1 install -m 644 doc/man/httpdirfs.1 \ @@ -62,19 +62,22 @@ doc: clean: -rm -f *.o - -rm -f httpdirfs - -rm -rf doc/html + -rm -f httpdirfs sonicfs distclean: clean uninstall: -rm -f $(DESTDIR)$(prefix)/bin/httpdirfs + -rm -f $(DESTDIR)$(prefix)/bin/sonicfs ifeq ($(OS),Linux) -rm -f $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1 endif ifeq ($(OS),FreeBSD) -rm -f $(DESTDIR)$(prefix)/man/man1/httpdirfs.1.gz endif +ifeq ($(OS),Darwin) + -rm -f $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1 +endif depend: .depend .depend: src/*.c diff --git a/src/httpdirfs.c b/src/httpdirfs.c index 50efa1a..f6fa6f8 100644 --- a/src/httpdirfs.c +++ b/src/httpdirfs.c @@ -1,8 +1,6 @@ - #include "main.h" int main(int argc, char **argv) { return common_main(&argc, &argv); -} - +} \ No newline at end of file diff --git a/src/main.c b/src/main.c index 7838d35..39a5a71 100644 --- a/src/main.c +++ b/src/main.c @@ -202,7 +202,13 @@ void print_help(char *program_name, int long_help) void print_version() { - fprintf(stderr, "HTTPDirFS version " VERSION "\n"); + char *fs_name; + if (!CONFIG.sonic_mode) { + fs_name = "HTTPDirFS"; + } else { + fs_name = "SonicFS"; + } + fprintf(stderr, "%s version " VERSION "\n", fs_name); /* --------- Print off SSL engine version --------- */ curl_version_info_data *data = curl_version_info(CURLVERSION_NOW); fprintf(stderr, "libcurl SSL engine: %s\n", data->ssl_version); @@ -212,7 +218,7 @@ void print_long_help() { fprintf(stderr, "\n\ -general options:\n\ +General options:\n\ --config Specify a configuration file \n\ -o opt,[opt...] Mount options\n\ -h --help Print help\n\ @@ -246,13 +252,16 @@ HTTPDirFS options:\n\ --insecure_tls Disable licurl TLS certificate verification by\n\ setting CURLOPT_SSL_VERIFYHOST to 0\n\ \n"); + if (CONFIG.sonic_mode) { + print_sonic_help(); + } } void print_sonic_help() { fprintf(stderr, "\n\ - For mounting a Airsonic / Subsonic server:\n\ +Airsonic / Subsonic server specific options:\n\ --sonic-username The username for your Airsonic / Subsonic server\n\ --sonic-password The password for your Airsonic / Subsonic server\n\ --sonic-id3 Enable ID3 mode - this present the server content in\n\ @@ -322,19 +331,19 @@ int common_main(int *argc_in, char ***argv_in) fprintf(stderr, "Error: Please supply a valid URL.\n"); print_help(argv[0], 0); exit(EXIT_FAILURE); - } else { - if (CONFIG.sonic_username && CONFIG.sonic_password) { - CONFIG.sonic_mode = 1; - } else if (CONFIG.sonic_username || CONFIG.sonic_password) { - fprintf(stderr, - "Error: You have to supply both username and password to \ -activate Sonic mode.\n"); - exit(EXIT_FAILURE); - } - if(!LinkSystem_init(base_url)) { - fprintf(stderr, "Error: Network initialisation failed.\n"); - exit(EXIT_FAILURE); - } + } + + if (CONFIG.sonic_mode && + !(CONFIG.sonic_username && CONFIG.sonic_password)) { + fprintf(stderr, + "Error: You have to supply both username and password for your\ +Sonic server account.\n"); + exit(EXIT_FAILURE); + } + + if(!LinkSystem_init(base_url)) { + fprintf(stderr, "Error: Network initialisation failed.\n"); + exit(EXIT_FAILURE); } fuse_start: diff --git a/src/main.h b/src/main.h index 65972b3..b7ae7a0 100644 --- a/src/main.h +++ b/src/main.h @@ -42,5 +42,8 @@ void print_long_help(); */ void print_sonic_help(); +/** + * @brief The old main function that is common to both HTTPDirFS and SonicFS + */ int common_main(int *argc_in, char ***argv_in); #endif \ No newline at end of file diff --git a/src/sonicfs.c b/src/sonicfs.c index e69de29..3e6eb70 100644 --- a/src/sonicfs.c +++ b/src/sonicfs.c @@ -0,0 +1,9 @@ +#include "main.h" + +#include "util.h" + +int main(int argc, char **argv) +{ + CONFIG.sonic_mode = 1; + return common_main(&argc, &argv); +} \ No newline at end of file diff --git a/src/util.c b/src/util.c index f2141bd..2ee2046 100644 --- a/src/util.c +++ b/src/util.c @@ -86,8 +86,6 @@ void Config_init(void) CONFIG.max_segbc = DEFAULT_MAX_SEGBC; /*-------------- Sonic related -------------*/ - CONFIG.sonic_mode = 0; - CONFIG.sonic_username = NULL; CONFIG.sonic_password = NULL; diff --git a/src/util.h b/src/util.h index d7c7c15..9b15cc3 100644 --- a/src/util.h +++ b/src/util.h @@ -26,11 +26,6 @@ */ #define DEFAULT_USER_AGENT "HTTPDirFS-" VERSION - - - - - /** * \brief configuration data structure * \note The opening curly bracket should be at line 39, so the code belong From 66635a5518ef3c07efa7250846debfa339e78913 Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Sat, 5 Jun 2021 04:41:34 +0100 Subject: [PATCH 09/15] Makefile now generates man page --- Makefile | 5 + doc/man/httpdirfs.1 | 57 +++++++---- doc/man/sonicfs.1 | 243 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 285 insertions(+), 20 deletions(-) create mode 100644 doc/man/sonicfs.1 diff --git a/Makefile b/Makefile index eafde42..0518a47 100644 --- a/Makefile +++ b/Makefile @@ -60,11 +60,16 @@ endif doc: doxygen Doxyfile +man: all + help2man --no-discard-stderr ./httpdirfs > doc/man/httpdirfs.1 + help2man --no-discard-stderr ./httpdirfs > doc/man/sonicfs.1 + clean: -rm -f *.o -rm -f httpdirfs sonicfs distclean: clean + -rm -rf doc/html uninstall: -rm -f $(DESTDIR)$(prefix)/bin/httpdirfs diff --git a/doc/man/httpdirfs.1 b/doc/man/httpdirfs.1 index a6db827..11dcf01 100644 --- a/doc/man/httpdirfs.1 +++ b/doc/man/httpdirfs.1 @@ -1,24 +1,22 @@ -.TH HTTPDIRFS "1" "August 2019" "HTTPDirFS version 1.1.10" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.8. +.TH HTTPDIRFS "1" "June 2021" "HTTPDirFS version 1.2.1" "User Commands" .SH NAME -HTTPDirFS \- filesystem client for HTTP directory listing -.SH SYNOPSIS -.B httpdirfs -[\fI\,options\/\fR] \fI\,URL mountpoint\/\fR +HTTPDirFS \- manual page for HTTPDirFS version 1.2.1 .SH DESCRIPTION -HTTPDirFS is program that can be used to mount HTTP directory listings -(generated using an Apache DirectoryIndex, for example) as a virtual filesystem -through the FUSE interface. It supports HTTP basic authentication and proxy. -.SH OPTIONS +usage: ./httpdirfs [options] URL mountpoint .SS "General options:" .TP +\fB\-\-config\fR +Specify a configuration file +.TP \fB\-o\fR opt,[opt...] -mount options +Mount options .TP -\fB\-h\fR \fB\-\-help\fR -print help +\fB\-h\fR \fB\-\-help\fR +Print help .TP -\fB\-V\fR \fB\-\-version\fR -print version +\fB\-V\fR \fB\-\-version\fR +Print version .SS "HTTPDirFS options:" .TP \fB\-u\fR \fB\-\-username\fR @@ -66,6 +64,14 @@ after encountering an error. (default: 5) .TP \fB\-\-user\-agent\fR Set user agent string (default: "HTTPDirFS") +.TP +\fB\-\-no\-range\-check\fR +Disable the build\-in check for the server's support +for HTTP range requests +.TP +\fB\-\-insecure_tls\fR +Disable licurl TLS certificate verification by +setting CURLOPT_SSL_VERIFYHOST to 0 .SS "FUSE options:" .TP \fB\-d\fR \fB\-o\fR debug @@ -218,9 +224,20 @@ prepend this directory to all paths (mandatory) .TP \fB\-o\fR [no]rellinks transform absolute symlinks to relative -.SH AUTHORS -.LP -HTTPDirFS has been written by Fufu Fang . -.LP -This manpage was written by Jerome Charaoui for the -Debian GNU/Linux distribution (but it may be used by others). +.PP +libcurl SSL engine: OpenSSL/1.1.1d +FUSE library version: 2.9.9 +fusermount version: 2.9.9 +using FUSE kernel interface version 7.19 +.SH "SEE ALSO" +The full documentation for +.B HTTPDirFS +is maintained as a Texinfo manual. If the +.B info +and +.B HTTPDirFS +programs are properly installed at your site, the command +.IP +.B info HTTPDirFS +.PP +should give you access to the complete manual. diff --git a/doc/man/sonicfs.1 b/doc/man/sonicfs.1 new file mode 100644 index 0000000..11dcf01 --- /dev/null +++ b/doc/man/sonicfs.1 @@ -0,0 +1,243 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.8. +.TH HTTPDIRFS "1" "June 2021" "HTTPDirFS version 1.2.1" "User Commands" +.SH NAME +HTTPDirFS \- manual page for HTTPDirFS version 1.2.1 +.SH DESCRIPTION +usage: ./httpdirfs [options] URL mountpoint +.SS "General options:" +.TP +\fB\-\-config\fR +Specify a configuration file +.TP +\fB\-o\fR opt,[opt...] +Mount options +.TP +\fB\-h\fR \fB\-\-help\fR +Print help +.TP +\fB\-V\fR \fB\-\-version\fR +Print version +.SS "HTTPDirFS options:" +.TP +\fB\-u\fR \fB\-\-username\fR +HTTP authentication username +.TP +\fB\-p\fR \fB\-\-password\fR +HTTP authentication password +.TP +\fB\-P\fR \fB\-\-proxy\fR +Proxy for libcurl, for more details refer to +https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html +.TP +\fB\-\-proxy\-username\fR +Username for the proxy +.TP +\fB\-\-proxy\-password\fR +Password for the proxy +.TP +\fB\-\-cache\fR +Enable cache (default: off) +.TP +\fB\-\-cache\-location\fR +Set a custom cache location +(default: "${XDG_CACHE_HOME}/httpdirfs") +.TP +\fB\-\-dl\-seg\-size\fR +Set cache download segment size, in MB (default: 8) +Note: this setting is ignored if previously +cached data is found for the requested file. +.TP +\fB\-\-max\-seg\-count\fR +Set maximum number of download segments a file +can have. (default: 128*1024) +With the default setting, the maximum memory usage +per file is 128KB. This allows caching files up +to 1TB in size using the default segment size. +.TP +\fB\-\-max\-conns\fR +Set maximum number of network connections that +libcurl is allowed to make. (default: 10) +.TP +\fB\-\-retry\-wait\fR +Set delay in seconds before retrying an HTTP request +after encountering an error. (default: 5) +.TP +\fB\-\-user\-agent\fR +Set user agent string (default: "HTTPDirFS") +.TP +\fB\-\-no\-range\-check\fR +Disable the build\-in check for the server's support +for HTTP range requests +.TP +\fB\-\-insecure_tls\fR +Disable licurl TLS certificate verification by +setting CURLOPT_SSL_VERIFYHOST to 0 +.SS "FUSE options:" +.TP +\fB\-d\fR \fB\-o\fR debug +enable debug output (implies \fB\-f\fR) +.TP +\fB\-f\fR +foreground operation +.TP +\fB\-s\fR +disable multi\-threaded operation +.TP +\fB\-o\fR allow_other +allow access to other users +.TP +\fB\-o\fR allow_root +allow access to root +.TP +\fB\-o\fR auto_unmount +auto unmount on process termination +.TP +\fB\-o\fR nonempty +allow mounts over non\-empty file/dir +.HP +\fB\-o\fR default_permissions enable permission checking by kernel +.TP +\fB\-o\fR fsname=NAME +set filesystem name +.TP +\fB\-o\fR subtype=NAME +set filesystem type +.TP +\fB\-o\fR large_read +issue large read requests (2.4 only) +.TP +\fB\-o\fR max_read=N +set maximum size of read requests +.TP +\fB\-o\fR hard_remove +immediate removal (don't hide files) +.TP +\fB\-o\fR use_ino +let filesystem set inode numbers +.TP +\fB\-o\fR readdir_ino +try to fill in d_ino in readdir +.TP +\fB\-o\fR direct_io +use direct I/O +.TP +\fB\-o\fR kernel_cache +cache files in kernel +.TP +\fB\-o\fR [no]auto_cache +enable caching based on modification times (off) +.TP +\fB\-o\fR umask=M +set file permissions (octal) +.TP +\fB\-o\fR uid=N +set file owner +.TP +\fB\-o\fR gid=N +set file group +.TP +\fB\-o\fR entry_timeout=T +cache timeout for names (1.0s) +.TP +\fB\-o\fR negative_timeout=T +cache timeout for deleted names (0.0s) +.TP +\fB\-o\fR attr_timeout=T +cache timeout for attributes (1.0s) +.TP +\fB\-o\fR ac_attr_timeout=T +auto cache timeout for attributes (attr_timeout) +.TP +\fB\-o\fR noforget +never forget cached inodes +.TP +\fB\-o\fR remember=T +remember cached inodes for T seconds (0s) +.TP +\fB\-o\fR nopath +don't supply path if not necessary +.TP +\fB\-o\fR intr +allow requests to be interrupted +.TP +\fB\-o\fR intr_signal=NUM +signal to send on interrupt (10) +.TP +\fB\-o\fR modules=M1[:M2...] +names of modules to push onto filesystem stack +.TP +\fB\-o\fR max_write=N +set maximum size of write requests +.TP +\fB\-o\fR max_readahead=N +set maximum readahead +.TP +\fB\-o\fR max_background=N +set number of maximum background requests +.TP +\fB\-o\fR congestion_threshold=N +set kernel's congestion threshold +.TP +\fB\-o\fR async_read +perform reads asynchronously (default) +.TP +\fB\-o\fR sync_read +perform reads synchronously +.TP +\fB\-o\fR atomic_o_trunc +enable atomic open+truncate support +.TP +\fB\-o\fR big_writes +enable larger than 4kB writes +.TP +\fB\-o\fR no_remote_lock +disable remote file locking +.TP +\fB\-o\fR no_remote_flock +disable remote file locking (BSD) +.HP +\fB\-o\fR no_remote_posix_lock disable remove file locking (POSIX) +.TP +\fB\-o\fR [no_]splice_write +use splice to write to the fuse device +.TP +\fB\-o\fR [no_]splice_move +move data while splicing to the fuse device +.TP +\fB\-o\fR [no_]splice_read +use splice to read from the fuse device +.PP +Module options: +.PP +[iconv] +.TP +\fB\-o\fR from_code=CHARSET +original encoding of file names (default: UTF\-8) +.TP +\fB\-o\fR to_code=CHARSET +new encoding of the file names (default: ANSI_X3.4\-1968) +.PP +[subdir] +.TP +\fB\-o\fR subdir=DIR +prepend this directory to all paths (mandatory) +.TP +\fB\-o\fR [no]rellinks +transform absolute symlinks to relative +.PP +libcurl SSL engine: OpenSSL/1.1.1d +FUSE library version: 2.9.9 +fusermount version: 2.9.9 +using FUSE kernel interface version 7.19 +.SH "SEE ALSO" +The full documentation for +.B HTTPDirFS +is maintained as a Texinfo manual. If the +.B info +and +.B HTTPDirFS +programs are properly installed at your site, the command +.IP +.B info HTTPDirFS +.PP +should give you access to the complete manual. From 9cd212c1cea5eaad268b1c2dc4cdf5b78c2c2de9 Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Sat, 5 Jun 2021 04:42:53 +0100 Subject: [PATCH 10/15] version number update --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0518a47..c9329a1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = 1.2.1 +VERSION = 1.3.0 CFLAGS += -O2 -Wall -Wextra -Wshadow -rdynamic -D_GNU_SOURCE\ -D_FILE_OFFSET_BITS=64 -DVERSION=\"$(VERSION)\"\ From 4ea6bcb709f80f340aaa5c53179f41cd35138c3f Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Sat, 5 Jun 2021 05:00:53 +0100 Subject: [PATCH 11/15] makefile now install sonicfs properly --- .gitignore | 2 +- Makefile | 28 +++-- doc/man/httpdirfs.1 | 57 ++++------- doc/man/sonicfs.1 | 243 -------------------------------------------- 4 files changed, 43 insertions(+), 287 deletions(-) delete mode 100644 doc/man/sonicfs.1 diff --git a/.gitignore b/.gitignore index 525d2b5..317e9ae 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,6 @@ *.kate-swp httpdirfs .depend -doc/html +doc .vscode sonicfs diff --git a/Makefile b/Makefile index c9329a1..189e116 100644 --- a/Makefile +++ b/Makefile @@ -34,27 +34,40 @@ httpdirfs: httpdirfs.o $(COBJS) sonicfs: sonicfs.o $(COBJS) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) -install: +install: all ifeq ($(OS),Linux) - install -m 755 -D httpdirfs sonicfs \ + install -m 755 -D httpdirfs \ $(DESTDIR)$(prefix)/bin/httpdirfs install -m 644 -D doc/man/httpdirfs.1 \ $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1 + install -m 755 -D sonicfs \ + $(DESTDIR)$(prefix)/bin/sonicfs + install -m 644 -D doc/man/sonicfs.1 \ + $(DESTDIR)$(prefix)/share/man/man1/sonicfs.1 endif ifeq ($(OS),FreeBSD) - install -m 755 httpdirfs sonicfs\ + install -m 755 httpdirfs\ $(DESTDIR)$(prefix)/bin/httpdirfs gzip -f -k doc/man/httpdirfs.1 install -m 644 doc/man/httpdirfs.1.gz \ $(DESTDIR)$(prefix)/man/man1/httpdirfs.1.gz + install -m 755 sonicfs\ + $(DESTDIR)$(prefix)/bin/sonicfs + gzip -f -k doc/man/sonicfs.1 + install -m 644 doc/man/sonicfs.1.gz \ + $(DESTDIR)$(prefix)/man/man1/sonicfs.1.gz endif ifeq ($(OS),Darwin) install -d $(DESTDIR)$(prefix)/bin - install -m 755 httpdirfs sonicfs\ + install -m 755 httpdirfs\ $(DESTDIR)$(prefix)/bin/httpdirfs + install -m 755 sonicfs\ + $(DESTDIR)$(prefix)/bin/sonicfs install -d $(DESTDIR)$(prefix)/share/man/man1 install -m 644 doc/man/httpdirfs.1 \ $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1 + install -m 644 doc/man/sonicfs.1 \ + $(DESTDIR)$(prefix)/share/man/man1/sonicfs.1 endif doc: @@ -62,7 +75,7 @@ doc: man: all help2man --no-discard-stderr ./httpdirfs > doc/man/httpdirfs.1 - help2man --no-discard-stderr ./httpdirfs > doc/man/sonicfs.1 + help2man --no-discard-stderr ./sonicfs > doc/man/sonicfs.1 clean: -rm -f *.o @@ -76,12 +89,15 @@ uninstall: -rm -f $(DESTDIR)$(prefix)/bin/sonicfs ifeq ($(OS),Linux) -rm -f $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1 + -rm -f $(DESTDIR)$(prefix)/share/man/man1/sonicfs.1 endif ifeq ($(OS),FreeBSD) -rm -f $(DESTDIR)$(prefix)/man/man1/httpdirfs.1.gz + -rm -f $(DESTDIR)$(prefix)/man/man1/sonicfs.1.gz endif ifeq ($(OS),Darwin) -rm -f $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1 + -rm -f $(DESTDIR)$(prefix)/share/man/man1/sonicfs.1 endif depend: .depend @@ -90,4 +106,4 @@ depend: .depend $(CC) $(CFLAGS) -MM $^ -MF ./.depend; include .depend -.PHONY: all doc install clean distclean uninstall depend +.PHONY: all doc man install clean distclean uninstall depend diff --git a/doc/man/httpdirfs.1 b/doc/man/httpdirfs.1 index 11dcf01..a6db827 100644 --- a/doc/man/httpdirfs.1 +++ b/doc/man/httpdirfs.1 @@ -1,22 +1,24 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.8. -.TH HTTPDIRFS "1" "June 2021" "HTTPDirFS version 1.2.1" "User Commands" +.TH HTTPDIRFS "1" "August 2019" "HTTPDirFS version 1.1.10" "User Commands" .SH NAME -HTTPDirFS \- manual page for HTTPDirFS version 1.2.1 +HTTPDirFS \- filesystem client for HTTP directory listing +.SH SYNOPSIS +.B httpdirfs +[\fI\,options\/\fR] \fI\,URL mountpoint\/\fR .SH DESCRIPTION -usage: ./httpdirfs [options] URL mountpoint +HTTPDirFS is program that can be used to mount HTTP directory listings +(generated using an Apache DirectoryIndex, for example) as a virtual filesystem +through the FUSE interface. It supports HTTP basic authentication and proxy. +.SH OPTIONS .SS "General options:" .TP -\fB\-\-config\fR -Specify a configuration file -.TP \fB\-o\fR opt,[opt...] -Mount options +mount options .TP -\fB\-h\fR \fB\-\-help\fR -Print help +\fB\-h\fR \fB\-\-help\fR +print help .TP -\fB\-V\fR \fB\-\-version\fR -Print version +\fB\-V\fR \fB\-\-version\fR +print version .SS "HTTPDirFS options:" .TP \fB\-u\fR \fB\-\-username\fR @@ -64,14 +66,6 @@ after encountering an error. (default: 5) .TP \fB\-\-user\-agent\fR Set user agent string (default: "HTTPDirFS") -.TP -\fB\-\-no\-range\-check\fR -Disable the build\-in check for the server's support -for HTTP range requests -.TP -\fB\-\-insecure_tls\fR -Disable licurl TLS certificate verification by -setting CURLOPT_SSL_VERIFYHOST to 0 .SS "FUSE options:" .TP \fB\-d\fR \fB\-o\fR debug @@ -224,20 +218,9 @@ prepend this directory to all paths (mandatory) .TP \fB\-o\fR [no]rellinks transform absolute symlinks to relative -.PP -libcurl SSL engine: OpenSSL/1.1.1d -FUSE library version: 2.9.9 -fusermount version: 2.9.9 -using FUSE kernel interface version 7.19 -.SH "SEE ALSO" -The full documentation for -.B HTTPDirFS -is maintained as a Texinfo manual. If the -.B info -and -.B HTTPDirFS -programs are properly installed at your site, the command -.IP -.B info HTTPDirFS -.PP -should give you access to the complete manual. +.SH AUTHORS +.LP +HTTPDirFS has been written by Fufu Fang . +.LP +This manpage was written by Jerome Charaoui for the +Debian GNU/Linux distribution (but it may be used by others). diff --git a/doc/man/sonicfs.1 b/doc/man/sonicfs.1 deleted file mode 100644 index 11dcf01..0000000 --- a/doc/man/sonicfs.1 +++ /dev/null @@ -1,243 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.8. -.TH HTTPDIRFS "1" "June 2021" "HTTPDirFS version 1.2.1" "User Commands" -.SH NAME -HTTPDirFS \- manual page for HTTPDirFS version 1.2.1 -.SH DESCRIPTION -usage: ./httpdirfs [options] URL mountpoint -.SS "General options:" -.TP -\fB\-\-config\fR -Specify a configuration file -.TP -\fB\-o\fR opt,[opt...] -Mount options -.TP -\fB\-h\fR \fB\-\-help\fR -Print help -.TP -\fB\-V\fR \fB\-\-version\fR -Print version -.SS "HTTPDirFS options:" -.TP -\fB\-u\fR \fB\-\-username\fR -HTTP authentication username -.TP -\fB\-p\fR \fB\-\-password\fR -HTTP authentication password -.TP -\fB\-P\fR \fB\-\-proxy\fR -Proxy for libcurl, for more details refer to -https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html -.TP -\fB\-\-proxy\-username\fR -Username for the proxy -.TP -\fB\-\-proxy\-password\fR -Password for the proxy -.TP -\fB\-\-cache\fR -Enable cache (default: off) -.TP -\fB\-\-cache\-location\fR -Set a custom cache location -(default: "${XDG_CACHE_HOME}/httpdirfs") -.TP -\fB\-\-dl\-seg\-size\fR -Set cache download segment size, in MB (default: 8) -Note: this setting is ignored if previously -cached data is found for the requested file. -.TP -\fB\-\-max\-seg\-count\fR -Set maximum number of download segments a file -can have. (default: 128*1024) -With the default setting, the maximum memory usage -per file is 128KB. This allows caching files up -to 1TB in size using the default segment size. -.TP -\fB\-\-max\-conns\fR -Set maximum number of network connections that -libcurl is allowed to make. (default: 10) -.TP -\fB\-\-retry\-wait\fR -Set delay in seconds before retrying an HTTP request -after encountering an error. (default: 5) -.TP -\fB\-\-user\-agent\fR -Set user agent string (default: "HTTPDirFS") -.TP -\fB\-\-no\-range\-check\fR -Disable the build\-in check for the server's support -for HTTP range requests -.TP -\fB\-\-insecure_tls\fR -Disable licurl TLS certificate verification by -setting CURLOPT_SSL_VERIFYHOST to 0 -.SS "FUSE options:" -.TP -\fB\-d\fR \fB\-o\fR debug -enable debug output (implies \fB\-f\fR) -.TP -\fB\-f\fR -foreground operation -.TP -\fB\-s\fR -disable multi\-threaded operation -.TP -\fB\-o\fR allow_other -allow access to other users -.TP -\fB\-o\fR allow_root -allow access to root -.TP -\fB\-o\fR auto_unmount -auto unmount on process termination -.TP -\fB\-o\fR nonempty -allow mounts over non\-empty file/dir -.HP -\fB\-o\fR default_permissions enable permission checking by kernel -.TP -\fB\-o\fR fsname=NAME -set filesystem name -.TP -\fB\-o\fR subtype=NAME -set filesystem type -.TP -\fB\-o\fR large_read -issue large read requests (2.4 only) -.TP -\fB\-o\fR max_read=N -set maximum size of read requests -.TP -\fB\-o\fR hard_remove -immediate removal (don't hide files) -.TP -\fB\-o\fR use_ino -let filesystem set inode numbers -.TP -\fB\-o\fR readdir_ino -try to fill in d_ino in readdir -.TP -\fB\-o\fR direct_io -use direct I/O -.TP -\fB\-o\fR kernel_cache -cache files in kernel -.TP -\fB\-o\fR [no]auto_cache -enable caching based on modification times (off) -.TP -\fB\-o\fR umask=M -set file permissions (octal) -.TP -\fB\-o\fR uid=N -set file owner -.TP -\fB\-o\fR gid=N -set file group -.TP -\fB\-o\fR entry_timeout=T -cache timeout for names (1.0s) -.TP -\fB\-o\fR negative_timeout=T -cache timeout for deleted names (0.0s) -.TP -\fB\-o\fR attr_timeout=T -cache timeout for attributes (1.0s) -.TP -\fB\-o\fR ac_attr_timeout=T -auto cache timeout for attributes (attr_timeout) -.TP -\fB\-o\fR noforget -never forget cached inodes -.TP -\fB\-o\fR remember=T -remember cached inodes for T seconds (0s) -.TP -\fB\-o\fR nopath -don't supply path if not necessary -.TP -\fB\-o\fR intr -allow requests to be interrupted -.TP -\fB\-o\fR intr_signal=NUM -signal to send on interrupt (10) -.TP -\fB\-o\fR modules=M1[:M2...] -names of modules to push onto filesystem stack -.TP -\fB\-o\fR max_write=N -set maximum size of write requests -.TP -\fB\-o\fR max_readahead=N -set maximum readahead -.TP -\fB\-o\fR max_background=N -set number of maximum background requests -.TP -\fB\-o\fR congestion_threshold=N -set kernel's congestion threshold -.TP -\fB\-o\fR async_read -perform reads asynchronously (default) -.TP -\fB\-o\fR sync_read -perform reads synchronously -.TP -\fB\-o\fR atomic_o_trunc -enable atomic open+truncate support -.TP -\fB\-o\fR big_writes -enable larger than 4kB writes -.TP -\fB\-o\fR no_remote_lock -disable remote file locking -.TP -\fB\-o\fR no_remote_flock -disable remote file locking (BSD) -.HP -\fB\-o\fR no_remote_posix_lock disable remove file locking (POSIX) -.TP -\fB\-o\fR [no_]splice_write -use splice to write to the fuse device -.TP -\fB\-o\fR [no_]splice_move -move data while splicing to the fuse device -.TP -\fB\-o\fR [no_]splice_read -use splice to read from the fuse device -.PP -Module options: -.PP -[iconv] -.TP -\fB\-o\fR from_code=CHARSET -original encoding of file names (default: UTF\-8) -.TP -\fB\-o\fR to_code=CHARSET -new encoding of the file names (default: ANSI_X3.4\-1968) -.PP -[subdir] -.TP -\fB\-o\fR subdir=DIR -prepend this directory to all paths (mandatory) -.TP -\fB\-o\fR [no]rellinks -transform absolute symlinks to relative -.PP -libcurl SSL engine: OpenSSL/1.1.1d -FUSE library version: 2.9.9 -fusermount version: 2.9.9 -using FUSE kernel interface version 7.19 -.SH "SEE ALSO" -The full documentation for -.B HTTPDirFS -is maintained as a Texinfo manual. If the -.B info -and -.B HTTPDirFS -programs are properly installed at your site, the command -.IP -.B info HTTPDirFS -.PP -should give you access to the complete manual. From 494251bb50fe569cb66fdf97c9607cbe6ff007ee Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Sat, 5 Jun 2021 05:16:19 +0100 Subject: [PATCH 12/15] added TODO page --- TODO.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 TODO.md diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..6cf0661 --- /dev/null +++ b/TODO.md @@ -0,0 +1,6 @@ +## Todo +- [ ] Automatic generation of man page with proper description +- [ ] Update change log +- [ ] Create a new release +- [ ] Contact maintainer for a new Debian package +- [ ] Improve debug functions \ No newline at end of file From e7d04bda6ecac4d21e52ff8774664e8856361a0c Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Sat, 5 Jun 2021 12:39:22 +0100 Subject: [PATCH 13/15] Update Makefile --- Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile b/Makefile index 7dfc279..189e116 100644 --- a/Makefile +++ b/Makefile @@ -99,9 +99,6 @@ ifeq ($(OS),Darwin) -rm -f $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1 -rm -f $(DESTDIR)$(prefix)/share/man/man1/sonicfs.1 endif -ifeq ($(OS),Darwin) - -rm -f $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1 -endif depend: .depend .depend: src/*.c From f8b7640334751c8d1d2f210d2be7a5735a430d94 Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Sat, 5 Jun 2021 21:41:16 +0100 Subject: [PATCH 14/15] Updated changelog --- CHANGELOG.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de66032..0a5a828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.0] +### Changed +Now generate separate binaries +- ``HTTDirFS`` for mounting HTTP directory listings. +- ``SonicFS`` for mounting Airsonic / Subsonic server. +### Fixed +- macOS uninstall in Makefile. ## [1.2.1] - 2021-05-27 ### Added -- macOS compilation support +- macOS compilation support. ## [1.2.0] - 2019-11-01 ### Added @@ -177,8 +184,9 @@ ${XDG_CONFIG_HOME}/httpdirfs, rather than ${HOME}/.httpdirfs ## [1.0] - 2018-08-22 - Initial release, everything works correctly, as far as I know. -[Unreleased]: https://github.com/fangfufu/httpdirfs/compare/Unreleased...1.2.1 -[1.2.1]: https://github.com/fangfufu/httpdirfs/compare/Unreleased...1.2.0 +[Unreleased]: https://github.com/fangfufu/httpdirfs/compare/Unreleased...1.3.0 +[1.3.0]: https://github.com/fangfufu/httpdirfs/compare/1.3.0...1.2.1 +[1.2.1]: https://github.com/fangfufu/httpdirfs/compare/1.2.1...1.2.0 [1.2.0]: https://github.com/fangfufu/httpdirfs/compare/1.2.0...1.1.10 [1.1.10]: https://github.com/fangfufu/httpdirfs/compare/1.1.9...1.1.10 [1.1.9]: https://github.com/fangfufu/httpdirfs/compare/1.1.8...1.1.9 From dff83811100cb565c73fc40839b34b3f12a65ab9 Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Wed, 9 Jun 2021 01:47:17 +0100 Subject: [PATCH 15/15] updated TODO and changelog --- CHANGELOG.md | 2 +- TODO.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a5a828..d6ca3e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ Now generate separate binaries - ``HTTDirFS`` for mounting HTTP directory listings. - ``SonicFS`` for mounting Airsonic / Subsonic server. ### Fixed -- macOS uninstall in Makefile. +- macOS uninstallation in Makefile. ## [1.2.1] - 2021-05-27 ### Added - macOS compilation support. diff --git a/TODO.md b/TODO.md index 6cf0661..a074c3d 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,6 @@ ## Todo +- [ ] Improve debug functions - [ ] Automatic generation of man page with proper description - [ ] Update change log - [ ] Create a new release -- [ ] Contact maintainer for a new Debian package -- [ ] Improve debug functions \ No newline at end of file +- [ ] Contact maintainer for a new Debian package \ No newline at end of file