Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 335 lines (296 sloc) 11.575 kB
4d4d90b @hzeller o More legalese
authored
1 // Folve - A fuse filesystem that convolves audio files on-the-fly.
2 //
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
3 // Copyright (C) 2012 Henner Zeller <h.zeller@acm.org>
1bce634 @hzeller o Remove some trailing whitespaces
authored
4 //
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 // Use latest version.
19 #define FUSE_USE_VERSION 26
49a4cd9 @hzeller o Provide an INSTALL.md that explains how to compile on older systems.
authored
20 #include <fuse/fuse.h>
a9d3e53 @hzeller o Found a project name: "Folve". Some renamings because of that.
authored
21
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
22 #include <dirent.h>
23 #include <errno.h>
b698853 @hzeller o README updates.
authored
24 #include <fcntl.h>
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
25 #include <limits.h>
b698853 @hzeller o README updates.
authored
26 #include <stdio.h>
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
27 #include <stdlib.h>
b698853 @hzeller o README updates.
authored
28 #include <string.h>
29 #include <sys/stat.h>
30 #include <sys/time.h>
49eca7f @hzeller o add syslog as preparation for parameter handling.
authored
31 #include <syslog.h>
b698853 @hzeller o README updates.
authored
32 #include <unistd.h>
ec3ae89 @hzeller o Print out version string of used libraries.
authored
33 #include <sndfile.h> // for sf_version_string
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
34
a9d3e53 @hzeller o Found a project name: "Folve". Some renamings because of that.
authored
35 #include "folve-filesystem.h"
8d1fbe7 @hzeller o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
authored
36 #include "status-server.h"
7689c9a @hzeller o preparation to extract classes from folve-filesystem into their
authored
37 #include "util.h"
e9c07dd @hzeller o add documentation
authored
38
6c6dedb @hzeller o Some readme tweaks and readability improvements.
authored
39 // Compilation unit variables to communicate with the fuse callbacks.
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
40 static struct FolveRuntime {
a372a03 @hzeller o Make meta-refresh configurable.
authored
41 FolveRuntime() : fs(NULL), mount_point(NULL),
4e69b5b @hzeller o Provide a way to see what readdir() yields. Some media servers
authored
42 status_port(-1), refresh_time(10), parameter_error(false),
43 readdir_dump_file(NULL) {}
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
44 FolveFilesystem *fs;
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
45 const char *mount_point;
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
46 int status_port;
a372a03 @hzeller o Make meta-refresh configurable.
authored
47 int refresh_time;
fa525ee @hzeller o If we find problems in the options, complain and exit.
authored
48 bool parameter_error;
4e69b5b @hzeller o Provide a way to see what readdir() yields. Some media servers
authored
49 FILE *readdir_dump_file;
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
50 } folve_rt;
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
51
7c7bda6 @hzeller o attempt to create a sndfile for every file, if that fails, fall
authored
52 static char *concat_path(char *buf, const char *a, const char *b) {
53 strcpy(buf, a);
54 strcat(buf, b);
55 return buf;
56 }
57
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
58 // Given a relative path from the root of the mounted file-system, get the
59 // original file from the source filesystem.
60 static const char *assemble_orig_path(char *buf, const char *path) {
08bbf28 @hzeller o First shot at gapless. Works pretty well for my test-case.
authored
61 return concat_path(buf, folve_rt.fs->underlying_dir().c_str(), path);
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
62 }
63
7c7bda6 @hzeller o attempt to create a sndfile for every file, if that fails, fall
authored
64 // Essentially lstat(). Just forward to the original filesystem (this
73093dc @hzeller o Keep open file-descriptor.
authored
65 // will by lying: our convolved files are of different size...)
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
66 static int folve_getattr(const char *path, struct stat *stbuf) {
9a8ea56 @hzeller o add infrastructure to provide Stat() output of currently open
authored
67 // If this is a currently open filename, we might be able to output a better
68 // estimate.
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
69 int result = folve_rt.fs->StatByFilename(path, stbuf);
369a0a7 @hzeller o Writing is not possible. Show permissions as readonly.
authored
70 if (result != 0) {
71 char path_buf[PATH_MAX];
72 result = lstat(assemble_orig_path(path_buf, path), stbuf);
73 if (result == -1)
74 return -errno;
75 }
76 // Whatever write mode was there before: now things are readonly.
77 stbuf->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
78 return 0;
79 }
80
73093dc @hzeller o Keep open file-descriptor.
authored
81 // readdir(). Just forward to original filesystem.
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
82 static int folve_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
83 off_t offset, struct fuse_file_info *fi) {
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
84 DIR *dp;
85 struct dirent *de;
86 char path_buf[PATH_MAX];
87
88 dp = opendir(assemble_orig_path(path_buf, path));
89 if (dp == NULL)
90 return -errno;
91
bf030af @hzeller o use readdir_r() - looks like readdir is indeed not really multi-thread
authored
92 // Entry size is a bit shaky to calculate, but this should be the upper bound.
93 const size_t entry_size = sizeof(struct dirent) + PATH_MAX;
94 struct dirent *entry_buf = (struct dirent *) malloc(entry_size);
95
4e69b5b @hzeller o Provide a way to see what readdir() yields. Some media servers
authored
96 if (folve_rt.readdir_dump_file)
97 fprintf(folve_rt.readdir_dump_file, "LIST %s\n", path);
98
bf030af @hzeller o use readdir_r() - looks like readdir is indeed not really multi-thread
authored
99 while (readdir_r(dp, entry_buf, &de) == 0 && de != NULL) {
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
100 struct stat st;
101 memset(&st, 0, sizeof(st));
102 st.st_ino = de->d_ino;
103 st.st_mode = de->d_type << 12;
7c7bda6 @hzeller o attempt to create a sndfile for every file, if that fails, fall
authored
104 const char *entry_name = de->d_name;
4e69b5b @hzeller o Provide a way to see what readdir() yields. Some media servers
authored
105 if (folve_rt.readdir_dump_file)
106 fprintf(folve_rt.readdir_dump_file, "ITEM %s%s%s\n",
107 path, strlen(path) > 1 ? "/" : "", de->d_name);
108 if (filler(buf, entry_name, &st, 0)) {
109 if (folve_rt.readdir_dump_file)
110 fprintf(folve_rt.readdir_dump_file, "DONE (%s)\n", de->d_name);
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
111 break;
4e69b5b @hzeller o Provide a way to see what readdir() yields. Some media servers
authored
112 }
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
113 }
bf030af @hzeller o use readdir_r() - looks like readdir is indeed not really multi-thread
authored
114 free(entry_buf);
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
115
116 closedir(dp);
117 return 0;
118 }
119
73093dc @hzeller o Keep open file-descriptor.
authored
120 // readlink(): forward to original filesystem.
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
121 static int folve_readlink(const char *path, char *buf, size_t size) {
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
122 char path_buf[PATH_MAX];
123 const int result = readlink(assemble_orig_path(path_buf, path),
124 buf, size - 1);
125 if (result == -1)
126 return -errno;
127
128 buf[result] = '\0';
129 return 0;
130 }
131
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
132 static int folve_open(const char *path, struct fuse_file_info *fi) {
8b18938 @hzeller o some comment changes. Ready to do some flac handling.
authored
133 // We want to be allowed to only return part of the requested data in read().
134 // That way, we can separate reading the ID3-tags from
135 // decoding of the music stream - that way indexing should be fast.
136 // Setting the flag 'direct_io' allows us to return partial results.
137 fi->direct_io = 1;
138
e9c07dd @hzeller o add documentation
authored
139 // The file-handle has the neat property to be 64 bit - so we can actually
b698853 @hzeller o README updates.
authored
140 // stuff a pointer to our file handler object in there :)
8b18938 @hzeller o some comment changes. Ready to do some flac handling.
authored
141 // (Yay, someone was thinking while developing that API).
08bbf28 @hzeller o First shot at gapless. Works pretty well for my test-case.
authored
142 FileHandler *handler = folve_rt.fs->GetOrCreateHandler(path);
680f590 @hzeller o report opening error.
authored
143 if (handler == NULL)
144 return -errno;
145 fi->fh = (uint64_t) handler;
146 return 0;
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
147 }
148
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
149 static int folve_read(const char *path, char *buf, size_t size, off_t offset,
150 struct fuse_file_info *fi) {
8d1fbe7 @hzeller o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
authored
151 return reinterpret_cast<FileHandler *>(fi->fh)->Read(buf, size, offset);
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
152 }
153
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
154 static int folve_release(const char *path, struct fuse_file_info *fi) {
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
155 folve_rt.fs->Close(path, reinterpret_cast<FileHandler *>(fi->fh));
8d1fbe7 @hzeller o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
authored
156 return 0;
9a8ea56 @hzeller o add infrastructure to provide Stat() output of currently open
authored
157 }
158
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
159 static int folve_fgetattr(const char *path, struct stat *result,
160 struct fuse_file_info *fi) {
8d1fbe7 @hzeller o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
authored
161 return reinterpret_cast<FileHandler *>(fi->fh)->Stat(result);
73093dc @hzeller o Keep open file-descriptor.
authored
162 }
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
163
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
164 static void *folve_init(struct fuse_conn_info *conn) {
165 const int ident_len = 20;
166 char *ident = (char*) malloc(ident_len); // openlog() keeps reference. Leaks.
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
167 snprintf(ident, ident_len, "folve[%d]", getpid());
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
168 openlog(ident, LOG_CONS|LOG_PERROR, LOG_USER);
ec3ae89 @hzeller o Print out version string of used libraries.
authored
169 syslog(LOG_INFO, "Version " FOLVE_VERSION " started "
170 "(with fuse=%d.%d; sndfile=%s). ",
171 FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION, sf_version_string());
172 syslog(LOG_INFO, "Serving '%s' on mount point '%s'",
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
173 folve_rt.fs->underlying_dir().c_str(), folve_rt.mount_point);
7689c9a @hzeller o preparation to extract classes from folve-filesystem into their
authored
174 if (folve::IsDebugLogEnabled()) {
5830c5a @hzeller o Switch logging to syslog()
authored
175 syslog(LOG_INFO, "Debug logging enabled (-D)");
176 }
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
177
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
178 if (folve_rt.status_port > 0) {
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
179 // Need to start status server after we're daemonized.
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
180 StatusServer *status_server = new StatusServer(folve_rt.fs);
181 if (status_server->Start(folve_rt.status_port)) {
a372a03 @hzeller o Make meta-refresh configurable.
authored
182 syslog(LOG_INFO, "HTTP status server on port %d; refresh=%d",
183 folve_rt.status_port, folve_rt.refresh_time);
184 status_server->set_meta_refresh(folve_rt.refresh_time);
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
185 } else {
186 syslog(LOG_ERR, "Couldn't start HTTP server on port %d\n",
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
187 folve_rt.status_port);
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
188 }
189 }
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
190
a90d922 @hzeller o Separate sanitizing of config subdirectories.
authored
191 folve_rt.fs->SetupInitialConfig();
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
192 return NULL;
193 }
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
194
0a3400d @hzeller o Write when we're exiting.
authored
195 static void folve_destroy(void *) {
4e69b5b @hzeller o Provide a way to see what readdir() yields. Some media servers
authored
196 if (folve_rt.readdir_dump_file) {
197 fclose(folve_rt.readdir_dump_file);
198 }
db66f7d @hzeller o print which directory is serviced.
authored
199 syslog(LOG_INFO, "Exiting.");
0a3400d @hzeller o Write when we're exiting.
authored
200 }
201
b698853 @hzeller o README updates.
authored
202 static int usage(const char *prg) {
8fb28ec @hzeller Making README.md more readable thanks to wordsmithing input from
authored
203 printf("usage: %s [options] <original-dir> <mount-point-dir>\n", prg);
5830c5a @hzeller o Switch logging to syslog()
authored
204 printf("Options: (in sequence of usefulness)\n"
31096bb @hzeller o remove option -c and add -C: give a base directory for all filters.
authored
205 "\t-C <cfg-dir> : Convolver base configuration directory.\n"
206 "\t Sub-directories name the different filters.\n"
1971a4a @hzeller o No more radio buttons.
authored
207 "\t Select on the HTTP status page.\n"
5830c5a @hzeller o Switch logging to syslog()
authored
208 "\t-p <port> : Port to run the HTTP status server on.\n"
436f57d @hzeller o Have a default refresh time of 10 seconds.
authored
209 "\t-r <refresh> : Seconds between refresh of status page;\n"
210 "\t Default is %d seconds; switch off with -1.\n"
f9b9bc9 @hzeller o gapless not experimental anymore.
authored
211 "\t-g : Gapless convolving alphabetically adjacent files.\n"
20e139c @hzeller o Less cluttered output in UI if -D is not set.
authored
212 "\t-D : Moderate volume Folve debug messages to syslog,\n"
213 "\t and some more detailed configuration info in UI\n"
5830c5a @hzeller o Switch logging to syslog()
authored
214 "\t-f : Operate in foreground; useful for debugging.\n"
8fb28ec @hzeller Making README.md more readable thanks to wordsmithing input from
authored
215 "\t-o <mnt-opt> : other generic mount parameters passed to FUSE.\n"
216 "\t-d : High volume FUSE debug log. Implies -f.\n",
4e69b5b @hzeller o Provide a way to see what readdir() yields. Some media servers
authored
217 "\t-R <file> : Debug readdir() calls. Debug output to file.\n",
436f57d @hzeller o Have a default refresh time of 10 seconds.
authored
218 folve_rt.refresh_time);
8b18938 @hzeller o some comment changes. Ready to do some flac handling.
authored
219 return 1;
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
220 }
221
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
222 struct FolveConfig {
223 FolveConfig() : base_dir(NULL), config_dir(NULL), port(-1) {}
224 const char *base_dir;
225 const char *mount_point;
226 const char *config_dir;
227 int port;
228 };
229
230 enum {
231 FOLVE_OPT_PORT = 42,
a372a03 @hzeller o Make meta-refresh configurable.
authored
232 FOLVE_OPT_REFRESH_TIME,
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
233 FOLVE_OPT_CONFIG,
5830c5a @hzeller o Switch logging to syslog()
authored
234 FOLVE_OPT_DEBUG,
4e69b5b @hzeller o Provide a way to see what readdir() yields. Some media servers
authored
235 FOLVE_OPT_DEBUG_READDIR,
08bbf28 @hzeller o First shot at gapless. Works pretty well for my test-case.
authored
236 FOLVE_OPT_GAPLESS,
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
237 };
238
239 int FolveOptionHandling(void *data, const char *arg, int key,
240 struct fuse_args *outargs) {
df18f63 @hzeller o Make path-names to filters and base-directory absolute
authored
241 char realpath_buf[PATH_MAX]; // running as daemon, need absolute names.
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
242 FolveRuntime *rt = (FolveRuntime*) data;
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
243 switch (key) {
244 case FUSE_OPT_KEY_NONOPT:
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
245 // First non-opt: our underlying dir.
246 if (rt->fs->underlying_dir().empty()) {
cf1b0e0 @hzeller o README demo tweaking
authored
247 const char *base_dir = realpath(arg, realpath_buf);
248 if (base_dir != NULL) {
249 rt->fs->set_underlying_dir(base_dir);
250 } else {
251 fprintf(stderr, "Invalid base path '%s': %s\n",
252 arg, strerror(errno));
fa525ee @hzeller o If we find problems in the options, complain and exit.
authored
253 rt->parameter_error = true;
cf1b0e0 @hzeller o README demo tweaking
authored
254 }
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
255 return 0; // we consumed this.
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
256 } else {
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
257 rt->mount_point = strdup(arg); // remmber as FYI
258 return 1; // .. but leave it to fuse
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
259 }
260 case FOLVE_OPT_PORT:
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
261 rt->status_port = atoi(arg + 2); // strip "-p"
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
262 return 0;
a372a03 @hzeller o Make meta-refresh configurable.
authored
263 case FOLVE_OPT_REFRESH_TIME:
264 rt->refresh_time = atoi(arg + 2); // strip "-r"
265 return 0;
cf1b0e0 @hzeller o README demo tweaking
authored
266 case FOLVE_OPT_CONFIG: {
31096bb @hzeller o remove option -c and add -C: give a base directory for all filters.
authored
267 const char *config_dir = realpath(arg + 2, realpath_buf); // strip "-C"
cf1b0e0 @hzeller o README demo tweaking
authored
268 if (config_dir != NULL) {
31096bb @hzeller o remove option -c and add -C: give a base directory for all filters.
authored
269 rt->fs->SetBaseConfigDir(config_dir);
cf1b0e0 @hzeller o README demo tweaking
authored
270 } else {
39fece1 @hzeller o remove debug ui feature. Not really used and disabled for a while.
authored
271 fprintf(stderr, "Invalid config dir '%s': %s\n", arg + 2, strerror(errno));
fa525ee @hzeller o If we find problems in the options, complain and exit.
authored
272 rt->parameter_error = true;
cf1b0e0 @hzeller o README demo tweaking
authored
273 }
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
274 return 0;
cf1b0e0 @hzeller o README demo tweaking
authored
275 }
5830c5a @hzeller o Switch logging to syslog()
authored
276 case FOLVE_OPT_DEBUG:
7689c9a @hzeller o preparation to extract classes from folve-filesystem into their
authored
277 folve::EnableDebugLog(true);
5830c5a @hzeller o Switch logging to syslog()
authored
278 return 0;
4e69b5b @hzeller o Provide a way to see what readdir() yields. Some media servers
authored
279 case FOLVE_OPT_DEBUG_READDIR:
280 rt->readdir_dump_file = fopen(arg + 2, "w");
281 return 0;
08bbf28 @hzeller o First shot at gapless. Works pretty well for my test-case.
authored
282 case FOLVE_OPT_GAPLESS:
283 rt->fs->set_gapless_processing(true);
284 return 0;
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
285 }
286 return 1;
287 }
288
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
289 int main(int argc, char *argv[]) {
1e9ff21 @hzeller o main: report if parameters are not directories.
authored
290 const char *progname = argv[0];
8b18938 @hzeller o some comment changes. Ready to do some flac handling.
authored
291 if (argc < 4) {
1e9ff21 @hzeller o main: report if parameters are not directories.
authored
292 return usage(progname);
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
293 }
49eca7f @hzeller o add syslog as preparation for parameter handling.
authored
294
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
295 folve_rt.fs = new FolveFilesystem();
296
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
297 static struct fuse_opt folve_options[] = {
5830c5a @hzeller o Switch logging to syslog()
authored
298 FUSE_OPT_KEY("-p ", FOLVE_OPT_PORT),
a372a03 @hzeller o Make meta-refresh configurable.
authored
299 FUSE_OPT_KEY("-r ", FOLVE_OPT_REFRESH_TIME),
31096bb @hzeller o remove option -c and add -C: give a base directory for all filters.
authored
300 FUSE_OPT_KEY("-C ", FOLVE_OPT_CONFIG),
5830c5a @hzeller o Switch logging to syslog()
authored
301 FUSE_OPT_KEY("-D", FOLVE_OPT_DEBUG),
4e69b5b @hzeller o Provide a way to see what readdir() yields. Some media servers
authored
302 FUSE_OPT_KEY("-R ", FOLVE_OPT_DEBUG_READDIR),
08bbf28 @hzeller o First shot at gapless. Works pretty well for my test-case.
authored
303 FUSE_OPT_KEY("-g", FOLVE_OPT_GAPLESS),
cca212e @hzeller o document compile error with old version of fuse.
authored
304 FUSE_OPT_END // This fails to compile for fuse <= 2.8.1; get >= 2.8.4
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
305 };
306 struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
ee675fe @hzeller o Provide a way to select between different filter diretories.
authored
307 fuse_opt_parse(&args, &folve_rt, folve_options, FolveOptionHandling);
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
308
fa525ee @hzeller o If we find problems in the options, complain and exit.
authored
309 if (folve_rt.parameter_error || !folve_rt.fs->CheckInitialized()) {
1e9ff21 @hzeller o main: report if parameters are not directories.
authored
310 return usage(progname);
311 }
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
312
313 struct fuse_operations folve_operations;
314 memset(&folve_operations, 0, sizeof(folve_operations));
8d1fbe7 @hzeller o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
authored
315
0a3400d @hzeller o Write when we're exiting.
authored
316 // Start/stop. Will write to syslog and start auxiliary http service.
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
317 folve_operations.init = folve_init;
0a3400d @hzeller o Write when we're exiting.
authored
318 folve_operations.destroy = folve_destroy;
8d1fbe7 @hzeller o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
authored
319
320 // Basic operations to make navigation work.
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
321 folve_operations.readdir = folve_readdir;
322 folve_operations.readlink = folve_readlink;
8d1fbe7 @hzeller o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
authored
323
324 // open() and close() file.
38cdeb1 @hzeller o whitespace changes.
authored
325 folve_operations.open = folve_open;
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
326 folve_operations.release = folve_release;
8d1fbe7 @hzeller o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
authored
327
328 // Actual workhorse: reading a file and returning predicted file-size
0330f76 @hzeller o Only start status server after we're daemonized, otherwise
authored
329 folve_operations.read = folve_read;
330 folve_operations.fgetattr = folve_fgetattr;
331 folve_operations.getattr = folve_getattr;
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
332
27c44cd @hzeller o Use fuse option handling to extract our flags and options.
authored
333 return fuse_main(args.argc, args.argv, &folve_operations, NULL);
98a5725 @hzeller o Start implementation. Just a basic forwarding filesystem for
authored
334 }
Something went wrong with that request. Please try again.