moved cache_opened to cache.h

This commit is contained in:
Fufu Fang 2021-09-01 10:38:45 +01:00
parent 95b86825ed
commit 8f9935ee5d
4 changed files with 9 additions and 8 deletions

View File

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1.
.TH PRINT_VERSION: "1" "August 2021" "print_version: HTTPDirFS version 1.2.3" "User Commands"
.TH PRINT_VERSION: "1" "September 2021" "print_version: HTTPDirFS version 1.2.3" "User Commands"
.SH NAME
print_version: \- manual page for print_version: HTTPDirFS version 1.2.3
.SH DESCRIPTION

View File

@ -734,8 +734,8 @@ Cache *Cache_open(const char *fn)
"thread %x: locking cf_lock;\n", pthread_self());
PTHREAD_MUTEX_LOCK(&cf_lock);
if (link->cache_opened) {
link->cache_opened++;
if (link->cache_ptr) {
link->cache_ptr->cache_opened++;
lprintf(cache_lock_debug,
"thread %x: unlocking cf_lock;\n", pthread_self());
@ -853,7 +853,7 @@ cf->content_length: %ld, Data_size(fn): %ld.\n", fn, cf->content_length, Data_si
return NULL;
}
cf->link->cache_opened = 1;
cf->cache_opened = 1;
/*
* Yup, we just created a circular loop. ;)
*/
@ -871,9 +871,9 @@ void Cache_close(Cache * cf)
"thread %x: locking cf_lock;\n", pthread_self());
PTHREAD_MUTEX_LOCK(&cf_lock);
cf->link->cache_opened--;
cf->cache_opened--;
if (cf->link->cache_opened > 0) {
if (cf->cache_opened > 0) {
lprintf(cache_lock_debug,
"thread %x: unlocking cf_lock;\n", pthread_self());

View File

@ -27,6 +27,9 @@ typedef uint8_t Seg;
* \brief cache data type in-memory data structure
*/
struct Cache {
/** \brief How many times the cache has been opened */
int cache_opened;
/** \brief the FILE pointer for the data file*/
FILE *dfp;
/** \brief the FILE pointer for the metadata */

View File

@ -68,8 +68,6 @@ struct Link {
LinkTable *next_table;
/** \brief CURLINFO_FILETIME obtained from the server */
long time;
/** \brief How many times associated cache has been opened */
int cache_opened;
/** \brief The pointer associated with the cache file */
Cache *cache_ptr;
/**