GDAL

cpl_vsi.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Project: CPL - Common Portability Library
4 * Author: Frank Warmerdam, warmerdam@pobox.com
5 * Purpose: Include file defining Virtual File System (VSI) functions, a
6 * layer over POSIX file and other system services.
7 *
8 ******************************************************************************
9 * Copyright (c) 1998, Frank Warmerdam
10 * Copyright (c) 2008-2014, Even Rouault <even dot rouault at spatialys.com>
11 *
12 * SPDX-License-Identifier: MIT
13 ****************************************************************************/
14
15#ifndef CPL_VSI_H_INCLUDED
16#define CPL_VSI_H_INCLUDED
17
18#include "cpl_port.h"
19#include "cpl_progress.h"
20
21#include <stdbool.h>
22
23#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
24 extern "C++"
25{
26#include <string>
27}
28#endif
29
48/* -------------------------------------------------------------------- */
49/* We need access to ``struct stat''. */
50/* -------------------------------------------------------------------- */
51
52/* Unix */
53#if !defined(_WIN32)
54#include <unistd.h>
55#endif
56
57/* Windows */
58#include <sys/stat.h>
59
60 CPL_C_START
61
63#ifdef ENABLE_EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
64#define EXPERIMENTAL_CPL_WARN_UNUSED_RESULT CPL_WARN_UNUSED_RESULT
65#else
66#define EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
67#endif
70/* ==================================================================== */
71/* stdio file access functions. These do not support large */
72/* files, and do not go through the virtualization API. */
73/* ==================================================================== */
74
77FILE CPL_DLL *VSIFOpen(const char *, const char *) CPL_WARN_UNUSED_RESULT;
78 int CPL_DLL VSIFClose(FILE *);
79 int CPL_DLL VSIFSeek(FILE *, long, int) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
80 long CPL_DLL VSIFTell(FILE *) CPL_WARN_UNUSED_RESULT;
81 void CPL_DLL VSIRewind(FILE *);
82 void CPL_DLL VSIFFlush(FILE *);
83
84 size_t CPL_DLL VSIFRead(void *, size_t, size_t,
85 FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
86 size_t CPL_DLL VSIFWrite(const void *, size_t, size_t,
87 FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
88 char CPL_DLL *VSIFGets(char *, int, FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
89 int CPL_DLL VSIFPuts(const char *, FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
90 int CPL_DLL VSIFPrintf(FILE *, CPL_FORMAT_STRING(const char *),
91 ...) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
92 CPL_PRINT_FUNC_FORMAT(2, 3);
93
94 int CPL_DLL VSIFGetc(FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
95 int CPL_DLL VSIFPutc(int, FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
96 int CPL_DLL VSIUngetc(int, FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
97 int CPL_DLL VSIFEof(FILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
98
101/* ==================================================================== */
102/* VSIStat() related. */
103/* ==================================================================== */
104
106typedef struct stat VSIStatBuf;
107 int CPL_DLL VSIStat(const char *, VSIStatBuf *) CPL_WARN_UNUSED_RESULT;
110#ifdef _WIN32
111#define VSI_ISLNK(x) (0) /* N/A on Windows */
112#define VSI_ISREG(x) ((x)&S_IFREG)
113#define VSI_ISDIR(x) ((x)&S_IFDIR)
114#define VSI_ISCHR(x) ((x)&S_IFCHR)
115#define VSI_ISBLK(x) (0) /* N/A on Windows */
116#else
118#define VSI_ISLNK(x) S_ISLNK(x)
120#define VSI_ISREG(x) S_ISREG(x)
122#define VSI_ISDIR(x) S_ISDIR(x)
124#define VSI_ISCHR(x) S_ISCHR(x)
125#define VSI_ISBLK(x) S_ISBLK(x)
127#endif
128
129/* ==================================================================== */
130/* 64bit stdio file access functions. If we have a big size */
131/* defined, then provide prototypes for the large file API, */
132/* otherwise redefine to use the regular api. */
133/* ==================================================================== */
134
136 typedef GUIntBig vsi_l_offset;
138#define VSI_L_OFFSET_MAX GUINTBIG_MAX
139
141 typedef struct VSIVirtualHandle VSILFILE;
142
143 VSILFILE CPL_DLL *VSIFOpenL(const char *, const char *) CPL_WARN_UNUSED_RESULT;
144 VSILFILE CPL_DLL *VSIFOpenExL(const char *, const char *,
145 int) CPL_WARN_UNUSED_RESULT;
146 VSILFILE CPL_DLL *VSIFOpenEx2L(const char *, const char *, int,
147 CSLConstList) CPL_WARN_UNUSED_RESULT;
148 int CPL_DLL VSIFCloseL(VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
149 int CPL_DLL VSIFSeekL(VSILFILE *, vsi_l_offset,
150 int) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
151 vsi_l_offset CPL_DLL VSIFTellL(VSILFILE *) CPL_WARN_UNUSED_RESULT;
152 void CPL_DLL VSIRewindL(VSILFILE *);
153 size_t CPL_DLL VSIFReadL(void *, size_t, size_t,
154 VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
155 int CPL_DLL VSIFReadMultiRangeL(int nRanges, void **ppData,
156 const vsi_l_offset *panOffsets,
157 const size_t *panSizes,
158 VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
159 size_t CPL_DLL VSIFWriteL(const void *, size_t, size_t,
160 VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
161 void CPL_DLL VSIFClearErrL(VSILFILE *);
162 int CPL_DLL VSIFErrorL(VSILFILE *) CPL_WARN_UNUSED_RESULT;
163 int CPL_DLL VSIFEofL(VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
164 int CPL_DLL VSIFTruncateL(VSILFILE *,
165 vsi_l_offset) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
166 int CPL_DLL VSIFFlushL(VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
167 int CPL_DLL VSIFPrintfL(VSILFILE *, CPL_FORMAT_STRING(const char *),
168 ...) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
169 CPL_PRINT_FUNC_FORMAT(2, 3);
170 int CPL_DLL VSIFPutcL(int, VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT;
171
173typedef enum
174{
175 VSI_RANGE_STATUS_UNKNOWN,
176 VSI_RANGE_STATUS_DATA,
177 VSI_RANGE_STATUS_HOLE
178} VSIRangeStatus;
179
180 VSIRangeStatus CPL_DLL VSIFGetRangeStatusL(VSILFILE *fp, vsi_l_offset nStart,
181 vsi_l_offset nLength);
182
183 int CPL_DLL VSIIngestFile(VSILFILE *fp, const char *pszFilename,
184 GByte **ppabyRet, vsi_l_offset *pnSize,
185 GIntBig nMaxSize) CPL_WARN_UNUSED_RESULT;
186
187 int CPL_DLL VSIOverwriteFile(VSILFILE *fpTarget, const char *pszSourceFilename)
188 CPL_WARN_UNUSED_RESULT;
189
190#if defined(VSI_STAT64_T)
192 typedef struct VSI_STAT64_T VSIStatBufL;
193#else
195#define VSIStatBufL VSIStatBuf
196#endif
197
198 int CPL_DLL VSIStatL(const char *, VSIStatBufL *) CPL_WARN_UNUSED_RESULT;
199
201#define VSI_STAT_EXISTS_FLAG 0x1
203#define VSI_STAT_NATURE_FLAG 0x2
205#define VSI_STAT_SIZE_FLAG 0x4
207#define VSI_STAT_SET_ERROR_FLAG 0x8
211#define VSI_STAT_CACHE_ONLY 0x10
212
213 int CPL_DLL VSIStatExL(const char *pszFilename, VSIStatBufL *psStatBuf,
214 int nFlags) CPL_WARN_UNUSED_RESULT;
215
216 int CPL_DLL VSIIsCaseSensitiveFS(const char *pszFilename);
217
218 int CPL_DLL VSISupportsSparseFiles(const char *pszPath);
219
220 bool CPL_DLL VSIIsLocal(const char *pszPath);
221
222 char CPL_DLL *VSIGetCanonicalFilename(const char *pszPath);
223
224 bool CPL_DLL VSISupportsSequentialWrite(const char *pszPath,
225 bool bAllowLocalTempFile);
226
227 bool CPL_DLL VSISupportsRandomWrite(const char *pszPath,
228 bool bAllowLocalTempFile);
229
230 int CPL_DLL VSIHasOptimizedReadMultiRange(const char *pszPath);
231
232 const char CPL_DLL *VSIGetActualURL(const char *pszFilename);
233
234 char CPL_DLL *VSIGetSignedURL(const char *pszFilename,
235 CSLConstList papszOptions);
236
237 const char CPL_DLL *VSIGetFileSystemOptions(const char *pszFilename);
238
239 char CPL_DLL **VSIGetFileSystemsPrefixes(void);
240
241 void CPL_DLL *VSIFGetNativeFileDescriptorL(VSILFILE *);
242
243 char CPL_DLL **
244 VSIGetFileMetadata(const char *pszFilename, const char *pszDomain,
245 CSLConstList papszOptions) CPL_WARN_UNUSED_RESULT;
246
247 int CPL_DLL VSISetFileMetadata(const char *pszFilename,
248 CSLConstList papszMetadata,
249 const char *pszDomain,
250 CSLConstList papszOptions);
251
252 void CPL_DLL VSISetPathSpecificOption(const char *pszPathPrefix,
253 const char *pszKey, const char *pszValue);
254 void CPL_DLL VSIClearPathSpecificOptions(const char *pszPathPrefix);
255 const char CPL_DLL *VSIGetPathSpecificOption(const char *pszPath,
256 const char *pszKey,
257 const char *pszDefault);
258
259 void CPL_DLL VSISetCredential(const char *pszPathPrefix, const char *pszKey,
260 const char *pszValue)
262 CPL_WARN_DEPRECATED("Use VSISetPathSpecificOption instead")
264 ;
265 void CPL_DLL VSIClearCredentials(const char *pszPathPrefix)
267 CPL_WARN_DEPRECATED("Use VSIClearPathSpecificOptions instead")
269 ;
270 const char CPL_DLL *VSIGetCredential(const char *pszPath, const char *pszKey,
271 const char *pszDefault)
273 CPL_WARN_DEPRECATED("Use VSIGetPathSpecificOption instead")
275 ;
276
277/* ==================================================================== */
278/* Memory allocation */
279/* ==================================================================== */
280
281 void CPL_DLL *VSICalloc(size_t, size_t) CPL_WARN_UNUSED_RESULT;
282 void CPL_DLL *VSIMalloc(size_t) CPL_WARN_UNUSED_RESULT;
283 void CPL_DLL VSIFree(void *);
284 void CPL_DLL *VSIRealloc(void *, size_t) CPL_WARN_UNUSED_RESULT;
285 char CPL_DLL *VSIStrdup(const char *) CPL_WARN_UNUSED_RESULT;
286
287#if defined(__cplusplus) && defined(GDAL_COMPILATION)
288 extern "C++"
289{
291 struct CPL_DLL VSIFreeReleaser
292 {
293 void operator()(void *p) const
294 {
295 VSIFree(p);
296 }
297 };
298
300}
301#endif
302
303 void CPL_DLL *VSIMallocAligned(size_t nAlignment,
304 size_t nSize) CPL_WARN_UNUSED_RESULT;
305 void CPL_DLL *VSIMallocAlignedAuto(size_t nSize) CPL_WARN_UNUSED_RESULT;
306 void CPL_DLL VSIFreeAligned(void *ptr);
307
308 void CPL_DLL *VSIMallocAlignedAutoVerbose(size_t nSize, const char *pszFile,
309 int nLine) CPL_WARN_UNUSED_RESULT;
311#define VSI_MALLOC_ALIGNED_AUTO_VERBOSE(size) \
312 VSIMallocAlignedAutoVerbose(size, __FILE__, __LINE__)
313
321 void CPL_DLL *VSIMalloc2(size_t nSize1, size_t nSize2) CPL_WARN_UNUSED_RESULT;
322
331 void CPL_DLL *VSIMalloc3(size_t nSize1, size_t nSize2,
332 size_t nSize3) CPL_WARN_UNUSED_RESULT;
333
335 void CPL_DLL *VSIMallocVerbose(size_t nSize, const char *pszFile,
336 int nLine) CPL_WARN_UNUSED_RESULT;
338#define VSI_MALLOC_VERBOSE(size) VSIMallocVerbose(size, __FILE__, __LINE__)
339
341 void CPL_DLL *VSIMalloc2Verbose(size_t nSize1, size_t nSize2,
342 const char *pszFile,
343 int nLine) CPL_WARN_UNUSED_RESULT;
345#define VSI_MALLOC2_VERBOSE(nSize1, nSize2) \
346 VSIMalloc2Verbose(nSize1, nSize2, __FILE__, __LINE__)
347
349 void CPL_DLL *VSIMalloc3Verbose(size_t nSize1, size_t nSize2, size_t nSize3,
350 const char *pszFile,
351 int nLine) CPL_WARN_UNUSED_RESULT;
353#define VSI_MALLOC3_VERBOSE(nSize1, nSize2, nSize3) \
354 VSIMalloc3Verbose(nSize1, nSize2, nSize3, __FILE__, __LINE__)
355
357 void CPL_DLL *VSICallocVerbose(size_t nCount, size_t nSize, const char *pszFile,
358 int nLine) CPL_WARN_UNUSED_RESULT;
360#define VSI_CALLOC_VERBOSE(nCount, nSize) \
361 VSICallocVerbose(nCount, nSize, __FILE__, __LINE__)
362
364 void CPL_DLL *VSIReallocVerbose(void *pOldPtr, size_t nNewSize,
365 const char *pszFile,
366 int nLine) CPL_WARN_UNUSED_RESULT;
368#define VSI_REALLOC_VERBOSE(pOldPtr, nNewSize) \
369 VSIReallocVerbose(pOldPtr, nNewSize, __FILE__, __LINE__)
370
372 char CPL_DLL *VSIStrdupVerbose(const char *pszStr, const char *pszFile,
373 int nLine) CPL_WARN_UNUSED_RESULT;
375#define VSI_STRDUP_VERBOSE(pszStr) VSIStrdupVerbose(pszStr, __FILE__, __LINE__)
376
377 GIntBig CPL_DLL CPLGetPhysicalRAM(void);
378 GIntBig CPL_DLL CPLGetUsablePhysicalRAM(void);
379
380/* ==================================================================== */
381/* Other... */
382/* ==================================================================== */
383
385#define CPLReadDir VSIReadDir
386 char CPL_DLL **VSIReadDir(const char *);
387 char CPL_DLL **VSIReadDirRecursive(const char *pszPath);
388 char CPL_DLL **VSIReadDirEx(const char *pszPath, int nMaxFiles);
389 char CPL_DLL **VSISiblingFiles(const char *pszPath);
390 char CPL_DLL **VSIGlob(const char *pszPattern, const char *const *papszOptions,
391 GDALProgressFunc pProgressFunc, void *pProgressData);
392
393 const char CPL_DLL *VSIGetDirectorySeparator(const char *pszPath);
394
396 typedef struct VSIDIR VSIDIR;
397
398 VSIDIR CPL_DLL *VSIOpenDir(const char *pszPath, int nRecurseDepth,
399 const char *const *papszOptions);
400
402 typedef struct VSIDIREntry VSIDIREntry;
403
407 struct VSIDIREntry
408{
410 char *pszName;
412 int nMode;
414 vsi_l_offset nSize;
416 GIntBig nMTime;
418 char bModeKnown;
420 char bSizeKnown;
422 char bMTimeKnown;
424 char **papszExtra;
425
426#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
428 VSIDIREntry();
429 ~VSIDIREntry();
430 VSIDIREntry(const VSIDIREntry &);
431 VSIDIREntry &operator=(VSIDIREntry &) = delete;
433#endif
434};
435
436 const VSIDIREntry CPL_DLL *VSIGetNextDirEntry(VSIDIR *dir);
437 void CPL_DLL VSICloseDir(VSIDIR *dir);
438
439 int CPL_DLL VSIMkdir(const char *pszPathname, long mode);
440 int CPL_DLL VSIMkdirRecursive(const char *pszPathname, long mode);
441 int CPL_DLL VSIRmdir(const char *pszDirname);
442 int CPL_DLL VSIRmdirRecursive(const char *pszDirname);
443 int CPL_DLL VSIUnlink(const char *pszFilename);
444 int CPL_DLL *VSIUnlinkBatch(CSLConstList papszFiles);
445 int CPL_DLL VSIRename(const char *oldpath, const char *newpath);
446 int CPL_DLL VSIMove(const char *oldpath, const char *newpath,
447 const char *const *papszOptions,
448 GDALProgressFunc pProgressFunc, void *pProgressData);
449 int CPL_DLL VSICopyFile(const char *pszSource, const char *pszTarget,
450 VSILFILE *fpSource, vsi_l_offset nSourceSize,
451 const char *const *papszOptions,
452 GDALProgressFunc pProgressFunc, void *pProgressData);
453 int CPL_DLL VSICopyFileRestartable(const char *pszSource, const char *pszTarget,
454 const char *pszInputPayload,
455 char **ppszOutputPayload,
456 const char *const *papszOptions,
457 GDALProgressFunc pProgressFunc,
458 void *pProgressData);
459 int CPL_DLL VSISync(const char *pszSource, const char *pszTarget,
460 const char *const *papszOptions,
461 GDALProgressFunc pProgressFunc, void *pProgressData,
462 char ***ppapszOutputs);
463
464 int CPL_DLL VSIMultipartUploadGetCapabilities(
465 const char *pszFilename, int *pbNonSequentialUploadSupported,
466 int *pbParallelUploadSupported, int *pbAbortSupported,
467 size_t *pnMinPartSize, size_t *pnMaxPartSize, int *pnMaxPartCount);
468
469 char CPL_DLL *VSIMultipartUploadStart(const char *pszFilename,
470 CSLConstList papszOptions);
471 char CPL_DLL *VSIMultipartUploadAddPart(const char *pszFilename,
472 const char *pszUploadId,
473 int nPartNumber,
474 vsi_l_offset nFileOffset,
475 const void *pData, size_t nDataLength,
476 CSLConstList papszOptions);
477 int CPL_DLL VSIMultipartUploadEnd(const char *pszFilename,
478 const char *pszUploadId, size_t nPartIdsCount,
479 const char *const *apszPartIds,
480 vsi_l_offset nTotalSize,
481 CSLConstList papszOptions);
482 int CPL_DLL VSIMultipartUploadAbort(const char *pszFilename,
483 const char *pszUploadId,
484 CSLConstList papszOptions);
485
486 int CPL_DLL VSIAbortPendingUploads(const char *pszFilename);
487
488 char CPL_DLL *VSIStrerror(int);
489 GIntBig CPL_DLL VSIGetDiskFreeSpace(const char *pszDirname);
490
491 void CPL_DLL VSINetworkStatsReset(void);
492 char CPL_DLL *VSINetworkStatsGetAsSerializedJSON(char **papszOptions);
493
494#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
495 extern "C++"
496{
497 std::string CPL_DLL VSIURIToVSIPath(const std::string &osURI);
498}
499#endif
500
501/* ==================================================================== */
502/* Install special file access handlers. */
503/* ==================================================================== */
504 void CPL_DLL VSIInstallMemFileHandler(void);
506 void CPL_DLL VSIInstallLargeFileHandler(void);
508 void CPL_DLL VSIInstallSubFileHandler(void);
509 void VSIInstallCurlFileHandler(void);
510 void CPL_DLL VSICurlClearCache(void);
511 void CPL_DLL VSICurlPartialClearCache(const char *pszFilenamePrefix);
512 void VSIInstallCurlStreamingFileHandler(void);
513 void VSIInstallS3FileHandler(void);
514 void VSIInstallS3StreamingFileHandler(void);
515 void VSIInstallGSFileHandler(void);
516 void VSIInstallGSStreamingFileHandler(void);
517 void VSIInstallAzureFileHandler(void);
518 void VSIInstallAzureStreamingFileHandler(void);
519 void VSIInstallADLSFileHandler(void);
520 void VSIInstallOSSFileHandler(void);
521 void VSIInstallOSSStreamingFileHandler(void);
522 void VSIInstallSwiftFileHandler(void);
523 void VSIInstallSwiftStreamingFileHandler(void);
524 void VSIInstall7zFileHandler(void); /* No reason to export that */
525 void VSIInstallRarFileHandler(void); /* No reason to export that */
526 void VSIInstallGZipFileHandler(void); /* No reason to export that */
527 void VSIInstallZipFileHandler(void); /* No reason to export that */
528 void VSIInstallStdinHandler(void); /* No reason to export that */
529 void VSIInstallHdfsHandler(void); /* No reason to export that */
530 void VSIInstallWebHdfsHandler(void); /* No reason to export that */
531 void VSIInstallStdoutHandler(void); /* No reason to export that */
532 void CPL_DLL VSIInstallSparseFileHandler(void);
533 void VSIInstallTarFileHandler(void); /* No reason to export that */
534 void VSIInstallCachedFileHandler(void); /* No reason to export that */
535 void CPL_DLL VSIInstallCryptFileHandler(void);
536 void CPL_DLL VSISetCryptKey(const GByte *pabyKey, int nKeySize);
538 void CPL_DLL VSICleanupFileManager(void);
541 bool CPL_DLL VSIDuplicateFileSystemHandler(const char *pszSourceFSName,
542 const char *pszNewFSName);
543
544 VSILFILE CPL_DLL *
545 VSIFileFromMemBuffer(const char *pszFilename, GByte *pabyData,
546 vsi_l_offset nDataLength,
547 int bTakeOwnership) CPL_WARN_UNUSED_RESULT;
548 GByte CPL_DLL *VSIGetMemFileBuffer(const char *pszFilename,
549 vsi_l_offset *pnDataLength,
550 int bUnlinkAndSeize);
551
552 const char CPL_DLL *VSIMemGenerateHiddenFilename(const char *pszFilename);
553
555 typedef size_t (*VSIWriteFunction)(const void *ptr, size_t size, size_t nmemb,
556 FILE *stream);
557 void CPL_DLL VSIStdoutSetRedirection(VSIWriteFunction pFct, FILE *stream);
558
563 typedef int (*VSIFilesystemPluginStatCallback)(void *pUserData,
564 const char *pszFilename,
565 VSIStatBufL *pStatBuf,
566 int nFlags);
571 typedef int (*VSIFilesystemPluginUnlinkCallback)(void *pUserData,
572 const char *pszFilename);
577 typedef int (*VSIFilesystemPluginRenameCallback)(void *pUserData,
578 const char *oldpath,
579 const char *newpath);
584 typedef int (*VSIFilesystemPluginMkdirCallback)(void *pUserData,
585 const char *pszDirname,
586 long nMode);
591 typedef int (*VSIFilesystemPluginRmdirCallback)(void *pUserData,
592 const char *pszDirname);
597 typedef char **(*VSIFilesystemPluginReadDirCallback)(void *pUserData,
598 const char *pszDirname,
599 int nMaxFiles);
609 typedef char **(*VSIFilesystemPluginSiblingFilesCallback)(
610 void *pUserData, const char *pszDirname);
617 typedef void *(*VSIFilesystemPluginOpenCallback)(void *pUserData,
618 const char *pszFilename,
619 const char *pszAccess);
624 typedef vsi_l_offset (*VSIFilesystemPluginTellCallback)(void *pFile);
629 typedef int (*VSIFilesystemPluginSeekCallback)(void *pFile,
630 vsi_l_offset nOffset,
631 int nWhence);
637 typedef size_t (*VSIFilesystemPluginReadCallback)(void *pFile, void *pBuffer,
638 size_t nSize, size_t nCount);
644 typedef int (*VSIFilesystemPluginReadMultiRangeCallback)(
645 void *pFile, int nRanges, void **ppData, const vsi_l_offset *panOffsets,
646 const size_t *panSizes);
651 typedef VSIRangeStatus (*VSIFilesystemPluginGetRangeStatusCallback)(
652 void *pFile, vsi_l_offset nOffset, vsi_l_offset nLength);
657 typedef int (*VSIFilesystemPluginEofCallback)(void *pFile);
662 typedef size_t (*VSIFilesystemPluginWriteCallback)(void *pFile,
663 const void *pBuffer,
664 size_t nSize, size_t nCount);
669 typedef int (*VSIFilesystemPluginFlushCallback)(void *pFile);
673 typedef int (*VSIFilesystemPluginTruncateCallback)(void *pFile,
674 vsi_l_offset nNewSize);
679 typedef int (*VSIFilesystemPluginCloseCallback)(void *pFile);
680
695 typedef void (*VSIFilesystemPluginAdviseReadCallback)(
696 void *pFile, int nRanges, const vsi_l_offset *panOffsets,
697 const size_t *panSizes);
698
703 typedef int (*VSIFilesystemPluginErrorCallback)(void *pFile);
704
709 typedef void (*VSIFilesystemPluginClearErrCallback)(void *pFile);
710
718 typedef struct
719{
724 void *pUserData;
725 VSIFilesystemPluginStatCallback stat;
726 VSIFilesystemPluginUnlinkCallback unlink;
727 VSIFilesystemPluginRenameCallback rename;
728 VSIFilesystemPluginMkdirCallback mkdir;
729 VSIFilesystemPluginRmdirCallback rmdir;
730 VSIFilesystemPluginReadDirCallback
731 read_dir;
732 VSIFilesystemPluginOpenCallback open;
733 VSIFilesystemPluginTellCallback
734 tell;
735 VSIFilesystemPluginSeekCallback
736 seek;
737 VSIFilesystemPluginReadCallback read;
738 VSIFilesystemPluginReadMultiRangeCallback
739 read_multi_range;
740 VSIFilesystemPluginGetRangeStatusCallback
741 get_range_status;
742 VSIFilesystemPluginEofCallback
743 eof;
744 VSIFilesystemPluginWriteCallback
745 write;
746 VSIFilesystemPluginFlushCallback flush;
747 VSIFilesystemPluginTruncateCallback truncate;
748 VSIFilesystemPluginCloseCallback close;
749 size_t nBufferSize;
750 size_t nCacheSize;
751 VSIFilesystemPluginSiblingFilesCallback
752 sibling_files;
755 VSIFilesystemPluginAdviseReadCallback advise_read;
757 VSIFilesystemPluginErrorCallback error;
758 VSIFilesystemPluginClearErrCallback clear_err;
759 /*
760 Callbacks are defined as a struct allocated by a call to
761 VSIAllocFilesystemPluginCallbacksStruct in order to try to maintain ABI
762 stability when eventually adding a new member. Any callbacks added to
763 this struct SHOULD be added to the END of this struct
764 */
765} VSIFilesystemPluginCallbacksStruct;
766
772 VSIFilesystemPluginCallbacksStruct CPL_DLL *
773 VSIAllocFilesystemPluginCallbacksStruct(void);
774
779 void CPL_DLL VSIFreeFilesystemPluginCallbacksStruct(
780 VSIFilesystemPluginCallbacksStruct *poCb);
781
788 int CPL_DLL VSIInstallPluginHandler(
789 const char *pszPrefix, const VSIFilesystemPluginCallbacksStruct *poCb);
790
800 int CPL_DLL VSIRemovePluginHandler(const char *pszPrefix);
801
802/* ==================================================================== */
803/* Time querying. */
804/* ==================================================================== */
805
807 unsigned long CPL_DLL VSITime(unsigned long *);
808 const char CPL_DLL *VSICTime(unsigned long);
809 struct tm CPL_DLL *VSIGMTime(const time_t *pnTime, struct tm *poBrokenTime);
810 struct tm CPL_DLL *VSILocalTime(const time_t *pnTime, struct tm *poBrokenTime);
814/* -------------------------------------------------------------------- */
815/* the following can be turned on for detailed logging of */
816/* almost all IO calls. */
817/* -------------------------------------------------------------------- */
818#ifdef VSI_DEBUG
819
820#ifndef DEBUG
821#define DEBUG
822#endif
823
824#include "cpl_error.h"
825
826#define VSIDebug4(f, a1, a2, a3, a4) CPLDebug("VSI", f, a1, a2, a3, a4);
827#define VSIDebug3(f, a1, a2, a3) CPLDebug("VSI", f, a1, a2, a3);
828#define VSIDebug2(f, a1, a2) CPLDebug("VSI", f, a1, a2);
829#define VSIDebug1(f, a1) CPLDebug("VSI", f, a1);
830#else
831#define VSIDebug4(f, a1, a2, a3, a4) \
832 { \
833 }
834#define VSIDebug3(f, a1, a2, a3) \
835 { \
836 }
837#define VSIDebug2(f, a1, a2) \
838 { \
839 }
840#define VSIDebug1(f, a1) \
841 { \
842 }
843#endif
846 CPL_C_END
847
848#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:208
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:289
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:285
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:860
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition cpl_port.h:844
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1087
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:870
GByte
unsigned char GByte
Unsigned byte type.
Definition cpl_port.h:175
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:205
VSIStatBufL
#define VSIStatBufL
Type for VSIStatL()
Definition cpl_vsi.h:195
VSICallocVerbose
void * VSICallocVerbose(size_t nCount, size_t nSize, const char *pszFile, int nLine)
VSICallocVerbose.
Definition cpl_vsisimple.cpp:1204
VSISetFileMetadata
int VSISetFileMetadata(const char *pszFilename, CSLConstList papszMetadata, const char *pszDomain, CSLConstList papszOptions)
Set metadata on files.
Definition cpl_vsil.cpp:1734
VSIUnlinkBatch
int * VSIUnlinkBatch(CSLConstList papszFiles)
Delete several files, possibly in a batch.
Definition cpl_vsil.cpp:743
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:3564
VSINetworkStatsReset
void VSINetworkStatsReset(void)
Clear network related statistics.
Definition cpl_vsil_curl.cpp:6556
VSIInstallCachedFileHandler
void VSIInstallCachedFileHandler(void)
Install /vsicached? file system handler.
Definition cpl_vsil_cache.cpp:742
VSIWriteFunction
size_t(* VSIWriteFunction)(const void *ptr, size_t size, size_t nmemb, FILE *stream)
Callback used by VSIStdoutSetRedirection()
Definition cpl_vsi.h:555
VSIInstallS3StreamingFileHandler
void VSIInstallS3StreamingFileHandler(void)
Install /vsis3_streaming/ Amazon S3 file system handler (requires libcurl).
Definition cpl_vsil_curl_streaming.cpp:2131
VSIURIToVSIPath
std::string VSIURIToVSIPath(const std::string &osURI)
Return a VSI compatible path from a URI / URL.
Definition cpl_vsil.cpp:4448
VSISiblingFiles
char ** VSISiblingFiles(const char *pszPath)
Return related filenames.
Definition cpl_vsil.cpp:133
VSIFFlushL
int VSIFFlushL(VSILFILE *)
Flush pending writes to disk.
Definition cpl_vsil.cpp:3098
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:644
VSIGetDirectorySeparator
const char * VSIGetDirectorySeparator(const char *pszPath)
Return the directory separator for the specified path.
Definition cpl_vsil.cpp:421
VSIFTellL
vsi_l_offset VSIFTellL(VSILFILE *)
Tell current file offset.
Definition cpl_vsil.cpp:3029
VSIRename
int VSIRename(const char *oldpath, const char *newpath)
Rename a file.
Definition cpl_vsil.cpp:793
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:3924
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:942
VSIFWriteL
size_t VSIFWriteL(const void *, size_t, size_t, VSILFILE *)
Write bytes to file.
Definition cpl_vsil.cpp:3260
VSIRangeStatus
VSIRangeStatus
Range status.
Definition cpl_vsi.h:174
VSI_RANGE_STATUS_DATA
@ VSI_RANGE_STATUS_DATA
Data present.
Definition cpl_vsi.h:176
VSI_RANGE_STATUS_HOLE
@ VSI_RANGE_STATUS_HOLE
Hole.
Definition cpl_vsi.h:177
VSI_RANGE_STATUS_UNKNOWN
@ VSI_RANGE_STATUS_UNKNOWN
Unknown.
Definition cpl_vsi.h:175
VSIMultipartUploadEnd
int VSIMultipartUploadEnd(const char *pszFilename, const char *pszUploadId, size_t nPartIdsCount, const char *const *apszPartIds, vsi_l_offset nTotalSize, CSLConstList papszOptions)
Completes a multi-part file upload.
Definition cpl_vsil.cpp:1322
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:637
VSIInstallStdinHandler
void VSIInstallStdinHandler(void)
Install /vsistdin/ file system handler.
Definition cpl_vsil_stdin.cpp:675
VSISupportsRandomWrite
bool VSISupportsRandomWrite(const char *pszPath, bool bAllowLocalTempFile)
Returns if the filesystem supports random write.
Definition cpl_vsil.cpp:1896
CPLGetPhysicalRAM
GIntBig CPLGetPhysicalRAM(void)
Return the total physical RAM in bytes.
Definition cpl_vsisimple.cpp:1385
VSIFTruncateL
int VSIFTruncateL(VSILFILE *, vsi_l_offset)
Truncate/expand the file to the specified size.
Definition cpl_vsil.cpp:3424
VSICalloc
void * VSICalloc(size_t, size_t)
Analog of calloc().
Definition cpl_vsisimple.cpp:434
VSIFilesystemPluginTellCallback
vsi_l_offset(* VSIFilesystemPluginTellCallback)(void *pFile)
Return current position in handle.
Definition cpl_vsi.h:624
VSIIsCaseSensitiveFS
int VSIIsCaseSensitiveFS(const char *pszFilename)
Returns if the filenames of the filesystem are case sensitive.
Definition cpl_vsil.cpp:1767
VSIInstallGZipFileHandler
void VSIInstallGZipFileHandler(void)
Install GZip file system handler.
Definition cpl_vsil_gzip.cpp:3293
VSIMalloc2Verbose
void * VSIMalloc2Verbose(size_t nSize1, size_t nSize2, const char *pszFile, int nLine)
VSIMalloc2Verbose.
Definition cpl_vsisimple.cpp:1155
VSIFClearErrL
void VSIFClearErrL(VSILFILE *)
Reset the error and end-of-file indicators.
Definition cpl_vsil.cpp:3386
VSIHasOptimizedReadMultiRange
int VSIHasOptimizedReadMultiRange(const char *pszPath)
Returns if the filesystem supports efficient multi-range reading.
Definition cpl_vsil.cpp:1920
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:695
VSIFilesystemPluginReadDirCallback
char **(* VSIFilesystemPluginReadDirCallback)(void *pUserData, const char *pszDirname, int nMaxFiles)
List directory content.
Definition cpl_vsi.h:597
VSIFreeFilesystemPluginCallbacksStruct
void VSIFreeFilesystemPluginCallbacksStruct(VSIFilesystemPluginCallbacksStruct *poCb)
free resources allocated by VSIAllocFilesystemPluginCallbacksStruct
Definition cpl_vsil_plugin.cpp:507
VSIFilesystemPluginRenameCallback
int(* VSIFilesystemPluginRenameCallback)(void *pUserData, const char *oldpath, const char *newpath)
Rename handle.
Definition cpl_vsi.h:577
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:3961
VSIRemovePluginHandler
int VSIRemovePluginHandler(const char *pszPrefix)
Unregister a handler previously installed with VSIInstallPluginHandler() on the given prefix.
Definition cpl_vsil_plugin.cpp:494
VSIInstallCurlFileHandler
void VSIInstallCurlFileHandler(void)
Install /vsicurl/ HTTP/FTP file system handler (requires libcurl)
Definition cpl_vsil_curl.cpp:6465
VSIMallocVerbose
void * VSIMallocVerbose(size_t nSize, const char *pszFile, int nLine)
VSIMallocVerbose.
Definition cpl_vsisimple.cpp:1138
VSIInstallWebHdfsHandler
void VSIInstallWebHdfsHandler(void)
Install /vsiwebhdfs/ WebHDFS (Hadoop File System) REST API file system handler (requires libcurl)
Definition cpl_vsil_webhdfs.cpp:1203
VSISupportsSequentialWrite
bool VSISupportsSequentialWrite(const char *pszPath, bool bAllowLocalTempFile)
Returns if the filesystem supports sequential write.
Definition cpl_vsil.cpp:1872
VSIFErrorL
int VSIFErrorL(VSILFILE *)
Test the error indicator.
Definition cpl_vsil.cpp:3351
VSIInstallS3FileHandler
void VSIInstallS3FileHandler(void)
Install /vsis3/ Amazon S3 file system handler (requires libcurl)
Definition cpl_vsil_s3.cpp:5430
VSIInstallHdfsHandler
void VSIInstallHdfsHandler(void)
Install /vsihdfs/ file system handler (requires JVM and HDFS support)
Definition cpl_vsil_hdfs.cpp:465
VSIInstallCryptFileHandler
void VSIInstallCryptFileHandler(void)
Install /vsicrypt/ encrypted file system handler (requires libcrypto++)
Definition cpl_vsil_crypt.cpp:2058
VSIGetFileSystemsPrefixes
char ** VSIGetFileSystemsPrefixes(void)
Return the list of prefixes for virtual file system handlers currently registered.
Definition cpl_vsil.cpp:3881
VSIOverwriteFile
int VSIOverwriteFile(VSILFILE *fpTarget, const char *pszSourceFilename)
Overwrite an existing file with content from another one.
Definition cpl_vsil.cpp:3772
VSIInstallSwiftStreamingFileHandler
void VSIInstallSwiftStreamingFileHandler(void)
Install /vsiswift_streaming/ OpenStack Swif Object Storage (Swift) file system handler (requires libc...
Definition cpl_vsil_curl_streaming.cpp:2211
VSISetCryptKey
void VSISetCryptKey(const GByte *pabyKey, int nKeySize)
Installs the encryption/decryption key.
Definition cpl_vsil_crypt.cpp:189
VSIMallocAlignedAutoVerbose
void * VSIMallocAlignedAutoVerbose(size_t nSize, const char *pszFile, int nLine)
See VSIMallocAlignedAuto()
Definition cpl_vsisimple.cpp:959
VSIInstallStdoutHandler
void VSIInstallStdoutHandler(void)
Install /vsistdout/ file system handler.
Definition cpl_vsil_stdout.cpp:450
VSIMkdirRecursive
int VSIMkdirRecursive(const char *pszPathname, long mode)
Create a directory and all its ancestors.
Definition cpl_vsil.cpp:645
VSIInstallMemFileHandler
void VSIInstallMemFileHandler(void)
Install "memory" file system handler.
Definition cpl_vsi_mem.cpp:1173
VSIFPutcL
int VSIFPutcL(int, VSILFILE *)
Write a single byte to the file.
Definition cpl_vsil.cpp:3514
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:1141
VSIMalloc2
void * VSIMalloc2(size_t nSize1, size_t nSize2)
VSIMalloc2 allocates (nSize1 * nSize2) bytes.
Definition cpl_vsisimple.cpp:1116
VSIFilesystemPluginCloseCallback
int(* VSIFilesystemPluginCloseCallback)(void *pFile)
Close file handle.
Definition cpl_vsi.h:679
VSIDIR
struct VSIDIR VSIDIR
Opaque type for a directory iterator.
Definition cpl_vsi.h:396
VSICurlClearCache
void VSICurlClearCache(void)
Clean local cache associated with /vsicurl/ (and related file systems)
Definition cpl_vsil_curl.cpp:6488
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:6533
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:3598
VSIFOpenExL
VSILFILE * VSIFOpenExL(const char *, const char *, int)
Open/create file.
Definition cpl_vsil.cpp:2797
VSISupportsSparseFiles
int VSISupportsSparseFiles(const char *pszPath)
Returns if the filesystem supports sparse files.
Definition cpl_vsil.cpp:1795
VSIMultipartUploadAbort
int VSIMultipartUploadAbort(const char *pszFilename, const char *pszUploadId, CSLConstList papszOptions)
Aborts a multi-part file upload.
Definition cpl_vsil.cpp:1357
VSIMultipartUploadAddPart
char * VSIMultipartUploadAddPart(const char *pszFilename, const char *pszUploadId, int nPartNumber, vsi_l_offset nFileOffset, const void *pData, size_t nDataLength, CSLConstList papszOptions)
Uploads a new part to a multi-part uploaded file.
Definition cpl_vsil.cpp:1285
VSIFilesystemPluginMkdirCallback
int(* VSIFilesystemPluginMkdirCallback)(void *pUserData, const char *pszDirname, long nMode)
Create Directory.
Definition cpl_vsi.h:584
VSIRealloc
void * VSIRealloc(void *, size_t)
Analog of realloc().
Definition cpl_vsisimple.cpp:680
VSIFilesystemPluginTruncateCallback
int(* VSIFilesystemPluginTruncateCallback)(void *pFile, vsi_l_offset nNewSize)
Truncate handle.
Definition cpl_vsi.h:673
VSIAllocFilesystemPluginCallbacksStruct
VSIFilesystemPluginCallbacksStruct * VSIAllocFilesystemPluginCallbacksStruct(void)
return a VSIFilesystemPluginCallbacksStruct to be populated at runtime with handler callbacks
Definition cpl_vsil_plugin.cpp:501
VSIFilesystemPluginWriteCallback
size_t(* VSIFilesystemPluginWriteCallback)(void *pFile, const void *pBuffer, size_t nSize, size_t nCount)
Write bytes at current offset.
Definition cpl_vsi.h:662
VSIFilesystemPluginSiblingFilesCallback
char **(* VSIFilesystemPluginSiblingFilesCallback)(void *pUserData, const char *pszDirname)
List related files.
Definition cpl_vsi.h:609
VSIMultipartUploadGetCapabilities
int VSIMultipartUploadGetCapabilities(const char *pszFilename, int *pbNonSequentialUploadSupported, int *pbParallelUploadSupported, int *pbAbortSupported, size_t *pnMinPartSize, size_t *pnMaxPartSize, int *pnMaxPartCount)
Return capabilities for multiple part file upload.
Definition cpl_vsil.cpp:1198
VSICloseDir
void VSICloseDir(VSIDIR *dir)
Close a directory.
Definition cpl_vsil.cpp:599
VSIUnlink
int VSIUnlink(const char *pszFilename)
Delete a file.
Definition cpl_vsil.cpp:712
VSIMalloc3
void * VSIMalloc3(size_t nSize1, size_t nSize2, size_t nSize3)
VSIMalloc3 allocates (nSize1 * nSize2 * nSize3) bytes.
Definition cpl_vsisimple.cpp:1129
VSIFCloseL
int VSIFCloseL(VSILFILE *)
Close file.
Definition cpl_vsil.cpp:2930
VSIOpenDir
VSIDIR * VSIOpenDir(const char *pszPath, int nRecurseDepth, const char *const *papszOptions)
Open a directory to read its entries.
Definition cpl_vsil.cpp:542
VSIGetMemFileBuffer
GByte * VSIGetMemFileBuffer(const char *pszFilename, vsi_l_offset *pnDataLength, int bUnlinkAndSeize)
Fetch buffer underlying memory file.
Definition cpl_vsi_mem.cpp:1294
VSIInstallSwiftFileHandler
void VSIInstallSwiftFileHandler(void)
Install /vsiswift/ OpenStack Swif Object Storage (Swift) file system handler (requires libcurl)
Definition cpl_vsil_swift.cpp:739
VSIInstallZipFileHandler
void VSIInstallZipFileHandler(void)
Install ZIP file system handler.
Definition cpl_vsil_gzip.cpp:4955
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:4029
VSIFilesystemPluginGetRangeStatusCallback
VSIRangeStatus(* VSIFilesystemPluginGetRangeStatusCallback)(void *pFile, vsi_l_offset nOffset, vsi_l_offset nLength)
Get empty ranges.
Definition cpl_vsi.h:651
VSIFGetNativeFileDescriptorL
void * VSIFGetNativeFileDescriptorL(VSILFILE *)
Returns the "native" file descriptor for the virtual handle.
Definition cpl_vsil.cpp:3843
VSIGetCanonicalFilename
char * VSIGetCanonicalFilename(const char *pszPath)
Returns the canonical filename.
Definition cpl_vsil.cpp:1848
VSIFilesystemPluginSeekCallback
int(* VSIFilesystemPluginSeekCallback)(void *pFile, vsi_l_offset nOffset, int nWhence)
Seek to position in handle.
Definition cpl_vsi.h:629
VSIClearCredentials
void VSIClearCredentials(const char *pszPathPrefix)
Clear path specific options set with VSISetPathSpecificOption()
Definition cpl_vsil.cpp:3988
VSIFilesystemPluginStatCallback
int(* VSIFilesystemPluginStatCallback)(void *pUserData, const char *pszFilename, VSIStatBufL *pStatBuf, int nFlags)
Return information about a handle.
Definition cpl_vsi.h:563
VSIInstallOSSStreamingFileHandler
void VSIInstallOSSStreamingFileHandler(void)
Install /vsiaz_streaming/ Alibaba Cloud Object Storage Service (OSS) (requires libcurl)
Definition cpl_vsil_curl_streaming.cpp:2191
VSIReadDirEx
char ** VSIReadDirEx(const char *pszPath, int nMaxFiles)
Read names in a directory.
Definition cpl_vsil.cpp:105
VSIMallocAligned
void * VSIMallocAligned(size_t nAlignment, size_t nSize)
Allocates a buffer with an alignment constraint.
Definition cpl_vsisimple.cpp:897
VSIGetSignedURL
char * VSIGetSignedURL(const char *pszFilename, CSLConstList papszOptions)
Returns a signed URL of a supplied filename.
Definition cpl_vsil.cpp:1991
VSIFilesystemPluginClearErrCallback
void(* VSIFilesystemPluginClearErrCallback)(void *pFile)
Clear error and end-of-file flags.
Definition cpl_vsi.h:709
VSIInstallPluginHandler
int VSIInstallPluginHandler(const char *pszPrefix, const VSIFilesystemPluginCallbacksStruct *poCb)
register a handler on the given prefix.
Definition cpl_vsil_plugin.cpp:484
VSIGetActualURL
const char * VSIGetActualURL(const char *pszFilename)
Returns the actual URL of a supplied filename.
Definition cpl_vsil.cpp:1948
VSIRmdirRecursive
int VSIRmdirRecursive(const char *pszDirname)
Delete a directory recursively.
Definition cpl_vsil.cpp:1511
VSIMkdir
int VSIMkdir(const char *pszPathname, long mode)
Create a directory.
Definition cpl_vsil.cpp:624
VSIReallocVerbose
void * VSIReallocVerbose(void *pOldPtr, size_t nNewSize, const char *pszFile, int nLine)
VSIReallocVerbose.
Definition cpl_vsisimple.cpp:1223
VSIFilesystemPluginOpenCallback
void *(* VSIFilesystemPluginOpenCallback)(void *pUserData, const char *pszFilename, const char *pszAccess)
Open a handle.
Definition cpl_vsi.h:617
VSIFReadL
size_t VSIFReadL(void *, size_t, size_t, VSILFILE *)
Read bytes from file.
Definition cpl_vsil.cpp:3152
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:3208
VSIInstallCurlStreamingFileHandler
void VSIInstallCurlStreamingFileHandler(void)
Install /vsicurl_streaming/ HTTP/FTP file system handler (requires libcurl).
Definition cpl_vsil_curl_streaming.cpp:2112
VSIStrdup
char * VSIStrdup(const char *)
Analog of strdup().
Definition cpl_vsisimple.cpp:1001
VSIFOpenL
VSILFILE * VSIFOpenL(const char *, const char *)
Open file.
Definition cpl_vsil.cpp:2027
VSIFEofL
int VSIFEofL(VSILFILE *)
Test for end of file.
Definition cpl_vsil.cpp:3304
VSIInstallSparseFileHandler
void VSIInstallSparseFileHandler(void)
Install /vsisparse/ virtual file handler.
Definition cpl_vsil_sparsefile.cpp:581
VSIGlob
char ** VSIGlob(const char *pszPattern, const char *const *papszOptions, GDALProgressFunc pProgressFunc, void *pProgressData)
Return a list of file and directory names matching a pattern that can contain wildcards.
Definition cpl_vsil.cpp:290
VSIInstallSubFileHandler
void VSIInstallSubFileHandler(void)
Install /vsisubfile/ virtual file handler.
Definition cpl_vsil_subfile.cpp:507
VSIRewindL
void VSIRewindL(VSILFILE *)
Rewind the file pointer to the beginning of the file.
Definition cpl_vsil.cpp:3049
VSIReadDir
char ** VSIReadDir(const char *)
Read names in a directory.
Definition cpl_vsil.cpp:72
VSIMalloc3Verbose
void * VSIMalloc3Verbose(size_t nSize1, size_t nSize2, size_t nSize3, const char *pszFile, int nLine)
VSIMalloc3Verbose.
Definition cpl_vsisimple.cpp:1179
VSIFilesystemPluginUnlinkCallback
int(* VSIFilesystemPluginUnlinkCallback)(void *pUserData, const char *pszFilename)
Remove handle by name.
Definition cpl_vsi.h:571
VSIInstallRarFileHandler
void VSIInstallRarFileHandler(void)
Install /vsirar/ RAR file system handler (requires libarchive)
Definition cpl_vsil_libarchive.cpp:49
VSIStrerror
char * VSIStrerror(int)
Return the error string corresponding to the error number.
Definition cpl_vsisimple.cpp:1364
VSIDuplicateFileSystemHandler
bool VSIDuplicateFileSystemHandler(const char *pszSourceFSName, const char *pszNewFSName)
Duplicate an existing file system handler.
Definition cpl_vsil.cpp:4088
VSIInstallADLSFileHandler
void VSIInstallADLSFileHandler(void)
Install /vsiaz/ Microsoft Azure Data Lake Storage Gen2 file system handler (requires libcurl)
Definition cpl_vsil_adls.cpp:2189
CPLGetUsablePhysicalRAM
GIntBig CPLGetUsablePhysicalRAM(void)
Return the total physical RAM, usable by a process, in bytes.
Definition cpl_vsisimple.cpp:1618
VSIStatL
int VSIStatL(const char *, VSIStatBufL *)
Get filesystem object info.
Definition cpl_vsil.cpp:1547
VSIReadDirRecursive
char ** VSIReadDirRecursive(const char *pszPath)
Read names in a directory recursively.
Definition cpl_vsil.cpp:460
VSICopyFileRestartable
int VSICopyFileRestartable(const char *pszSource, const char *pszTarget, const char *pszInputPayload, char **ppszOutputPayload, const char *const *papszOptions, GDALProgressFunc pProgressFunc, void *pProgressData)
Copy a source file into a target file in a way that can (potentially) be restarted.
Definition cpl_vsil.cpp:1035
VSIInstallGSStreamingFileHandler
void VSIInstallGSStreamingFileHandler(void)
Install /vsigs_streaming/ Google Cloud Storage file system handler (requires libcurl)
Definition cpl_vsil_curl_streaming.cpp:2151
VSIFilesystemPluginEofCallback
int(* VSIFilesystemPluginEofCallback)(void *pFile)
Has end of file been reached.
Definition cpl_vsi.h:657
VSIMove
int VSIMove(const char *oldpath, const char *newpath, const char *const *papszOptions, GDALProgressFunc pProgressFunc, void *pProgressData)
Move (or rename) a file.
Definition cpl_vsil.cpp:827
VSIFPrintfL
int VSIFPrintfL(VSILFILE *, const char *,...)
Formatted write to file.
Definition cpl_vsil.cpp:3448
VSIStatExL
int VSIStatExL(const char *pszFilename, VSIStatBufL *psStatBuf, int nFlags)
Get filesystem object info.
Definition cpl_vsil.cpp:1586
VSINetworkStatsGetAsSerializedJSON
char * VSINetworkStatsGetAsSerializedJSON(char **papszOptions)
Return network related statistics, as a JSON serialized object.
Definition cpl_vsil_curl.cpp:6655
VSIInstallOSSFileHandler
void VSIInstallOSSFileHandler(void)
Install /vsioss/ Alibaba Cloud Object Storage Service (OSS) file system handler (requires libcurl)
Definition cpl_vsil_oss.cpp:319
VSIGetDiskFreeSpace
GIntBig VSIGetDiskFreeSpace(const char *pszDirname)
Return free disk space available on the filesystem.
Definition cpl_vsil.cpp:3861
VSIFOpenEx2L
VSILFILE * VSIFOpenEx2L(const char *, const char *, int, CSLConstList)
Open/create file.
Definition cpl_vsil.cpp:2875
VSIInstallTarFileHandler
void VSIInstallTarFileHandler(void)
Install /vsitar/ file system handler.
Definition cpl_vsil_tar.cpp:625
VSIInstall7zFileHandler
void VSIInstall7zFileHandler(void)
Install /vsi7z/ 7zip file system handler (requires libarchive)
Definition cpl_vsil_libarchive.cpp:31
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:3900
VSIFreeAligned
void VSIFreeAligned(void *ptr)
Free a buffer allocated with VSIMallocAligned().
Definition cpl_vsisimple.cpp:981
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:946
VSIAbortPendingUploads
int VSIAbortPendingUploads(const char *pszFilename)
Abort all ongoing multi-part uploads.
Definition cpl_vsil.cpp:1459
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:42
VSIGetPathSpecificOption
const char * VSIGetPathSpecificOption(const char *pszPath, const char *pszKey, const char *pszDefault)
Get the value a path specific option.
Definition cpl_vsil.cpp:4048
VSIMalloc
void * VSIMalloc(size_t)
Analog of malloc().
Definition cpl_vsisimple.cpp:550
VSIFSeekL
int VSIFSeekL(VSILFILE *, vsi_l_offset, int)
Seek to requested offset.
Definition cpl_vsil.cpp:2988
VSIFilesystemPluginFlushCallback
int(* VSIFilesystemPluginFlushCallback)(void *pFile)
Sync written bytes.
Definition cpl_vsi.h:669
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:1206
VSIIsLocal
bool VSIIsLocal(const char *pszPath)
Returns if the file/filesystem is "local".
Definition cpl_vsil.cpp:1823
VSIMemGenerateHiddenFilename
const char * VSIMemGenerateHiddenFilename(const char *pszFilename)
Generates a unique filename that can be used with the /vsimem/ virtual file system.
Definition cpl_vsi_mem.cpp:1372
VSIRmdir
int VSIRmdir(const char *pszDirname)
Delete a directory.
Definition cpl_vsil.cpp:1486
VSIInstallAzureFileHandler
void VSIInstallAzureFileHandler(void)
Install /vsiaz/ Microsoft Azure Blob file system handler (requires libcurl)
Definition cpl_vsil_az.cpp:2599
VSIFree
void VSIFree(void *)
Analog of free() for data allocated with VSIMalloc(), VSICalloc(), VSIRealloc().
Definition cpl_vsisimple.cpp:833
VSIStrdupVerbose
char * VSIStrdupVerbose(const char *pszStr, const char *pszFile, int nLine)
VSIStrdupVerbose.
Definition cpl_vsisimple.cpp:1241
VSIClearPathSpecificOptions
void VSIClearPathSpecificOptions(const char *pszPathPrefix)
Clear path specific options set with VSISetPathSpecificOption()
Definition cpl_vsil.cpp:4006
vsi_l_offset
GUIntBig vsi_l_offset
Type for a file offset.
Definition cpl_vsi.h:136
VSIGetNextDirEntry
const VSIDIREntry * VSIGetNextDirEntry(VSIDIR *dir)
Return the next entry of the directory.
Definition cpl_vsil.cpp:581
VSIMultipartUploadStart
char * VSIMultipartUploadStart(const char *pszFilename, CSLConstList papszOptions)
Initiates the upload a (big) file in a piece-wise way.
Definition cpl_vsil.cpp:1247
VSIInstallGSFileHandler
void VSIInstallGSFileHandler(void)
Install /vsigs/ Google Cloud Storage file system handler (requires libcurl)
Definition cpl_vsil_gs.cpp:952
VSIFilesystemPluginErrorCallback
int(* VSIFilesystemPluginErrorCallback)(void *pFile)
Has a read error (non end-of-file related) has occurred?
Definition cpl_vsi.h:703
VSIInstallAzureStreamingFileHandler
void VSIInstallAzureStreamingFileHandler(void)
Install /vsiaz_streaming/ Microsoft Azure Blob file system handler (requires libcurl)
Definition cpl_vsil_curl_streaming.cpp:2171
VSIGetFileMetadata
char ** VSIGetFileMetadata(const char *pszFilename, const char *pszDomain, CSLConstList papszOptions)
Get metadata on files.
Definition cpl_vsil.cpp:1664
VSIFilesystemPluginRmdirCallback
int(* VSIFilesystemPluginRmdirCallback)(void *pUserData, const char *pszDirname)
Delete Directory.
Definition cpl_vsi.h:591
VSIDIREntry
Directory entry.
Definition cpl_vsi.h:408
VSIDIREntry::pszName
char * pszName
Filename.
Definition cpl_vsi.h:410
VSIDIREntry::nMTime
GIntBig nMTime
Last modification time (seconds since 1970/01/01)
Definition cpl_vsi.h:416
VSIDIREntry::bMTimeKnown
char bMTimeKnown
Whether nMTime is known: 0 = unknown, 1 = known.
Definition cpl_vsi.h:422
VSIDIREntry::bSizeKnown
char bSizeKnown
Whether nSize is known: 0 = unknown, 1 = known.
Definition cpl_vsi.h:420
VSIDIREntry::bModeKnown
char bModeKnown
Whether nMode is known: 0 = unknown, 1 = known.
Definition cpl_vsi.h:418
VSIDIREntry::papszExtra
char ** papszExtra
NULL-terminated list of extra properties.
Definition cpl_vsi.h:424
VSIDIREntry::nSize
vsi_l_offset nSize
File size.
Definition cpl_vsi.h:414
VSIDIREntry::nMode
int nMode
File mode.
Definition cpl_vsi.h:412
VSIFilesystemPluginCallbacksStruct
struct containing callbacks to used by the handler.
Definition cpl_vsi.h:719
VSIFilesystemPluginCallbacksStruct::advise_read
VSIFilesystemPluginAdviseReadCallback advise_read
The following optional member has been added in GDAL 3.7:
Definition cpl_vsi.h:755
VSIFilesystemPluginCallbacksStruct::write
VSIFilesystemPluginWriteCallback write
write bytes to current position (w)
Definition cpl_vsi.h:745
VSIFilesystemPluginCallbacksStruct::nBufferSize
size_t nBufferSize
buffer small reads (makes handler read only)
Definition cpl_vsi.h:749
VSIFilesystemPluginCallbacksStruct::rename
VSIFilesystemPluginRenameCallback rename
rename handle ()
Definition cpl_vsi.h:727
VSIFilesystemPluginCallbacksStruct::read_multi_range
VSIFilesystemPluginReadMultiRangeCallback read_multi_range
read multiple blocks ()
Definition cpl_vsi.h:739
VSIFilesystemPluginCallbacksStruct::unlink
VSIFilesystemPluginUnlinkCallback unlink
unlink handle by name ()
Definition cpl_vsi.h:726
VSIFilesystemPluginCallbacksStruct::rmdir
VSIFilesystemPluginRmdirCallback rmdir
remove directory ()
Definition cpl_vsi.h:729
VSIFilesystemPluginCallbacksStruct::clear_err
VSIFilesystemPluginClearErrCallback clear_err
clear error flags(r)
Definition cpl_vsi.h:758
VSIFilesystemPluginCallbacksStruct::nCacheSize
size_t nCacheSize
max mem to use per file when buffering
Definition cpl_vsi.h:750
VSIFilesystemPluginCallbacksStruct::eof
VSIFilesystemPluginEofCallback eof
has end of file been reached (r?)
Definition cpl_vsi.h:743
VSIFilesystemPluginCallbacksStruct::sibling_files
VSIFilesystemPluginSiblingFilesCallback sibling_files
list related files
Definition cpl_vsi.h:752
VSIFilesystemPluginCallbacksStruct::open
VSIFilesystemPluginOpenCallback open
open handle by name (rw)
Definition cpl_vsi.h:732
VSIFilesystemPluginCallbacksStruct::seek
VSIFilesystemPluginSeekCallback seek
set current position of handle (rw)
Definition cpl_vsi.h:736
VSIFilesystemPluginCallbacksStruct::get_range_status
VSIFilesystemPluginGetRangeStatusCallback get_range_status
get range status ()
Definition cpl_vsi.h:741
VSIFilesystemPluginCallbacksStruct::close
VSIFilesystemPluginCloseCallback close
close handle (rw)
Definition cpl_vsi.h:748
VSIFilesystemPluginCallbacksStruct::read
VSIFilesystemPluginReadCallback read
read from current position (r)
Definition cpl_vsi.h:737
VSIFilesystemPluginCallbacksStruct::flush
VSIFilesystemPluginFlushCallback flush
sync bytes (w)
Definition cpl_vsi.h:746
VSIFilesystemPluginCallbacksStruct::read_dir
VSIFilesystemPluginReadDirCallback read_dir
list directory content (r?)
Definition cpl_vsi.h:731
VSIFilesystemPluginCallbacksStruct::pUserData
void * pUserData
Optional opaque pointer passed back to filemanager callbacks (e.g.
Definition cpl_vsi.h:724
VSIFilesystemPluginCallbacksStruct::error
VSIFilesystemPluginErrorCallback error
has read error occurred (r)
Definition cpl_vsi.h:757
VSIFilesystemPluginCallbacksStruct::truncate
VSIFilesystemPluginTruncateCallback truncate
truncate handle (w?)
Definition cpl_vsi.h:747
VSIFilesystemPluginCallbacksStruct::mkdir
VSIFilesystemPluginMkdirCallback mkdir
make directory ()
Definition cpl_vsi.h:728
VSIFilesystemPluginCallbacksStruct::stat
VSIFilesystemPluginStatCallback stat
stat handle by name (rw)
Definition cpl_vsi.h:725
VSIFilesystemPluginCallbacksStruct::tell
VSIFilesystemPluginTellCallback tell
get current position of handle (rw)
Definition cpl_vsi.h:734
VSIVirtualHandle
Virtual file handle.
Definition cpl_vsi_virtual.h:48