Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
buffile.h60 linesDownload Raw Back to storage
1/*-------------------------------------------------------------------------2 *3 * buffile.h4 *	  Management of large buffered temporary files.5 *6 * The BufFile routines provide a partial replacement for stdio atop7 * virtual file descriptors managed by fd.c.  Currently they only support8 * buffered access to a virtual file, without any of stdio's formatting9 * features.  That's enough for immediate needs, but the set of facilities10 * could be expanded if necessary.11 *12 * BufFile also supports working with temporary files that exceed the OS13 * file size limit and/or the largest offset representable in an int.14 * It might be better to split that out as a separately accessible module,15 * but currently we have no need for oversize temp files without buffered16 * access.17 *18 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group19 * Portions Copyright (c) 1994, Regents of the University of California20 *21 * src/include/storage/buffile.h22 *23 *-------------------------------------------------------------------------24 */25 26#ifndef BUFFILE_H27#define BUFFILE_H28 29#include "storage/fileset.h"30 31/* BufFile is an opaque type whose details are not known outside buffile.c. */32 33typedef struct BufFile BufFile;34 35/*36 * prototypes for functions in buffile.c37 */38 39extern BufFile *BufFileCreateTemp(bool interXact);40extern void BufFileClose(BufFile *file);41extern pg_nodiscard size_t BufFileRead(BufFile *file, void *ptr, size_t size);42extern void BufFileReadExact(BufFile *file, void *ptr, size_t size);43extern size_t BufFileReadMaybeEOF(BufFile *file, void *ptr, size_t size, bool eofOK);44extern void BufFileWrite(BufFile *file, const void *ptr, size_t size);45extern int	BufFileSeek(BufFile *file, int fileno, off_t offset, int whence);46extern void BufFileTell(BufFile *file, int *fileno, off_t *offset);47extern int	BufFileSeekBlock(BufFile *file, long blknum);48extern int64 BufFileSize(BufFile *file);49extern long BufFileAppend(BufFile *target, BufFile *source);50 51extern BufFile *BufFileCreateFileSet(FileSet *fileset, const char *name);52extern void BufFileExportFileSet(BufFile *file);53extern BufFile *BufFileOpenFileSet(FileSet *fileset, const char *name,54								   int mode, bool missing_ok);55extern void BufFileDeleteFileSet(FileSet *fileset, const char *name,56								 bool missing_ok);57extern void BufFileTruncateFileSet(BufFile *file, int fileno, off_t offset);58 59#endif							/* BUFFILE_H */60 
codekingpro/portable-devtools · Team Ai