#include "cache.h"
#include "playlist.h"
Go to the source code of this file.
Functions | |
void | error_handler (request_rec *r, const char *caller) |
Handles error for the flat file cache subsystem. | |
short | cache_make_dir (request_rec *r, char *dirpath) |
Creates cache subdirectories. | |
void | cache_remove_dir (request_rec *r, DIR *cachedir, char *curdir) |
Removes cache subdirectories. | |
short | cache_init (request_rec *r, mu_config *conf) |
Initializes flat file cache subsystem. | |
short | cache_check_dir (request_rec *r, mu_config *conf, mu_cache_data *cachedata) |
Checks if a directory already exists in the cache. | |
short | cache_check_file (request_rec *r, mu_config *conf, mu_cache_data *cachedata) |
Checks if a file already exists in the cache. | |
mu_ent * | cache_read_file (request_rec *r, mu_ent *head, mu_config *conf, mu_cache_data *cachedata) |
Reads cache file information and fills mu_ent entry accordingly. | |
short | cache_write_file (request_rec *r, mu_ent *p, mu_config *conf, mu_cache_data *cachedata) |
Creates and writes cache file information. |
Any cache implementation (regular files, SQL, or whatever backend) ought to provide the 4 mandatory interfaces:
short cache_check_dir(request_rec *, mu_config *, mu_cache_data *)
short cache_check_file(request_rec *, mu_config *, mu_cache_data *)
mu_ent *cache_read_file(request_rec *, mu_ent *, mu_config *, mu_cache_data *)
short cache_write_file(request_rec *, mu_ent *, mu_config *, mu_cache_data *)
'errno' seems not to be seen as volatile by the compiler, therefore we cannot do "if(mkdir(foo) && errno == EEXIST)" for instance.
No flat file cache support for Solaris.
Solaris support (flat file).
Definition in file cache.c.
|
Checks if a directory already exists in the cache. This function is called when the caller wants to know whether a given directory (as found in the cachedata struct) exists or not in the cache. If the directory exists, the function returns successfully, otherwise it tries to create it if possible and returns accordingly.
Definition at line 285 of file cache.c. References CA_FATAL, CA_MISSARG, cache_init(), cache_make_dir(), mu_config::cache_path, cache_remove_dir(), error_handler(), and mu_cache_data::name. Referenced by make_music_entry(). |
|
Checks if a file already exists in the cache. This function is called when the caller wants to know whether a given file (as found in the cachedata struct) exists or not in the cache. If the file exists, the function returns successfully, providing the FILE stream in cachedata->stream, otherwise it returns a specific error code.
Definition at line 346 of file cache.c. References CA_CREATE, CA_FATAL, CA_MISSARG, cache_init(), mu_config::cache_path, error_handler(), mu_cache_data::name, and mu_cache_data::stream. Referenced by make_music_entry(). |
|
Initializes flat file cache subsystem. Basically we do nothing more here than creating the root cache folder.
Definition at line 258 of file cache.c. References CA_FATAL, cache_make_dir(), mu_config::cache_path, and error_handler(). Referenced by cache_check_dir(), and cache_check_file(). |
|
Creates cache subdirectories. This subroutine takes care of creating all requested directories and subdirectories if they don't already exist and if possible.
Definition at line 168 of file cache.c. References CA_FATAL, and error_handler(). Referenced by cache_check_dir(), and cache_init(). |
|
Reads cache file information and fills mu_ent entry accordingly. This function instanciates a new mu_ent entry and fills in its fields with data gathered from the cache file.
Definition at line 396 of file cache.c. References mu_ent::album, mu_ent::artist, mu_ent::bitrate, mu_ent::date, mu_ent::filetype, mu_ent::genre, mu_ent::length, MAX_STRING, new_ent(), mu_ent::posn, mu_ent::size, mu_cache_data::stream, mu_ent::title, and mu_ent::track. Referenced by make_music_entry(). |
|
Removes cache subdirectories. This subroutine takes care of removing any given directory and its content (recursively) if any, and if possible.
Definition at line 209 of file cache.c. References error_handler(). Referenced by cache_check_dir(). |
|
Creates and writes cache file information. This function creates a new cache file (using cachedata->name), and fills it with the data contained in the mu_ent p structure.
Definition at line 450 of file cache.c. References mu_ent::album, mu_ent::artist, mu_ent::bitrate, CA_FATAL, CA_LOCKED, mu_config::cache_path, mu_ent::date, error_handler(), mu_ent::filetype, mu_ent::genre, mu_ent::length, mu_cache_data::name, mu_ent::posn, mu_ent::size, mu_cache_data::stream, mu_ent::title, and mu_ent::track. Referenced by make_music_entry(). |
|
Handles error for the flat file cache subsystem. This function handles various errors depending on errno's value.
Definition at line 87 of file cache.c. Referenced by cache_check_dir(), cache_check_file(), cache_init(), cache_make_dir(), cache_remove_dir(), and cache_write_file(). |