summaryrefslogtreecommitdiffstats
path: root/src/server/integrity.c
diff options
context:
space:
mode:
authorSimon Rettberg2014-06-16 19:24:17 +0200
committerSimon Rettberg2014-06-16 19:24:17 +0200
commit49f9218d330f5842fe24bce79267bd2c5b239df3 (patch)
tree74e7b49e9c058145069ac4e2aa6de5d9f2cac3ce /src/server/integrity.c
parent[CLIENT] Debug argument handling in daemon mode (diff)
downloaddnbd3-49f9218d330f5842fe24bce79267bd2c5b239df3.tar.gz
dnbd3-49f9218d330f5842fe24bce79267bd2c5b239df3.tar.xz
dnbd3-49f9218d330f5842fe24bce79267bd2c5b239df3.zip
Improve uplink handling, add code to debug thread creation/destruction, change stupid convention of freeDiskSpace returning 0 on error, which is ambiguous to the disk simply being full...
Diffstat (limited to 'src/server/integrity.c')
-rw-r--r--src/server/integrity.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/server/integrity.c b/src/server/integrity.c
index 4e637f6..16bc9eb 100644
--- a/src/server/integrity.c
+++ b/src/server/integrity.c
@@ -42,7 +42,7 @@ void integrity_init()
pthread_mutex_init( &integrityQueueLock, NULL );
pthread_cond_init( &queueSignal, NULL );
bRunning = TRUE;
- if ( 0 != pthread_create( &thread, NULL, &integrity_main, (void *)NULL ) ) {
+ if ( 0 != thread_create( &thread, NULL, &integrity_main, (void *)NULL ) ) {
bRunning = FALSE;
memlogf( "[WARNING] Could not start integrity check thread. Corrupted images will not be detected." );
return;
@@ -57,7 +57,7 @@ void integrity_shutdown()
pthread_mutex_lock( &integrityQueueLock );
pthread_cond_signal( &queueSignal );
pthread_mutex_unlock( &integrityQueueLock );
- pthread_join( thread, NULL );
+ thread_join( thread, NULL );
while ( bRunning )
usleep( 10000 );
pthread_mutex_destroy( &integrityQueueLock );
@@ -135,7 +135,7 @@ static void* integrity_main(void *data)
int fd = open( image->path, O_RDONLY );
if ( fd >= 0 ) {
if ( image_checkBlocksCrc32( fd, (uint32_t*)buffer, blocks, fileSize ) ) {
- printf( "[DEBUG] CRC check of block %d for %s succeeded :-)\n", blocks[0], image->lower_name );
+ //printf( "[DEBUG] CRC check of block %d for %s succeeded :-)\n", blocks[0], image->lower_name );
} else {
memlogf( "[WARNING] Hash check for block %d of %s failed!", blocks[0], image->lower_name );
image_updateCachemap( image, blocks[0] * HASH_BLOCK_SIZE, (blocks[0] + 1) * HASH_BLOCK_SIZE, FALSE );