Re: 0.9.8 released

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 22 Aug 2009 01:46:54 +0200
Tomasz Chmielewski <mangoo@xxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux