#include "mod_musicindex.h"
#include <string.h>
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
Go to the source code of this file.
Data Structures | |
struct | mu_cache_data |
Structure used to exchange data between cache management routines. More... | |
Defines | |
#define | CA_FATAL 10 |
Something bad happened. | |
#define | CA_MISSARG 20 |
Argument missing. | |
#define | CA_CREATE 30 |
Requesting file creation. | |
#define | CA_LOCKED 40 |
Cache entry is locked and unusuable. | |
Functions | |
short | cache_check_dir (request_rec *, mu_config *, mu_cache_data *) |
Checks if a directory already exists in the cache. | |
short | cache_check_file (request_rec *, mu_config *, mu_cache_data *) |
Checks if a file already exists in the cache. | |
mu_ent * | cache_read_file (request_rec *, mu_ent *, mu_config *, mu_cache_data *) |
Reads cache file information and fills mu_ent entry accordingly. | |
short | cache_write_file (request_rec *, mu_ent *, mu_config *, mu_cache_data *) |
Creates and writes cache file information. |
|
Requesting file creation.
Definition at line 48 of file cache.h. Referenced by cache_check_file(), and make_music_entry(). |
|
Something bad happened.
Definition at line 46 of file cache.h. Referenced by cache_check_dir(), cache_check_file(), cache_init(), cache_make_dir(), and cache_write_file(). |
|
Cache entry is locked and unusuable.
Definition at line 49 of file cache.h. Referenced by cache_write_file(). |
|
Argument missing.
Definition at line 47 of file cache.h. Referenced by cache_check_dir(), and cache_check_file(). |
|
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(). |
|
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(). |
|
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(). |