/* mhddfs - Multi HDD [FUSE] File System Copyright (C) 2008 Dmitry E. Oboukhov This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include #include #include #include #include #include #include #include #include #include "parse_options.h" #include "usage.h" #include "version.h" #include "debug.h" #include "tools.h" struct mhdd_config mhdd={0}; #define MHDDFS_OPT(t, p, v) { t, offsetof(struct mhdd_config, p), v } #define MHDD_VERSION_OPT 15121974 #if FUSE_VERSION >= 27 #define FUSE_MP_OPT_STR "-osubtype=mhddfs,fsname=" #else #define FUSE_MP_OPT_STR "-ofsname=mhddfs#" #endif /* the number less (or equal) than 100 is in percent, more than 100 is in bytes */ #define DEFAULT_MLIMIT ( 4l * 1024 * 1024 * 1024 ) #define MINIMUM_MLIMIT ( 50l * 1024 * 1024 ) static struct fuse_opt mhddfs_opts[]={ MHDDFS_OPT("mlimit=%s", mlimit_str, 0), MHDDFS_OPT("logfile=%s", debug_file, 0), MHDDFS_OPT("loglevel=%d", loglevel, 0), FUSE_OPT_KEY("-V", MHDD_VERSION_OPT), FUSE_OPT_KEY("--version", MHDD_VERSION_OPT), FUSE_OPT_END }; static void add_mhdd_dirs(const char * dir) { int i; char ** newdirs; char *add_dir; if (*dir=='/') { add_dir=strdup(dir); } else { char cpwd[PATH_MAX]; getcwd(cpwd, PATH_MAX); add_dir = create_path(cpwd, dir); } if (!mhdd.dirs) { mhdd.dirs=calloc(2, sizeof(char *)); mhdd.dirs[0]=add_dir; mhdd.cdirs=1; return; } newdirs=calloc(mhdd.cdirs+2, sizeof(char *)); for (i=0; i 100) mhdd.move_limit = MINIMUM_MLIMIT; } } } if (mhdd.move_limit <= 100) fprintf(stderr, "mhddfs: move size limit %lld%%\n", (long long)mhdd.move_limit); else fprintf(stderr, "mhddfs: move size limit %lld bytes\n", (long long)mhdd.move_limit); mhdd_debug(MHDD_MSG, " >>>>> mhdd " VERSION " started <<<<<\n"); return args; }