From b8e5a73d12367281bd9d5ecb6d1a6886582fa0d0 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Sun, 17 Aug 2008 14:37:05 +0200 Subject: - Simplify mfs_file_data_from_path a lot and rename it to mfs_realpath, which have the objective of looking up the real file path, given the musicfs path. Some thoughts: Instead of creating a function for each operation we want to do, this change adds a mfs_lookup_path which allocates a buffer with the real path of the file we're looking for. This way, we can do the operations we want on the path externally instead, which is a lot simpler when using it. This also gets rid of the file_data data structure, and just use a pointer pointer where one is to allocate the real path. --- include/musicfs.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/musicfs.h b/include/musicfs.h index 8443198..5c141c3 100644 --- a/include/musicfs.h +++ b/include/musicfs.h @@ -42,14 +42,6 @@ struct filler_data { 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 @@ -59,10 +51,8 @@ enum mfs_filetype { MFS_NOTFOUND, MFS_FILE, MFS_DIRECTORY }; 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; +/* Lookup real pathname for a file. */ +lookup_fn_t mfs_lookup_path; /* Lookup function loading a path into DB */ lookup_fn_t mfs_lookup_load_path; @@ -77,7 +67,7 @@ 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 *); +int mfs_realpath(const char *, char **); int mfs_reload_config(); char *mfs_get_home_path(const char *); -- cgit v1.2.3