• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ VBOXHGCMSVCFNTABLE类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VBOXHGCMSVCFNTABLE的典型用法代码示例。如果您正苦于以下问题:C++ VBOXHGCMSVCFNTABLE类的具体用法?C++ VBOXHGCMSVCFNTABLE怎么用?C++ VBOXHGCMSVCFNTABLE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VBOXHGCMSVCFNTABLE类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: testFlushFileSimple

void testFlushFileSimple(RTTEST hTest)
{
    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    SHFLROOT Root;
    const RTFILE hcFile = (RTFILE) 0x10000;
    SHFLHANDLE Handle;
    int rc;

    RTTestSub(hTest, "Flush file simple");
    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                   "/test/mapping", "testname");
    testRTFileOpenpFile = hcFile;
    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
                    &Handle, NULL);
    RTTEST_CHECK_RC_OK(hTest, rc);
    rc = flushFile(&svcTable, Root, Handle);
    RTTEST_CHECK_RC_OK(hTest, rc);
    RTTEST_CHECK_MSG(hTest, testRTFileFlushFile == hcFile,
                     (hTest, "File=%llu\n", LLUIFY(testRTFileFlushFile)));
    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    RTTestGuardedFree(hTest, svcTable.pvService);
    RTTEST_CHECK_MSG(hTest, testRTFileCloseFile == hcFile,
                     (hTest, "File=%llu\n", LLUIFY(testRTFileCloseFile)));
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:26,代码来源:tstSharedFolderService.cpp


示例2: testDirListEmpty

void testDirListEmpty(RTTEST hTest)
{
    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    SHFLROOT Root;
    PRTDIR pcDir = (PRTDIR)0x10000;
    SHFLHANDLE Handle;
    SHFLDIRINFO DirInfo;
    uint32_t cFiles;
    int rc;

    RTTestSub(hTest, "List empty directory");
    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                   "/test/mapping", "testname");
    testRTDirOpenpDir = pcDir;
    rc = createFile(&svcTable, Root, "test/dir",
                    SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, &Handle, NULL);
    RTTEST_CHECK_RC_OK(hTest, rc);
    rc = listDir(&svcTable, Root, Handle, 0, sizeof (SHFLDIRINFO), NULL,
                 &DirInfo, sizeof(DirInfo), 0, &cFiles);
    RTTEST_CHECK_RC(hTest, rc, VERR_NO_MORE_FILES);
    RTTEST_CHECK_MSG(hTest, testRTDirReadExDir == pcDir,
                     (hTest, "Dir=%llu\n", LLUIFY(testRTDirReadExDir)));
    RTTEST_CHECK_MSG(hTest, cFiles == 0,
                     (hTest, "cFiles=%llu\n", LLUIFY(cFiles)));
    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    RTTestGuardedFree(hTest, svcTable.pvService);
    RTTEST_CHECK_MSG(hTest,
                     testRTDirClosepDir == pcDir,
                     (hTest, "pDir=%llu\n", LLUIFY(testRTDirClosepDir)));
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:32,代码来源:tstSharedFolderService.cpp


示例3: testReadFileSimple

void testReadFileSimple(RTTEST hTest)
{
    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    SHFLROOT Root;
    const RTFILE hcFile = (RTFILE) 0x10000;
    SHFLHANDLE Handle;
    const char *pcszReadData = "Data to read";
    char acBuf[sizeof(pcszReadData) + 10];
    uint32_t cbRead;
    int rc;

    RTTestSub(hTest, "Read file simple");
    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                   "/test/mapping", "testname");
    testRTFileOpenpFile = hcFile;
    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
                    &Handle, NULL);
    RTTEST_CHECK_RC_OK(hTest, rc);
    testRTFileReadData = pcszReadData;
    rc = readFile(&svcTable, Root, Handle, 0, strlen(pcszReadData) + 1,
                  &cbRead, acBuf, (uint32_t)sizeof(acBuf));
    RTTEST_CHECK_RC_OK(hTest, rc);
    RTTEST_CHECK_MSG(hTest,
                     !strncmp(acBuf, pcszReadData, sizeof(acBuf)),
                     (hTest, "pvBuf=%.*s\n", sizeof(acBuf), acBuf));
    RTTEST_CHECK_MSG(hTest, cbRead == strlen(pcszReadData) + 1,
                     (hTest, "cbRead=%llu\n", LLUIFY(cbRead)));
    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    RTTEST_CHECK_MSG(hTest, testRTFileCloseFile == hcFile,
                     (hTest, "File=%llu\n", LLUIFY(testRTFileCloseFile)));
    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    RTTestGuardedFree(hTest, svcTable.pvService);
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:34,代码来源:tstSharedFolderService.cpp


示例4: testWriteFileSimple

void testWriteFileSimple(RTTEST hTest)
{
    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    SHFLROOT Root;
    const RTFILE hcFile = (RTFILE) 0x10000;
    SHFLHANDLE Handle;
    const char *pcszWrittenData = "Data to write";
    uint32_t cbToWrite = (uint32_t)strlen(pcszWrittenData) + 1;
    uint32_t cbWritten;
    int rc;

    RTTestSub(hTest, "Write file simple");
    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                   "/test/mapping", "testname");
    testRTFileOpenpFile = hcFile;
    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
                    &Handle, NULL);
    RTTEST_CHECK_RC_OK(hTest, rc);
    rc = writeFile(&svcTable, Root, Handle, 0, cbToWrite, &cbWritten,
                   pcszWrittenData, cbToWrite);
    RTTEST_CHECK_RC_OK(hTest, rc);
    RTTEST_CHECK_MSG(hTest,
                     !strcmp(testRTFileWriteData, pcszWrittenData),
                     (hTest, "pvBuf=%s\n", testRTFileWriteData));
    RTTEST_CHECK_MSG(hTest, cbWritten == cbToWrite,
                     (hTest, "cbWritten=%llu\n", LLUIFY(cbWritten)));
    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    RTTEST_CHECK_MSG(hTest, testRTFileCloseFile == hcFile,
                     (hTest, "File=%llu\n", LLUIFY(testRTFileCloseFile)));
    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    RTTestGuardedFree(hTest, svcTable.pvService);
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:33,代码来源:tstSharedFolderService.cpp


示例5: testCreateFileSimple

void testCreateFileSimple(RTTEST hTest)
{
    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    SHFLROOT Root;
    const RTFILE hcFile = (RTFILE) 0x10000;
    SHFLCREATERESULT Result;
    int rc;

    RTTestSub(hTest, "Create file simple");
    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                   "/test/mapping", "testname");
    testRTFileOpenpFile = hcFile;
    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ, NULL,
                    &Result);
    RTTEST_CHECK_RC_OK(hTest, rc);
    RTTEST_CHECK_MSG(hTest,
                     !strcmp(testRTFileOpenName, "/test/mapping/test/file"),
                     (hTest, "pszFilename=%s\n", testRTFileOpenName));
    RTTEST_CHECK_MSG(hTest, testRTFileOpenFlags == 0x181,
                     (hTest, "fOpen=%llu\n", LLUIFY(testRTFileOpenFlags)));
    RTTEST_CHECK_MSG(hTest, Result == SHFL_FILE_CREATED,
                     (hTest, "Result=%d\n", (int) Result));
    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    RTTestGuardedFree(hTest, svcTable.pvService);
    RTTEST_CHECK_MSG(hTest, testRTFileCloseFile == hcFile,
                     (hTest, "File=%llu\n", LLUIFY(testRTFileCloseFile)));
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:29,代码来源:tstSharedFolderService.cpp


示例6: testCreateDirSimple

void testCreateDirSimple(RTTEST hTest)
{
    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    SHFLROOT Root;
    PRTDIR pcDir = (PRTDIR)0x10000;
    SHFLCREATERESULT Result;
    int rc;

    RTTestSub(hTest, "Create directory simple");
    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                   "/test/mapping", "testname");
    testRTDirOpenpDir = pcDir;
    rc = createFile(&svcTable, Root, "test/dir",
                    SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, NULL, &Result);
    RTTEST_CHECK_RC_OK(hTest, rc);
    RTTEST_CHECK_MSG(hTest,
                     !strcmp(testRTDirCreatePath, "/test/mapping/test/dir"),
                     (hTest, "pszPath=%s\n", testRTDirCreatePath));
    RTTEST_CHECK_MSG(hTest,
                     !strcmp(testRTDirOpenName, "/test/mapping/test/dir"),
                     (hTest, "pszFilename=%s\n", testRTDirOpenName));
    RTTEST_CHECK_MSG(hTest, Result == SHFL_FILE_CREATED,
                     (hTest, "Result=%d\n", (int) Result));
    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    RTTestGuardedFree(hTest, svcTable.pvService);
    RTTEST_CHECK_MSG(hTest,
                     testRTDirClosepDir == pcDir,
                     (hTest, "pDir=%llu\n", LLUIFY(testRTDirClosepDir)));
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:31,代码来源:tstSharedFolderService.cpp


示例7: testFSInfoQuerySetEndOfFile

void testFSInfoQuerySetEndOfFile(RTTEST hTest)
{
    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    SHFLROOT Root;
    const RTFILE hcFile = (RTFILE) 0x10000;
    const RTFOFF cbNew = 50000;
    SHFLFSOBJINFO Info;
    SHFLHANDLE Handle;
    int rc;

    RTTestSub(hTest, "Set end of file position");
    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                   "/test/mapping", "testname");
    testRTFileOpenpFile = hcFile;
    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
                    &Handle, NULL);
    RTTEST_CHECK_RC_OK(hTest, rc);
    RT_ZERO(Info);
    Info.cbObject = cbNew;
    rc = sfInformation(&svcTable, Root, Handle, SHFL_INFO_SET | SHFL_INFO_SIZE,
                       sizeof(Info), &Info);
    RTTEST_CHECK_RC_OK(hTest, rc);
    RTTEST_CHECK_MSG(hTest, testRTFileSetSizeFile == hcFile,
                     (hTest, "File=%llu\n", LLUIFY(testRTFileSetSizeFile)));
    RTTEST_CHECK_MSG(hTest, testRTFileSetSizeSize == cbNew,
                     (hTest, "Size=%llu\n", LLUIFY(testRTFileSetSizeSize)));
    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    RTTestGuardedFree(hTest, svcTable.pvService);
    RTTEST_CHECK_MSG(hTest, testRTFileCloseFile == hcFile,
                     (hTest, "File=%llu\n", LLUIFY(testRTFileCloseFile)));
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:33,代码来源:tstSharedFolderService.cpp


示例8: test4

static void test4(void)
{
    RTTestISub("GET_PROP_HOST buffer handling");

    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    initTable(&svcTable, &svcHelpers);
    RTTESTI_CHECK_RC_OK_RETV(VBoxHGCMSvcLoad(&svcTable));

    /* Insert a property that we can mess around with. */
    static char const s_szProp[]  = "/MyProperties/Sub/Sub/Sub/Sub/Sub/Sub/Sub/Property";
    static char const s_szValue[] = "Property Value";
    RTTESTI_CHECK_RC_OK(doSetProperty(&svcTable, s_szProp, s_szValue, "", true, true));


    /* Get the value with buffer sizes up to 1K.  */
    for (unsigned iVariation = 0; iVariation < 2; iVariation++)
    {
        for (uint32_t cbBuf = 0; cbBuf < _1K; cbBuf++)
        {
            void *pvBuf;
            RTTESTI_CHECK_RC_BREAK(RTTestGuardedAlloc(g_hTest, cbBuf, 1, iVariation == 0, &pvBuf), VINF_SUCCESS);

            VBOXHGCMSVCPARM aParms[4];
            aParms[0].setString(s_szProp);
            aParms[1].setPointer(pvBuf, cbBuf);
            int rc = svcTable.pfnHostCall(svcTable.pvService, GET_PROP_HOST, RT_ELEMENTS(aParms), aParms);

            RTTestGuardedFree(g_hTest, pvBuf);
        }
    }

    /* Done. */
    RTTESTI_CHECK_RC_OK(svcTable.pfnUnload(svcTable.pvService));
}
开发者ID:gvsurenderreddy,项目名称:virtualbox,代码行数:35,代码来源:tstGuestPropSvc.cpp


示例9: test2

static void test2(void)
{
    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    initTable(&svcTable, &svcHelpers);

    /* The function is inside the service, not HGCM. */
    RTTESTI_CHECK_RC_OK_RETV(VBoxHGCMSvcLoad(&svcTable));

    testSetPropsHost(&svcTable);
    testEnumPropsHost(&svcTable);

    /* Set up the asynchronous notification test */
    setupAsyncNotification(&svcTable);
    testSetProp(&svcTable);
    RTTestISub("Async notification call data");
    testAsyncNotification(&svcTable); /* Our previous notification call should have completed by now. */

    testDelProp(&svcTable);
    testGetProp(&svcTable);
    testGetNotification(&svcTable);

    /* Cleanup */
    RTTESTI_CHECK_RC_OK(svcTable.pfnUnload(svcTable.pvService));
}
开发者ID:gvsurenderreddy,项目名称:virtualbox,代码行数:25,代码来源:tstGuestPropSvc.cpp


示例10: test5

static void test5(void)
{
    RTTestISub("ENUM_PROPS_HOST buffer handling");

    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    initTable(&svcTable, &svcHelpers);
    RTTESTI_CHECK_RC_OK_RETV(VBoxHGCMSvcLoad(&svcTable));

    /* Insert a few property that we can mess around with. */
    RTTESTI_CHECK_RC_OK(doSetProperty(&svcTable, "/MyProperties/Sub/Sub/Sub/Sub/Sub/Sub/Sub/Property", "Property Value", "", true, true));
    RTTESTI_CHECK_RC_OK(doSetProperty(&svcTable, "/MyProperties/12357",  "83848569", "", true, true));
    RTTESTI_CHECK_RC_OK(doSetProperty(&svcTable, "/MyProperties/56678",  "abcdefghijklm", "", true, true));
    RTTESTI_CHECK_RC_OK(doSetProperty(&svcTable, "/MyProperties/932769", "n", "", true, true));

    /* Get the value with buffer sizes up to 1K.  */
    for (unsigned iVariation = 0; iVariation < 2; iVariation++)
    {
        for (uint32_t cbBuf = 0; cbBuf < _1K; cbBuf++)
        {
            void *pvBuf;
            RTTESTI_CHECK_RC_BREAK(RTTestGuardedAlloc(g_hTest, cbBuf, 1, iVariation == 0, &pvBuf), VINF_SUCCESS);

            VBOXHGCMSVCPARM aParms[3];
            aParms[0].setString("*");
            aParms[1].setPointer(pvBuf, cbBuf);
            int rc2 = svcTable.pfnHostCall(svcTable.pvService, ENUM_PROPS_HOST, RT_ELEMENTS(aParms), aParms);

            RTTestGuardedFree(g_hTest, pvBuf);
        }
    }

    /* Done. */
    RTTESTI_CHECK_RC_OK(svcTable.pfnUnload(svcTable.pvService));
}
开发者ID:gvsurenderreddy,项目名称:virtualbox,代码行数:35,代码来源:tstGuestPropSvc.cpp


示例11: main

int main(int argc, char **argv)
{
    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    RTEXITCODE          rcExit;

    rcExit  = RTTestInitAndCreate("tstGuestPropSvc", &g_hTest);
    if (rcExit != RTEXITCODE_SUCCESS)
        return rcExit;
    RTTestBanner(g_hTest);

/** @todo convert the rest of this testcase. */
    initTable(&svcTable, &svcHelpers);

    if (RT_FAILURE(testConvertFlags()))
        return 1;
    /* The function is inside the service, not HGCM. */
    if (RT_FAILURE(VBoxHGCMSvcLoad(&svcTable)))
    {
        RTPrintf("Failed to start the HGCM service.\n");
        return 1;
    }
    if (RT_FAILURE(testSetPropsHost(&svcTable)))
        return 1;
    if (RT_FAILURE(testEnumPropsHost(&svcTable)))
        return 1;
    /* Set up the asynchronous notification test */
    if (RT_FAILURE(setupAsyncNotification(&svcTable)))
        return 1;
    if (RT_FAILURE(testSetProp(&svcTable)))
        return 1;
    RTPrintf("Checking the data returned by the asynchronous notification call.\n");
    /* Our previous notification call should have completed by now. */
    if (RT_FAILURE(testAsyncNotification(&svcTable)))
        return 1;
    if (RT_FAILURE(testDelProp(&svcTable)))
        return 1;
    if (RT_FAILURE(testGetProp(&svcTable)))
        return 1;
    if (RT_FAILURE(testGetNotification(&svcTable)))
        return 1;
    if (RT_FAILURE(svcTable.pfnUnload(svcTable.pvService)))
    {
        RTPrintf("Failed to unload the HGCM service.\n");
        return 1;
    }
    if (RT_FAILURE(testSetPropROGuest(&svcTable)))
        return 1;
    if (RT_FAILURE(testDelPropROGuest(&svcTable)))
        return 1;

    return RTTestSummaryAndDestroy(g_hTest);
}
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:53,代码来源:tstGuestPropSvc.cpp


示例12: testLockFileSimple

void testLockFileSimple(RTTEST hTest)
{
    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    SHFLROOT Root;
    const RTFILE hcFile = (RTFILE) 0x10000;
    const int64_t offLock = 50000;
    const uint64_t cbLock = 4000;
    SHFLHANDLE Handle;
    int rc;

    RTTestSub(hTest, "Simple file lock and unlock");
    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                   "/test/mapping", "testname");
    testRTFileOpenpFile = hcFile;
    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
                    &Handle, NULL);
    RTTEST_CHECK_RC_OK(hTest, rc);
    rc = lockFile(&svcTable, Root, Handle, offLock, cbLock, SHFL_LOCK_SHARED);
    RTTEST_CHECK_RC_OK(hTest, rc);
#ifdef RT_OS_WINDOWS  /* Locking is a no-op elsewhere. */
    RTTEST_CHECK_MSG(hTest, testRTFileLockFile == hcFile,
                     (hTest, "File=%llu\n", LLUIFY(testRTFileLockFile)));
    RTTEST_CHECK_MSG(hTest, testRTFileLockfLock == 0,
                     (hTest, "fLock=%u\n", testRTFileLockfLock));
    RTTEST_CHECK_MSG(hTest, testRTFileLockOffset == offLock,
                     (hTest, "Offs=%llu\n", (long long) testRTFileLockOffset));
    RTTEST_CHECK_MSG(hTest, testRTFileLockSize == cbLock,
                     (hTest, "Size=%llu\n", LLUIFY(testRTFileLockSize)));
#endif
    rc = lockFile(&svcTable, Root, Handle, offLock, cbLock, SHFL_LOCK_CANCEL);
    RTTEST_CHECK_RC_OK(hTest, rc);
#ifdef RT_OS_WINDOWS
    RTTEST_CHECK_MSG(hTest, testRTFileUnlockFile == hcFile,
                     (hTest, "File=%llu\n", LLUIFY(testRTFileUnlockFile)));
    RTTEST_CHECK_MSG(hTest, testRTFileUnlockOffset == offLock,
                     (hTest, "Offs=%llu\n",
                      (long long) testRTFileUnlockOffset));
    RTTEST_CHECK_MSG(hTest, testRTFileUnlockSize == cbLock,
                     (hTest, "Size=%llu\n", LLUIFY(testRTFileUnlockSize)));
#endif
    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    RTTestGuardedFree(hTest, svcTable.pvService);
    RTTEST_CHECK_MSG(hTest, testRTFileCloseFile == hcFile,
                     (hTest, "File=%llu\n", LLUIFY(testRTFileCloseFile)));
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:47,代码来源:tstSharedFolderService.cpp


示例13: testFSInfoQuerySetFileATime

void testFSInfoQuerySetFileATime(RTTEST hTest)
{
    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    SHFLROOT Root;
    const RTFILE hcFile = (RTFILE) 0x10000;
    const int64_t ccAtimeNano = 100000;
    SHFLFSOBJINFO Info;
    SHFLHANDLE Handle;
    int rc;

    RTTestSub(hTest, "Query and set file atime");
    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                   "/test/mapping", "testname");
    testRTFileOpenpFile = hcFile;
    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
                    &Handle, NULL);
    RTTEST_CHECK_RC_OK(hTest, rc);
    RT_ZERO(Info);
    RTTimeSpecSetNano(&testRTFileQueryInfoATime, ccAtimeNano);
    rc = sfInformation(&svcTable, Root, Handle, SHFL_INFO_FILE, sizeof(Info),
                       &Info);
    RTTEST_CHECK_RC_OK(hTest, rc);
    RTTEST_CHECK_MSG(hTest, testRTFileQueryInfoFile == hcFile,
                     (hTest, "File=%llu\n", LLUIFY(testRTFileQueryInfoFile)));
    RTTEST_CHECK_MSG(hTest, RTTimeSpecGetNano(&Info.AccessTime) == ccAtimeNano,
                     (hTest, "ATime=%llu\n",
                      LLUIFY(RTTimeSpecGetNano(&Info.AccessTime))));
    RT_ZERO(Info);
    RTTimeSpecSetNano(&Info.AccessTime, ccAtimeNano);
    rc = sfInformation(&svcTable, Root, Handle, SHFL_INFO_SET | SHFL_INFO_FILE,
                       sizeof(Info), &Info);
    RTTEST_CHECK_RC_OK(hTest, rc);
    RTTEST_CHECK_MSG(hTest,    RTTimeSpecGetNano(&testRTFileSetTimesATime)
                            == ccAtimeNano,
                     (hTest, "ATime=%llu\n",
                      LLUIFY(RTTimeSpecGetNano(&testRTFileSetTimesATime))));
    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    RTTestGuardedFree(hTest, svcTable.pvService);
    RTTEST_CHECK_MSG(hTest, testRTFileCloseFile == hcFile,
                     (hTest, "File=%llu\n", LLUIFY(testRTFileCloseFile)));
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:43,代码来源:tstSharedFolderService.cpp


示例14: test6

static void test6(void)
{
    RTTestISub("Max properties");

    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    initTable(&svcTable, &svcHelpers);
    RTTESTI_CHECK_RC_OK_RETV(VBoxHGCMSvcLoad(&svcTable));

    /* Insert the max number of properties. */
    static char const   s_szPropFmt[] = "/MyProperties/Sub/Sub/Sub/Sub/Sub/Sub/Sub/PropertyNo#%u";
    char                szProp[80];
    unsigned            cProps = 0;
    for (;;)
    {
        RTStrPrintf(szProp, sizeof(szProp), s_szPropFmt, cProps);
        int rc = doSetProperty(&svcTable, szProp, "myvalue", "", true, true);
        if (rc == VERR_TOO_MUCH_DATA)
            break;
        if (RT_FAILURE(rc))
        {
            RTTestIFailed("Unexpected error %Rrc setting property number %u", rc, cProps);
            break;
        }
        cProps++;
    }
    RTTestIValue("Max Properties", cProps, RTTESTUNIT_OCCURRENCES);

    /* Touch them all again. */
    for (unsigned iProp = 0; iProp < cProps; iProp++)
    {
        RTStrPrintf(szProp, sizeof(szProp), s_szPropFmt, iProp);
        int rc;
        RTTESTI_CHECK_MSG((rc = doSetProperty(&svcTable, szProp, "myvalue", "", true, true)) == VINF_SUCCESS,
                          ("%Rrc - #%u\n", rc, iProp));
        RTTESTI_CHECK_MSG((rc = doSetProperty(&svcTable, szProp, "myvalue", "", true, false)) == VINF_SUCCESS,
                          ("%Rrc - #%u\n", rc, iProp));
        RTTESTI_CHECK_MSG((rc = doSetProperty(&svcTable, szProp, "myvalue", "", false, true)) == VINF_SUCCESS,
                          ("%Rrc - #%u\n", rc, iProp));
        RTTESTI_CHECK_MSG((rc = doSetProperty(&svcTable, szProp, "myvalue", "", false, false)) == VINF_SUCCESS,
                          ("%Rrc - #%u\n", rc, iProp));
    }

    /* Benchmark. */
    uint64_t cNsMax = 0;
    uint64_t cNsMin = UINT64_MAX;
    uint64_t cNsAvg = 0;
    for (unsigned iProp = 0; iProp < cProps; iProp++)
    {
        size_t cchProp = RTStrPrintf(szProp, sizeof(szProp), s_szPropFmt, iProp);

        uint64_t cNsElapsed = RTTimeNanoTS();
        unsigned iCall;
        for (iCall = 0; iCall < 1000; iCall++)
        {
            VBOXHGCMSVCPARM aParms[4];
            char            szBuffer[256];
            aParms[0].setPointer(szProp, cchProp + 1);
            aParms[1].setPointer(szBuffer, sizeof(szBuffer));
            RTTESTI_CHECK_RC_BREAK(svcTable.pfnHostCall(svcTable.pvService, GET_PROP_HOST, 4, aParms), VINF_SUCCESS);
        }
        cNsElapsed = RTTimeNanoTS() - cNsElapsed;
        if (iCall)
        {
            uint64_t cNsPerCall = cNsElapsed / iCall;
            cNsAvg += cNsPerCall;
            if (cNsPerCall < cNsMin)
                cNsMin = cNsPerCall;
            if (cNsPerCall > cNsMax)
                cNsMax = cNsPerCall;
        }
    }
    if (cProps)
        cNsAvg /= cProps;
    RTTestIValue("GET_PROP_HOST Min", cNsMin, RTTESTUNIT_NS_PER_CALL);
    RTTestIValue("GET_PROP_HOST Avg", cNsAvg, RTTESTUNIT_NS_PER_CALL);
    RTTestIValue("GET_PROP_HOST Max", cNsMax, RTTESTUNIT_NS_PER_CALL);

    /* Done. */
    RTTESTI_CHECK_RC_OK(svcTable.pfnUnload(svcTable.pvService));
}
开发者ID:gvsurenderreddy,项目名称:virtualbox,代码行数:81,代码来源:tstGuestPropSvc.cpp



注:本文中的VBOXHGCMSVCFNTABLE类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VBObject类代码示例发布时间:2022-05-31
下一篇:
C++ VBO类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap