e4defrag: fix ppc build

ppc glibc seems to be missing sync_file_range, so we fell back
to the local define, and there ppc differs as well, so the
build was failing.

Thanks to Kyle for the patch w/ the tidy solution.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Kyle McMartin 2009-08-23 22:09:58 -07:00 committed by Theodore Ts'o
parent c1b875979f
commit a9e55a1191
1 changed files with 6 additions and 0 deletions

View File

@ -305,8 +305,10 @@ static int posix_fadvise(int fd, loff_t offset, size_t len, int advise)
#warning Using locally defined sync_file_range interface.
#ifndef __NR_sync_file_range
#ifndef __NR_sync_file_range2 /* ppc */
#error Your kernel headers dont define __NR_sync_file_range
#endif
#endif
/*
* sync_file_range() - Sync file region.
@ -318,7 +320,11 @@ static int posix_fadvise(int fd, loff_t offset, size_t len, int advise)
*/
int sync_file_range(int fd, loff_t offset, loff_t length, unsigned int flag)
{
#ifdef __NR_sync_file_range
return syscall(__NR_sync_file_range, fd, offset, length, flag);
#else
return syscall(__NR_sync_file_range2, fd, flag, offset, length);
#endif
}
#endif /* ! HAVE_SYNC_FILE_RANGE */