summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mp3_opt_parse.c16
-rw-r--r--src/mp3_subr.c1
-rwxr-xr-xsrc/mp3_vnops.c9
-rwxr-xr-xsrc/mp3fs.c25
4 files changed, 27 insertions, 24 deletions
diff --git a/src/mp3_opt_parse.c b/src/mp3_opt_parse.c
deleted file mode 100644
index 6419c72..0000000
--- a/src/mp3_opt_parse.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-#include <fuse_opt.h>
-
-extern char *sourcedir;
-
-static int mp3fs_opt_proc (void *data, const char *arg, int key,
- struct fuse_args *outargs)
-{
- if (key == FUSE_OPT_KEY_NONOPT && !sourcedir) {
- /* The source directory isn't already set, let's do it */
- sourcedir = arg;
- return (0);
- }
- else
- return (1);
-}
diff --git a/src/mp3_subr.c b/src/mp3_subr.c
new file mode 100644
index 0000000..a570139
--- /dev/null
+++ b/src/mp3_subr.c
@@ -0,0 +1 @@
+/* Miscellaneous subroutines for mp3fs. */
diff --git a/src/mp3_vnops.c b/src/mp3_vnops.c
index bb59b88..9d60a98 100755
--- a/src/mp3_vnops.c
+++ b/src/mp3_vnops.c
@@ -73,9 +73,16 @@ static int mp3_read (const char *path, char *buf, size_t size, off_t offset,
return -ENOENT;
}
-static struct fuse_operations mp3_oper = {
+static struct fuse_operations mp3_ops = {
.getattr = mp3_getattr,
.readdir = mp3_readdir,
.open = mp3_open,
.read = mp3_read,
};
+
+int
+mp3_run(struct fuse_args *args)
+{
+
+ return (fuse_main(args->argc, args->argv, &mp3_ops, NULL));
+}
diff --git a/src/mp3fs.c b/src/mp3fs.c
index f8e4cba..ebc1c27 100755
--- a/src/mp3fs.c
+++ b/src/mp3fs.c
@@ -4,13 +4,11 @@
#include <stdlib.h>
#include <stdio.h>
#include <fuse.h>
+#include <fuse_opt.h>
+#include <mp3fs.h>
-#include "mp3_vnops.c"
-#include "mp3_opt_parse.c"
-
-/* static struct fuse_module mp3_mod { */
-/* .name = "MP3FS" */
-/* }; */
+/* Prototypes. */
+static int mp3fs_opt_proc (void *, const char *, int, struct fuse_args *);
/* Just for testing the argument parsing. TODO: fix something better */
char *sourcedir = NULL;
@@ -23,5 +21,18 @@ main(int argc, char **argv)
if (fuse_opt_parse(&args, NULL, NULL, mp3fs_opt_proc) != 0)
exit (1);
- return (fuse_main (args.argc, args.argv, &mp3_oper, NULL));
+ printf("Starting up mp3fs\n");
+ mp3_run(&args);
+ printf("Shutting down mp3fs\n");
+}
+
+static int mp3fs_opt_proc (void *data, const char *arg, int key,
+ struct fuse_args *outargs)
+{
+ if (key == FUSE_OPT_KEY_NONOPT && !sourcedir) {
+ /* The source directory isn't already set, let's do it */
+ sourcedir = arg;
+ return (0);
+ }
+ return (-1);
}