From: Ben O. <ben...@us...> - 2002-02-24 00:23:14
|
Update of /cvsroot/njbfs/njbfs In directory usw-pr-cvs1:/tmp/cvs-serv2357 Modified Files: njbfs_cache.h Log Message: ben: support for new directory structure Index: njbfs_cache.h =================================================================== RCS file: /cvsroot/njbfs/njbfs/njbfs_cache.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** njbfs_cache.h 10 Feb 2002 21:59:23 -0000 1.4 --- njbfs_cache.h 24 Feb 2002 00:23:12 -0000 1.5 *************** *** 2,7 **** #define _NJBFS_CACHE_H_ ! #define NJBFS_CACHE_LEN 5 ! #define NJBFS_CACHE_HASH 5 #define NJBFS_CACHE_TTL 300 --- 2,7 ---- #define _NJBFS_CACHE_H_ ! #define NJBFS_CACHE_LEN 2048 ! #define NJBFS_CACHE_HASH 2048 #define NJBFS_CACHE_TTL 300 *************** *** 107,110 **** --- 107,158 ---- } datafile_t; + struct njbfs_fattr_list { + struct njbfs_fattr *fattr; + struct njbfs_fattr_list *next; + }; + + struct njbfs_album { + char *name; + struct njbfs_fattr_list *tracks; + struct njbfs_artist *artist; + }; + + struct njbfs_album_list { + struct njbfs_album *album; + struct njbfs_album_list *next; + }; + + + struct njbfs_artist { + char *name; + struct njbfs_fattr_list *tracks; + struct njbfs_album_list *albums; + }; + + struct njbfs_artist_list { + struct njbfs_artist *artist; + struct njbfs_artist_list *next; + }; + + struct njbfs_genre { + char *name; + struct njbfs_fattr_list *tracks; + }; + + struct njbfs_genre_list { + struct njbfs_genre *genre; + struct njbfs_genre_list *next; + }; + + + #define NJBFS_GENERIC_HASH_SIZE 1024 + + typedef struct __njbfs_hash_element { + char *id; + void *data; + struct __njbfs_hash_element *next; + } njbfs_hash_element; + + /* ----------------- NJB file system cache ------------------------ */ *************** *** 119,133 **** unsigned long blocks; time_t atime; ! u_int32_t fileid; /* the NJB file id */ ! /* NJB attributes */ ! char *codec; /* codec frame */ ! char *title; /* title frame */ ! char *artist; /* artist frame */ ! char *album; /* album frame */ ! char *genre; /* genre frame */ ! u_int32_t length; /* optional frame: length in seconds */ ! u_int32_t tracknum; /* optional frame: album track number */ ! track_t *track; /* track */ ! int update_track_tag; /* should track tag be updated? 1=yes 0=no */ }; --- 167,171 ---- unsigned long blocks; time_t atime; ! struct njbfs_fattr *fattr; }; *************** *** 156,164 **** struct njbfs_sb_info; ! void njbfs_cache_init(struct njbfs_sb_info *); ! int njbfs_cache_empty(struct njbfs_sb_info *); ! int njbfs_cache_get(struct njbfs_sb_info *, char *, struct njbfs_directory **); ! void njbfs_cache_invalidate(struct dentry *); #endif --- 194,225 ---- struct njbfs_sb_info; ! /* directory specific caching functions (cache.c) */ ! void njbfs_cache_init(struct njbfs_sb_info *); ! int njbfs_cache_empty(struct njbfs_sb_info *); ! int njbfs_cache_get(struct njbfs_sb_info *, char *, struct njbfs_directory **); ! void njbfs_cache_invalidate(struct dentry *); ! int njbfs_cache_addnode(struct njbfs_sb_info *, char *, ! struct njbfs_dirlist_node *); ! ! int init_fattr_cache(struct njbfs_sb_info *); ! ! /* functions for the outside world to access the track cache */ ! struct njbfs_artist *njbfs_get_artist(char *); ! struct njbfs_album *njbfs_get_album(char *, char *); ! struct njbfs_album_list *njbfs_get_albums(char *); ! struct njbfs_genre *njbfs_get_genre(char *); ! int njbfs_add_fattr(struct njbfs_fattr *); ! void njbfs_remove_fattr(struct njbfs_fattr *); ! struct njbfs_fattr_list *add_fattr_to_list(struct njbfs_fattr_list **, ! struct njbfs_fattr *); ! ! ! /* the linked lists that make up the core of our cache */ ! extern struct njbfs_album_list *album_list_head; ! extern struct njbfs_artist_list *artist_list_head; ! extern struct njbfs_genre_list *genre_list_head; ! extern struct njbfs_fattr_list *track_list_head; ! extern struct njbfs_fattr_list *virtual_list_head; #endif |