1 | /** @file
|
---|
2 | * VBox Shared Folders testcase stub redefinitions.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2011-2024 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
25 | */
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Macros for renaming iprt file operations to redirect them to testcase
|
---|
29 | * stub functions (mocks). The religiously correct way to do this would be
|
---|
30 | * to make the service use a file operations structure with function pointers
|
---|
31 | * but I'm not sure that would be universally appreciated. */
|
---|
32 |
|
---|
33 | #ifndef VBOX_INCLUDED_SRC_SharedFolders_teststubs_h
|
---|
34 | #define VBOX_INCLUDED_SRC_SharedFolders_teststubs_h
|
---|
35 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
36 | # pragma once
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | #include <iprt/dir.h>
|
---|
40 | #include <iprt/file.h>
|
---|
41 | #include <iprt/time.h>
|
---|
42 |
|
---|
43 | #define RTDirClose testRTDirClose
|
---|
44 | extern int testRTDirClose(RTDIR hDir);
|
---|
45 | #define RTDirCreate testRTDirCreate
|
---|
46 | extern int testRTDirCreate(const char *pszPath, RTFMODE fMode, uint32_t fCreate);
|
---|
47 | #define RTDirOpen testRTDirOpen
|
---|
48 | extern int testRTDirOpen(RTDIR *phDir, const char *pszPath);
|
---|
49 | #define RTDirOpenFiltered testRTDirOpenFiltered
|
---|
50 | extern int testRTDirOpenFiltered(RTDIR *phDir, const char *pszPath, RTDIRFILTER enmFilter, uint32_t fFlags);
|
---|
51 | #define RTDirQueryInfo testRTDirQueryInfo
|
---|
52 | extern int testRTDirQueryInfo(RTDIR hDir, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs);
|
---|
53 | #define RTDirRemove testRTDirRemove
|
---|
54 | extern int testRTDirRemove(const char *pszPath);
|
---|
55 | #define RTDirReadEx testRTDirReadEx
|
---|
56 | extern int testRTDirReadEx(RTDIR hDir, PRTDIRENTRYEX pDirEntry, size_t *pcbDirEntry, RTFSOBJATTRADD enmAdditionalAttribs, uint32_t fFlags);
|
---|
57 | #define RTDirSetMode testRTDirSetMode
|
---|
58 | extern int testRTDirSetMode(RTDIR hDir, RTFMODE fMode);
|
---|
59 | #define RTDirSetTimes testRTDirSetTimes
|
---|
60 | extern int testRTDirSetTimes(RTDIR hDir, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime);
|
---|
61 | #define RTFileClose testRTFileClose
|
---|
62 | extern int testRTFileClose(RTFILE hFile);
|
---|
63 | #define RTFileDelete testRTFileDelete
|
---|
64 | extern int testRTFileDelete(const char *pszFilename);
|
---|
65 | #define RTFileFlush testRTFileFlush
|
---|
66 | extern int testRTFileFlush(RTFILE hFile);
|
---|
67 | #define RTFileLock testRTFileLock
|
---|
68 | extern int testRTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock);
|
---|
69 | #define RTFileOpenEx testRTFileOpenEx
|
---|
70 | extern int testRTFileOpenEx(const char *pszFilename, uint64_t fOpen, PRTFILE phFile, PRTFILEACTION penmActionTaken);
|
---|
71 | #define RTFileQueryInfo testRTFileQueryInfo
|
---|
72 | extern int testRTFileQueryInfo(RTFILE hFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs);
|
---|
73 | #define RTFileRead testRTFileRead
|
---|
74 | extern int testRTFileRead(RTFILE hFile, void *pvBuf, size_t cbToRead, size_t *pcbRead);
|
---|
75 | #define RTFileReadAt testRTFileReadAt
|
---|
76 | extern int testRTFileReadAt(RTFILE hFile, uint64_t offFile, void *pvBuf, size_t cbToRead, size_t *pcbRead);
|
---|
77 | #define RTFileSetMode testRTFileSetMode
|
---|
78 | extern int testRTFileSetMode(RTFILE hFile, RTFMODE fMode);
|
---|
79 | #define RTFileSetSize testRTFileSetSize
|
---|
80 | extern int testRTFileSetSize(RTFILE hFile, uint64_t cbSize);
|
---|
81 | #define RTFileSetTimes testRTFileSetTimes
|
---|
82 | extern int testRTFileSetTimes(RTFILE hFile, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime);
|
---|
83 | #define RTFileSeek testRTFileSeek
|
---|
84 | extern int testRTFileSeek(RTFILE hFile, int64_t offSeek, unsigned uMethod, uint64_t *poffActual);
|
---|
85 | #define RTFileUnlock testRTFileUnlock
|
---|
86 | extern int testRTFileUnlock(RTFILE hFile, int64_t offLock, uint64_t cbLock);
|
---|
87 | #define RTFileWrite testRTFileWrite
|
---|
88 | extern int testRTFileWrite(RTFILE hFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
|
---|
89 | #define RTFileWriteAt testRTFileWriteAt
|
---|
90 | extern int testRTFileWriteAt(RTFILE hFile, uint64_t offFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
|
---|
91 | #define RTFsQueryProperties testRTFsQueryProperties
|
---|
92 | extern int testRTFsQueryProperties(const char *pszFsPath, PRTFSPROPERTIES pProperties);
|
---|
93 | #define RTFsQuerySerial testRTFsQuerySerial
|
---|
94 | extern int testRTFsQuerySerial(const char *pszFsPath, uint32_t *pu32Serial);
|
---|
95 | #define RTFsQuerySizes testRTFsQuerySizes
|
---|
96 | extern int testRTFsQuerySizes(const char *pszFsPath, RTFOFF *pcbTotal, RTFOFF *pcbFree, uint32_t *pcbBlock, uint32_t *pcbSector);
|
---|
97 | #define RTPathQueryInfoEx testRTPathQueryInfoEx
|
---|
98 | extern int testRTPathQueryInfoEx(const char *pszPath, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs, uint32_t fFlags);
|
---|
99 | #define RTSymlinkDelete testRTSymlinkDelete
|
---|
100 | extern int testRTSymlinkDelete(const char *pszSymlink, uint32_t fDelete);
|
---|
101 | #define RTSymlinkRead testRTSymlinkRead
|
---|
102 | extern int testRTSymlinkRead(const char *pszSymlink, char *pszTarget, size_t cbTarget, uint32_t fRead);
|
---|
103 | #define RTSymlinkCreate testRTSymlinkCreate
|
---|
104 | extern int testRTSymlinkCreate(const char *pszSymlink, const char *pszTarget, RTSYMLINKTYPE enmType, uint32_t fCreate);
|
---|
105 |
|
---|
106 | #endif /* !VBOX_INCLUDED_SRC_SharedFolders_teststubs_h */
|
---|