void vCreateAndVerifySampleFiles( void ) { int32_t lStatus; /* First initialize the Reliance Edge driver. */ lStatus = red_init(); /* Format the volume. */ if( lStatus == 0 ) { lStatus = red_format( fsVOLUME_NAME ); } /* Mount the volume. */ if( lStatus == 0 ) { lStatus = red_mount( fsVOLUME_NAME ); } if( lStatus == 0 ) { /* Create a set of files using red_write(). */ prvCreateDemoFiles(); /* Read back and verify the files that were created using red_write(). */ prvVerifyDemoFiles(); } }
/** @brief Entry point for the fsstress test. */ int main( int argc, char *argv[]) { int iRet; PARAMSTATUS pstatus; FSSTRESSPARAM param; uint8_t bVolNum; const char *pszDrive; pstatus = FsstressParseParams(argc, argv, ¶m, &bVolNum, &pszDrive); if(pstatus == PARAMSTATUS_OK) { const char *pszVolume = gaRedVolConf[bVolNum].pszPathPrefix; int32_t iErr; iErr = red_init(); if(iErr == -1) { fprintf(stderr, "Unexpected error %d from red_init()\n", (int)red_errno); exit(red_errno); } if((pszDrive != NULL) && (_stricmp(pszDrive, "ram") != 0)) { REDSTATUS ret; /* Let the Win32 block device layer know the path/drive to be used for this volume's block device. */ pszDrive = MassageDriveName(pszDrive); ret = RedOsBDevConfig(bVolNum, pszDrive); if(ret != 0) { fprintf(stderr, "Unexpected error %d from RedOsBDevConfig()\n", (int)ret); exit(ret); } } iErr = red_format(pszVolume); if(iErr == -1) { fprintf(stderr, "Unexpected error %d from red_format()\n", (int)red_errno); exit(red_errno); } iErr = red_mount(pszVolume); if(iErr == -1) { fprintf(stderr, "Unexpected error %d from red_mount()\n", (int)red_errno); exit(red_errno); } iErr = red_chdir(pszVolume); if(iErr == -1) { fprintf(stderr, "Unexpected error %d from red_chdir()\n", (int)red_errno); exit(red_errno); } printf("fsstress begin...\n"); iRet = FsstressStart(¶m); printf("fsstress end, return %d\n", iRet); } else if(pstatus == PARAMSTATUS_HELP) { iRet = 0; /* Help request: do nothing but indicate success. */ } else { iRet = 1; /* Bad parameters: indicate failure. */ } return iRet; }