[stgt] FW: [fedora-arm] [PATCH] scsi-target-utils: Fix sync_file_range symbol for arm.

Vinit Dhatrak vinitd at marvell.com
Tue Aug 18 07:01:19 CEST 2009

Sounds ok to me. Please include it upstream so that various package builders will have this fix.
From: FUJITA Tomonori [fujita.tomonori at lab.ntt.co.jp]
Sent: Tuesday, August 18, 2009 10:23 AM
To: Vinit Dhatrak
Cc: stgt at vger.kernel.org
Subject: Re: FW: [fedora-arm] [PATCH] scsi-target-utils: Fix sync_file_range symbol     for arm.

On Mon, 17 Aug 2009 04:46:27 -0700
Vinit Dhatrak <vinitd at marvell.com> wrote:

> This patch is to fix build error for arm. Please refer to bug,
>              https://bugzilla.redhat.com/show_bug.cgi?id=510699

Now the majority of distributions has glibc that supports
sync_file_range() so let's make things just work on any architectures.

This should work for Fedora.

diff --git a/usr/util.h b/usr/util.h
index 49d980d..7497cb6 100644
--- a/usr/util.h
+++ b/usr/util.h
@@ -2,6 +2,7 @@
 #define __UTIL_H__

 #include <byteswap.h>
+#include <fcntl.h>
 #include <syscall.h>
 #include <unistd.h>
 #include <errno.h>
@@ -93,42 +94,20 @@ do {                                                                        \

 extern unsigned long pagesize, pageshift;

- * the latest glibc have a proper sync_file_range definition but
- * most of the distributions aren't shipped with it yet.
-#ifndef __NR_sync_file_range
-#if defined(__i386)
-#define __NR_sync_file_range   314
-#elif defined(__x86_64__)
-#define __NR_sync_file_range   277
-#elif defined(__ia64__)
-#define __NR_sync_file_range   1300
-#elif defined(__powerpc64__) || defined(__PPC__)
-#define __NR_sync_file_range   308
-#define SYNC_FILE_RANGE_WRITE          2
-extern long int syscall(long int sysno, ...);
 static inline int __sync_file_range(int fd, __off64_t offset, __off64_t bytes)
        int ret;
                | SYNC_FILE_RANGE_WAIT_AFTER;

-       ret = syscall(__NR_sync_file_range, fd, offset, bytes, flags);
+       ret = sync_file_range(fd, offset, bytes, flags);
        if (ret)
                ret = fsync(fd);
        return ret;
+#define __sync_file_range(fd, offset, bytes) fsync(fd)

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