VirtualBox

Ignore:
Timestamp:
Apr 1, 2019 1:21:04 PM (6 years ago)
Author:
vboxsync
Message:

FsPerf: Bigger path buffers. bugref:9172

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp

    r77969 r77979  
    8888*   Defined Constants And Macros                                                                                                 *
    8989*********************************************************************************************************************************/
     90/** Used for cutting the the -d parameter value short and avoid a number of buffer overflow checks.  */
     91#define FSPERF_MAX_NEEDED_PATH  224
     92/** The max path used by this code.
     93 * It greatly exceeds the RTPATH_MAX so we can push the limits on windows.  */
     94#define FSPERF_MAX_PATH         (_32K)
     95
    9096/** @def FSPERF_TEST_SENDFILE
    9197 * Whether to enable the sendfile() tests. */
     
    498504
    499505/** The test directory (absolute).  This will always have a trailing slash. */
    500 static char         g_szDir[RTPATH_MAX];
     506static char         g_szDir[FSPERF_MAX_PATH];
    501507/** The test directory (absolute), 2nd copy for use with InDir2().  */
    502 static char         g_szDir2[RTPATH_MAX];
     508static char         g_szDir2[FSPERF_MAX_PATH];
    503509/** The empty test directory (absolute). This will always have a trailing slash. */
    504 static char         g_szEmptyDir[RTPATH_MAX];
     510static char         g_szEmptyDir[FSPERF_MAX_PATH];
    505511/** The deep test directory (absolute). This will always have a trailing slash. */
    506 static char         g_szDeepDir[RTPATH_MAX];
     512static char         g_szDeepDir[FSPERF_MAX_PATH + _1K];
    507513
    508514
     
    741747    RTListForEach(&g_ManyTreeHead, pCur, FSPERFNAMEENTRY, Entry)
    742748    {
    743         char szPath[RTPATH_MAX];
     749        char szPath[FSPERF_MAX_PATH];
    744750        memcpy(szPath, pCur->szName, pCur->cchName);
    745751        for (uint32_t i = 0; i < g_cManyTreeFilesPerDir; i++)
     
    936942
    937943    /* Manytree: */
    938     char szPath[RTPATH_MAX];
     944    char szPath[FSPERF_MAX_PATH];
    939945    PROFILE_MANYTREE_FN(szPath, fsPerfOpenExistingOnceReadonly(szPath), 1, g_nsTestRun, "RTFileOpen/Close/manytree/readonly");
    940946}
     
    10461052
    10471053    /* Manytree: */
    1048     char szPath[RTPATH_MAX];
     1054    char szPath[FSPERF_MAX_PATH];
    10491055    PROFILE_MANYTREE_FN(szPath, RTPathQueryInfoEx(szPath, &ObjInfo, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK),
    10501056                        1, g_nsTestRun, "RTPathQueryInfoEx/manytree/NOTHING");
     
    10871093
    10881094    /* Manytree: */
    1089     char szPath[RTPATH_MAX];
     1095    char szPath[FSPERF_MAX_PATH];
    10901096    PROFILE_MANYTREE_FN(szPath, RTPathSetMode(szPath, iIteration & 1 ? fOddMode : fEvenMode), 1, g_nsTestRun,
    10911097                        "RTPathSetMode/manytree");
     
    11511157
    11521158    /* Manytree: */
    1153     char szPath[RTPATH_MAX];
     1159    char szPath[FSPERF_MAX_PATH];
    11541160    PROFILE_MANYTREE_FN(szPath, RTPathSetTimesEx(szPath, iIteration & 1 ? &Time1 : &Time2, iIteration & 1 ? &Time2 : &Time1,
    11551161                                                 NULL, NULL, RTPATH_F_ON_LINK),
     
    11601166DECL_FORCE_INLINE(int) fsPerfRenameMany(const char *pszFile, uint32_t iIteration)
    11611167{
    1162     char szRenamed[RTPATH_MAX];
     1168    char szRenamed[FSPERF_MAX_PATH];
    11631169    strcat(strcpy(szRenamed, pszFile), "-renamed");
    11641170    if (!(iIteration & 1))
     
    11711177{
    11721178    RTTestISub("rename");
    1173     char szPath[RTPATH_MAX];
     1179    char szPath[FSPERF_MAX_PATH];
    11741180
    11751181/** @todo rename directories too!   */
     
    15891595         */
    15901596        {
    1591             char szPath[RTPATH_MAX];
     1597            char szPath[FSPERF_MAX_PATH];
    15921598            uint64_t const nsStart = RTTimeNanoTS();
    15931599            DO_MANYTREE_FN(szPath, RTTESTI_CHECK_RC_RETV(RTFileDelete(szPath), VINF_SUCCESS));
     
    37763782        /* Create a new file, 256 KB in size, and fill it with random bytes.
    37773783           Try uncached access if we can to force the page-in to do actual reads. */
    3778         char szFile2[RTPATH_MAX + 32];
     3784        char szFile2[FSPERF_MAX_PATH + 32];
    37793785        memcpy(szFile2, g_szDir, g_cchDir);
    37803786        RTStrPrintf(&szFile2[g_cchDir], sizeof(szFile2) - g_cchDir, "mmap-%u.noh", i);
     
    42844290static void Usage(PRTSTREAM pStrm)
    42854291{
    4286     char szExec[RTPATH_MAX];
     4292    char szExec[FSPERF_MAX_PATH];
    42874293    RTStrmPrintf(pStrm, "usage: %s <-d <testdir>> [options]\n",
    42884294                 RTPathFilename(RTProcGetExecutablePath(szExec, sizeof(szExec))));
     
    43694375     * Default values.
    43704376     */
    4371     rc = RTPathGetCurrent(g_szDir, sizeof(g_szDir) / 2);
     4377    rc = RTPathGetCurrent(g_szDir, sizeof(g_szDir) - FSPERF_MAX_NEEDED_PATH);
    43724378    if (RT_SUCCESS(rc))
    4373         rc = RTPathAppend(g_szDir, sizeof(g_szDir) / 2, "fstestdir-");
     4379        rc = RTPathAppend(g_szDir, sizeof(g_szDir) - FSPERF_MAX_NEEDED_PATH, "fstestdir-");
    43744380    if (RT_SUCCESS(rc))
    43754381    {
     
    43914397        {
    43924398            case 'd':
    4393                 rc = RTPathAbs(ValueUnion.psz, g_szDir, sizeof(g_szDir) / 2);
     4399                rc = RTPathAbs(ValueUnion.psz, g_szDir, sizeof(g_szDir) - FSPERF_MAX_NEEDED_PATH);
    43944400                if (RT_SUCCESS(rc))
    43954401                {
Note: See TracChangeset for help on using the changeset viewer.

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