GDAL

cpl_vsi.h
Go to the documentation of this file.
1/******************************************************************************
2 * $Id$
3 *
4 * Project: CPL - Common Portability Library
5 * Author: Frank Warmerdam, warmerdam@pobox.com
6 * Purpose: Include file defining Virtual File System (VSI) functions, a
7 * layer over POSIX file and other system services.
8 *
9 ******************************************************************************
10 * Copyright (c) 1998, Frank Warmerdam
11 * Copyright (c) 2008-2014, Even Rouault <even dot rouault at spatialys.com>
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included
21 * in all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 * DEALINGS IN THE SOFTWARE.
30 ****************************************************************************/
31
32#ifndef CPL_VSI_H_INCLUDED
33#define CPL_VSI_H_INCLUDED
34
35#include "cpl_port.h"
36#include "cpl_progress.h"
37
38#include <stdbool.h>
39
58/* -------------------------------------------------------------------- */
59/* We need access to ``struct stat''. */
60/* -------------------------------------------------------------------- */
61
62/* Unix */
63#if !defined(_WIN32)
64#include <unistd.h>
65#endif
66
67/* Windows */
68#include <sys/stat.h>
69
70 CPL_C_START
71
73#ifdef ENABLE_EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
74#define EXPERIMENTAL_CPL_WARN_UNUSED_RESULT CPL_WARN_UNUSED_RESULT
75#else
76#define EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
77#endif
80/* ==================================================================== */
81/* stdio file access functions. These do not support large */
82/* files, and do not go through the virtualization API. */
83/* ==================================================================== */
84
87FILE CPL_DLL *VSIFOpen(const char *, const char *) CPL_WARN_UNUSED_RESULT;
88 int CPL_DLL VSIFClose(FILE *);
89 int CPL_DLL VSIFSeek(FILE *, long, int) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
90 long CPL_DLL VSIFTell(FILE *) CPL_WARN_UNUSED_RESULT;
91 void CPL_DLL VSIRewind(FILE *);
92 void CPL_DLL VSIFFlush(FILE *);
93
94 size_t CPL_DLL VSIFRead(void *, size_t, size_t,
95 FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
96 size_t CPL_DLL VSIFWrite(const void *, size_t, size_t,
97 FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
98 char CPL_DLL *VSIFGets(char *, int, FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
99 int CPL_DLL VSIFPuts(const char *, FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
100 int CPL_DLL VSIFPrintf(FILE *, CPL_FORMAT_STRING(const char *),
101 ...) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
102 CPL_PRINT_FUNC_FORMAT(2, 3);
103
104 int CPL_DLL VSIFGetc(FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
105 int CPL_DLL VSIFPutc(int, FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
106 int CPL_DLL VSIUngetc(int, FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
107 int CPL_DLL VSIFEof(FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
108
111/* ==================================================================== */
112/* VSIStat() related. */
113/* ==================================================================== */
114
116typedef struct stat VSIStatBuf;
117 int CPL_DLL VSIStat(const char *, VSIStatBuf *) CPL_WARN_UNUSED_RESULT;
120#ifdef _WIN32
121#define VSI_ISLNK(x) (0) /* N/A on Windows */
122#define VSI_ISREG(x) ((x)&S_IFREG)
123#define VSI_ISDIR(x) ((x)&S_IFDIR)
124#define VSI_ISCHR(x) ((x)&S_IFCHR)
125#define VSI_ISBLK(x) (0) /* N/A on Windows */
126#else
128#define VSI_ISLNK(x) S_ISLNK(x)
130#define VSI_ISREG(x) S_ISREG(x)
132#define VSI_ISDIR(x) S_ISDIR(x)
134#define VSI_ISCHR(x) S_ISCHR(x)
135#define VSI_ISBLK(x) S_ISBLK(x)
137#endif
138
139/* ==================================================================== */
140/* 64bit stdio file access functions. If we have a big size */
141/* defined, then provide prototypes for the large file API, */
142/* otherwise redefine to use the regular api. */
143/* ==================================================================== */
144
146 typedef GUIntBig vsi_l_offset;
148#define VSI_L_OFFSET_MAX GUINTBIG_MAX
149
151 typedef struct VSIVirtualHandle VSILFILE;
152
153 VSILFILE CPL_DLL *VSIFOpenL(const char *, const char *) CPL_WARN_UNUSED_RESULT;
154 VSILFILE CPL_DLL *VSIFOpenExL(const char *, const char *,
155 int) CPL_WARN_UNUSED_RESULT;
156 VSILFILE CPL_DLL *VSIFOpenEx2L(const char *, const char *, int,
157 CSLConstList) CPL_WARN_UNUSED_RESULT;
158 int CPL_DLL VSIFCloseL(VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
159 int CPL_DLL VSIFSeekL(VSILFILE *, vsi_l_offset,
160 int) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
161 vsi_l_offset CPL_DLL VSIFTellL(VSILFILE *) CPL_WARN_UNUSED_RESULT;
162 void CPL_DLL VSIRewindL(VSILFILE *);
163 size_t CPL_DLL VSIFReadL(void *, size_t, size_t,
164 VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
165 int CPL_DLL VSIFReadMultiRangeL(int nRanges, void **ppData,
166 const vsi_l_offset *panOffsets,
167 const size_t *panSizes,
168 VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
169 size_t CPL_DLL VSIFWriteL(const void *, size_t, size_t,
170 VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
171 int CPL_DLL VSIFEofL(VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
172 int CPL_DLL VSIFTruncateL(VSILFILE *,
173 vsi_l_offset) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
174 int CPL_DLL VSIFFlushL(VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
175 int CPL_DLL VSIFPrintfL(VSILFILE *, CPL_FORMAT_STRING(const char *),
176 ...) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
177 CPL_PRINT_FUNC_FORMAT(2, 3);
178 int CPL_DLL VSIFPutcL(int, VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
179
181typedef enum
182{
183 VSI_RANGE_STATUS_UNKNOWN,
184 VSI_RANGE_STATUS_DATA,
185 VSI_RANGE_STATUS_HOLE
186} VSIRangeStatus;
187
188 VSIRangeStatus CPL_DLL VSIFGetRangeStatusL(VSILFILE *fp, vsi_l_offset nStart,
189 vsi_l_offset nLength);
190
191 int CPL_DLL VSIIngestFile(VSILFILE *fp, const char *pszFilename,
192 GByte **ppabyRet, vsi_l_offset *pnSize,
193 GIntBig nMaxSize) CPL_WARN_UNUSED_RESULT;
194
195 int CPL_DLL VSIOverwriteFile(VSILFILE *fpTarget, const char *pszSourceFilename)
196 CPL_WARN_UNUSED_RESULT;
197
198#if defined(VSI_STAT64_T)
200 typedef struct VSI_STAT64_T VSIStatBufL;
201#else
203#define VSIStatBufL VSIStatBuf
204#endif
205
206 int CPL_DLL VSIStatL(const char *, VSIStatBufL *) CPL_WARN_UNUSED_RESULT;
207
209#define VSI_STAT_EXISTS_FLAG 0x1
211#define VSI_STAT_NATURE_FLAG 0x2
213#define VSI_STAT_SIZE_FLAG 0x4
215#define VSI_STAT_SET_ERROR_FLAG 0x8
219#define VSI_STAT_CACHE_ONLY 0x10
220
221 int CPL_DLL VSIStatExL(const char *pszFilename, VSIStatBufL *psStatBuf,
222 int nFlags) CPL_WARN_UNUSED_RESULT;
223
224 int CPL_DLL VSIIsCaseSensitiveFS(const char *pszFilename);
225
226 int CPL_DLL VSISupportsSparseFiles(const char *pszPath);
227
228 bool CPL_DLL VSIIsLocal(const char *pszPath);
229
230 char CPL_DLL *VSIGetCanonicalFilename(const char *pszPath);
231
232 bool CPL_DLL VSISupportsSequentialWrite(const char *pszPath,
233 bool bAllowLocalTempFile);
234
235 bool CPL_DLL VSISupportsRandomWrite(const char *pszPath,
236 bool bAllowLocalTempFile);
237
238 int CPL_DLL VSIHasOptimizedReadMultiRange(const char *pszPath);
239
240 const char CPL_DLL *VSIGetActualURL(const char *pszFilename);
241
242 char CPL_DLL *VSIGetSignedURL(const char *pszFilename,
243 CSLConstList papszOptions);
244
245 const char CPL_DLL *VSIGetFileSystemOptions(const char *pszFilename);
246
247 char CPL_DLL **VSIGetFileSystemsPrefixes(void);
248
249 void CPL_DLL *VSIFGetNativeFileDescriptorL(VSILFILE *);
250
251 char CPL_DLL **
252 VSIGetFileMetadata(const char *pszFilename, const char *pszDomain,
253 CSLConstList papszOptions) CPL_WARN_UNUSED_RESULT;
254
255 int CPL_DLL VSISetFileMetadata(const char *pszFilename,
256 CSLConstList papszMetadata,
257 const char *pszDomain,
258 CSLConstList papszOptions);
259
260 void CPL_DLL VSISetPathSpecificOption(const char *pszPathPrefix,
261 const char *pszKey, const char *pszValue);
262 void CPL_DLL VSIClearPathSpecificOptions(const char *pszPathPrefix);
263 const char CPL_DLL *VSIGetPathSpecificOption(const char *pszPath,
264 const char *pszKey,
265 const char *pszDefault);
266
267 void CPL_DLL VSISetCredential(const char *pszPathPrefix, const char *pszKey,
268 const char *pszValue)
270 CPL_WARN_DEPRECATED("Use VSISetPathSpecificOption instead")
272 ;
273 void CPL_DLL VSIClearCredentials(const char *pszPathPrefix)
275 CPL_WARN_DEPRECATED("Use VSIClearPathSpecificOptions instead")
277 ;
278 const char CPL_DLL *VSIGetCredential(const char *pszPath, const char *pszKey,
279 const char *pszDefault)
281 CPL_WARN_DEPRECATED("Use VSIGetPathSpecificOption instead")
283 ;
284
285/* ==================================================================== */
286/* Memory allocation */
287/* ==================================================================== */
288
289 void CPL_DLL *VSICalloc(size_t, size_t) CPL_WARN_UNUSED_RESULT;
290 void CPL_DLL *VSIMalloc(size_t) CPL_WARN_UNUSED_RESULT;
291 void CPL_DLL VSIFree(void *);
292 void CPL_DLL *VSIRealloc(void *, size_t) CPL_WARN_UNUSED_RESULT;
293 char CPL_DLL *VSIStrdup(const char *) CPL_WARN_UNUSED_RESULT;
294
295#if defined(__cplusplus) && defined(GDAL_COMPILATION)
296 extern "C++"
297{
299 struct CPL_DLL VSIFreeReleaser
300 {
301 void operator()(void *p) const
302 {
303 VSIFree(p);
304 }
305 };
306
308}
309#endif
310
311 void CPL_DLL *VSIMallocAligned(size_t nAlignment,
312 size_t nSize) CPL_WARN_UNUSED_RESULT;
313 void CPL_DLL *VSIMallocAlignedAuto(size_t nSize) CPL_WARN_UNUSED_RESULT;
314 void CPL_DLL VSIFreeAligned(void *ptr);
315
316 void CPL_DLL *VSIMallocAlignedAutoVerbose(size_t nSize, const char *pszFile,
317 int nLine) CPL_WARN_UNUSED_RESULT;
319#define VSI_MALLOC_ALIGNED_AUTO_VERBOSE(size) \
320 VSIMallocAlignedAutoVerbose(size, __FILE__, __LINE__)
321
329 void CPL_DLL *VSIMalloc2(size_t nSize1, size_t nSize2) CPL_WARN_UNUSED_RESULT;
330
339 void CPL_DLL *VSIMalloc3(size_t nSize1, size_t nSize2,
340 size_t nSize3) CPL_WARN_UNUSED_RESULT;
341
343 void CPL_DLL *VSIMallocVerbose(size_t nSize, const char *pszFile,
344 int nLine) CPL_WARN_UNUSED_RESULT;
346#define VSI_MALLOC_VERBOSE(size) VSIMallocVerbose(size, __FILE__, __LINE__)
347
349 void CPL_DLL *VSIMalloc2Verbose(size_t nSize1, size_t nSize2,
350 const char *pszFile,
351 int nLine) CPL_WARN_UNUSED_RESULT;
353#define VSI_MALLOC2_VERBOSE(nSize1, nSize2) \
354 VSIMalloc2Verbose(nSize1, nSize2, __FILE__, __LINE__)
355
357 void CPL_DLL *VSIMalloc3Verbose(size_t nSize1, size_t nSize2, size_t nSize3,
358 const char *pszFile,
359 int nLine) CPL_WARN_UNUSED_RESULT;
361#define VSI_MALLOC3_VERBOSE(nSize1, nSize2, nSize3) \
362 VSIMalloc3Verbose(nSize1, nSize2, nSize3, __FILE__, __LINE__)
363
365 void CPL_DLL *VSICallocVerbose(size_t nCount, size_t nSize, const char *pszFile,
366 int nLine) CPL_WARN_UNUSED_RESULT;
368#define VSI_CALLOC_VERBOSE(nCount, nSize) \
369 VSICallocVerbose(nCount, nSize, __FILE__, __LINE__)
370
372 void CPL_DLL *VSIReallocVerbose(void *pOldPtr, size_t nNewSize,
373 const char *pszFile,
374 int nLine) CPL_WARN_UNUSED_RESULT;
376#define VSI_REALLOC_VERBOSE(pOldPtr, nNewSize) \
377 VSIReallocVerbose(pOldPtr, nNewSize, __FILE__, __LINE__)
378
380 char CPL_DLL *VSIStrdupVerbose(const char *pszStr, const char *pszFile,
381 int nLine) CPL_WARN_UNUSED_RESULT;
383#define VSI_STRDUP_VERBOSE(pszStr) VSIStrdupVerbose(pszStr, __FILE__, __LINE__)
384
385 GIntBig CPL_DLL CPLGetPhysicalRAM(void);
386 GIntBig CPL_DLL CPLGetUsablePhysicalRAM(void);
387
388/* ==================================================================== */
389/* Other... */
390/* ==================================================================== */
391
393#define CPLReadDir VSIReadDir
394 char CPL_DLL **VSIReadDir(const char *);
395 char CPL_DLL **VSIReadDirRecursive(const char *pszPath);
396 char CPL_DLL **VSIReadDirEx(const char *pszPath, int nMaxFiles);
397 char CPL_DLL **VSISiblingFiles(const char *pszPath);
398
399 const char CPL_DLL *VSIGetDirectorySeparator(const char *pszPath);
400
402 typedef struct VSIDIR VSIDIR;
403
404 VSIDIR CPL_DLL *VSIOpenDir(const char *pszPath, int nRecurseDepth,
405 const char *const *papszOptions);
406
408 typedef struct VSIDIREntry VSIDIREntry;
409
413 struct VSIDIREntry
414{
416 char *pszName;
418 int nMode;
420 vsi_l_offset nSize;
422 GIntBig nMTime;
424 char bModeKnown;
426 char bSizeKnown;
428 char bMTimeKnown;
430 char **papszExtra;
431
432#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
434 VSIDIREntry();
435 ~VSIDIREntry();
436 VSIDIREntry(const VSIDIREntry &);
437 VSIDIREntry &operator=(VSIDIREntry &) = delete;
439#endif
440};
441
442 const VSIDIREntry CPL_DLL *VSIGetNextDirEntry(VSIDIR *dir);
443 void CPL_DLL VSICloseDir(VSIDIR *dir);
444
445 int CPL_DLL VSIMkdir(const char *pszPathname, long mode);
446 int CPL_DLL VSIMkdirRecursive(const char *pszPathname, long mode);
447 int CPL_DLL VSIRmdir(const char *pszDirname);
448 int CPL_DLL VSIRmdirRecursive(const char *pszDirname);
449 int CPL_DLL VSIUnlink(const char *pszFilename);
450 int CPL_DLL *VSIUnlinkBatch(CSLConstList papszFiles);
451 int CPL_DLL VSIRename(const char *oldpath, const char *newpath);
452 int CPL_DLL VSICopyFile(const char *pszSource, const char *pszTarget,
453 VSILFILE *fpSource, vsi_l_offset nSourceSize,
454 const char *const *papszOptions,
455 GDALProgressFunc pProgressFunc, void *pProgressData);
456 int CPL_DLL VSISync(const char *pszSource, const char *pszTarget,
457 const char *const *papszOptions,
458 GDALProgressFunc pProgressFunc, void *pProgressData,
459 char ***ppapszOutputs);
460 int CPL_DLL VSIAbortPendingUploads(const char *pszFilename);
461
462 char CPL_DLL *VSIStrerror(int);
463 GIntBig CPL_DLL VSIGetDiskFreeSpace(const char *pszDirname);
464
465 void CPL_DLL VSINetworkStatsReset(void);
466 char CPL_DLL *VSINetworkStatsGetAsSerializedJSON(char **papszOptions);
467
468/* ==================================================================== */
469/* Install special file access handlers. */
470/* ==================================================================== */
471 void CPL_DLL VSIInstallMemFileHandler(void);
473 void CPL_DLL VSIInstallLargeFileHandler(void);
475 void CPL_DLL VSIInstallSubFileHandler(void);
476 void VSIInstallCurlFileHandler(void);
477 void CPL_DLL VSICurlClearCache(void);
478 void CPL_DLL VSICurlPartialClearCache(const char *pszFilenamePrefix);
479 void VSIInstallCurlStreamingFileHandler(void);
480 void VSIInstallS3FileHandler(void);
481 void VSIInstallS3StreamingFileHandler(void);
482 void VSIInstallGSFileHandler(void);
483 void VSIInstallGSStreamingFileHandler(void);
484 void VSIInstallAzureFileHandler(void);
485 void VSIInstallAzureStreamingFileHandler(void);
486 void VSIInstallADLSFileHandler(void);
487 void VSIInstallOSSFileHandler(void);
488 void VSIInstallOSSStreamingFileHandler(void);
489 void VSIInstallSwiftFileHandler(void);
490 void VSIInstallSwiftStreamingFileHandler(void);
491 void VSIInstall7zFileHandler(void); /* No reason to export that */
492 void VSIInstallRarFileHandler(void); /* No reason to export that */
493 void VSIInstallGZipFileHandler(void); /* No reason to export that */
494 void VSIInstallZipFileHandler(void); /* No reason to export that */
495 void VSIInstallStdinHandler(void); /* No reason to export that */
496 void VSIInstallHdfsHandler(void); /* No reason to export that */
497 void VSIInstallWebHdfsHandler(void); /* No reason to export that */
498 void VSIInstallStdoutHandler(void); /* No reason to export that */
499 void CPL_DLL VSIInstallSparseFileHandler(void);
500 void VSIInstallTarFileHandler(void); /* No reason to export that */
501 void VSIInstallCachedFileHandler(void); /* No reason to export that */
502 void CPL_DLL VSIInstallCryptFileHandler(void);
503 void CPL_DLL VSISetCryptKey(const GByte *pabyKey, int nKeySize);
505 void CPL_DLL VSICleanupFileManager(void);
508 bool CPL_DLL VSIDuplicateFileSystemHandler(const char *pszSourceFSName,
509 const char *pszNewFSName);
510
511 VSILFILE CPL_DLL *
512 VSIFileFromMemBuffer(const char *pszFilename, GByte *pabyData,
513 vsi_l_offset nDataLength,
514 int bTakeOwnership) CPL_WARN_UNUSED_RESULT;
515 GByte CPL_DLL *VSIGetMemFileBuffer(const char *pszFilename,
516 vsi_l_offset *pnDataLength,
517 int bUnlinkAndSeize);
518
520 typedef size_t (*VSIWriteFunction)(const void *ptr, size_t size, size_t nmemb,
521 FILE *stream);
522 void CPL_DLL VSIStdoutSetRedirection(VSIWriteFunction pFct, FILE *stream);
523
528 typedef int (*VSIFilesystemPluginStatCallback)(void *pUserData,
529 const char *pszFilename,
530 VSIStatBufL *pStatBuf,
531 int nFlags);
536 typedef int (*VSIFilesystemPluginUnlinkCallback)(void *pUserData,
537 const char *pszFilename);
542 typedef int (*VSIFilesystemPluginRenameCallback)(void *pUserData,
543 const char *oldpath,
544 const char *newpath);
549 typedef int (*VSIFilesystemPluginMkdirCallback)(void *pUserData,
550 const char *pszDirname,
551 long nMode);
556 typedef int (*VSIFilesystemPluginRmdirCallback)(void *pUserData,
557 const char *pszDirname);
562 typedef char **(*VSIFilesystemPluginReadDirCallback)(void *pUserData,
563 const char *pszDirname,
564 int nMaxFiles);
574 typedef char **(*VSIFilesystemPluginSiblingFilesCallback)(
575 void *pUserData, const char *pszDirname);
582 typedef void *(*VSIFilesystemPluginOpenCallback)(void *pUserData,
583 const char *pszFilename,
584 const char *pszAccess);
589 typedef vsi_l_offset (*VSIFilesystemPluginTellCallback)(void *pFile);
594 typedef int (*VSIFilesystemPluginSeekCallback)(void *pFile,
595 vsi_l_offset nOffset,
596 int nWhence);
602 typedef size_t (*VSIFilesystemPluginReadCallback)(void *pFile, void *pBuffer,
603 size_t nSize, size_t nCount);
609 typedef int (*VSIFilesystemPluginReadMultiRangeCallback)(
610 void *pFile, int nRanges, void **ppData, const vsi_l_offset *panOffsets,
611 const size_t *panSizes);
616 typedef VSIRangeStatus (*VSIFilesystemPluginGetRangeStatusCallback)(
617 void *pFile, vsi_l_offset nOffset, vsi_l_offset nLength);
622 typedef int (*VSIFilesystemPluginEofCallback)(void *pFile);
627 typedef size_t (*VSIFilesystemPluginWriteCallback)(void *pFile,
628 const void *pBuffer,
629 size_t nSize, size_t nCount);
634 typedef int (*VSIFilesystemPluginFlushCallback)(void *pFile);
638 typedef int (*VSIFilesystemPluginTruncateCallback)(void *pFile,
639 vsi_l_offset nNewSize);
644 typedef int (*VSIFilesystemPluginCloseCallback)(void *pFile);
645
660 typedef void (*VSIFilesystemPluginAdviseReadCallback)(
661 void *pFile, int nRanges, const vsi_l_offset *panOffsets,
662 const size_t *panSizes);
663
671 typedef struct
672{
677 void *pUserData;
678 VSIFilesystemPluginStatCallback stat;
679 VSIFilesystemPluginUnlinkCallback unlink;
680 VSIFilesystemPluginRenameCallback rename;
681 VSIFilesystemPluginMkdirCallback mkdir;
682 VSIFilesystemPluginRmdirCallback rmdir;
683 VSIFilesystemPluginReadDirCallback
684 read_dir;
685 VSIFilesystemPluginOpenCallback open;
686 VSIFilesystemPluginTellCallback
687 tell;
688 VSIFilesystemPluginSeekCallback
689 seek;
690 VSIFilesystemPluginReadCallback read;
691 VSIFilesystemPluginReadMultiRangeCallback
692 read_multi_range;
693 VSIFilesystemPluginGetRangeStatusCallback
694 get_range_status;
695 VSIFilesystemPluginEofCallback
696 eof;
697 VSIFilesystemPluginWriteCallback
698 write;
699 VSIFilesystemPluginFlushCallback flush;
700 VSIFilesystemPluginTruncateCallback truncate;
701 VSIFilesystemPluginCloseCallback close;
702 size_t nBufferSize;
703 size_t nCacheSize;
704 VSIFilesystemPluginSiblingFilesCallback
705 sibling_files;
708 VSIFilesystemPluginAdviseReadCallback advise_read;
709 /*
710 Callbacks are defined as a struct allocated by a call to
711 VSIAllocFilesystemPluginCallbacksStruct in order to try to maintain ABI
712 stability when eventually adding a new member. Any callbacks added to
713 this struct SHOULD be added to the END of this struct
714 */
715} VSIFilesystemPluginCallbacksStruct;
716
722 VSIFilesystemPluginCallbacksStruct CPL_DLL *
723 VSIAllocFilesystemPluginCallbacksStruct(void);
724
729 void CPL_DLL VSIFreeFilesystemPluginCallbacksStruct(
730 VSIFilesystemPluginCallbacksStruct *poCb);
731
738 int CPL_DLL VSIInstallPluginHandler(
739 const char *pszPrefix, const VSIFilesystemPluginCallbacksStruct *poCb);
740
750 int CPL_DLL VSIRemovePluginHandler(const char *pszPrefix);
751
752/* ==================================================================== */
753/* Time querying. */
754/* ==================================================================== */
755
757 unsigned long CPL_DLL VSITime(unsigned long *);
758 const char CPL_DLL *VSICTime(unsigned long);
759 struct tm CPL_DLL *VSIGMTime(const time_t *pnTime, struct tm *poBrokenTime);
760 struct tm CPL_DLL *VSILocalTime(const time_t *pnTime, struct tm *poBrokenTime);
764/* -------------------------------------------------------------------- */
765/* the following can be turned on for detailed logging of */
766/* almost all IO calls. */
767/* -------------------------------------------------------------------- */
768#ifdef VSI_DEBUG
769
770#ifndef DEBUG
771#define DEBUG
772#endif
773
774#include "cpl_error.h"
775
776#define VSIDebug4(f, a1, a2, a3, a4) CPLDebug("VSI", f, a1, a2, a3, a4);
777#define VSIDebug3(f, a1, a2, a3) CPLDebug("VSI", f, a1, a2, a3);
778#define VSIDebug2(f, a1, a2) CPLDebug("VSI", f, a1, a2);
779#define VSIDebug1(f, a1) CPLDebug("VSI", f, a1);
780#else
781#define VSIDebug4(f, a1, a2, a3, a4) \
782 { \
783 }
784#define VSIDebug3(f, a1, a2, a3) \
785 { \
786 }
787#define VSIDebug2(f, a1, a2) \
788 { \
789 }
790#define VSIDebug1(f, a1) \
791 { \
792 }
793#endif
796 CPL_C_END
797
798#endif /* ndef CPL_VSI_H_INCLUDED */
cpl_error.h
CPL error handling services.
cpl_port.h
Core portability definitions for CPL.
GUIntBig
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition cpl_port.h:218
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:299
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:295
CPL_FORMAT_STRING
#define CPL_FORMAT_STRING(arg)
Macro into which to wrap the format argument of a printf-like function.
Definition cpl_port.h:966
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition cpl_port.h:950
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1183
CPL_WARN_UNUSED_RESULT
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition cpl_port.h:976
GByte
unsigned char GByte
Unsigned byte type.
Definition cpl_port.h:185
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:215
VSIStatBufL
#define VSIStatBufL
Type for VSIStatL()
Definition cpl_vsi.h:203
VSICallocVerbose
void * VSICallocVerbose(size_t nCount, size_t nSize, const char *pszFile, int nLine)
VSICallocVerbose.
Definition cpl_vsisimple.cpp:1213
VSISetFileMetadata
int VSISetFileMetadata(const char *pszFilename, CSLConstList papszMetadata, const char *pszDomain, CSLConstList papszOptions)
Set metadata on files.
Definition cpl_vsil.cpp:987
VSIUnlinkBatch
int * VSIUnlinkBatch(CSLConstList papszFiles)
Delete several files, possibly in a batch.
Definition cpl_vsil.cpp:481
VSIFGetRangeStatusL
VSIRangeStatus VSIFGetRangeStatusL(VSILFILE *fp, vsi_l_offset nStart, vsi_l_offset nLength)
Return if a given file range contains data or holes filled with zeroes.
Definition cpl_vsil.cpp:2605
VSINetworkStatsReset
void VSINetworkStatsReset(void)
Clear network related statistics.
Definition cpl_vsil_curl.cpp:6212
VSIInstallCachedFileHandler
void VSIInstallCachedFileHandler(void)
Install /vsicached? file system handler.
Definition cpl_vsil_cache.cpp:723
VSIWriteFunction
size_t(* VSIWriteFunction)(const void *ptr, size_t size, size_t nmemb, FILE *stream)
Callback used by VSIStdoutSetRedirection()
Definition cpl_vsi.h:520
VSIInstallS3StreamingFileHandler
void VSIInstallS3StreamingFileHandler(void)
Install /vsis3_streaming/ Amazon S3 file system handler (requires libcurl).
Definition cpl_vsil_curl_streaming.cpp:2091
VSISiblingFiles
char ** VSISiblingFiles(const char *pszPath)
Return related filenames.
Definition cpl_vsil.cpp:151
VSIFFlushL
int VSIFFlushL(VSILFILE *)
Flush pending writes to disk.
Definition cpl_vsil.cpp:2219
VSIFilesystemPluginReadMultiRangeCallback
int(* VSIFilesystemPluginReadMultiRangeCallback)(void *pFile, int nRanges, void **ppData, const vsi_l_offset *panOffsets, const size_t *panSizes)
Read from multiple offsets.
Definition cpl_vsi.h:609
VSIGetDirectorySeparator
const char * VSIGetDirectorySeparator(const char *pszPath)
Return the directory separator for the specified path.
Definition cpl_vsil.cpp:170
VSIFTellL
vsi_l_offset VSIFTellL(VSILFILE *)
Tell current file offset.
Definition cpl_vsil.cpp:2150
VSIRename
int VSIRename(const char *oldpath, const char *newpath)
Rename a file.
Definition cpl_vsil.cpp:525
VSISetCredential
void VSISetCredential(const char *pszPathPrefix, const char *pszKey, const char *pszValue)
Set a credential (or more generally an option related to a virtual file system) for a given path pref...
Definition cpl_vsil.cpp:2971
VSICopyFile
int VSICopyFile(const char *pszSource, const char *pszTarget, VSILFILE *fpSource, vsi_l_offset nSourceSize, const char *const *papszOptions, GDALProgressFunc pProgressFunc, void *pProgressData)
Copy a source file into a target file.
Definition cpl_vsil.cpp:567
VSIFWriteL
size_t VSIFWriteL(const void *, size_t, size_t, VSILFILE *)
Write bytes to file.
Definition cpl_vsil.cpp:2379
VSIRangeStatus
VSIRangeStatus
Range status.
Definition cpl_vsi.h:182
VSI_RANGE_STATUS_DATA
@ VSI_RANGE_STATUS_DATA
Data present.
Definition cpl_vsi.h:184
VSI_RANGE_STATUS_HOLE
@ VSI_RANGE_STATUS_HOLE
Hole.
Definition cpl_vsi.h:185
VSI_RANGE_STATUS_UNKNOWN
@ VSI_RANGE_STATUS_UNKNOWN
Unknown.
Definition cpl_vsi.h:183
VSIFilesystemPluginReadCallback
size_t(* VSIFilesystemPluginReadCallback)(void *pFile, void *pBuffer, size_t nSize, size_t nCount)
Read data from current position, returns the number of blocks correctly read.
Definition cpl_vsi.h:602
VSIInstallStdinHandler
void VSIInstallStdinHandler(void)
Install /vsistdin/ file system handler.
Definition cpl_vsil_stdin.cpp:667
VSISupportsRandomWrite
bool VSISupportsRandomWrite(const char *pszPath, bool bAllowLocalTempFile)
Returns if the filesystem supports random write.
Definition cpl_vsil.cpp:1151
CPLGetPhysicalRAM
GIntBig CPLGetPhysicalRAM(void)
Return the total physical RAM in bytes.
Definition cpl_vsisimple.cpp:1396
VSIFTruncateL
int VSIFTruncateL(VSILFILE *, vsi_l_offset)
Truncate/expand the file to the specified size.
Definition cpl_vsil.cpp:2463
VSICalloc
void * VSICalloc(size_t, size_t)
Analog of calloc().
Definition cpl_vsisimple.cpp:451
VSIFilesystemPluginTellCallback
vsi_l_offset(* VSIFilesystemPluginTellCallback)(void *pFile)
Return current position in handle.
Definition cpl_vsi.h:589
VSIIsCaseSensitiveFS
int VSIIsCaseSensitiveFS(const char *pszFilename)
Returns if the filenames of the filesystem are case sensitive.
Definition cpl_vsil.cpp:1021
VSIInstallGZipFileHandler
void VSIInstallGZipFileHandler(void)
Install GZip file system handler.
Definition cpl_vsil_gzip.cpp:3281
VSIMalloc2Verbose
void * VSIMalloc2Verbose(size_t nSize1, size_t nSize2, const char *pszFile, int nLine)
VSIMalloc2Verbose.
Definition cpl_vsisimple.cpp:1164
VSIHasOptimizedReadMultiRange
int VSIHasOptimizedReadMultiRange(const char *pszPath)
Returns if the filesystem supports efficient multi-range reading.
Definition cpl_vsil.cpp:1176
VSIFilesystemPluginAdviseReadCallback
void(* VSIFilesystemPluginAdviseReadCallback)(void *pFile, int nRanges, const vsi_l_offset *panOffsets, const size_t *panSizes)
This optional method is called when code plans to access soon one or several ranges in a file.
Definition cpl_vsi.h:660
VSIFilesystemPluginReadDirCallback
char **(* VSIFilesystemPluginReadDirCallback)(void *pUserData, const char *pszDirname, int nMaxFiles)
List directory content.
Definition cpl_vsi.h:562
VSIFreeFilesystemPluginCallbacksStruct
void VSIFreeFilesystemPluginCallbacksStruct(VSIFilesystemPluginCallbacksStruct *poCb)
free resources allocated by VSIAllocFilesystemPluginCallbacksStruct
Definition cpl_vsil_plugin.cpp:489
VSIFilesystemPluginRenameCallback
int(* VSIFilesystemPluginRenameCallback)(void *pUserData, const char *oldpath, const char *newpath)
Rename handle.
Definition cpl_vsi.h:542
VSISetPathSpecificOption
void VSISetPathSpecificOption(const char *pszPathPrefix, const char *pszKey, const char *pszValue)
Set a path specific option for a given path prefix.
Definition cpl_vsil.cpp:3008
VSIRemovePluginHandler
int VSIRemovePluginHandler(const char *pszPrefix)
Unregister a handler previously installed with VSIInstallPluginHandler() on the given prefix.
Definition cpl_vsil_plugin.cpp:476
VSIInstallCurlFileHandler
void VSIInstallCurlFileHandler(void)
Install /vsicurl/ HTTP/FTP file system handler (requires libcurl)
Definition cpl_vsil_curl.cpp:6126
VSIMallocVerbose
void * VSIMallocVerbose(size_t nSize, const char *pszFile, int nLine)
VSIMallocVerbose.
Definition cpl_vsisimple.cpp:1147
VSIInstallWebHdfsHandler
void VSIInstallWebHdfsHandler(void)
Install /vsiwebhdfs/ WebHDFS (Hadoop File System) REST API file system handler (requires libcurl)
Definition cpl_vsil_webhdfs.cpp:1212
VSISupportsSequentialWrite
bool VSISupportsSequentialWrite(const char *pszPath, bool bAllowLocalTempFile)
Returns if the filesystem supports sequential write.
Definition cpl_vsil.cpp:1127
VSIInstallS3FileHandler
void VSIInstallS3FileHandler(void)
Install /vsis3/ Amazon S3 file system handler (requires libcurl)
Definition cpl_vsil_s3.cpp:4922
VSIInstallHdfsHandler
void VSIInstallHdfsHandler(void)
Install /vsihdfs/ file system handler (requires JVM and HDFS support)
Definition cpl_vsil_hdfs.cpp:471
VSIInstallCryptFileHandler
void VSIInstallCryptFileHandler(void)
Install /vsicrypt/ encrypted file system handler (requires libcrypto++)
Definition cpl_vsil_crypt.cpp:2059
VSIGetFileSystemsPrefixes
char ** VSIGetFileSystemsPrefixes(void)
Return the list of prefixes for virtual file system handlers currently registered.
Definition cpl_vsil.cpp:2927
VSIOverwriteFile
int VSIOverwriteFile(VSILFILE *fpTarget, const char *pszSourceFilename)
Overwrite an existing file with content from another one.
Definition cpl_vsil.cpp:2816
VSIInstallSwiftStreamingFileHandler
void VSIInstallSwiftStreamingFileHandler(void)
Install /vsiswift_streaming/ OpenStack Swif Object Storage (Swift) file system handler (requires libc...
Definition cpl_vsil_curl_streaming.cpp:2175
VSISetCryptKey
void VSISetCryptKey(const GByte *pabyKey, int nKeySize)
Installs the encryption/decryption key.
Definition cpl_vsil_crypt.cpp:204
VSIMallocAlignedAutoVerbose
void * VSIMallocAlignedAutoVerbose(size_t nSize, const char *pszFile, int nLine)
See VSIMallocAlignedAuto()
Definition cpl_vsisimple.cpp:967
VSIInstallStdoutHandler
void VSIInstallStdoutHandler(void)
Install /vsistdout/ file system handler.
Definition cpl_vsil_stdout.cpp:448
VSIMkdirRecursive
int VSIMkdirRecursive(const char *pszPathname, long mode)
Create a directory and all its ancestors.
Definition cpl_vsil.cpp:399
VSIInstallMemFileHandler
void VSIInstallMemFileHandler(void)
Install "memory" file system handler.
Definition cpl_vsi_mem.cpp:969
VSIFPutcL
int VSIFPutcL(int, VSILFILE *)
Write a single byte to the file.
Definition cpl_vsil.cpp:2553
VSISync
int VSISync(const char *pszSource, const char *pszTarget, const char *const *papszOptions, GDALProgressFunc pProgressFunc, void *pProgressData, char ***ppapszOutputs)
Synchronize a source file/directory with a target file/directory.
Definition cpl_vsil.cpp:671
VSIMalloc2
void * VSIMalloc2(size_t nSize1, size_t nSize2)
VSIMalloc2 allocates (nSize1 * nSize2) bytes.
Definition cpl_vsisimple.cpp:1125
VSIFilesystemPluginCloseCallback
int(* VSIFilesystemPluginCloseCallback)(void *pFile)
Close file handle.
Definition cpl_vsi.h:644
VSIDIR
struct VSIDIR VSIDIR
Opaque type for a directory iterator.
Definition cpl_vsi.h:402
VSICurlClearCache
void VSICurlClearCache(void)
Clean local cache associated with /vsicurl/ (and related file systems)
Definition cpl_vsil_curl.cpp:6150
VSICurlPartialClearCache
void VSICurlPartialClearCache(const char *pszFilenamePrefix)
Clean local cache associated with /vsicurl/ (and related file systems) for a given filename (and its ...
Definition cpl_vsil_curl.cpp:6189
VSIIngestFile
int VSIIngestFile(VSILFILE *fp, const char *pszFilename, GByte **ppabyRet, vsi_l_offset *pnSize, GIntBig nMaxSize)
Ingest a file into memory.
Definition cpl_vsil.cpp:2640
VSIFOpenExL
VSILFILE * VSIFOpenExL(const char *, const char *, int)
Open file.
Definition cpl_vsil.cpp:1939
VSISupportsSparseFiles
int VSISupportsSparseFiles(const char *pszPath)
Returns if the filesystem supports sparse files.
Definition cpl_vsil.cpp:1050
VSIFilesystemPluginMkdirCallback
int(* VSIFilesystemPluginMkdirCallback)(void *pUserData, const char *pszDirname, long nMode)
Create Directory.
Definition cpl_vsi.h:549
VSIRealloc
void * VSIRealloc(void *, size_t)
Analog of realloc().
Definition cpl_vsisimple.cpp:694
VSIFilesystemPluginTruncateCallback
int(* VSIFilesystemPluginTruncateCallback)(void *pFile, vsi_l_offset nNewSize)
Truncate handle.
Definition cpl_vsi.h:638
VSIAllocFilesystemPluginCallbacksStruct
VSIFilesystemPluginCallbacksStruct * VSIAllocFilesystemPluginCallbacksStruct(void)
return a VSIFilesystemPluginCallbacksStruct to be populated at runtime with handler callbacks
Definition cpl_vsil_plugin.cpp:483
VSIFilesystemPluginWriteCallback
size_t(* VSIFilesystemPluginWriteCallback)(void *pFile, const void *pBuffer, size_t nSize, size_t nCount)
Write bytes at current offset.
Definition cpl_vsi.h:627
VSIFilesystemPluginSiblingFilesCallback
char **(* VSIFilesystemPluginSiblingFilesCallback)(void *pUserData, const char *pszDirname)
List related files.
Definition cpl_vsi.h:574
VSICloseDir
void VSICloseDir(VSIDIR *dir)
Close a directory.
Definition cpl_vsil.cpp:352
VSIUnlink
int VSIUnlink(const char *pszFilename)
Delete a file.
Definition cpl_vsil.cpp:450
VSIMalloc3
void * VSIMalloc3(size_t nSize1, size_t nSize2, size_t nSize3)
VSIMalloc3 allocates (nSize1 * nSize2 * nSize3) bytes.
Definition cpl_vsisimple.cpp:1138
VSIFCloseL
int VSIFCloseL(VSILFILE *)
Close file.
Definition cpl_vsil.cpp:2051
VSIOpenDir
VSIDIR * VSIOpenDir(const char *pszPath, int nRecurseDepth, const char *const *papszOptions)
Open a directory to read its entries.
Definition cpl_vsil.cpp:293
VSIGetMemFileBuffer
GByte * VSIGetMemFileBuffer(const char *pszFilename, vsi_l_offset *pnDataLength, int bUnlinkAndSeize)
Fetch buffer underlying memory file.
Definition cpl_vsi_mem.cpp:1086
VSIInstallSwiftFileHandler
void VSIInstallSwiftFileHandler(void)
Install /vsiswift/ OpenStack Swif Object Storage (Swift) file system handler (requires libcurl)
Definition cpl_vsil_swift.cpp:747
VSIInstallZipFileHandler
void VSIInstallZipFileHandler(void)
Install ZIP file system handler.
Definition cpl_vsil_gzip.cpp:4878
VSIGetCredential
const char * VSIGetCredential(const char *pszPath, const char *pszKey, const char *pszDefault)
Get the value of a credential (or more generally an option related to a virtual file system) for a gi...
Definition cpl_vsil.cpp:3076
VSIFilesystemPluginGetRangeStatusCallback
VSIRangeStatus(* VSIFilesystemPluginGetRangeStatusCallback)(void *pFile, vsi_l_offset nOffset, vsi_l_offset nLength)
Get empty ranges.
Definition cpl_vsi.h:616
VSIFGetNativeFileDescriptorL
void * VSIFGetNativeFileDescriptorL(VSILFILE *)
Returns the "native" file descriptor for the virtual handle.
Definition cpl_vsil.cpp:2887
VSIGetCanonicalFilename
char * VSIGetCanonicalFilename(const char *pszPath)
Returns the canonical filename.
Definition cpl_vsil.cpp:1103
VSIFilesystemPluginSeekCallback
int(* VSIFilesystemPluginSeekCallback)(void *pFile, vsi_l_offset nOffset, int nWhence)
Seek to position in handle.
Definition cpl_vsi.h:594
VSIClearCredentials
void VSIClearCredentials(const char *pszPathPrefix)
Clear path specific options set with VSISetPathSpecificOption()
Definition cpl_vsil.cpp:3035
VSIFilesystemPluginStatCallback
int(* VSIFilesystemPluginStatCallback)(void *pUserData, const char *pszFilename, VSIStatBufL *pStatBuf, int nFlags)
Return information about a handle.
Definition cpl_vsi.h:528
VSIInstallOSSStreamingFileHandler
void VSIInstallOSSStreamingFileHandler(void)
Install /vsiaz_streaming/ Alibaba Cloud Object Storage Service (OSS) (requires libcurl)
Definition cpl_vsil_curl_streaming.cpp:2154
VSIReadDirEx
char ** VSIReadDirEx(const char *pszPath, int nMaxFiles)
Read names in a directory.
Definition cpl_vsil.cpp:123
VSIMallocAligned
void * VSIMallocAligned(size_t nAlignment, size_t nSize)
Allocates a buffer with an alignment constraint.
Definition cpl_vsisimple.cpp:908
VSIGetSignedURL
char * VSIGetSignedURL(const char *pszFilename, CSLConstList papszOptions)
Returns a signed URL of a supplied filename.
Definition cpl_vsil.cpp:1249
VSIInstallPluginHandler
int VSIInstallPluginHandler(const char *pszPrefix, const VSIFilesystemPluginCallbacksStruct *poCb)
register a handler on the given prefix.
Definition cpl_vsil_plugin.cpp:466
VSIGetActualURL
const char * VSIGetActualURL(const char *pszFilename)
Returns the actual URL of a supplied filename.
Definition cpl_vsil.cpp:1205
VSIRmdirRecursive
int VSIRmdirRecursive(const char *pszDirname)
Delete a directory recursively.
Definition cpl_vsil.cpp:774
VSIMkdir
int VSIMkdir(const char *pszPathname, long mode)
Create a directory.
Definition cpl_vsil.cpp:377
VSIReallocVerbose
void * VSIReallocVerbose(void *pOldPtr, size_t nNewSize, const char *pszFile, int nLine)
VSIReallocVerbose.
Definition cpl_vsisimple.cpp:1232
VSIFilesystemPluginOpenCallback
void *(* VSIFilesystemPluginOpenCallback)(void *pUserData, const char *pszFilename, const char *pszAccess)
Open a handle.
Definition cpl_vsi.h:582
VSIFReadL
size_t VSIFReadL(void *, size_t, size_t, VSILFILE *)
Read bytes from file.
Definition cpl_vsil.cpp:2269
VSIFReadMultiRangeL
int VSIFReadMultiRangeL(int nRanges, void **ppData, const vsi_l_offset *panOffsets, const size_t *panSizes, VSILFILE *)
Read several ranges of bytes from file.
Definition cpl_vsil.cpp:2327
VSIInstallCurlStreamingFileHandler
void VSIInstallCurlStreamingFileHandler(void)
Install /vsicurl_streaming/ HTTP/FTP file system handler (requires libcurl).
Definition cpl_vsil_curl_streaming.cpp:2071
VSIStrdup
char * VSIStrdup(const char *)
Analog of strdup().
Definition cpl_vsisimple.cpp:1010
VSIFOpenL
VSILFILE * VSIFOpenL(const char *, const char *)
Open file.
Definition cpl_vsil.cpp:1286
VSIFEofL
int VSIFEofL(VSILFILE *)
Test for end of file.
Definition cpl_vsil.cpp:2423
VSIInstallSparseFileHandler
void VSIInstallSparseFileHandler(void)
Install /vsisparse/ virtual file handler.
Definition cpl_vsil_sparsefile.cpp:555
VSIInstallSubFileHandler
void VSIInstallSubFileHandler(void)
Install /vsisubfile/ virtual file handler.
Definition cpl_vsil_subfile.cpp:501
VSIRewindL
void VSIRewindL(VSILFILE *)
Rewind the file pointer to the beginning of the file.
Definition cpl_vsil.cpp:2170
VSIReadDir
char ** VSIReadDir(const char *)
Read names in a directory.
Definition cpl_vsil.cpp:89
VSIMalloc3Verbose
void * VSIMalloc3Verbose(size_t nSize1, size_t nSize2, size_t nSize3, const char *pszFile, int nLine)
VSIMalloc3Verbose.
Definition cpl_vsisimple.cpp:1188
VSIFilesystemPluginUnlinkCallback
int(* VSIFilesystemPluginUnlinkCallback)(void *pUserData, const char *pszFilename)
Remove handle by name.
Definition cpl_vsi.h:536
VSIInstallRarFileHandler
void VSIInstallRarFileHandler(void)
Install /vsirar/ RAR file system handler (requires libarchive)
Definition cpl_vsil_libarchive.cpp:65
VSIStrerror
char * VSIStrerror(int)
Return the error string corresponding to the error number.
Definition cpl_vsisimple.cpp:1373
VSIDuplicateFileSystemHandler
bool VSIDuplicateFileSystemHandler(const char *pszSourceFSName, const char *pszNewFSName)
Duplicate an existing file system handler.
Definition cpl_vsil.cpp:3135
VSIInstallADLSFileHandler
void VSIInstallADLSFileHandler(void)
Install /vsiaz/ Microsoft Azure Data Lake Storage Gen2 file system handler (requires libcurl)
Definition cpl_vsil_adls.cpp:2222
CPLGetUsablePhysicalRAM
GIntBig CPLGetUsablePhysicalRAM(void)
Return the total physical RAM, usable by a process, in bytes.
Definition cpl_vsisimple.cpp:1613
VSIStatL
int VSIStatL(const char *, VSIStatBufL *)
Get filesystem object info.
Definition cpl_vsil.cpp:810
VSIReadDirRecursive
char ** VSIReadDirRecursive(const char *pszPath)
Read names in a directory recursively.
Definition cpl_vsil.cpp:210
VSIInstallGSStreamingFileHandler
void VSIInstallGSStreamingFileHandler(void)
Install /vsigs_streaming/ Google Cloud Storage file system handler (requires libcurl)
Definition cpl_vsil_curl_streaming.cpp:2112
VSIFilesystemPluginEofCallback
int(* VSIFilesystemPluginEofCallback)(void *pFile)
Has end of file been reached.
Definition cpl_vsi.h:622
VSIFPrintfL
int VSIFPrintfL(VSILFILE *, const char *,...)
Formatted write to file.
Definition cpl_vsil.cpp:2487
VSIStatExL
int VSIStatExL(const char *pszFilename, VSIStatBufL *psStatBuf, int nFlags)
Get filesystem object info.
Definition cpl_vsil.cpp:850
VSINetworkStatsGetAsSerializedJSON
char * VSINetworkStatsGetAsSerializedJSON(char **papszOptions)
Return network related statistics, as a JSON serialized object.
Definition cpl_vsil_curl.cpp:6312
VSIInstallOSSFileHandler
void VSIInstallOSSFileHandler(void)
Install /vsioss/ Alibaba Cloud Object Storage Service (OSS) file system handler (requires libcurl)
Definition cpl_vsil_oss.cpp:332
VSIGetDiskFreeSpace
GIntBig VSIGetDiskFreeSpace(const char *pszDirname)
Return free disk space available on the filesystem.
Definition cpl_vsil.cpp:2906
VSIFOpenEx2L
VSILFILE * VSIFOpenEx2L(const char *, const char *, int, CSLConstList)
Open file.
Definition cpl_vsil.cpp:1996
VSIInstallTarFileHandler
void VSIInstallTarFileHandler(void)
Install /vsitar/ file system handler.
Definition cpl_vsil_tar.cpp:671
VSIInstall7zFileHandler
void VSIInstall7zFileHandler(void)
Install /vsi7z/ 7zip file system handler (requires libarchive)
Definition cpl_vsil_libarchive.cpp:47
VSIGetFileSystemOptions
const char * VSIGetFileSystemOptions(const char *pszFilename)
Return the list of options associated with a virtual file system handler as a serialized XML string.
Definition cpl_vsil.cpp:2947
VSIFreeAligned
void VSIFreeAligned(void *ptr)
Free a buffer allocated with VSIMallocAligned().
Definition cpl_vsisimple.cpp:990
VSIMallocAlignedAuto
void * VSIMallocAlignedAuto(size_t nSize)
Allocates a buffer with an alignment constraint such that it can be used by the most demanding vector...
Definition cpl_vsisimple.cpp:954
VSIAbortPendingUploads
int VSIAbortPendingUploads(const char *pszFilename)
Abort ongoing multi-part uploads.
Definition cpl_vsil.cpp:721
VSIStdoutSetRedirection
void VSIStdoutSetRedirection(VSIWriteFunction pFct, FILE *stream)
Set an alternative write function and output file handle instead of fwrite() / stdout.
Definition cpl_vsil_stdout.cpp:62
VSIGetPathSpecificOption
const char * VSIGetPathSpecificOption(const char *pszPath, const char *pszKey, const char *pszDefault)
Get the value a path specific option.
Definition cpl_vsil.cpp:3095
VSIMalloc
void * VSIMalloc(size_t)
Analog of malloc().
Definition cpl_vsisimple.cpp:567
VSIFSeekL
int VSIFSeekL(VSILFILE *, vsi_l_offset, int)
Seek to requested offset.
Definition cpl_vsil.cpp:2109
VSIFilesystemPluginFlushCallback
int(* VSIFilesystemPluginFlushCallback)(void *pFile)
Sync written bytes.
Definition cpl_vsi.h:634
VSIFileFromMemBuffer
VSILFILE * VSIFileFromMemBuffer(const char *pszFilename, GByte *pabyData, vsi_l_offset nDataLength, int bTakeOwnership)
Create memory "file" from a buffer.
Definition cpl_vsi_mem.cpp:1002
VSIIsLocal
bool VSIIsLocal(const char *pszPath)
Returns if the file/filesystem is "local".
Definition cpl_vsil.cpp:1078
VSIRmdir
int VSIRmdir(const char *pszDirname)
Delete a directory.
Definition cpl_vsil.cpp:748
VSIInstallAzureFileHandler
void VSIInstallAzureFileHandler(void)
Install /vsiaz/ Microsoft Azure Blob file system handler (requires libcurl)
Definition cpl_vsil_az.cpp:2645
VSIFree
void VSIFree(void *)
Analog of free() for data allocated with VSIMalloc(), VSICalloc(), VSIRealloc()
Definition cpl_vsisimple.cpp:843
VSIStrdupVerbose
char * VSIStrdupVerbose(const char *pszStr, const char *pszFile, int nLine)
VSIStrdupVerbose.
Definition cpl_vsisimple.cpp:1250
VSIClearPathSpecificOptions
void VSIClearPathSpecificOptions(const char *pszPathPrefix)
Clear path specific options set with VSISetPathSpecificOption()
Definition cpl_vsil.cpp:3053
vsi_l_offset
GUIntBig vsi_l_offset
Type for a file offset.
Definition cpl_vsi.h:146
VSIGetNextDirEntry
const VSIDIREntry * VSIGetNextDirEntry(VSIDIR *dir)
Return the next entry of the directory.
Definition cpl_vsil.cpp:333
VSIInstallGSFileHandler
void VSIInstallGSFileHandler(void)
Install /vsigs/ Google Cloud Storage file system handler (requires libcurl)
Definition cpl_vsil_gs.cpp:832
VSIInstallAzureStreamingFileHandler
void VSIInstallAzureStreamingFileHandler(void)
Install /vsiaz_streaming/ Microsoft Azure Blob file system handler (requires libcurl)
Definition cpl_vsil_curl_streaming.cpp:2133
VSIGetFileMetadata
char ** VSIGetFileMetadata(const char *pszFilename, const char *pszDomain, CSLConstList papszOptions)
Get metadata on files.
Definition cpl_vsil.cpp:917
VSIFilesystemPluginRmdirCallback
int(* VSIFilesystemPluginRmdirCallback)(void *pUserData, const char *pszDirname)
Delete Directory.
Definition cpl_vsi.h:556
VSIDIREntry
Directory entry.
Definition cpl_vsi.h:414
VSIDIREntry::pszName
char * pszName
Filename.
Definition cpl_vsi.h:416
VSIDIREntry::nMTime
GIntBig nMTime
Last modification time (seconds since 1970/01/01)
Definition cpl_vsi.h:422
VSIDIREntry::bMTimeKnown
char bMTimeKnown
Whether nMTime is known: 0 = unknown, 1 = known.
Definition cpl_vsi.h:428
VSIDIREntry::bSizeKnown
char bSizeKnown
Whether nSize is known: 0 = unknown, 1 = known.
Definition cpl_vsi.h:426
VSIDIREntry::bModeKnown
char bModeKnown
Whether nMode is known: 0 = unknown, 1 = known.
Definition cpl_vsi.h:424
VSIDIREntry::papszExtra
char ** papszExtra
NULL-terminated list of extra properties.
Definition cpl_vsi.h:430
VSIDIREntry::nSize
vsi_l_offset nSize
File size.
Definition cpl_vsi.h:420
VSIDIREntry::nMode
int nMode
File mode.
Definition cpl_vsi.h:418
VSIFilesystemPluginCallbacksStruct
struct containing callbacks to used by the handler.
Definition cpl_vsi.h:672
VSIFilesystemPluginCallbacksStruct::advise_read
VSIFilesystemPluginAdviseReadCallback advise_read
The following optional member has been added in GDAL 3.7:
Definition cpl_vsi.h:708
VSIFilesystemPluginCallbacksStruct::write
VSIFilesystemPluginWriteCallback write
write bytes to current position (w)
Definition cpl_vsi.h:698
VSIFilesystemPluginCallbacksStruct::nBufferSize
size_t nBufferSize
buffer small reads (makes handler read only)
Definition cpl_vsi.h:702
VSIFilesystemPluginCallbacksStruct::rename
VSIFilesystemPluginRenameCallback rename
rename handle ()
Definition cpl_vsi.h:680
VSIFilesystemPluginCallbacksStruct::read_multi_range
VSIFilesystemPluginReadMultiRangeCallback read_multi_range
read multiple blocks ()
Definition cpl_vsi.h:692
VSIFilesystemPluginCallbacksStruct::unlink
VSIFilesystemPluginUnlinkCallback unlink
unlink handle by name ()
Definition cpl_vsi.h:679
VSIFilesystemPluginCallbacksStruct::rmdir
VSIFilesystemPluginRmdirCallback rmdir
remove directory ()
Definition cpl_vsi.h:682
VSIFilesystemPluginCallbacksStruct::nCacheSize
size_t nCacheSize
max mem to use per file when buffering
Definition cpl_vsi.h:703
VSIFilesystemPluginCallbacksStruct::eof
VSIFilesystemPluginEofCallback eof
has end of file been reached (r?)
Definition cpl_vsi.h:696
VSIFilesystemPluginCallbacksStruct::sibling_files
VSIFilesystemPluginSiblingFilesCallback sibling_files
list related files
Definition cpl_vsi.h:705
VSIFilesystemPluginCallbacksStruct::open
VSIFilesystemPluginOpenCallback open
open handle by name (rw)
Definition cpl_vsi.h:685
VSIFilesystemPluginCallbacksStruct::seek
VSIFilesystemPluginSeekCallback seek
set current position of handle (rw)
Definition cpl_vsi.h:689
VSIFilesystemPluginCallbacksStruct::get_range_status
VSIFilesystemPluginGetRangeStatusCallback get_range_status
get range status ()
Definition cpl_vsi.h:694
VSIFilesystemPluginCallbacksStruct::close
VSIFilesystemPluginCloseCallback close
close handle (rw)
Definition cpl_vsi.h:701
VSIFilesystemPluginCallbacksStruct::read
VSIFilesystemPluginReadCallback read
read from current position (r)
Definition cpl_vsi.h:690
VSIFilesystemPluginCallbacksStruct::flush
VSIFilesystemPluginFlushCallback flush
sync bytes (w)
Definition cpl_vsi.h:699
VSIFilesystemPluginCallbacksStruct::read_dir
VSIFilesystemPluginReadDirCallback read_dir
list directory content (r?)
Definition cpl_vsi.h:684
VSIFilesystemPluginCallbacksStruct::pUserData
void * pUserData
Optional opaque pointer passed back to filemanager callbacks (e.g.
Definition cpl_vsi.h:677
VSIFilesystemPluginCallbacksStruct::truncate
VSIFilesystemPluginTruncateCallback truncate
truncate handle (w?)
Definition cpl_vsi.h:700
VSIFilesystemPluginCallbacksStruct::mkdir
VSIFilesystemPluginMkdirCallback mkdir
make directory ()
Definition cpl_vsi.h:681
VSIFilesystemPluginCallbacksStruct::stat
VSIFilesystemPluginStatCallback stat
stat handle by name (rw)
Definition cpl_vsi.h:678
VSIFilesystemPluginCallbacksStruct::tell
VSIFilesystemPluginTellCallback tell
get current position of handle (rw)
Definition cpl_vsi.h:687
VSIVirtualHandle
Virtual file handle.
Definition cpl_vsi_virtual.h:63