00001 /*------------------------------------------------------------------------- 00002 * 00003 * buffile.h 00004 * Management of large buffered files, primarily temporary files. 00005 * 00006 * The BufFile routines provide a partial replacement for stdio atop 00007 * virtual file descriptors managed by fd.c. Currently they only support 00008 * buffered access to a virtual file, without any of stdio's formatting 00009 * features. That's enough for immediate needs, but the set of facilities 00010 * could be expanded if necessary. 00011 * 00012 * BufFile also supports working with temporary files that exceed the OS 00013 * file size limit and/or the largest offset representable in an int. 00014 * It might be better to split that out as a separately accessible module, 00015 * but currently we have no need for oversize temp files without buffered 00016 * access. 00017 * 00018 * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group 00019 * Portions Copyright (c) 1994, Regents of the University of California 00020 * 00021 * src/include/storage/buffile.h 00022 * 00023 *------------------------------------------------------------------------- 00024 */ 00025 00026 #ifndef BUFFILE_H 00027 #define BUFFILE_H 00028 00029 /* BufFile is an opaque type whose details are not known outside buffile.c. */ 00030 00031 typedef struct BufFile BufFile; 00032 00033 /* 00034 * prototypes for functions in buffile.c 00035 */ 00036 00037 extern BufFile *BufFileCreateTemp(bool interXact); 00038 extern void BufFileClose(BufFile *file); 00039 extern size_t BufFileRead(BufFile *file, void *ptr, size_t size); 00040 extern size_t BufFileWrite(BufFile *file, void *ptr, size_t size); 00041 extern int BufFileSeek(BufFile *file, int fileno, off_t offset, int whence); 00042 extern void BufFileTell(BufFile *file, int *fileno, off_t *offset); 00043 extern int BufFileSeekBlock(BufFile *file, long blknum); 00044 00045 #endif /* BUFFILE_H */