[stgt] 0.9.8 released

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Thu Aug 27 01:52:33 CEST 2009


On Sat, 22 Aug 2009 01:46:54 +0200
Tomasz Chmielewski <mangoo at wpkg.org> wrote:

> FUJITA Tomonori schrieb:
> > The tar is also available:
> > 
> > http://stgt.berlios.de/releases/tgt-0.9.8.tar.bz2
> 
> Fails to compile on Debian Etch (4.0) for me - anything obvious I'm missing?

Duh, glibc defines SYNC_FILE_RANGE_WAIT_BEFORE even though it doesn't
support sync_file_range...

Ok, this works for everyone?

diff --git a/usr/util.h b/usr/util.h
index 7497cb6..c941b37 100644
--- a/usr/util.h
+++ b/usr/util.h
@@ -7,6 +7,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <endian.h>
+#include <sys/syscall.h>
 #include "be_byteshift.h"
 
 #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
@@ -94,14 +95,18 @@ do {									\
 
 extern unsigned long pagesize, pageshift;
 
-#ifdef SYNC_FILE_RANGE_WAIT_BEFORE
+#if defined(__NR_sync_file_range) || defined(__NR_sync_file_range2)
 static inline int __sync_file_range(int fd, __off64_t offset, __off64_t bytes)
 {
 	int ret;
+#if defined(__NR_sync_file_range)
+	long int n = __NR_sync_file_range;
+#else
+	long int n = __NR_sync_file_range2;
+#endif
 	unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE
 		| SYNC_FILE_RANGE_WAIT_AFTER;
-
-	ret = sync_file_range(fd, offset, bytes, flags);
+	ret = syscall(n, fd, offset, bytes, flags);
 	if (ret)
 		ret = fsync(fd);
 	return ret;
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list