VirtualBox

source: vbox/trunk/include/iprt/vfslowlevel.h@ 34407

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

vfsmemory.cpp: initial coding.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 44.0 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_vfslowlevel_h
27#define ___iprt_vfslowlevel_h
28
29#include <iprt/vfs.h>
30#include <iprt/err.h>
31#include <iprt/list.h>
32#include <iprt/param.h>
33
34
35RT_C_DECLS_BEGIN
36
37/** @defgroup grp_rt_vfs_lowlevel RTVfs - Low-level Interface.
38 * @ingroup grp_rt_vfs
39 * @{
40 */
41
42
43/** @name VFS Lock Abstraction
44 * @todo This should be moved somewhere else as it is of general use.
45 * @{ */
46
47/**
48 * VFS lock types.
49 */
50typedef enum RTVFSLOCKTYPE
51{
52 /** Invalid lock type. */
53 RTVFSLOCKTYPE_INVALID = 0,
54 /** Read write semaphore. */
55 RTVFSLOCKTYPE_RW,
56 /** Fast mutex semaphore (critical section in ring-3). */
57 RTVFSLOCKTYPE_FASTMUTEX,
58 /** Full fledged mutex semaphore. */
59 RTVFSLOCKTYPE_MUTEX,
60 /** The end of valid lock types. */
61 RTVFSLOCKTYPE_END,
62 /** The customary 32-bit type hack. */
63 RTVFSLOCKTYPE_32BIT_HACK = 0x7fffffff
64} RTVFSLOCKTYPE;
65
66/** VFS lock handle. */
67typedef struct RTVFSLOCKINTERNAL *RTVFSLOCK;
68/** Pointer to a VFS lock handle. */
69typedef RTVFSLOCK *PRTVFSLOCK;
70/** Nil VFS lock handle. */
71#define NIL_RTVFSLOCK ((RTVFSLOCK)~(uintptr_t)0)
72
73/** Special handle value for creating a new read/write semaphore based lock. */
74#define RTVFSLOCK_CREATE_RW ((RTVFSLOCK)~(uintptr_t)1)
75/** Special handle value for creating a new fast mutex semaphore based lock. */
76#define RTVFSLOCK_CREATE_FASTMUTEX ((RTVFSLOCK)~(uintptr_t)2)
77/** Special handle value for creating a new mutex semaphore based lock. */
78#define RTVFSLOCK_CREATE_MUTEX ((RTVFSLOCK)~(uintptr_t)3)
79
80/**
81 * Retains a reference to the VFS lock handle.
82 *
83 * @returns New reference count on success, UINT32_MAX on failure.
84 * @param hLock The VFS lock handle.
85 */
86RTDECL(uint32_t) RTVfsLockRetain(RTVFSLOCK hLock);
87
88/**
89 * Releases a reference to the VFS lock handle.
90 *
91 * @returns New reference count on success (0 if closed), UINT32_MAX on failure.
92 * @param hLock The VFS lock handle.
93 */
94RTDECL(uint32_t) RTVfsLockRelease(RTVFSLOCK hLock);
95
96/**
97 * Gets the lock type.
98 *
99 * @returns The lock type on success, RTVFSLOCKTYPE_INVALID if the handle is
100 * not valid.
101 * @param hLock The lock handle.
102 */
103RTDECL(RTVFSLOCKTYPE) RTVfsLockGetType(RTVFSLOCK hLock);
104
105
106
107RTDECL(void) RTVfsLockAcquireReadSlow(RTVFSLOCK hLock);
108RTDECL(void) RTVfsLockReleaseReadSlow(RTVFSLOCK hLock);
109RTDECL(void) RTVfsLockAcquireWriteSlow(RTVFSLOCK hLock);
110RTDECL(void) RTVfsLockReleaseWriteSlow(RTVFSLOCK hLock);
111/** @} */
112
113/**
114 * Acquire a read lock.
115 *
116 * @param hLock The lock handle, can be NIL.
117 */
118DECLINLINE(void) RTVfsLockAcquireRead(RTVFSLOCK hLock)
119{
120 if (hLock != NIL_RTVFSLOCK)
121 RTVfsLockAcquireReadSlow(hLock);
122}
123
124
125/**
126 * Release a read lock.
127 *
128 * @param hLock The lock handle, can be NIL.
129 */
130DECLINLINE(void) RTVfsLockReleaseRead(RTVFSLOCK hLock)
131{
132 if (hLock != NIL_RTVFSLOCK)
133 RTVfsLockReleaseReadSlow(hLock);
134}
135
136
137/**
138 * Acquire a write lock.
139 *
140 * @param hLock The lock handle, can be NIL.
141 */
142DECLINLINE(void) RTVfsLockAcquireWrite(RTVFSLOCK hLock)
143{
144 if (hLock != NIL_RTVFSLOCK)
145 RTVfsLockAcquireWriteSlow(hLock);
146}
147
148
149/**
150 * Release a write lock.
151 *
152 * @param hLock The lock handle, can be NIL.
153 */
154DECLINLINE(void) RTVfsLockReleaseWrite(RTVFSLOCK hLock)
155{
156 if (hLock != NIL_RTVFSLOCK)
157 RTVfsLockReleaseWriteSlow(hLock);
158}
159
160/** @} */
161
162/**
163 * The VFS operations.
164 */
165typedef struct RTVFSOPS
166{
167 /** The structure version (RTVFSOPS_VERSION). */
168 uint32_t uVersion;
169 /** The virtual file system feature mask. */
170 uint32_t fFeatures;
171 /** The name of the operations. */
172 const char *pszName;
173
174 /**
175 * Destructor.
176 *
177 * @param pvThis The implementation specific data.
178 */
179 DECLCALLBACKMEMBER(void, pfnDestroy)(void *pvThis);
180
181 /**
182 * Opens the root directory.
183 *
184 * @returns IPRT status code.
185 * @param pvThis The implementation specific data.
186 * @param phVfsDir Where to return the handle to the root directory.
187 */
188 DECLCALLBACKMEMBER(int, pfnOpenRoot)(void *pvThis, PRTVFSDIR phVfsDir);
189
190 /** @todo There will be more methods here to optimize opening and
191 * querying. */
192
193#if 0
194 /**
195 * Optional entry point for optimizing path traversal within the file system.
196 *
197 * @returns IPRT status code.
198 * @param pvThis The implementation specific data.
199 * @param pszPath The path to resolve.
200 * @param poffPath The current path offset on input, what we've
201 * traversed to on successful return.
202 * @param phVfs??? Return handle to what we've traversed.
203 * @param p??? Return other stuff...
204 */
205 DECLCALLBACKMEMBER(int, pfnTraverse)(void *pvThis, const char *pszPath, size_t *poffPath, PRTVFS??? phVfs?, ???* p???);
206#endif
207
208 /** Marks the end of the structure (RTVFSOPS_VERSION). */
209 uintptr_t uEndMarker;
210} RTVFSOPS;
211/** Pointer to constant VFS operations. */
212typedef RTVFSOPS const *PCRTVFSOPS;
213
214/** The RTVFSOPS structure version. */
215#define RTVFSOPS_VERSION RT_MAKE_U32_FROM_U8(0xff,0x0f,1,0)
216
217/** @name RTVFSOPS::fFeatures
218 * @{ */
219/** The VFS supports attaching other systems. */
220#define RTVFSOPS_FEAT_ATTACH RT_BIT_32(0)
221/** @} */
222
223
224/**
225 * The basis for all virtual file system objects except RTVFS.
226 */
227typedef struct RTVFSOBJOPS
228{
229 /** The structure version (RTVFSOBJOPS_VERSION). */
230 uint32_t uVersion;
231 /** The object type for type introspection. */
232 RTVFSOBJTYPE enmType;
233 /** The name of the operations. */
234 const char *pszName;
235
236 /**
237 * Close the object.
238 *
239 * @returns IPRT status code.
240 * @param pvThis The implementation specific file data.
241 */
242 DECLCALLBACKMEMBER(int, pfnClose)(void *pvThis);
243
244 /**
245 * Get information about the file.
246 *
247 * @returns IPRT status code. See RTVfsObjQueryInfo.
248 * @param pvThis The implementation specific file data.
249 * @param pObjInfo Where to return the object info on success.
250 * @param enmAddAttr Which set of additional attributes to request.
251 * @sa RTVfsObjQueryInfo, RTFileQueryInfo, RTPathQueryInfo
252 */
253 DECLCALLBACKMEMBER(int, pfnQueryInfo)(void *pvThis, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
254
255 /** Marks the end of the structure (RTVFSOBJOPS_VERSION). */
256 uintptr_t uEndMarker;
257} RTVFSOBJOPS;
258/** Pointer to constant VFS object operations. */
259typedef RTVFSOBJOPS const *PCRTVFSOBJOPS;
260
261/** The RTVFSOBJOPS structure version. */
262#define RTVFSOBJOPS_VERSION RT_MAKE_U32_FROM_U8(0xff,0x1f,1,0)
263
264
265/**
266 * Creates a new VFS base object handle.
267 *
268 * @returns IPRT status code
269 * @param pObjOps The base object operations.
270 * @param cbInstance The size of the instance data.
271 * @param hVfs The VFS handle to associate this base object
272 * with. NIL_VFS is ok.
273 * @param hLock Handle to a custom lock to be used with the new
274 * object. The reference is consumed. NIL and
275 * special lock handles are fine.
276 * @param phVfsFss Where to return the new handle.
277 * @param ppvInstance Where to return the pointer to the instance data
278 * (size is @a cbInstance).
279 */
280RTDECL(int) RTVfsNewBaseObj(PCRTVFSOBJOPS pObjOps, size_t cbInstance, RTVFS hVfs, RTVFSLOCK hLock,
281 PRTVFSOBJ phVfsObj, void **ppvInstance);
282
283
284/**
285 * Additional operations for setting object attributes.
286 */
287typedef struct RTVFSOBJSETOPS
288{
289 /** The structure version (RTVFSOBJSETOPS_VERSION). */
290 uint32_t uVersion;
291 /** The offset to the RTVFSOBJOPS structure. */
292 int32_t offObjOps;
293
294 /**
295 * Set the unix style owner and group.
296 *
297 * @returns IPRT status code.
298 * @param pvThis The implementation specific file data.
299 * @param fMode The new mode bits.
300 * @param fMask The mask indicating which bits we are
301 * changing.
302 * @sa RTFileSetMode
303 */
304 DECLCALLBACKMEMBER(int, pfnSetMode)(void *pvThis, RTFMODE fMode, RTFMODE fMask);
305
306 /**
307 * Set the timestamps associated with the object.
308 *
309 * @returns IPRT status code.
310 * @param pvThis The implementation specific file data.
311 * @param pAccessTime Pointer to the new access time. NULL if not
312 * to be changed.
313 * @param pModificationTime Pointer to the new modifcation time. NULL if
314 * not to be changed.
315 * @param pChangeTime Pointer to the new change time. NULL if not
316 * to be changed.
317 * @param pBirthTime Pointer to the new time of birth. NULL if
318 * not to be changed.
319 * @remarks See RTFileSetTimes for restrictions and behavior imposed by the
320 * host OS or underlying VFS provider.
321 * @sa RTFileSetTimes
322 */
323 DECLCALLBACKMEMBER(int, pfnSetTimes)(void *pvThis, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
324 PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime);
325
326 /**
327 * Set the unix style owner and group.
328 *
329 * @returns IPRT status code.
330 * @param pvThis The implementation specific file data.
331 * @param uid The user ID of the new owner. NIL_RTUID if
332 * unchanged.
333 * @param gid The group ID of the new owner group. NIL_RTGID if
334 * unchanged.
335 * @sa RTFileSetOwner
336 */
337 DECLCALLBACKMEMBER(int, pfnSetOwner)(void *pvThis, RTUID uid, RTGID gid);
338
339 /** Marks the end of the structure (RTVFSOBJSETOPS_VERSION). */
340 uintptr_t uEndMarker;
341} RTVFSOBJSETOPS;
342/** Pointer to const object attribute setter operations. */
343typedef RTVFSOBJSETOPS const *PCRTVFSOBJSETOPS;
344
345/** The RTVFSOBJSETOPS structure version. */
346#define RTVFSOBJSETOPS_VERSION RT_MAKE_U32_FROM_U8(0xff,0x2f,1,0)
347
348
349/**
350 * The filesystem stream operations.
351 *
352 * @extends RTVFSOBJOPS
353 */
354typedef struct RTVFSFSSTREAMOPS
355{
356 /** The basic object operation. */
357 RTVFSOBJOPS Obj;
358 /** The structure version (RTVFSFSSTREAMOPS_VERSION). */
359 uint32_t uVersion;
360 /** Reserved field, MBZ. */
361 uint32_t fReserved;
362
363 /**
364 * Gets the next object in the stream.
365 *
366 * @returns IPRT status code.
367 * @retval VINF_SUCCESS if a new object was retrieved.
368 * @retval VERR_EOF when there are no more objects.
369 * @param pvThis The implementation specific directory data.
370 * @param ppszName Where to return the object name. Must be freed by
371 * calling RTStrFree.
372 * @param penmType Where to return the object type.
373 * @param hVfsObj Where to return the object handle (referenced).
374 * This must be cast to the desired type before use.
375 * @sa RTVfsFsStrmNext
376 */
377 DECLCALLBACKMEMBER(int, pfnNext)(void *pvThis, char **ppszName, RTVFSOBJTYPE *penmType, PRTVFSOBJ phVfsObj);
378
379 /** Marks the end of the structure (RTVFSFSSTREAMOPS_VERSION). */
380 uintptr_t uEndMarker;
381} RTVFSFSSTREAMOPS;
382/** Pointer to const object attribute setter operations. */
383typedef RTVFSFSSTREAMOPS const *PCRTVFSFSSTREAMOPS;
384
385/** The RTVFSFSSTREAMOPS structure version. */
386#define RTVFSFSSTREAMOPS_VERSION RT_MAKE_U32_FROM_U8(0xff,0x3f,1,0)
387
388
389/**
390 * Creates a new VFS filesystem stream handle.
391 *
392 * @returns IPRT status code
393 * @param pFsStreamOps The filesystem stream operations.
394 * @param cbInstance The size of the instance data.
395 * @param hVfs The VFS handle to associate this filesystem
396 * stream with. NIL_VFS is ok.
397 * @param hLock Handle to a custom lock to be used with the new
398 * object. The reference is consumed. NIL and
399 * special lock handles are fine.
400 * @param phVfsFss Where to return the new handle.
401 * @param ppvInstance Where to return the pointer to the instance data
402 * (size is @a cbInstance).
403 */
404RTDECL(int) RTVfsNewFsStream(PCRTVFSFSSTREAMOPS pFsStreamOps, size_t cbInstance, RTVFS hVfs, RTVFSLOCK hLock,
405 PRTVFSFSSTREAM phVfsFss, void **ppvInstance);
406
407
408/**
409 * The directory operations.
410 *
411 * @extends RTVFSOBJOPS
412 * @extends RTVFSOBJSETOPS
413 */
414typedef struct RTVFSDIROPS
415{
416 /** The basic object operation. */
417 RTVFSOBJOPS Obj;
418 /** The structure version (RTVFSDIROPS_VERSION). */
419 uint32_t uVersion;
420 /** Reserved field, MBZ. */
421 uint32_t fReserved;
422 /** The object setter operations. */
423 RTVFSOBJSETOPS ObjSet;
424
425 /**
426 * Opens a directory entry for traversal purposes.
427 *
428 * Method which sole purpose is helping the path traversal. Only one of
429 * the three output variables will be set, the others will left untouched
430 * (caller sets them to NIL).
431 *
432 * @returns IPRT status code.
433 * @retval VERR_PATH_NOT_FOUND if @a pszEntry was not found.
434 * @param pvThis The implementation specific directory data.
435 * @param pszEntry The name of the directory entry to remove.
436 * @param phVfsDir If not NULL and it is a directory, open it and
437 * return the handle here.
438 * @param phVfsSymlink If not NULL and it is a symbolic link, open it
439 * and return the handle here.
440 * @param phVfsMounted If not NULL and it is a mounted VFS directory,
441 * reference it and return the handle here.
442 * @todo Should com dir, symlinks and mount points using some common
443 * ancestor "class".
444 */
445 DECLCALLBACKMEMBER(int, pfnTraversalOpen)(void *pvThis, const char *pszEntry, PRTVFSDIR phVfsDir,
446 PRTVFSSYMLINK phVfsSymlink, PRTVFS phVfsMounted);
447
448 /**
449 * Open or create a file.
450 *
451 * @returns IPRT status code.
452 * @param pvThis The implementation specific directory data.
453 * @param pszFilename The name of the immediate file to open or create.
454 * @param fOpen The open flags (RTFILE_O_XXX).
455 * @param phVfsFile Where to return the thandle to the opened file.
456 * @sa RTFileOpen.
457 */
458 DECLCALLBACKMEMBER(int, pfnOpenFile)(void *pvThis, const char *pszFilename, uint32_t fOpen, PRTVFSFILE phVfsFile);
459
460 /**
461 * Open an existing subdirectory.
462 *
463 * @returns IPRT status code.
464 * @param pvThis The implementation specific directory data.
465 * @param pszSubDir The name of the immediate subdirectory to open.
466 * @param phVfsDir Where to return the handle to the opened directory.
467 * @sa RTDirOpen.
468 */
469 DECLCALLBACKMEMBER(int, pfnOpenDir)(void *pvThis, const char *pszSubDir, PRTVFSDIR phVfsDir);
470
471 /**
472 * Creates a new subdirectory.
473 *
474 * @returns IPRT status code.
475 * @param pvThis The implementation specific directory data.
476 * @param pszSubDir The name of the immediate subdirectory to create.
477 * @param fMode The mode mask of the new directory.
478 * @param phVfsDir Where to optionally return the handle to the newly
479 * create directory.
480 * @sa RTDirCreate.
481 */
482 DECLCALLBACKMEMBER(int, pfnCreateDir)(void *pvThis, const char *pszSubDir, RTFMODE fMode, PRTVFSDIR phVfsDir);
483
484 /**
485 * Opens an existing symbolic link.
486 *
487 * @returns IPRT status code.
488 * @param pvThis The implementation specific directory data.
489 * @param pszSymlink The name of the immediate symbolic link to open.
490 * @param phVfsSymlink Where to optionally return the handle to the
491 * newly create symbolic link.
492 * @sa RTSymlinkCreate.
493 */
494 DECLCALLBACKMEMBER(int, pfnOpenSymlink)(void *pvThis, const char *pszSymlink, PRTVFSSYMLINK phVfsSymlink);
495
496 /**
497 * Creates a new symbolic link.
498 *
499 * @returns IPRT status code.
500 * @param pvThis The implementation specific directory data.
501 * @param pszSymlink The name of the immediate symbolic link to create.
502 * @param pszTarget The symbolic link target.
503 * @param enmType The symbolic link type.
504 * @param phVfsSymlink Where to optionally return the handle to the
505 * newly create symbolic link.
506 * @sa RTSymlinkCreate.
507 */
508 DECLCALLBACKMEMBER(int, pfnCreateSymlink)(void *pvThis, const char *pszSymlink, const char *pszTarget,
509 RTSYMLINKTYPE enmType, PRTVFSSYMLINK phVfsSymlink);
510
511 /**
512 * Removes a directory entry.
513 *
514 * @returns IPRT status code.
515 * @param pvThis The implementation specific directory data.
516 * @param pszEntry The name of the directory entry to remove.
517 * @param fType If non-zero, this restricts the type of the entry to
518 * the object type indicated by the mask
519 * (RTFS_TYPE_XXX).
520 * @sa RTFileRemove, RTDirRemove, RTSymlinkRemove.
521 */
522 DECLCALLBACKMEMBER(int, pfnUnlinkEntry)(void *pvThis, const char *pszEntry, RTFMODE fType, PRTVFSDIR phVfsDir);
523
524 /**
525 * Rewind the directory stream so that the next read returns the first
526 * entry.
527 *
528 * @returns IPRT status code.
529 * @param pvThis The implementation specific directory data.
530 */
531 DECLCALLBACKMEMBER(int, pfnRewindDir)(void *pvThis);
532
533 /**
534 * Rewind the directory stream so that the next read returns the first
535 * entry.
536 *
537 * @returns IPRT status code.
538 * @param pvThis The implementation specific directory data.
539 * @param pDirEntry Output buffer.
540 * @param pcbDirEntry Complicated, see RTDirReadEx.
541 * @param enmAddAttr Which set of additional attributes to request.
542 * @sa RTDirReadEx
543 */
544 DECLCALLBACKMEMBER(int, pfnReadDir)(void *pvThis, PRTDIRENTRYEX pDirEntry, size_t *pcbDirEntry, RTFSOBJATTRADD enmAddAttr);
545
546 /** Marks the end of the structure (RTVFSDIROPS_VERSION). */
547 uintptr_t uEndMarker;
548} RTVFSDIROPS;
549/** Pointer to const directory operations. */
550typedef RTVFSDIROPS const *PCRTVFSDIROPS;
551/** The RTVFSDIROPS structure version. */
552#define RTVFSDIROPS_VERSION RT_MAKE_U32_FROM_U8(0xff,0x4f,1,0)
553
554
555/**
556 * The symbolic link operations.
557 *
558 * @extends RTVFSOBJOPS
559 * @extends RTVFSOBJSETOPS
560 */
561typedef struct RTVFSSYMLINKOPS
562{
563 /** The basic object operation. */
564 RTVFSOBJOPS Obj;
565 /** The structure version (RTVFSSYMLINKOPS_VERSION). */
566 uint32_t uVersion;
567 /** Reserved field, MBZ. */
568 uint32_t fReserved;
569 /** The object setter operations. */
570 RTVFSOBJSETOPS ObjSet;
571
572 /**
573 * Read the symbolic link target.
574 *
575 * @returns IPRT status code.
576 * @param pvThis The implementation specific symbolic link data.
577 * @param pszTarget The target buffer.
578 * @param cbTarget The size of the target buffer.
579 * @sa RTSymlinkRead
580 */
581 DECLCALLBACKMEMBER(int, pfnRead)(void *pvThis, char *pszTarget, size_t cbTarget);
582
583 /** Marks the end of the structure (RTVFSSYMLINKOPS_VERSION). */
584 uintptr_t uEndMarker;
585} RTVFSSYMLINKOPS;
586/** Pointer to const symbolic link operations. */
587typedef RTVFSSYMLINKOPS const *PCRTVFSSYMLINKOPS;
588/** The RTVFSSYMLINKOPS structure version. */
589#define RTVFSSYMLINKOPS_VERSION RT_MAKE_U32_FROM_U8(0xff,0x5f,1,0)
590
591
592/**
593 * Creates a new VFS symlink handle.
594 *
595 * @returns IPRT status code
596 * @param pSymlinkOps The symlink operations.
597 * @param cbInstance The size of the instance data.
598 * @param hVfs The VFS handle to associate this symlink object
599 * with. NIL_VFS is ok.
600 * @param hLock Handle to a custom lock to be used with the new
601 * object. The reference is consumed. NIL and
602 * special lock handles are fine.
603 * @param phVfsSym Where to return the new handle.
604 * @param ppvInstance Where to return the pointer to the instance data
605 * (size is @a cbInstance).
606 */
607RTDECL(int) RTVfsNewSymlink(PCRTVFSSYMLINKOPS pSymlinkOps, size_t cbInstance, RTVFS hVfs, RTVFSLOCK hLock,
608 PRTVFSSYMLINK phVfsSym, void **ppvInstance);
609
610
611/**
612 * The basis for all I/O objects (files, pipes, sockets, devices, ++).
613 *
614 * @extends RTVFSOBJOPS
615 */
616typedef struct RTVFSIOSTREAMOPS
617{
618 /** The basic object operation. */
619 RTVFSOBJOPS Obj;
620 /** The structure version (RTVFSIOSTREAMOPS_VERSION). */
621 uint32_t uVersion;
622 /** Feature field. */
623 uint32_t fFeatures;
624
625 /**
626 * Reads from the file/stream.
627 *
628 * @returns IPRT status code. See RTVfsIoStrmRead.
629 * @param pvThis The implementation specific file data.
630 * @param off Where to read at, -1 for the current position.
631 * @param pSgBuf Gather buffer describing the bytes that are to be
632 * written.
633 * @param fBlocking If @c true, the call is blocking, if @c false it
634 * should not block.
635 * @param pcbRead Where return the number of bytes actually read.
636 * This is set it 0 by the caller. If NULL, try read
637 * all and fail if incomplete.
638 * @sa RTVfsIoStrmRead, RTVfsIoStrmSgRead, RTVfsFileRead,
639 * RTVfsFileReadAt, RTFileRead, RTFileReadAt.
640 */
641 DECLCALLBACKMEMBER(int, pfnRead)(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead);
642
643 /**
644 * Writes to the file/stream.
645 *
646 * @returns IPRT status code.
647 * @param pvThis The implementation specific file data.
648 * @param off Where to start wrinting, -1 for the current
649 * position.
650 * @param pSgBuf Gather buffers describing the bytes that are to be
651 * written.
652 * @param fBlocking If @c true, the call is blocking, if @c false it
653 * should not block.
654 * @param pcbWritten Where to return the number of bytes actually
655 * written. This is set it 0 by the caller. If
656 * NULL, try write it all and fail if incomplete.
657 * @sa RTFileWrite, RTFileWriteAt.
658 */
659 DECLCALLBACKMEMBER(int, pfnWrite)(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten);
660
661 /**
662 * Flushes any pending data writes to the stream.
663 *
664 * @returns IPRT status code.
665 * @param pvThis The implementation specific file data.
666 * @sa RTFileFlush.
667 */
668 DECLCALLBACKMEMBER(int, pfnFlush)(void *pvThis);
669
670 /**
671 * Poll for events.
672 *
673 * @returns IPRT status code.
674 * @param pvThis The implementation specific file data.
675 * @param fEvents The events to poll for (RTPOLL_EVT_XXX).
676 * @param cMillies How long to wait for event to eventuate.
677 * @param fIntr Whether the wait is interruptible and can return
678 * VERR_INTERRUPTED (@c true) or if this condition
679 * should be hidden from the caller (@c false).
680 * @param pfRetEvents Where to return the event mask.
681 * @sa RTPollSetAdd, RTPoll, RTPollNoResume.
682 */
683 DECLCALLBACKMEMBER(int, pfnPollOne)(void *pvThis, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr,
684 uint32_t *pfRetEvents);
685
686 /**
687 * Tells the current file/stream position.
688 *
689 * @returns IPRT status code.
690 * @param pvThis The implementation specific file data.
691 * @param poffActual Where to return the actual offset.
692 * @sa RTFileTell
693 */
694 DECLCALLBACKMEMBER(int, pfnTell)(void *pvThis, PRTFOFF poffActual);
695
696 /**
697 * Skips @a cb ahead in the stream.
698 *
699 * @returns IPRT status code.
700 * @param pvThis The implementation specific file data.
701 * @param cb The number bytes to skip.
702 * @remarks This is optional and can be NULL.
703 */
704 DECLCALLBACKMEMBER(int, pfnSkip)(void *pvThis, RTFOFF cb);
705
706 /**
707 * Fills the stream with @a cb zeros.
708 *
709 * @returns IPRT status code.
710 * @param pvThis The implementation specific file data.
711 * @param cb The number of zero bytes to insert.
712 * @remarks This is optional and can be NULL.
713 */
714 DECLCALLBACKMEMBER(int, pfnZeroFill)(void *pvThis, RTFOFF cb);
715
716 /** Marks the end of the structure (RTVFSIOSTREAMOPS_VERSION). */
717 uintptr_t uEndMarker;
718} RTVFSIOSTREAMOPS;
719/** Pointer to const I/O stream operations. */
720typedef RTVFSIOSTREAMOPS const *PCRTVFSIOSTREAMOPS;
721
722/** The RTVFSIOSTREAMOPS structure version. */
723#define RTVFSIOSTREAMOPS_VERSION RT_MAKE_U32_FROM_U8(0xff,0x6f,1,0)
724
725/** @name RTVFSIOSTREAMOPS::fFeatures
726 * @{ */
727/** No scatter gather lists, thank you. */
728#define RTVFSIOSTREAMOPS_FEAT_NO_SG RT_BIT_32(0)
729/** Mask of the valid I/O stream feature flags. */
730#define RTVFSIOSTREAMOPS_FEAT_VALID_MASK UINT32_C(0x00000001)
731/** @} */
732
733
734/**
735 * Creates a new VFS I/O stream handle.
736 *
737 * @returns IPRT status code
738 * @param pIoStreamOps The I/O stream operations.
739 * @param cbInstance The size of the instance data.
740 * @param fOpen The open flags. The minimum is the access mask.
741 * @param hVfs The VFS handle to associate this I/O stream
742 * with. NIL_VFS is ok.
743 * @param hLock Handle to a custom lock to be used with the new
744 * object. The reference is consumed. NIL and
745 * special lock handles are fine.
746 * @param phVfsIos Where to return the new handle.
747 * @param ppvInstance Where to return the pointer to the instance data
748 * (size is @a cbInstance).
749 */
750RTDECL(int) RTVfsNewIoStream(PCRTVFSIOSTREAMOPS pIoStreamOps, size_t cbInstance, uint32_t fOpen, RTVFS hVfs, RTVFSLOCK hLock,
751 PRTVFSIOSTREAM phVfsIos, void **ppvInstance);
752
753
754/**
755 * The file operations.
756 *
757 * @extends RTVFSIOSTREAMOPS
758 * @extends RTVFSOBJSETOPS
759 */
760typedef struct RTVFSFILEOPS
761{
762 /** The I/O stream and basis object operations. */
763 RTVFSIOSTREAMOPS Stream;
764 /** The structure version (RTVFSFILEOPS_VERSION). */
765 uint32_t uVersion;
766 /** Reserved field, MBZ. */
767 uint32_t fReserved;
768 /** The object setter operations. */
769 RTVFSOBJSETOPS ObjSet;
770
771 /**
772 * Changes the current file position.
773 *
774 * @returns IPRT status code.
775 * @param pvThis The implementation specific file data.
776 * @param offSeek The offset to seek.
777 * @param uMethod The seek method, i.e. what the seek is relative to.
778 * @param poffActual Where to return the actual offset.
779 * @sa RTFileSeek
780 */
781 DECLCALLBACKMEMBER(int, pfnSeek)(void *pvThis, RTFOFF offSeek, unsigned uMethod, PRTFOFF poffActual);
782
783 /**
784 * Get the current file/stream size.
785 *
786 * @returns IPRT status code.
787 * @param pvThis The implementation specific file data.
788 * @param pcbFile Where to store the current file size.
789 * @sa RTFileGetSize
790 */
791 DECLCALLBACKMEMBER(int, pfnQuerySize)(void *pvThis, uint64_t *pcbFile);
792
793 /** @todo There will be more methods here. */
794
795 /** Marks the end of the structure (RTVFSFILEOPS_VERSION). */
796 uintptr_t uEndMarker;
797} RTVFSFILEOPS;
798/** Pointer to const file operations. */
799typedef RTVFSFILEOPS const *PCRTVFSFILEOPS;
800
801/** The RTVFSFILEOPS structure version. */
802#define RTVFSFILEOPS_VERSION RT_MAKE_U32_FROM_U8(0xff,0x7f,1,0)
803
804/**
805 * Creates a new VFS file handle.
806 *
807 * @returns IPRT status code
808 * @param pFileOps The file operations.
809 * @param cbInstance The size of the instance data.
810 * @param fOpen The open flags. The minimum is the access mask.
811 * @param hVfs The VFS handle to associate this file with.
812 * NIL_VFS is ok.
813 * @param hLock Handle to a custom lock to be used with the new
814 * object. The reference is consumed. NIL and
815 * special lock handles are fine.
816 * @param phVfsFile Where to return the new handle.
817 * @param ppvInstance Where to return the pointer to the instance data
818 * (size is @a cbInstance).
819 */
820RTDECL(int) RTVfsNewFile(PCRTVFSFILEOPS pFileOps, size_t cbInstance, uint32_t fOpen, RTVFS hVfs, RTVFSLOCK hLock,
821 PRTVFSFILE phVfsFile, void **ppvInstance);
822
823
824/** @defgroup grp_rt_vfs_ll_util VFS Utility APIs
825 * @{ */
826
827/**
828 * Parsed path.
829 */
830typedef struct RTVFSPARSEDPATH
831{
832 /** The length of the path in szCopy. */
833 uint16_t cch;
834 /** The number of path components. */
835 uint16_t cComponents;
836 /** Set if the path ends with slash, indicating that it's a directory
837 * reference and not a file reference. The slash has been removed from
838 * the copy. */
839 bool fDirSlash;
840 /** The offset where each path component starts, i.e. the char after the
841 * slash. The array has cComponents + 1 entries, where the final one is
842 * cch + 1 so that one can always terminate the current component by
843 * szPath[aoffComponent[i] - 1] = '\0'. */
844 uint16_t aoffComponents[RTPATH_MAX / 2 + 1];
845 /** A normalized copy of the path.
846 * Reserve some extra space so we can be more relaxed about overflow
847 * checks and terminator paddings, especially when recursing. */
848 char szPath[RTPATH_MAX];
849} RTVFSPARSEDPATH;
850/** Pointer to a parsed path. */
851typedef RTVFSPARSEDPATH *PRTVFSPARSEDPATH;
852
853/** The max accepted path length.
854 * This must be a few chars shorter than RTVFSPARSEDPATH::szPath because we
855 * use two terminators and wish be a little bit lazy with checking. */
856#define RTVFSPARSEDPATH_MAX (RTPATH_MAX - 4)
857
858/**
859 * Appends @a pszPath (relative) to the already parsed path @a pPath.
860 *
861 * @retval VINF_SUCCESS
862 * @retval VERR_FILENAME_TOO_LONG
863 * @retval VERR_INTERNAL_ERROR_4
864 * @param pPath The parsed path to append @a pszPath onto.
865 * This is both input and output.
866 * @param pszPath The path to append. This must be relative.
867 * @param piRestartComp The component to restart parsing at. This is
868 * input/output. The input does not have to be
869 * within the valid range. Optional.
870 */
871RTDECL(int) RTVfsParsePathAppend(PRTVFSPARSEDPATH pPath, const char *pszPath, uint16_t *piRestartComp);
872
873/**
874 * Parses a path.
875 *
876 * @retval VINF_SUCCESS
877 * @retval VERR_FILENAME_TOO_LONG
878 * @param pPath Where to store the parsed path.
879 * @param pszPath The path to parse. Absolute or relative to @a
880 * pszCwd.
881 * @param pszCwd The current working directory. Must be
882 * absolute.
883 */
884RTDECL(int) RTVfsParsePath(PRTVFSPARSEDPATH pPath, const char *pszPath, const char *pszCwd);
885
886/**
887 * Same as RTVfsParsePath except that it allocates a temporary buffer.
888 *
889 * @retval VINF_SUCCESS
890 * @retval VERR_NO_TMP_MEMORY
891 * @retval VERR_FILENAME_TOO_LONG
892 * @param pszPath The path to parse. Absolute or relative to @a
893 * pszCwd.
894 * @param pszCwd The current working directory. Must be
895 * absolute.
896 * @param ppPath Where to store the pointer to the allocated
897 * buffer containing the parsed path. This must
898 * be freed by calling RTVfsParsePathFree. NULL
899 * will be stored on failured.
900 */
901RTDECL(int) RTVfsParsePathA(const char *pszPath, const char *pszCwd, PRTVFSPARSEDPATH *ppPath);
902
903/**
904 * Frees a buffer returned by RTVfsParsePathA.
905 *
906 * @param pPath The parsed path buffer to free. NULL is fine.
907 */
908RTDECL(void) RTVfsParsePathFree(PRTVFSPARSEDPATH pPath);
909
910/**
911 * Dummy implementation of RTVFSIOSTREAMOPS::pfnPollOne.
912 *
913 * This handles the case where there is no chance any events my be raised and
914 * all that is required is to wait according to the parameters.
915 *
916 * @returns IPRT status code.
917 * @param pvThis The implementation specific file data.
918 * @param fEvents The events to poll for (RTPOLL_EVT_XXX).
919 * @param cMillies How long to wait for event to eventuate.
920 * @param fIntr Whether the wait is interruptible and can return
921 * VERR_INTERRUPTED (@c true) or if this condition
922 * should be hidden from the caller (@c false).
923 * @param pfRetEvents Where to return the event mask.
924 * @sa RTVFSIOSTREAMOPS::pfnPollOne, RTPollSetAdd, RTPoll, RTPollNoResume.
925 */
926RTDECL(int) RTVfsUtilDummyPollOne(uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr, uint32_t *pfRetEvents);
927
928/**
929 * Pumps data from one I/O stream to another.
930 *
931 * The data is read in chunks from @a hVfsIosSrc and written to @a hVfsIosDst
932 * until @hVfsIosSrc indicates end of stream.
933 *
934 * @returns IPRT status code
935 *
936 * @param hVfsIosSrc The input stream.
937 * @param hVfsIosDst The output stream.
938 * @param cbBufHint Hints at a good temporary buffer size, pass 0 if
939 * clueless.
940 */
941RTDECL(int) RTVfsUtilPumpIoStreams(RTVFSIOSTREAM hVfsIosSrc, RTVFSIOSTREAM hVfsIosDst, size_t cbBufHint);
942
943/** @} */
944
945
946/** @defgroup grp_rt_vfs_lowlevel_chain VFS Chains
947 * @ref grp_rt_vfs_chain
948 * @{
949 */
950
951
952/**
953 * Chain element input actions.
954 */
955typedef enum RTVFSCHAINACTION
956{
957 /** Invalid action. */
958 RTVFSCHAINACTION_INVALID = 0,
959 /** No action (start of the chain). */
960 RTVFSCHAINACTION_NONE,
961 /** Passive filtering (expressed by pipe symbol). */
962 RTVFSCHAINACTION_PASSIVE,
963 /** Push filtering (expressed by redirection-out symbol). */
964 RTVFSCHAINACTION_PUSH,
965 /** The end of the valid actions. */
966 RTVFSCHAINACTION_END,
967 /** Make sure it's a 32-bit type. */
968 RTVFSCHAINACTION_32BIT_HACK = 0x7fffffff
969} RTVFSCHAINACTION;
970
971
972/**
973 * VFS chain element specification.
974 */
975typedef struct RTVFSCHAINELEMSPEC
976{
977 /** The provider name. */
978 char *pszProvider;
979 /** The input type. */
980 RTVFSOBJTYPE enmTypeIn;
981 /** The output type. */
982 RTVFSOBJTYPE enmTypeOut;
983 /** The action to take (or not). */
984 RTVFSCHAINACTION enmAction;
985 /** The number of arguments. */
986 uint32_t cArgs;
987 /** Arguments. */
988 char **papszArgs;
989} RTVFSCHAINELEMSPEC;
990/** Pointer to a chain element specification. */
991typedef RTVFSCHAINELEMSPEC *PRTVFSCHAINELEMSPEC;
992/** Pointer to a const chain element specification. */
993typedef RTVFSCHAINELEMSPEC const *PCRTVFSCHAINELEMSPEC;
994
995
996/**
997 * Parsed VFS chain specification.
998 */
999typedef struct RTVFSCHAINSPEC
1000{
1001 /** The action element, UINT32_MAX if none.
1002 * Currently we only support one action element (RTVFSCHAINACTION_PASSIVE
1003 * is not considered). */
1004 uint32_t iActionElement;
1005 /** The number of elements. */
1006 uint32_t cElements;
1007 /** The elements. */
1008 PRTVFSCHAINELEMSPEC paElements;
1009} RTVFSCHAINSPEC;
1010/** Pointer to a parsed VFS chain specification. */
1011typedef RTVFSCHAINSPEC *PRTVFSCHAINSPEC;
1012/** Pointer to a const, parsed VFS chain specification. */
1013typedef RTVFSCHAINSPEC const *PCRTVFSCHAINSPEC;
1014
1015
1016/**
1017 * A chain element provider registration record.
1018 */
1019typedef struct RTVFSCHAINELEMENTREG
1020{
1021 /** The version (RTVFSCHAINELEMENTREG_VERSION). */
1022 uint32_t uVersion;
1023 /** Reserved, MBZ. */
1024 uint32_t fReserved;
1025 /** The provider name (unique). */
1026 const char *pszName;
1027 /** For chaining the providers. */
1028 RTLISTNODE ListEntry;
1029
1030 /**
1031 * Create a VFS from the given chain element specficiation.
1032 *
1033 * @returns IPRT status code.
1034 * @param pSpec The chain element specification.
1035 * @param phVfs Where to returned the VFS handle.
1036 */
1037 DECLCALLBACKMEMBER(int, pfnOpenVfs)( PCRTVFSCHAINELEMSPEC pSpec, PRTVFS phVfs);
1038
1039 /**
1040 * Open a directory from the given chain element specficiation.
1041 *
1042 * @returns IPRT status code.
1043 * @param pSpec The chain element specification.
1044 * @param phVfsDir Where to returned the directory handle.
1045 */
1046 DECLCALLBACKMEMBER(int, pfnOpenDir)( PCRTVFSCHAINELEMSPEC pSpec, PRTVFSDIR phVfsDir);
1047
1048 /**
1049 * Open a file from the given chain element specficiation.
1050 *
1051 * @returns IPRT status code.
1052 * @param pSpec The chain element specification.
1053 * @param fOpen The open flag. Can be zero and the
1054 * specification may modify it.
1055 * @param phVfsFile Where to returned the file handle.
1056 */
1057 DECLCALLBACKMEMBER(int, pfnOpenFile)( PCRTVFSCHAINELEMSPEC pSpec, uint32_t fOpen, PRTVFSFILE phVfsFile);
1058
1059 /**
1060 * Open a symlink from the given chain element specficiation.
1061 *
1062 * @returns IPRT status code.
1063 * @param pSpec The chain element specification.
1064 * @param phVfsSym Where to returned the symlink handle.
1065 */
1066 DECLCALLBACKMEMBER(int, pfnOpenSymlink)( PCRTVFSCHAINELEMSPEC pSpec, PRTVFSSYMLINK phVfsSym);
1067
1068 /**
1069 * Open a I/O stream from the given chain element specficiation.
1070 *
1071 * @returns IPRT status code.
1072 * @param pSpec The chain element specification.
1073 * @param fOpen The open flag. Can be zero and the
1074 * specification may modify it.
1075 * @param phVfsIos Where to returned the I/O stream handle.
1076 */
1077 DECLCALLBACKMEMBER(int, pfnOpenIoStream)(PCRTVFSCHAINELEMSPEC pSpec, uint32_t fOpen, PRTVFSIOSTREAM phVfsIos);
1078
1079 /**
1080 * Open a filesystem stream from the given chain element specficiation.
1081 *
1082 * @returns IPRT status code.
1083 * @param pSpec The chain element specification.
1084 * @param phVfsFss Where to returned the filesystem stream handle.
1085 */
1086 DECLCALLBACKMEMBER(int, pfnOpenFsStream)(PCRTVFSCHAINELEMSPEC pSpec, PRTVFSFSSTREAM phVfsFss);
1087
1088 /** End marker (RTVFSCHAINELEMENTREG_VERSION). */
1089 uintptr_t uEndMarker;
1090} RTVFSCHAINELEMENTREG;
1091/** Pointer to a VFS chain element registration record. */
1092typedef RTVFSCHAINELEMENTREG *PRTVFSCHAINELEMENTREG;
1093/** Pointer to a const VFS chain element registration record. */
1094typedef RTVFSCHAINELEMENTREG const *PCRTVFSCHAINELEMENTREG;
1095
1096/** The VFS chain element registration record version number. */
1097#define RTVFSCHAINELEMENTREG_VERSION RT_MAKE_U32_FROM_U8(0xff, 0x7f, 1, 0)
1098
1099
1100/**
1101 * Parses the specification.
1102 *
1103 * @returns IPRT status code.
1104 * @param pszSpec The specification string to parse.
1105 * @param fFlags Flags, see RTVFSCHAIN_PF_XXX.
1106 * @param enmLeadingAction The only allowed leading action type.
1107 * @param enmTrailingAction The only allowed trailing action type.
1108 * @param ppSpec Where to return the pointer to the parsed
1109 * specification. This must be freed by calling
1110 * RTVfsChainSpecFree. Will always be set (unless
1111 * invalid parameters.)
1112 * @param ppszError On failure, this will point at the error
1113 * location in @a pszSpec. Optional.
1114 */
1115RTDECL(int) RTVfsChainSpecParse(const char *pszSpec, RTVFSCHAINACTION enmLeadingAction,
1116 RTVFSCHAINACTION enmTrailingAction,
1117 PRTVFSCHAINSPEC *ppSpec, const char *ppszError);
1118
1119/** @name RTVfsChainSpecParse
1120 * @{ */
1121/** No real action is permitted, i.e. only passive filtering (aka pipe). */
1122#define RTVFSCHAIN_PF_NO_REAL_ACTION RT_BIT_32(0)
1123/** The specified leading action is optional. */
1124#define RTVFSCHAIN_PF_LEADING_ACTION_OPTIONAL RT_BIT_32(1)
1125/** The specified trailing action is optional. */
1126#define RTVFSCHAIN_PF_TRAILING_ACTION_OPTIONAL RT_BIT_32(2)
1127/** Mask of valid flags. */
1128#define RTVFSCHAIN_PF_VALID_MASK UINT32_C(0x00000007)
1129/** @}*/
1130
1131/**
1132 * Frees a parsed chain specification.
1133 *
1134 * @param pSpec What RTVfsChainSpecParse returned. NULL is
1135 * quietly ignored.
1136 */
1137RTDECL(void) RTVfsChainSpecFree(PRTVFSCHAINSPEC pSpec);
1138
1139/**
1140 * Registers a chain element provider.
1141 *
1142 * @returns IPRT status code
1143 * @param pRegRec The registration record.
1144 * @param fFromCtor Indicates where we're called from.
1145 */
1146RTDECL(int) RTVfsChainElementRegisterProvider(PRTVFSCHAINELEMENTREG pRegRec, bool fFromCtor);
1147
1148/**
1149 * Deregisters a chain element provider.
1150 *
1151 * @returns IPRT status code
1152 * @param pRegRec The registration record.
1153 * @param fFromDtor Indicates where we're called from.
1154 */
1155RTDECL(int) RTVfsChainElementDeregisterProvider(PRTVFSCHAINELEMENTREG pRegRec, bool fFromDtor);
1156
1157
1158/** @def RTVFSCHAIN_AUTO_REGISTER_ELEMENT_PROVIDER
1159 * Automatically registers a chain element provider using a global constructor
1160 * and destructor hack.
1161 *
1162 * @param pRegRec Pointer to the registration record.
1163 * @param name Some unique variable name prefix.
1164 */
1165
1166#ifdef __cplusplus
1167/**
1168 * Class used for registering a VFS chain element provider.
1169 */
1170class RTVfsChainElementAutoRegisterHack
1171{
1172private:
1173 /** The registration record, NULL if registration failed. */
1174 PRTVFSCHAINELEMENTREG m_pRegRec;
1175
1176public:
1177 RTVfsChainElementAutoRegisterHack(PRTVFSCHAINELEMENTREG a_pRegRec)
1178 : m_pRegRec(a_pRegRec)
1179 {
1180 int rc = RTVfsChainElementRegisterProvider(m_pRegRec, true);
1181 if (RT_FAILURE(rc))
1182 m_pRegRec = NULL;
1183 }
1184
1185 ~RTVfsChainElementAutoRegisterHack()
1186 {
1187 RTVfsChainElementDeregisterProvider(m_pRegRec, true);
1188 m_pRegRec = NULL;
1189 }
1190};
1191
1192# define RTVFSCHAIN_AUTO_REGISTER_ELEMENT_PROVIDER(pRegRec, name) \
1193 static RTVfsChainElementAutoRegisterHack name ## AutoRegistrationHack(pRegRec)
1194
1195#else
1196# define RTVFSCHAIN_AUTO_REGISTER_ELEMENT_PROVIDER(pRegRec, name) \
1197 extern void *name ## AutoRegistrationHack = \
1198 &Sorry_but_RTVFSCHAIN_AUTO_REGISTER_ELEMENT_PROVIDER_does_not_work_in_c_source_files
1199#endif
1200
1201
1202/** @} */
1203
1204
1205/** @} */
1206
1207RT_C_DECLS_END
1208
1209#endif /* !___iprt_vfslowlevel_h */
1210
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