From 90eccb60497b93492263399dac700d1e6dd04381 Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Fri, 12 Apr 2019 13:52:11 +0100 Subject: [PATCH] created the skeletal cache.c --- Makefile | 2 +- src/cache.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/cache.h | 7 +------ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0714e50..ef8c196 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ VERSION=1.0.4 CFLAGS+= -g -O2 -Wall -Wextra -D_FILE_OFFSET_BITS=64 -DVERSION=\"$(VERSION)\" `pkg-config --cflags-only-I gumbo libcurl fuse` LDFLAGS+= -lgumbo -lcurl -lfuse -lcrypto `pkg-config --libs-only-L gumbo libcurl fuse` -COBJS = main.o network.o fuse_local.o link.o +COBJS = main.o network.o fuse_local.o link.o cache.o prefix ?= /usr/local diff --git a/src/cache.c b/src/cache.c index 05b26b0..f1b65ab 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1 +1,43 @@ #include "cache.h" + +off_t Cache_read(const char *filepath, off_t offset, size_t size) +{ +} + +size_t Cache_write(const char *filepath, off_t offset, size_t size, + const uint8_t *content) +{ +} + +int Cache_create(const char *filepath, size_t size) +{ +} + + +Cache *Cache_open(const char *filepath) +{ +} + + +int Meta_write(Cache *cf) +{ +} + + +int Meta_read(Cache *cf) +{ +} + + +size_t Data_read(Cache *cf, off_t offset, size_t size) +{ +} + +size_t Data_write(Cache *cf, off_t offset, size_t size, + const uint8_t *content) +{ +} + +int Data_create(Cache *cf, size_t size) +{ +} diff --git a/src/cache.h b/src/cache.h index feaea32..ce74f05 100644 --- a/src/cache.h +++ b/src/cache.h @@ -38,13 +38,8 @@ typedef struct { /** * \brief read from a cache file - * \details This is the God function which does everything, it is probably an - * anti-pattern. This function does the following: - * - Try and open the cache file - * - If the cache file does not exist, - * - */ -size_t Cache_read(const char *filepath, off_t offset, size_t size); +off_t Cache_read(const char *filepath, off_t offset, size_t size); /** * \brief write to a cache file