diff options
author | Ulf Lilleengen <lulf@carrot.studby.ntnu.no> | 2008-08-17 14:37:05 +0200 |
---|---|---|
committer | Ulf Lilleengen <lulf@carrot.studby.ntnu.no> | 2008-08-17 14:37:05 +0200 |
commit | b8e5a73d12367281bd9d5ecb6d1a6886582fa0d0 (patch) | |
tree | 4f844af17b4340dbb485b41eb25dceeca4bb88a7 /include | |
parent | ea89c89fff226f0f9eef485afa38ef4833aaa824 (diff) |
- 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.
Diffstat (limited to 'include')
-rw-r--r-- | include/musicfs.h | 16 |
1 files changed, 3 insertions, 13 deletions
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 *); |