VirtualBox

source: vbox/trunk/include/iprt/vfs.h@ 33948

Last change on this file since 33948 was 33948, checked in by vboxsync, 14 years ago

vfs: more filesystem streaming code.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.6 KB
Line 
1/** @file
2 * IPRT - Virtual Filesystem.
3 */
4
5/*
6 * Copyright (C) 2010 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___iprt_vfs_h
27#define ___iprt_vfs_h
28
29#include <iprt/cdefs.h>
30#include <iprt/types.h>
31#include <iprt/dir.h>
32#include <iprt/fs.h>
33#include <iprt/symlink.h>
34#include <iprt/sg.h>
35#include <iprt/time.h>
36
37
38RT_C_DECLS_BEGIN
39
40/** @defgroup grp_rt_fs RTVfs - Virtual Filesystem
41 * @ingroup grp_rt
42 *
43 * The virtual filesystem APIs are intended to make it possible to work on
44 * container files, file system sub-trees, file system overlays and other custom
45 * filesystem configurations. It also makes it possible to create filters, like
46 * automatically gunzipping a tar.gz file before feeding it to the RTTar API for
47 * unpacking - or wise versa.
48 *
49 * The virtual filesystem APIs are intended to mirror the RTDir, RTFile, RTPath
50 * and RTFs APIs pretty closely so that rewriting a piece of code to work with
51 * it should be easy. However there are some differences to the way the APIs
52 * works and the user should heed the documentation. The differences are
53 * usually motivated by simplification and in some case to make the VFS more
54 * flexible.
55 *
56 * @{
57 */
58
59/** Virtual Filesystem handle. */
60typedef struct RTVFSINTERNAL *RTVFS;
61/** Pointer to a VFS handle. */
62typedef RTVFS *PRTVFS;
63/** A NIL VFS handle. */
64#define NIL_RTVFS ((RTVFS)~(uintptr_t)0)
65
66/** Virtual Filesystem base object handle. */
67typedef struct RTVFSOBJINTERNAL *RTVFSOBJ;
68/** Pointer to a VFS base object handle. */
69typedef RTVFSOBJ *PRTVFSOBJ;
70/** A NIL VFS base object handle. */
71#define NIL_RTVFSOBJ ((RTVFSOBJ)~(uintptr_t)0)
72
73/** Virtual Filesystem directory handle. */
74typedef struct RTVFSDIRINTERNAL *RTVFSDIR;
75/** Pointer to a VFS directory handle. */
76typedef RTVFSDIR *PRTVFSDIR;
77/** A NIL VFS directory handle. */
78#define NIL_RTVFSDIR ((RTVFSDIR)~(uintptr_t)0)
79
80/** Virtual Filesystem filesystem stream handle. */
81typedef struct RTVFSFSSTREAMINTERNAL *RTVFSFSSTREAM;
82/** Pointer to a VFS filesystem stream handle. */
83typedef RTVFSFSSTREAM *PRTVFSFSSTREAM;
84/** A NIL VFS filesystem stream handle. */
85#define NIL_RTVFSFSSTREAM ((RTVFSFSSTREAM)~(uintptr_t)0)
86
87/** Virtual Filesystem I/O stream handle. */
88typedef struct RTVFSIOSTREAMINTERNAL *RTVFSIOSTREAM;
89/** Pointer to a VFS I/O stream handle. */
90typedef RTVFSIOSTREAM *PRTVFSIOSTREAM;
91/** A NIL VFS I/O stream handle. */
92#define NIL_RTVFSIOSTREAM ((RTVFSIOSTREAM)~(uintptr_t)0)
93
94/** Virtual Filesystem file handle. */
95typedef struct RTVFSFILEINTERNAL *RTVFSFILE;
96/** Pointer to a VFS file handle. */
97typedef RTVFSFILE *PRTVFSFILE;
98/** A NIL VFS file handle. */
99#define NIL_RTVFSFILE ((RTVFSFILE)~(uintptr_t)0)
100
101/** Virtual Filesystem symbolic link handle. */
102typedef struct RTVFSSYMLINKINTERNAL *RTVFSSYMLINK;
103/** Pointer to a VFS symbolic link handle. */
104typedef RTVFSSYMLINK *PRTVFSSYMLINK;
105/** A NIL VFS symbolic link handle. */
106#define NIL_RTVFSSYMLINK ((RTVFSSYMLINK)~(uintptr_t)0)
107
108/**
109 * The object type.
110 */
111typedef enum RTVFSOBJTYPE
112{
113 /** Invalid type. */
114 RTVFSOBJTYPE_INVALID = 0,
115 /** Pure base object.
116 * This is returned by the filesystem stream to represent directories,
117 * devices, fifos and similar that needs to be created. */
118 RTVFSOBJTYPE_BASE,
119 /** Virtual filesystem. */
120 RTVFSOBJTYPE_VFS,
121 /** Filesystem stream. */
122 RTVFSOBJTYPE_FS_STREAM,
123 /** Pure I/O stream. */
124 RTVFSOBJTYPE_IO_STREAM,
125 /** Directory. */
126 RTVFSOBJTYPE_DIR,
127 /** File. */
128 RTVFSOBJTYPE_FILE,
129 /** Symbolic link. */
130 RTVFSOBJTYPE_SYMLINK,
131 /** End of valid object types. */
132 RTVFSOBJTYPE_END,
133 /** Pure I/O stream. */
134 RTVFSOBJTYPE_32BIT_HACK = 0x7fffffff
135} RTVFSOBJTYPE;
136/** Pointer to a VFS object type. */
137typedef RTVFSOBJTYPE *PRTVFSOBJTYPE;
138
139
140
141
142/** @name RTVfsCreate flags
143 * @{ */
144/** Whether the file system is read-only. */
145#define RTVFS_C_READONLY RT_BIT(0)
146/** Whether we the VFS should be thread safe (i.e. automaticaly employ
147 * locks). */
148#define RTVFS_C_THREAD_SAFE RT_BIT(1)
149/** @} */
150
151/**
152 * Creates an empty virtual filesystem.
153 *
154 * @returns IPRT status code.
155 * @param pszName Name, for logging and such.
156 * @param fFlags Flags, MBZ.
157 * @param phVfs Where to return the VFS handle. Release the returned
158 * reference by calling RTVfsRelease.
159 */
160RTDECL(int) RTVfsCreate(const char *pszName, uint32_t fFlags, PRTVFS phVfs);
161RTDECL(uint32_t) RTVfsRetain(RTVFS phVfs);
162RTDECL(uint32_t) RTVfsRelease(RTVFS phVfs);
163RTDECL(int) RTVfsAttach(RTVFS hVfs, const char *pszMountPoint, uint32_t fFlags, RTVFS hVfsAttach);
164RTDECL(int) RTVfsDetach(RTVFS hVfs, const char *pszMountPoint, RTVFS hVfsToDetach, PRTVFS *phVfsDetached);
165RTDECL(uint32_t) RTVfsGetAttachmentCount(RTVFS hVfs);
166RTDECL(int) RTVfsGetAttachment(RTVFS hVfs, uint32_t iOrdinal, PRTVFS *phVfsAttached, uint32_t *pfFlags,
167 char *pszMountPoint, size_t cbMountPoint);
168
169
170/** @defgroup grp_vfs_dir VFS Directory API
171 * @{
172 */
173
174RTDECL(RTVFS) RTVfsObjToVfs(RTVFSOBJ hVfsObj);
175RTDECL(RTVFSFSSTREAM) RTVfsObjToFsStream(RTVFSOBJ hVfsObj);
176RTDECL(RTVFSDIR) RTVfsObjToDir(RTVFSOBJ hVfsObj);
177RTDECL(RTVFSIOSTREAM) RTVfsObjToIoStream(RTVFSOBJ hVfsObj);
178RTDECL(RTVFSFILE) RTVfsObjToFile(RTVFSOBJ hVfsObj);
179RTDECL(RTVFSSYMLINK) RTVfsObjToSymlink(RTVFSOBJ hVfsObj);
180
181RTDECL(RTVFSOBJ) RTVfsObjFromVfs(RTVFS hVfs);
182RTDECL(RTVFSOBJ) RTVfsObjFromFsStream(RTVFSFSSTREAM hVfsFss);
183RTDECL(RTVFSOBJ) RTVfsObjFromDir(RTVFSDIR hVfsDir);
184RTDECL(RTVFSOBJ) RTVfsObjFromIoStream(RTVFSIOSTREAM hVfsIos);
185RTDECL(RTVFSOBJ) RTVfsObjFromFile(RTVFSFILE hVfsFile);
186RTDECL(RTVFSOBJ) RTVfsObjFromSymlink(RTVFSSYMLINK hVfsSym);
187
188/**
189 * Query information about the object.
190 *
191 * @returns IPRT status code.
192 * @param hVfsObj The VFS object handle.
193 * @param pObjInfo Where to return the info.
194 * @param enmAddAttr Which additional attributes should be retrieved.
195 * @sa RTFileQueryInfo, RTPathQueryInfo
196 */
197RTDECL(int) RTVfsObjQueryInfo(RTVFSOBJ hVfsObj, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
198
199/** @} */
200
201
202/** @defgroup grp_vfs_fsstream VFS Filesystem Stream API
203 *
204 * Filesystem streams are for tar, cpio and similar. Any virtual filesystem can
205 * be turned into a filesystem stream using RTVfsFsStrmFromVfs.
206 *
207 * @{
208 */
209
210RTDECL(uint32_t) RTVfsFsStrmRetain(RTVFSFSSTREAM hVfsFss);
211RTDECL(uint32_t) RTVfsFsStrmRelease(RTVFSFSSTREAM hVfsFss);
212RTDECL(int) RTVfsFsStrmQueryInfo(RTVFSFSSTREAM hVfsFss, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
213
214/**
215 * Gets the next object in the stream.
216 *
217 * This call may affect the stream posision of a previously returned object.
218 *
219 * The type of object returned here typically boils down to three types:
220 * - I/O streams (representing files),
221 * - symbolic links
222 * - base object
223 * The base objects represent anything not convered by the two other, i.e.
224 * directories, device nodes, fifos, sockets and whatnot. The details can be
225 * queried using RTVfsObjQueryInfo.
226 *
227 * That said, absolutely any object except for filesystem stream objects can be
228 * returned by this call. Any generic code is adviced to just deal with it all.
229 *
230 * @returns IPRT status code.
231 * @retval VINF_SUCCESS if a new object was retrieved.
232 * @retval VERR_EOF when there are no more objects.
233 * @param pvThis The implementation specific directory data.
234 * @param ppszName Where to return the object name. Must be freed by
235 * calling RTStrFree.
236 * @param penmType Where to return the object type.
237 * @param hVfsObj Where to return the object handle (referenced).
238 * This must be cast to the desired type before use.
239 */
240RTDECL(int) RTVfsFsStrmNext(RTVFSFSSTREAM hVfsFss, char **ppszName, RTVFSOBJTYPE *penmType, PRTVFSOBJ phVfsObj);
241
242/** @} */
243
244
245/** @defgroup grp_vfs_dir VFS Directory API
246 * @{
247 */
248
249/**
250 * Retains a reference to the VFS directory handle.
251 *
252 * @returns New reference count on success, UINT32_MAX on failure.
253 * @param hVfsDir The VFS directory handle.
254 */
255RTDECL(uint32_t) RTVfsDirRetain(RTVFSDIR hVfsDir);
256
257/**
258 * Releases a reference to the VFS directory handle.
259 *
260 * @returns New reference count on success (0 if closed), UINT32_MAX on failure.
261 * @param hVfsIos The VFS directory handle.
262 */
263RTDECL(uint32_t) RTVfsDirRelease(RTVFSDIR hVfsDir);
264
265/** @} */
266
267
268/** @defgroup grp_vfs_iostream VFS Symbolic Link API
269 * @{
270 */
271
272RTDECL(uint32_t) RTVfsSymlinkRetain(RTVFSSYMLINK hVfsSym);
273RTDECL(uint32_t) RTVfsSymlinkRelease(RTVFSSYMLINK hVfsSym);
274
275/**
276 * Read the symbolic link target.
277 *
278 * @returns IPRT status code.
279 * @param hVfsSym The VFS symbolic link handle.
280 * @param pszTarget The target buffer.
281 * @param cbTarget The size of the target buffer.
282 * @sa RTSymlinkRead
283 */
284RTDECL(int) RTVfsSymlinkRead(RTVFSSYMLINK hVfsSym, char *pszTarget, size_t cbTarget);
285
286/** @} */
287
288
289
290/** @defgroup grp_vfs_iostream VFS I/O Stream API
291 * @{
292 */
293
294/**
295 * Retains a reference to the VFS I/O stream handle.
296 *
297 * @returns New reference count on success, UINT32_MAX on failure.
298 * @param hVfsIos The VFS I/O stream handle.
299 */
300RTDECL(uint32_t) RTVfsIoStrmRetain(RTVFSIOSTREAM hVfsIos);
301
302/**
303 * Releases a reference to the VFS I/O stream handle.
304 *
305 * @returns New reference count on success (0 if closed), UINT32_MAX on failure.
306 * @param hVfsIos The VFS I/O stream handle.
307 */
308RTDECL(uint32_t) RTVfsIoStrmRelease(RTVFSIOSTREAM hVfsIos);
309
310/**
311 * Convert the VFS I/O stream handle to a VFS file handle.
312 *
313 * @returns The VFS file handle on success, this must be released.
314 * NIL_RTVFSFILE if the I/O stream handle is invalid.
315 * @param hVfsIos The VFS I/O stream handle.
316 * @sa RTVfsFileToIoStream
317 */
318RTDECL(RTVFSFILE) RTVfsIoStrmToFile(RTVFSIOSTREAM hVfsIos);
319
320/**
321 * Query information about the I/O stream.
322 *
323 * @returns IPRT status code.
324 * @param hVfsIos The VFS I/O stream handle.
325 * @param pObjInfo Where to return the info.
326 * @param enmAddAttr Which additional attributes should be retrieved.
327 * @sa RTFileQueryInfo
328 */
329RTDECL(int) RTVfsIoStrmQueryInfo(RTVFSIOSTREAM hVfsIos, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
330
331/**
332 * Read bytes from the I/O stream.
333 *
334 * @returns IPRT status code.
335 * @param hVfsIos The VFS I/O stream handle.
336 * @param pvBuf Where to store the read bytes.
337 * @param cbToRead The number of bytes to read.
338 * @param pcbRead Where to always store the number of bytes actually
339 * read. If this is NULL, the call will block until
340 * @a cbToRead bytes are available. If this is
341 * non-NULL, the call will not block and return what
342 * is currently avaiable.
343 * @sa RTFileRead, RTPipeRead, RTPipeReadBlocking, RTSocketRead
344 */
345RTDECL(int) RTVfsIoStrmRead(RTVFSIOSTREAM hVfsIos, void *pvBuf, size_t cbToRead, size_t *pcbRead);
346
347/**
348 * Write bytes to the I/O stream.
349 *
350 * @returns IPRT status code.
351 * @param hVfsIos The VFS I/O stream handle.
352 * @param pvBuf The bytes to write.
353 * @param cbToWrite The number of bytes to write.
354 * @param pcbWritten Where to always store the number of bytes actually
355 * written. If this is NULL, the call will block
356 * until
357 * @a cbToWrite bytes are available. If this is
358 * non-NULL, the call will not block and return after
359 * writing what is possible.
360 * @sa RTFileWrite, RTPipeWrite, RTPipeWriteBlocking, RTSocketWrite
361 */
362RTDECL(int) RTVfsIoStrmWrite(RTVFSIOSTREAM hVfsIos, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
363
364/**
365 * Reads bytes from the I/O stream into a scatter buffer.
366 *
367 * @returns IPRT status code.
368 * @retval VINF_SUCCESS and the number of bytes read written to @a pcbRead.
369 * @retval VINF_TRY_AGAIN if @a fBlocking is @c false, @a pcbRead is not NULL,
370 * and no data was available. @a *pcbRead will be set to 0.
371 * @retval VINF_EOF when trying to read __beyond__ the end of the stream and
372 * @a pcbRead is not NULL (it will be set to the number of bytes read,
373 * or 0 if the end of the stream was reached before this call).
374 * When the last byte of the read request is the last byte in the
375 * stream, this status code will not be used. However, VINF_EOF is
376 * returned when attempting to read 0 bytes while standing at the end
377 * of the stream.
378 * @retval VERR_EOF when trying to read __beyond__ the end of the stream and
379 * @a pcbRead is NULL.
380 *
381 * @param hVfsIos The VFS I/O stream handle.
382 * @param pSgBuf Pointer to a scatter buffer descriptor. The number
383 * of bytes described by the segments is what will be
384 * attemted read.
385 * @param fBlocking Whether the call is blocking (@c true) or not. If
386 * not, the @a pcbRead parameter must not be NULL.
387 * @param pcbRead Where to always store the number of bytes actually
388 * read. This can be NULL if @a fBlocking is true.
389 * @sa RTFileSgRead, RTSocketSgRead, RTPipeRead, RTPipeReadBlocking
390 */
391RTDECL(int) RTVfsIoStrmSgRead(RTVFSIOSTREAM hVfsIos, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead);
392
393/**
394 * Write bytes to the I/O stream from a gather buffer.
395 *
396 * @returns IPRT status code.
397 * @param hVfsIos The VFS I/O stream handle.
398 * @param pSgBuf Pointer to a gather buffer descriptor. The number
399 * of bytes described by the segments is what will be
400 * attemted written.
401 * @param fBlocking Whether the call is blocking (@c true) or not. If
402 * not, the @a pcbWritten parameter must not be NULL.
403 * @param pcbRead Where to always store the number of bytes actually
404 * written. This can be NULL if @a fBlocking is true.
405 * @sa RTFileSgWrite, RTSocketSgWrite
406 */
407RTDECL(int) RTVfsIoStrmSgWrite(RTVFSIOSTREAM hVfsIos, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten);
408
409/**
410 * Flush any buffered data to the I/O stream.
411 *
412 * @returns IPRT status code.
413 * @param hVfsIos The VFS I/O stream handle.
414 * @sa RTFileFlush, RTPipeFlush
415 */
416RTDECL(int) RTVfsIoStrmFlush(RTVFSIOSTREAM hVfsIos);
417
418/**
419 * Poll for events.
420 *
421 * @returns IPRT status code.
422 * @param hVfsIos The VFS I/O stream handle.
423 * @param fEvents The events to poll for (RTPOLL_EVT_XXX).
424 * @param cMillies How long to wait for event to eventuate.
425 * @param fIntr Whether the wait is interruptible and can return
426 * VERR_INTERRUPTED (@c true) or if this condition
427 * should be hidden from the caller (@c false).
428 * @param pfRetEvents Where to return the event mask.
429 * @sa RTPollSetAdd, RTPoll, RTPollNoResume.
430 */
431RTDECL(RTFOFF) RTVfsIoStrmPoll(RTVFSIOSTREAM hVfsIos, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr,
432 uint32_t *pfRetEvents);
433/**
434 * Tells the current I/O stream position.
435 *
436 * @returns Zero or higher - where to return the I/O stream offset. Values
437 * below zero are IPRT status codes (VERR_XXX).
438 * @param hVfsIos The VFS I/O stream handle.
439 * @sa RTFileTell
440 */
441RTDECL(RTFOFF) RTVfsIoStrmTell(RTVFSIOSTREAM hVfsIos);
442
443/**
444 * Skips @a cb ahead in the stream.
445 *
446 * @returns IPRT status code.
447 * @param hVfsIos The VFS I/O stream handle.
448 * @param cb The number bytes to skip.
449 */
450RTDECL(int) RTVfsIoStrmSkip(RTVFSIOSTREAM hVfsIos, RTFOFF cb);
451
452/**
453 * Fills the stream with @a cb zeros.
454 *
455 * @returns IPRT status code.
456 * @param hVfsIos The VFS I/O stream handle.
457 * @param cb The number of zero bytes to insert.
458 */
459RTDECL(int) RTVfsIoStrmZeroFill(RTVFSIOSTREAM hVfsIos, RTFOFF cb);
460/** @} */
461
462
463/** @defgroup grp_vfs_file VFS File API
464 * @{
465 */
466RTDECL(int) RTVfsFileOpen(RTVFS hVfs, const char *pszFilename, uint32_t fOpen, PRTVFSFILE phVfsFile);
467
468/**
469 * Create a VFS file handle from a standard IPRT file handle (RTFILE).
470 *
471 * @returns IPRT status code.
472 * @param hFile The standard IPRT file handle.
473 * @param fOpen The flags the handle was opened with. Pass 0 to
474 * have these detected.
475 * @param fLeaveOpen Whether to leave the handle open when the VFS file
476 * is released, or to close it (@c false).
477 * @param phVfsFile Where to return the VFS file handle.
478 */
479RTDECL(int) RTVfsFileFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, PRTVFSFILE phVfsFile);
480RTDECL(RTHCUINTPTR) RTVfsFileToNative(RTFILE hVfsFile);
481
482/**
483 * Convert the VFS file handle to a VFS I/O stream handle.
484 *
485 * @returns The VFS I/O stream handle on success, this must be released.
486 * NIL_RTVFSIOSTREAM if the file handle is invalid.
487 * @param hVfsFile The VFS file handle.
488 * @sa RTVfsIoStrmToFile
489 */
490RTDECL(RTVFSIOSTREAM) RTVfsFileToIoStream(RTVFSFILE hVfsFile);
491
492/**
493 * Retains a reference to the VFS file handle.
494 *
495 * @returns New reference count on success, UINT32_MAX on failure.
496 * @param hVfsFile The VFS file handle.
497 */
498RTDECL(uint32_t) RTVfsFileRetain(RTVFSFILE hVfsFile);
499
500/**
501 * Releases a reference to the VFS file handle.
502 *
503 * @returns New reference count on success (0 if closed), UINT32_MAX on failure.
504 * @param hVfsFile The VFS file handle.
505 */
506RTDECL(uint32_t) RTVfsFileRelease(RTVFSFILE hVfsFile);
507
508RTDECL(int) RTVfsFileQueryInfo(RTVFSFILE hVfsFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
509RTDECL(int) RTVfsFileRead(RTVFSFILE hVfsFile, void *pvBuf, size_t cbToRead, size_t *pcbRead);
510RTDECL(int) RTVfsFileReadAt(RTVFSFILE hVfsFile, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead);
511RTDECL(int) RTVfsFileWrite(RTVFSFILE hVfsFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
512RTDECL(int) RTVfsFileWriteAt(RTVFSFILE hVfsFile, RTFOFF off, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
513RTDECL(int) RTVfsFileFlush(RTVFSFILE hVfsFile);
514RTDECL(RTFOFF) RTVfsFilePoll(RTVFSFILE hVfsFile, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr,
515 uint32_t *pfRetEvents);
516RTDECL(RTFOFF) RTVfsFileTell(RTVFSFILE hVfsFile);
517
518RTDECL(int) RTVfsFileSeek(RTVFSFILE hVfsFile, RTFOFF offSeek, uint32_t uMethod, uint64_t *poffActual);
519RTDECL(int) RTVfsFileSetSize(RTVFSFILE hVfsFile, uint64_t cbSize);
520RTDECL(int) RTVfsFileGetSize(RTVFSFILE hVfsFile, uint64_t *pcbSize);
521RTDECL(RTFOFF) RTVfsFileGetMaxSize(RTVFSFILE hVfsFile);
522RTDECL(int) RTVfsFileGetMaxSizeEx(RTVFSFILE hVfsFile, PRTFOFF pcbMax);
523
524/** @} */
525
526
527/** @defgroup grp_rt_vfs_chain VFS Chains
528 *
529 * VFS chains is for doing pipe like things with VFS objects from the command
530 * line. Imagine you want to cat the readme.gz of an ISO you could do
531 * something like:
532 * RTCat :iprtvfs:vfs(isofs,./mycd.iso)|ios(open,readme.gz)|ios(gunzip)
533 * or
534 * RTCat :iprtvfs:ios(isofs,./mycd.iso,/readme.gz)|ios(gunzip)
535 *
536 * The "isofs", "open" and "gunzip" bits in the above examples are chain
537 * element providers registered with IPRT. See RTVFSCHAINELEMENTREG for how
538 * these works.
539 *
540 * @{ */
541
542/** The path prefix used to identify an VFS chain specification. */
543#define RTVFSCHAIN_SPEC_PREFIX ":iprtvfs:"
544
545RTDECL(int) RTVfsChainOpenVfs( const char *pszSpec, PRTVFS phVfs, const char **ppszError);
546RTDECL(int) RTVfsChainOpenFsStream( const char *pszSpec, PRTVFSFSSTREAM phVfsFss, const char **ppszError);
547RTDECL(int) RTVfsChainOpenDir( const char *pszSpec, uint32_t fOpen, PRTVFSDIR phVfsDir, const char **ppszError);
548RTDECL(int) RTVfsChainOpenFile( const char *pszSpec, uint32_t fOpen, PRTVFSFILE phVfsFile, const char **ppszError);
549RTDECL(int) RTVfsChainOpenSymlink( const char *pszSpec, PRTVFSSYMLINK phVfsSym, const char **ppszError);
550RTDECL(int) RTVfsChainOpenIoStream( const char *pszSpec, uint32_t fOpen, PRTVFSIOSTREAM phVfsIos, const char **ppszError);
551
552/** @} */
553
554
555/** @} */
556
557RT_C_DECLS_END
558
559#endif /* !___iprt_vfs_h */
560
561
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette