diff --git a/src/shred.cpp b/src/shred.cpp index 3c98379..283f3cb 100644 --- a/src/shred.cpp +++ b/src/shred.cpp @@ -17,19 +17,19 @@ extern "C" } #endif -const static char* randomsrc = (char*)"/dev/urandom"; +const static char *randomsrc = (char *)"/dev/urandom"; Shred::Shred() { #ifdef ADAPTIVE_CHUNK_SIZE // Allocate aligned buffers for maximum chunk size - if (posix_memalign((void**)&caTfngData, 4096, CHUNK_SIZE_MAX) != 0) + if (posix_memalign((void **)&caTfngData, 4096, CHUNK_SIZE_MAX) != 0) { Logger::logThis()->error("Failed to allocate aligned buffer for tfng data"); caTfngData = nullptr; } - if (posix_memalign((void**)&caReadBuffer, 4096, CHUNK_SIZE_MAX) != 0) + if (posix_memalign((void **)&caReadBuffer, 4096, CHUNK_SIZE_MAX) != 0) { Logger::logThis()->error("Failed to allocate aligned buffer for read buffer"); caReadBuffer = nullptr; @@ -83,7 +83,7 @@ void Shred::startMeasurement() * \param file descriptor for signaling * \return 0 on success, -1 on error */ -void Shred::evaluateThroughput(Drive* drive) +void Shred::evaluateThroughput(Drive *drive) { auto measurementEndTime = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed = measurementEndTime - measurementStartTime; @@ -129,7 +129,7 @@ void Shred::evaluateThroughput(Drive* drive) * \param pointer to Drive instance * \return void */ -void Shred::adjustChunkSize(Drive* drive) +void Shred::adjustChunkSize(Drive *drive) { size_t oldChunkSize = currentChunkSize; @@ -190,10 +190,10 @@ size_t Shred::getCurrentChunkSize() const * \param file descriptor for signaling * \return 0 on success, -1 on error */ -int Shred::shredDrive(Drive* drive, int* ipSignalFd) +int Shred::shredDrive(Drive *drive, int *ipSignalFd) { ostringstream address; - address << (void const*)&(*drive); + address << (void const *)&(*drive); Logger::logThis()->info("Shred-Task started - Drive: " + drive->getModelName() + "-" + drive->getSerial() + " @" + address.str()); // Mark as started but NOT shredded yet @@ -229,7 +229,8 @@ int Shred::shredDrive(Drive* drive, int* ipSignalFd) #endif #ifndef DRYRUN - const char* cpDrivePath = drive->getPath().c_str(); + string sDrivePath = drive->getPath(); + const char *cpDrivePath = sDrivePath.c_str(); unsigned char ucKey[TFNG_KEY_SIZE]; #ifdef ADAPTIVE_CHUNK_SIZE @@ -635,7 +636,7 @@ long Shred::getDriveSizeInBytes(fileDescriptor file) * \param signal file descriptor * \return checksum value (0 = all zeros) */ -unsigned int Shred::uiCalcChecksum(fileDescriptor file, Drive* drive, int* ipSignalFd) +unsigned int Shred::uiCalcChecksum(fileDescriptor file, Drive *drive, int *ipSignalFd) { unsigned int uiChecksum = 0; unsigned long ulDriveByteCounter = 0U;