summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Ørbekk <orbekk@pvv.ntnu.no>2008-08-14 11:48:45 +0200
committerKjetil Ørbekk <orbekk@pvv.ntnu.no>2008-08-14 12:01:09 +0200
commitde84f0b82b5cf461a83aa4fac108856c591faf3c (patch)
treeced5c015c919404599888a2aea50edd9a59ea007
parent62bfd37585fb26c5bfcd9da02a0b6fd6f268b118 (diff)
- Renamed mp3fs to musicfs
-rw-r--r--Makefile2
-rwxr-xr-xREADME5
-rw-r--r--include/mp3fs.h63
-rw-r--r--include/musicfs.h63
-rw-r--r--src/mp3_subr.c158
-rwxr-xr-xsrc/mp3_vnops.c58
-rwxr-xr-xsrc/mp3fs.c10
7 files changed, 180 insertions, 179 deletions
diff --git a/Makefile b/Makefile
index 0681845..23e9755 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ CC = gcc
C_FILES = $(wildcard src/*.c)
OBJS = $(C_FILES:.c=.o) \
-PROGRAM = mp3fs
+PROGRAM = musicfs
all: $(PROGRAM)
diff --git a/README b/README
index 1dbf88b..f17e811 100755
--- a/README
+++ b/README
@@ -1,5 +1,6 @@
-MP3FS is a FUSE module implementing a mp3 filesystem in userland. The purpose of
-mp3fs is to provide filesystem hierarchy based on id3 tags of mp3-files.
+musicfs is a FUSE module implementing a mp3 filesystem in
+userland. The purpose of musicfs is to provide filesystem hierarchy
+based on id3 tags of mp3-files.
Dependencies
~~~~~~~~~~~~
diff --git a/include/mp3fs.h b/include/mp3fs.h
deleted file mode 100644
index 3de2ffc..0000000
--- a/include/mp3fs.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef _MP3FS_H_
-#define _MP3FS_H_
-struct fuse_args;
-
-#define DBNAME "music.db"
-
-int mp3_run(int, char **);
-int mp3_initscan(char *);
-
-
-/*
- * Functions traversing the underlying filesystem and do operations on the
- * files, for instance scanning the collection.
- */
-typedef void traverse_fn_t(char *);
-void traverse_hierarchy(char *, traverse_fn_t);
-traverse_fn_t mp3_scan;
-
-/*
- * Data passed to mp3_lookup_list
- */
-struct filler_data {
- void *buf;
- fuse_fill_dir_t filler;
-};
-
-/*
- * Data passed to mp3_lookup_open
- */
-struct file_data {
- int fd;
- int found;
-};
-
-#define LIST_DATATYPE_STRING 1
-#define LIST_DATATYPE_INT 2
-
-enum mp3_filetype { MP3_NOTFOUND, MP3_FILE, MP3_DIRECTORY };
-
-/* A lookup functions returns 0 if it's finished. */
-typedef int lookup_fn_t(void *, const char *);
-/* Lookup function listing each row. */
-lookup_fn_t mp3_lookup_list;
-/* Lookup function opening the first file match. */
-lookup_fn_t mp3_lookup_open;
-/* Lookup function stat'ing a file. */
-lookup_fn_t mp3_lookup_stat;
-
-struct lookuphandle;
-
-struct lookuphandle *mp3_lookup_start(int, void *, lookup_fn_t *, const char *);
-void mp3_lookup_insert(struct lookuphandle *, void *, int);
-void mp3_lookup_finish(struct lookuphandle *);
-
-void mp3_lookup_artist(const char *, struct filler_data *);
-void mp3_lookup_genre(const char *, struct filler_data *);
-void mp3_lookup_album(const char *, struct filler_data *);
-char *mp3_gettoken(const char *, int);
-int mp3_numtoken(const char *);
-int mp3_file_data_for_path(const char *, void *);
-
-enum mp3_filetype mp3_get_filetype(const char *);
-#endif
diff --git a/include/musicfs.h b/include/musicfs.h
new file mode 100644
index 0000000..5f92946
--- /dev/null
+++ b/include/musicfs.h
@@ -0,0 +1,63 @@
+#ifndef _MP3FS_H_
+#define _MP3FS_H_
+struct fuse_args;
+
+#define DBNAME "music.db"
+
+int mfs_run(int, char **);
+int mfs_initscan(char *);
+
+
+/*
+ * Functions traversing the underlying filesystem and do operations on the
+ * files, for instance scanning the collection.
+ */
+typedef void traverse_fn_t(char *);
+void traverse_hierarchy(char *, traverse_fn_t);
+traverse_fn_t mfs_scan;
+
+/*
+ * Data passed to mfs_lookup_list
+ */
+struct filler_data {
+ void *buf;
+ fuse_fill_dir_t filler;
+};
+
+/*
+ * Data passed to mfs_lookup_open
+ */
+struct file_data {
+ int fd;
+ int found;
+};
+
+#define LIST_DATATYPE_STRING 1
+#define LIST_DATATYPE_INT 2
+
+enum mfs_filetype { MFS_NOTFOUND, MFS_FILE, MFS_DIRECTORY };
+
+/* A lookup functions returns 0 if it's finished. */
+typedef int lookup_fn_t(void *, const char *);
+/* Lookup function listing each row. */
+lookup_fn_t mfs_lookup_list;
+/* Lookup function opening the first file match. */
+lookup_fn_t mfs_lookup_open;
+/* Lookup function stat'ing a file. */
+lookup_fn_t mfs_lookup_stat;
+
+struct lookuphandle;
+
+struct lookuphandle *mfs_lookup_start(int, void *, lookup_fn_t *, const char *);
+void mfs_lookup_insert(struct lookuphandle *, void *, int);
+void mfs_lookup_finish(struct lookuphandle *);
+
+void mfs_lookup_artist(const char *, struct filler_data *);
+void mfs_lookup_genre(const char *, struct filler_data *);
+void mfs_lookup_album(const char *, struct filler_data *);
+char *mfs_gettoken(const char *, int);
+int mfs_numtoken(const char *);
+int mfs_file_data_for_path(const char *, void *);
+
+enum mfs_filetype mfs_get_filetype(const char *);
+#endif
diff --git a/src/mp3_subr.c b/src/mp3_subr.c
index 2e6ad7a..22e533a 100644
--- a/src/mp3_subr.c
+++ b/src/mp3_subr.c
@@ -1,5 +1,5 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* Miscellaneous subroutines for mp3fs. */
+/* Miscellaneous subroutines for musicfs. */
#define FUSE_USE_VERSION 26
#include <stdio.h>
#include <errno.h>
@@ -13,7 +13,7 @@
#include <fuse.h>
#include <tag_c.h>
-#include <mp3fs.h>
+#include <musicfs.h>
#include <sqlite3.h>
#include <debug.h>
@@ -30,7 +30,7 @@ struct lookuphandle {
sqlite3 *handle;
int
-mp3_initscan(char *musicpath)
+mfs_initscan(char *musicpath)
{
int error;
@@ -41,7 +41,7 @@ mp3_initscan(char *musicpath)
sqlite3_close(handle);
return (-1);
}
- traverse_hierarchy(musicpath, mp3_scan);
+ traverse_hierarchy(musicpath, mfs_scan);
sqlite3_close(handle);
return (0);
}
@@ -88,7 +88,7 @@ traverse_hierarchy(char *dirpath, traverse_fn_t fileop)
/* Scan the music initially. */
void
-mp3_scan(char *filepath)
+mfs_scan(char *filepath)
{
TagLib_File *file;
TagLib_Tag *tag;
@@ -273,7 +273,7 @@ mp3_scan(char *filepath)
* resources and return the handle.
*/
struct lookuphandle *
-mp3_lookup_start(int field, void *data, lookup_fn_t *fn, const char *query)
+mfs_lookup_start(int field, void *data, lookup_fn_t *fn, const char *query)
{
struct lookuphandle *lh;
int ret, error;
@@ -304,10 +304,10 @@ mp3_lookup_start(int field, void *data, lookup_fn_t *fn, const char *query)
/*
* Insert data that should be searched for in the list. The data is assumed to
- * be dynamically allocated, and will be free'd when mp3_lookup_finish is called!
+ * be dynamically allocated, and will be free'd when mfs_lookup_finish is called!
*/
void
-mp3_lookup_insert(struct lookuphandle *lh, void *data, int type)
+mfs_lookup_insert(struct lookuphandle *lh, void *data, int type)
{
char *str;
int val;
@@ -329,7 +329,7 @@ mp3_lookup_insert(struct lookuphandle *lh, void *data, int type)
* returned data. Free the handle when done.
*/
void
-mp3_lookup_finish(struct lookuphandle *lh)
+mfs_lookup_finish(struct lookuphandle *lh)
{
char buf[1024];
const unsigned char *value;
@@ -373,7 +373,7 @@ mp3_lookup_finish(struct lookuphandle *lh)
* returns 0 on success
*/
int
-mp3_file_data_for_path(const char *path, void *data) {
+mfs_file_data_for_path(const char *path, void *data) {
DEBUG("getting file data for %s\n", path);
struct file_data *fd;
fd = (struct file_data *)data;
@@ -386,61 +386,61 @@ mp3_file_data_for_path(const char *path, void *data) {
/* Open a specific track. */
if (strncmp(path, "/Tracks", 7) == 0) {
- switch (mp3_numtoken(path)) {
+ switch (mfs_numtoken(path)) {
case 2:
- title = mp3_gettoken(path, 2);
+ title = mfs_gettoken(path, 2);
if (title == NULL)
break;
- lh = mp3_lookup_start(0, fd, mp3_lookup_open,
+ lh = mfs_lookup_start(0, fd, mfs_lookup_open,
"SELECT filepath FROM song "
"WHERE (artistname||' - '||title||'.'||extension) LIKE ?");
if (lh == NULL)
return (-EIO);
- mp3_lookup_insert(lh, title, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, title, LIST_DATATYPE_STRING);
break;
default:
return (-ENOENT);
}
} else if (strncmp(path, "/Albums", 7) == 0) {
- switch (mp3_numtoken(path)) {
+ switch (mfs_numtoken(path)) {
case 3:
- album = mp3_gettoken(path, 2);
+ album = mfs_gettoken(path, 2);
if (album == NULL)
break;
- title = mp3_gettoken(path, 3);
+ title = mfs_gettoken(path, 3);
if (title == NULL)
break;
- lh = mp3_lookup_start(0, fd, mp3_lookup_open,
+ lh = mfs_lookup_start(0, fd, mfs_lookup_open,
"SELECT filepath FROM song "
"WHERE (title||'.'||extension) LIKE ? AND "
"album LIKE ?");
if (lh == NULL)
return (-EIO);
- mp3_lookup_insert(lh, title, LIST_DATATYPE_STRING);
- mp3_lookup_insert(lh, album, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, title, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, album, LIST_DATATYPE_STRING);
break;
default:
return (-ENOENT);
}
} else if (strncmp(path, "/Artists", 8) == 0) {
- switch (mp3_numtoken(path)) {
+ switch (mfs_numtoken(path)) {
case 4:
- artist = mp3_gettoken(path, 2);
- album = mp3_gettoken(path, 3);
- title = mp3_gettoken(path, 4);
+ artist = mfs_gettoken(path, 2);
+ album = mfs_gettoken(path, 3);
+ title = mfs_gettoken(path, 4);
DEBUG("artist(%s) album(%s) title(%s)\n", artist, album, title);
if (!(artist && album && title)) {
break;
}
- lh = mp3_lookup_start(0, fd, mp3_lookup_open,
+ lh = mfs_lookup_start(0, fd, mfs_lookup_open,
"SELECT filepath FROM song WHERE artistname LIKE ? AND "
"album LIKE ? AND "
"(LTRIM(track||' ')||title||'.'||extension) LIKE ?");
if (lh == NULL)
return (-EIO);
- mp3_lookup_insert(lh, artist, LIST_DATATYPE_STRING);
- mp3_lookup_insert(lh, album, LIST_DATATYPE_STRING);
- mp3_lookup_insert(lh, title, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, artist, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, album, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, title, LIST_DATATYPE_STRING);
break;
default:
return (-ENOENT);
@@ -448,7 +448,7 @@ mp3_file_data_for_path(const char *path, void *data) {
}
if (lh) {
- mp3_lookup_finish(lh);
+ mfs_lookup_finish(lh);
}
return 0;
@@ -459,7 +459,7 @@ mp3_file_data_for_path(const char *path, void *data) {
* XXX: should we strip the first and last?
*/
int
-mp3_numtoken(const char *str)
+mfs_numtoken(const char *str)
{
const char *ptr;
int num;
@@ -481,7 +481,7 @@ mp3_numtoken(const char *str)
* Extract token number toknum and return it in escaped form.
*/
char *
-mp3_gettoken(const char *str, int toknum)
+mfs_gettoken(const char *str, int toknum)
{
const char *ptr, *start, *end;
char *ret, *dest;
@@ -529,122 +529,122 @@ mp3_gettoken(const char *str, int toknum)
* List album given a path.
*/
void
-mp3_lookup_album(const char *path, struct filler_data *fd)
+mfs_lookup_album(const char *path, struct filler_data *fd)
{
struct lookuphandle *lh;
char *album;
- switch (mp3_numtoken(path)) {
+ switch (mfs_numtoken(path)) {
case 1:
- lh = mp3_lookup_start(0, fd, mp3_lookup_list,
+ lh = mfs_lookup_start(0, fd, mfs_lookup_list,
"SELECT DISTINCT album FROM song");
break;
case 2:
/* So, now we got to find out the artist and list its albums. */
- album = mp3_gettoken(path, 2);
+ album = mfs_gettoken(path, 2);
if (album == NULL)
break;
- lh = mp3_lookup_start(0, fd, mp3_lookup_list,
+ lh = mfs_lookup_start(0, fd, mfs_lookup_list,
"SELECT DISTINCT title||'.'||extension FROM song "
"WHERE album LIKE ?");
- mp3_lookup_insert(lh, album, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, album, LIST_DATATYPE_STRING);
break;
}
- mp3_lookup_finish(lh);
+ mfs_lookup_finish(lh);
}
/*
* List artist given a path.
*/
void
-mp3_lookup_artist(const char *path, struct filler_data *fd)
+mfs_lookup_artist(const char *path, struct filler_data *fd)
{
struct lookuphandle *lh;
char *name, *album;
- switch (mp3_numtoken(path)) {
+ switch (mfs_numtoken(path)) {
case 1:
- lh = mp3_lookup_start(0, fd, mp3_lookup_list,
+ lh = mfs_lookup_start(0, fd, mfs_lookup_list,
"SELECT name FROM artist");
break;
case 2:
/* So, now we got to find out the artist and list its albums. */
- name = mp3_gettoken(path, 2);
+ name = mfs_gettoken(path, 2);
if (name == NULL)
break;
- lh = mp3_lookup_start(0, fd, mp3_lookup_list,
+ lh = mfs_lookup_start(0, fd, mfs_lookup_list,
"SELECT DISTINCT album FROM song, "
"artist WHERE song.artistname = artist.name AND artist.name"
" LIKE ?");
- mp3_lookup_insert(lh, name, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, name, LIST_DATATYPE_STRING);
break;
case 3:
/* List songs in an album. */
- name = mp3_gettoken(path, 2);
+ name = mfs_gettoken(path, 2);
if (name == NULL)
break;
- album = mp3_gettoken(path, 3);
+ album = mfs_gettoken(path, 3);
if (album == NULL)
break;
- lh = mp3_lookup_start(0, fd, mp3_lookup_list,
+ lh = mfs_lookup_start(0, fd, mfs_lookup_list,
"SELECT LTRIM(track||' ')||title||'.'||extension "
"FROM song, artist "
"WHERE song.artistname = artist.name AND artist.name "
"LIKE ? AND song.album LIKE ?");
- mp3_lookup_insert(lh, name, LIST_DATATYPE_STRING);
- mp3_lookup_insert(lh, album, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, name, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, album, LIST_DATATYPE_STRING);
break;
}
- mp3_lookup_finish(lh);
+ mfs_lookup_finish(lh);
}
/*
* Looks up tracks given a genre, or all genres.
*/
void
-mp3_lookup_genre(const char *path, struct filler_data *fd)
+mfs_lookup_genre(const char *path, struct filler_data *fd)
{
struct lookuphandle *lh;
char *genre, *album;
- switch (mp3_numtoken(path)) {
+ switch (mfs_numtoken(path)) {
case 1:
- lh = mp3_lookup_start(0, fd, mp3_lookup_list,
+ lh = mfs_lookup_start(0, fd, mfs_lookup_list,
"SELECT name FROM genre");
break;
case 2:
- genre = mp3_gettoken(path, 2);
+ genre = mfs_gettoken(path, 2);
if (genre == NULL)
break;
- lh = mp3_lookup_start(0, fd, mp3_lookup_list,
+ lh = mfs_lookup_start(0, fd, mfs_lookup_list,
"SELECT DISTINCT album FROM song, "
"genre WHERE song.genrename = genre.name AND genre.name "
"LIKE ?");
- mp3_lookup_insert(lh, genre, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, genre, LIST_DATATYPE_STRING);
break;
case 3:
- genre = mp3_gettoken(path, 2);
+ genre = mfs_gettoken(path, 2);
if (genre == NULL)
break;
- album = mp3_gettoken(path, 3);
+ album = mfs_gettoken(path, 3);
if (album == NULL)
break;
- lh = mp3_lookup_start(0, fd, mp3_lookup_list,
+ lh = mfs_lookup_start(0, fd, mfs_lookup_list,
"SELECT title||'.'||extension FROM song, genre WHERE"
" song.genrename = genre.name AND genre.name LIKE ? "
" AND song.album LIKE ?");
- mp3_lookup_insert(lh, genre, LIST_DATATYPE_STRING);
- mp3_lookup_insert(lh, album, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, genre, LIST_DATATYPE_STRING);
+ mfs_lookup_insert(lh, album, LIST_DATATYPE_STRING);
break;
}
- mp3_lookup_finish(lh);
+ mfs_lookup_finish(lh);
}
/*
* Lookup function for filling given data into a filler.
*/
int
-mp3_lookup_list(void *data, const char *str)
+mfs_lookup_list(void *data, const char *str)
{
struct filler_data *fd;
@@ -657,7 +657,7 @@ mp3_lookup_list(void *data, const char *str)
* Lookup a file and open it if found.
*/
int
-mp3_lookup_open(void *data, const char *str)
+mfs_lookup_open(void *data, const char *str)
{
struct file_data *fd;
@@ -672,7 +672,7 @@ mp3_lookup_open(void *data, const char *str)
* XXX: watch out for duplicates, we might stat more than once.
*/
int
-mp3_lookup_stat(void *data, const char *str)
+mfs_lookup_stat(void *data, const char *str)
{
struct stat *st;
@@ -692,12 +692,12 @@ mp3_lookup_stat(void *data, const char *str)
*
* - /Tracks/Whatever should be a file, since Whatever is a song
*
- * Note: This should only be used for paths inside the mp3fs
+ * Note: This should only be used for paths inside the musicfs
* directories (Artists, Tracks, ...)
*/
-enum mp3_filetype
-mp3_get_filetype(const char *path) {
- int tokens = mp3_numtoken(path);
+enum mfs_filetype
+mfs_get_filetype(const char *path) {
+ int tokens = mfs_numtoken(path);
if (strncmp(path, "/Genres", 7) == 0 ||
strncmp(path, "/Artists", 8) == 0) {
@@ -705,32 +705,32 @@ mp3_get_filetype(const char *path) {
case 1:
case 2:
case 3:
- return (MP3_DIRECTORY);
+ return (MFS_DIRECTORY);
case 4:
- return (MP3_FILE);
+ return (MFS_FILE);
default:
- return (MP3_NOTFOUND);
+ return (MFS_NOTFOUND);
}
} else if (strncmp(path, "/Albums", 7) == 0) {
switch (tokens) {
case 1:
case 2:
- return (MP3_DIRECTORY);
+ return (MFS_DIRECTORY);
case 3:
- return (MP3_FILE);
+ return (MFS_FILE);
default:
- return (MP3_NOTFOUND);
+ return (MFS_NOTFOUND);
}
} else if (strncmp(path, "/Tracks", 7) == 0) {
switch (tokens) {
case 1:
- return (MP3_DIRECTORY);
+ return (MFS_DIRECTORY);
case 2:
- return (MP3_FILE);
+ return (MFS_FILE);
default:
- return (MP3_NOTFOUND);
+ return (MFS_NOTFOUND);
}
} else {
- return (MP3_NOTFOUND);
+ return (MFS_NOTFOUND);
}
}
diff --git a/src/mp3_vnops.c b/src/mp3_vnops.c
index 26f02a6..92a314c 100755
--- a/src/mp3_vnops.c
+++ b/src/mp3_vnops.c
@@ -14,13 +14,13 @@
#include <unistd.h>
#include <tag_c.h>
-#include <mp3fs.h>
+#include <musicfs.h>
#include <debug.h>
-char musicpath[MAXPATHLEN]; // = "/home/lulf/dev/mp3fs/music";
-char *logpath = "/home/lulf/dev/mp3fs/mp3fs.log";
+char musicpath[MAXPATHLEN]; // = "/home/lulf/dev/musicfs/music";
+char *logpath = "/home/lulf/dev/musicfs/musicfs.log";
-static int mp3_getattr (const char *path, struct stat *stbuf)
+static int mfs_getattr (const char *path, struct stat *stbuf)
{
struct file_data fd;
fd.fd = -1;
@@ -35,16 +35,16 @@ static int mp3_getattr (const char *path, struct stat *stbuf)
return 0;
}
- enum mp3_filetype type = mp3_get_filetype(path);
+ enum mfs_filetype type = mfs_get_filetype(path);
switch (type) {
- case MP3_DIRECTORY:
+ case MFS_DIRECTORY:
stbuf->st_mode = S_IFDIR | 0444;
stbuf->st_nlink = 1;
stbuf->st_size = 12;
return 0;
- case MP3_FILE:
- status = mp3_file_data_for_path(path, &fd);
+ case MFS_FILE:
+ status = mfs_file_data_for_path(path, &fd);
if (status != 0)
return (status);
@@ -58,14 +58,14 @@ static int mp3_getattr (const char *path, struct stat *stbuf)
else
return (-ENOENT);
- case MP3_NOTFOUND:
+ case MFS_NOTFOUND:
default:
return -ENOENT;
}
}
-static int mp3_readdir (const char *path, void *buf, fuse_fill_dir_t filler,
+static int mfs_readdir (const char *path, void *buf, fuse_fill_dir_t filler,
off_t offset, struct fuse_file_info *fi)
{
struct filler_data fd;
@@ -90,32 +90,32 @@ static int mp3_readdir (const char *path, void *buf, fuse_fill_dir_t filler,
* 3. Return the list of those mp3s.
*/
if (strncmp(path, "/Artists", 8) == 0) {
- mp3_lookup_artist(path, &fd);
+ mfs_lookup_artist(path, &fd);
return (0);
} else if (strncmp(path, "/Genres", 7) == 0) {
- mp3_lookup_genre(path, &fd);
+ mfs_lookup_genre(path, &fd);
return (0);
} else if (strcmp(path, "/Tracks") == 0) {
- lh = mp3_lookup_start(0, &fd, mp3_lookup_list,
+ lh = mfs_lookup_start(0, &fd, mfs_lookup_list,
"SELECT DISTINCT artistname||' - '||title||'.'||extension "
"FROM song");
- mp3_lookup_finish(lh);
+ mfs_lookup_finish(lh);
return (0);
} else if (strncmp(path, "/Albums", 7) == 0) {
- mp3_lookup_album(path, &fd);
+ mfs_lookup_album(path, &fd);
return (0);
}
return (-ENOENT);
}
-static int mp3_open (const char *path, struct fuse_file_info *fi)
+static int mfs_open (const char *path, struct fuse_file_info *fi)
{
struct file_data fd;
fd.fd = -1;
fd.found = 0;
- int status = mp3_file_data_for_path(path, &fd);
+ int status = mfs_file_data_for_path(path, &fd);
if (status != 0)
return (status);
@@ -137,7 +137,7 @@ static int mp3_open (const char *path, struct fuse_file_info *fi)
*/
}
-static int mp3_read (const char *path, char *buf, size_t size, off_t offset,
+static int mfs_read (const char *path, char *buf, size_t size, off_t offset,
struct fuse_file_info *fi)
{
struct file_data fd;
@@ -145,7 +145,7 @@ static int mp3_read (const char *path, char *buf, size_t size, off_t offset,
fd.found = 0;
size_t bytes;
- int status = mp3_file_data_for_path(path, &fd);
+ int status = mfs_file_data_for_path(path, &fd);
if (status != 0)
return (status);
@@ -165,14 +165,14 @@ static int mp3_read (const char *path, char *buf, size_t size, off_t offset,
*/
}
-static struct fuse_operations mp3_ops = {
- .getattr = mp3_getattr,
- .readdir = mp3_readdir,
- .open = mp3_open,
- .read = mp3_read,
+static struct fuse_operations mfs_ops = {
+ .getattr = mfs_getattr,
+ .readdir = mfs_readdir,
+ .open = mfs_open,
+ .read = mfs_read,
};
-static int mp3fs_opt_proc (void *data, const char *arg, int key,
+static int musicfs_opt_proc (void *data, const char *arg, int key,
struct fuse_args *outargs)
{
static int musicpath_set = 0;
@@ -187,7 +187,7 @@ static int mp3fs_opt_proc (void *data, const char *arg, int key,
}
int
-mp3_run(int argc, char **argv)
+mfs_run(int argc, char **argv)
{
int ret;
/*
@@ -202,13 +202,13 @@ mp3_run(int argc, char **argv)
struct fuse_args args = FUSE_ARGS_INIT (argc, argv);
- if (fuse_opt_parse(&args, NULL, NULL, mp3fs_opt_proc) != 0)
+ if (fuse_opt_parse(&args, NULL, NULL, musicfs_opt_proc) != 0)
exit (1);
DEBUG("musicpath: %s\n", musicpath);
- mp3_initscan(musicpath);
+ mfs_initscan(musicpath);
ret = 0;
- ret = fuse_main(args.argc, args.argv, &mp3_ops, NULL);
+ ret = fuse_main(args.argc, args.argv, &mfs_ops, NULL);
return (ret);
}
diff --git a/src/mp3fs.c b/src/mp3fs.c
index 3555d20..8690346 100755
--- a/src/mp3fs.c
+++ b/src/mp3fs.c
@@ -5,16 +5,16 @@
#include <stdio.h>
#include <fuse.h>
#include <fuse_opt.h>
-#include <mp3fs.h>
+#include <musicfs.h>
/* Prototypes. */
-static int mp3fs_opt_proc (void *, const char *, int, struct fuse_args *);
+static int musicfs_opt_proc (void *, const char *, int, struct fuse_args *);
int
main(int argc, char **argv)
{
- printf("Starting up mp3fs\n");
- mp3_run(argc, argv);
- printf("Shutting down mp3fs\n");
+ printf("Starting up musicfs\n");
+ mfs_run(argc, argv);
+ printf("Shutting down musicfs\n");
}