Beginnings of a test for tracking down the file corruptions that still seem
to occur in current revisions. The working hypothesis is that the corruptions happen below the file system (i.e. in file/block cache or VM). The intended setup for the test is a device driver -- a loop device kind of thing -- that also stores check sums for all blocks and a file system that communicates the check sums to expect via an independent channel (ioctl) to the driver. Whenever a block arrives at the driver for writing, the block is checked against its expected check sum. Initially Axel's idea, BTW. The device driver is done and working as far as tested (save for unregistering devices). The file system part is still to be done. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37247 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -89,6 +89,7 @@ SimpleTest sigsuspend_test : sigsuspend_test.cpp ;
|
||||
SubInclude HAIKU_TOP src tests system kernel cache ;
|
||||
#SubInclude HAIKU_TOP src tests system kernel disk_device_manager ;
|
||||
SubInclude HAIKU_TOP src tests system kernel device_manager ;
|
||||
SubInclude HAIKU_TOP src tests system kernel file_corruption ;
|
||||
SubInclude HAIKU_TOP src tests system kernel scheduler ;
|
||||
SubInclude HAIKU_TOP src tests system kernel slab ;
|
||||
SubInclude HAIKU_TOP src tests system kernel swap ;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2010, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef CHECK_SUM_H
|
||||
#define CHECK_SUM_H
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <SHA256.h>
|
||||
|
||||
|
||||
struct CheckSum {
|
||||
|
||||
bool IsZero() const
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(fData); i++) {
|
||||
if (fData[i] != 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CheckSum& operator=(const CheckSum& other)
|
||||
{
|
||||
memcpy(fData, other.fData, sizeof(fData));
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const void* buffer) const
|
||||
{
|
||||
return memcmp(fData, buffer, sizeof(fData)) == 0;
|
||||
}
|
||||
|
||||
bool operator!=(const void* buffer) const
|
||||
{
|
||||
return !(*this == buffer);
|
||||
}
|
||||
|
||||
private:
|
||||
uint8 fData[SHA_DIGEST_LENGTH];
|
||||
};
|
||||
|
||||
|
||||
#endif // CHECK_SUM_H
|
||||
@@ -0,0 +1,16 @@
|
||||
SubDir HAIKU_TOP src tests system kernel file_corruption ;
|
||||
|
||||
|
||||
SubDirHdrs $(HAIKU_TOP) src system kernel device_manager ;
|
||||
UsePrivateKernelHeaders ;
|
||||
|
||||
|
||||
KernelAddon <test_driver>checksum_device :
|
||||
checksum_device.cpp
|
||||
|
||||
# from src/kits/shared
|
||||
SHA256.cpp
|
||||
;
|
||||
|
||||
SEARCH on [ FGristFiles SHA256.cpp ]
|
||||
= [ FDirName $(HAIKU_TOP) src kits shared ] ;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2010, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef CHECKSUM_DEVICE_H
|
||||
#define CHECKSUM_DEVICE_H
|
||||
|
||||
|
||||
#include <Drivers.h>
|
||||
|
||||
#include "CheckSum.h"
|
||||
|
||||
|
||||
enum {
|
||||
CHECKSUM_DEVICE_IOCTL_SET_CHECK_SUM = B_DEVICE_OP_CODES_END + 0x666
|
||||
};
|
||||
|
||||
|
||||
struct checksum_device_ioctl_set_check_sum {
|
||||
uint64 blockIndex;
|
||||
CheckSum checkSum;
|
||||
};
|
||||
|
||||
|
||||
#endif // CHECKSUM_DEVICE_H
|
||||
Reference in New Issue
Block a user