diff --git a/src/cache.c b/src/cache.c index addd86a..69d3e39 100644 --- a/src/cache.c +++ b/src/cache.c @@ -163,12 +163,15 @@ static int Meta_read(Cache *cf) return EIO; } + /* + * TODO: This appears to be broken + */ if (sizeof(long) != fread(&cf->time, sizeof(long), 1, fp) || sizeof(off_t) != fread(&cf->content_length, sizeof(off_t), 1, fp) || sizeof(int) != fread(&cf->blksz, sizeof(int), 1, fp) || sizeof(long) != fread(&cf->segbc, sizeof(long), 1, fp) || ferror(fp)) { - lprintf(error, "error reading core metadata!\n"); + lprintf(error, "error reading core metadata %s!\n", cf->path); return EIO; } @@ -541,7 +544,9 @@ static void Cache_free(Cache *cf) static int Cache_exist(const char *fn) { char *metafn = path_append(META_DIR, fn); + lprintf(debug, "metafn: %s\n", metafn); char *datafn = path_append(DATA_DIR, fn); + lprintf(debug, "datafn: %s\n", datafn); /* * access() returns 0 on success */ @@ -551,11 +556,13 @@ static int Cache_exist(const char *fn) if (no_meta ^ no_data) { lprintf(warning, "Cache file partially missing.\n"); if (no_meta) { + lprintf(debug, "Unlinking datafn: %s\n", datafn); if (unlink(datafn)) { lprintf(fatal, "unlink(): %s\n", strerror(errno)); } } if (no_data) { + lprintf(debug, "Unlinking metafn: %s\n", metafn); if (unlink(metafn)) { lprintf(fatal, "unlink(): %s\n", strerror(errno)); } diff --git a/src/fuse_local.c b/src/fuse_local.c index f5fa40f..8d2894e 100644 --- a/src/fuse_local.c +++ b/src/fuse_local.c @@ -100,14 +100,18 @@ static int fs_open(const char *path, struct fuse_file_info *fi) return -EROFS; } if (CACHE_SYSTEM_INIT) { + lprintf(debug, "Cache_open(%s);\n", path); fi->fh = (uint64_t) Cache_open(path); if (!fi->fh) { /* * The link clearly exists, the cache cannot be opened, attempt * cache creation */ + lprintf(debug, "Cache_delete(%s);\n", path); Cache_delete(path); + lprintf(debug, "Cache_create(%s);\n", path); Cache_create(path); + lprintf(debug, "Cache_open(%s);\n", path); fi->fh = (uint64_t) Cache_open(path); /* * The cache definitely cannot be opened for some reason. @@ -117,6 +121,7 @@ static int fs_open(const char *path, struct fuse_file_info *fi) * percentage encoded */ if (!fi->fh) { + lprintf(fatal, "Cache file creation failure for %s.\n", path); return -ENOENT; } }