summaryrefslogtreecommitdiffstats
path: root/src/server/image.c
diff options
context:
space:
mode:
authorSebastian2016-02-10 21:53:15 +0100
committerSebastian2016-02-11 00:09:39 +0100
commit1ee67aedd55b452c7d5851d0e39e01aef4aca766 (patch)
treecaf482cd40463d5a4b15f14e5bd5b2d34bf936bd /src/server/image.c
parentcleanup commits (diff)
downloaddnbd3-1ee67aedd55b452c7d5851d0e39e01aef4aca766.tar.gz
dnbd3-1ee67aedd55b452c7d5851d0e39e01aef4aca766.tar.xz
dnbd3-1ee67aedd55b452c7d5851d0e39e01aef4aca766.zip
dnbd3server build success on freebsd :)
Diffstat (limited to 'src/server/image.c')
-rw-r--r--src/server/image.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/server/image.c b/src/server/image.c
index 7c9680e..3d4aab6 100644
--- a/src/server/image.c
+++ b/src/server/image.c
@@ -1,28 +1,18 @@
#include "image.h"
#include "helper.h"
#include "fileutil.h"
-#include "../shared/log.h"
#include "uplink.h"
#include "locks.h"
#include "integrity.h"
-#include "../shared/protocol.h"
-#include "../shared/sockhelper.h"
#include "altservers.h"
-#include "server.h"
-#include "../shared/fdsignal.h"
+#include "../shared/protocol.h"
#include <assert.h>
-#include <stdio.h>
#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <dirent.h>
#include <zlib.h>
#include <inttypes.h>
-#include <pthread.h>
-#include <errno.h>
#include <glob.h>
#define PATHLEN (2000)
@@ -243,9 +233,17 @@ bool image_saveCacheMap(dnbd3_image_t *image)
write( fd, map, size );
if ( image->cacheFd != -1 ) {
+#ifdef HAVE_FDATASYNC
fdatasync( image->cacheFd );
+#else
+ fsync( image->cacheFd );
+#endif
}
+#ifdef HAVE_FDATASYNC
fdatasync( fd );
+#else
+ fsync( fd );
+#endif
close( fd );
free( map );
@@ -1167,7 +1165,7 @@ static dnbd3_image_t *loadImageServer(char * const name, const uint16_t requeste
snprintf( imageFile, PATHLEN, "%s/%s.r%d", _basePath, name, requestedRid );
detectedRid = requestedRid;
} else {
- glob_t g = { 0 };
+ glob_t g;
snprintf( imageFile, PATHLEN, "%s/%s.r*", _basePath, name );
const int ret = glob( imageFile, GLOB_NOSORT | GLOB_MARK, NULL, &g );
imageFile[0] = '\0';