09243c7da5f14dbfa408cf7a54e567080da81a05 markd Wed Oct 17 10:44:15 2018 -0700 Added ability to access UDC file in cache using virtual memory (mmap). The test sure are nice. diff --git src/inc/udc.h src/inc/udc.h index 9ca5f24..5460ce2 100644 --- src/inc/udc.h +++ src/inc/udc.h @@ -159,16 +159,29 @@ boolean udcFastReadString(struct udcFile *f, char buf[256]); /* Read a string into buffer, which must be long enough * to hold it. String is in 'writeString' format. */ off_t udcFileSize(char *url); /* fetch remote or local file size from given URL or path */ boolean udcExists(char *url); /* return true if a remote or local file exists */ boolean udcIsLocal(char *url); /* return true if url is not a http or ftp file, just a normal local file path */ void udcSetLog(FILE *fp); /* Tell UDC where to log its statistics. */ + +void udcMMap(struct udcFile *file); +/* Enable access to underlying file as memory using mmap. udcMMapFetch + * must be called to actually access regions of the file. */ + +void *udcMMapFetch(struct udcFile *file, bits64 offset, bits64 size); +/* Return pointer to a region of the file in memory, ensuring that regions is + * cached.. udcMMap must have been called to enable access. This must be + * called for first access to a range of the file or erroneous (zeros) data + * maybe returned. Maybe called multiple times on a range or overlapping + * returns. */ + + #endif /* UDC_H */