All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] fallocate/fallocate02.c: fix compilation error on RHEL5.10
@ 2014-02-26  5:03 Xiaoguang Wang
  2014-03-04 17:46 ` chrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Xiaoguang Wang @ 2014-02-26  5:03 UTC (permalink / raw)
  To: ltp-list

add #define _GNU_SOURCE in order to have LLONG_MAX defined in RHEL5.10.

ltp-fallocate.m4: create a configure check for fallocate() syscall and
define the wrapper only when it's not available.

fallocate02.c: delete this test item "{&fdw, FNAMEW, DEFAULT_TEST_MODE,
BLOCKS_WRITTEN-OFFSET, 1, 0}". Fallocate02 is to test various error
conditions for fallocate() syscall, usually these error conditions
can be checked in vfs layer. Here this test item, which the expected
return value is 0, is dependent on whether the underlying file systems
implement fallocate. So here we choose to remove it, or may specify a
block device, which contains a ext4 file system.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
---
 configure.ac                                      |  1 +
 m4/ltp-fallocate.m4                               | 25 +++++++++++++++++++++++
 testcases/kernel/syscalls/fallocate/fallocate.h   |  3 +++
 testcases/kernel/syscalls/fallocate/fallocate02.c |  2 +-
 4 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 m4/ltp-fallocate.m4

diff --git a/configure.ac b/configure.ac
index 89a86b3..b954ede 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,5 +171,6 @@ LTP_CHECK_KERNEL_DEVEL
 LTP_CHECK_XFS_QUOTACTL
 LTP_CHECK_CLONE_SUPPORTS_7_ARGS
 LTP_CHECK_MKDIRAT
+LTP_CHECK_FALLOCATE
 
 AC_OUTPUT
diff --git a/m4/ltp-fallocate.m4 b/m4/ltp-fallocate.m4
new file mode 100644
index 0000000..c7d509e
--- /dev/null
+++ b/m4/ltp-fallocate.m4
@@ -0,0 +1,25 @@
+dnl
+dnl Copyright (c) Linux Test Project, 2014
+dnl
+dnl This program is free software;  you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+dnl the GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program;  if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+dnl
+
+dnl
+dnl LTP_CHECK_FALLOCATE
+dnl ----------------------------
+dnl
+AC_DEFUN([LTP_CHECK_FALLOCATE],[
+AC_CHECK_FUNCS(fallocate,,)
+])
diff --git a/testcases/kernel/syscalls/fallocate/fallocate.h b/testcases/kernel/syscalls/fallocate/fallocate.h
index 358e610..22b2f51 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate.h
+++ b/testcases/kernel/syscalls/fallocate/fallocate.h
@@ -23,8 +23,10 @@
 
 #include <sys/types.h>
 #include <endian.h>
+#include "config.h"
 #include "linux_syscall_numbers.h"
 
+#if !defined(HAVE_FALLOCATE)
 static inline long fallocate(int fd, int mode, loff_t offset, loff_t len)
 {
 	/* Deal with 32bit ABIs that have 64bit syscalls. */
@@ -40,5 +42,6 @@ static inline long fallocate(int fd, int mode, loff_t offset, loff_t len)
 						  (off_t) len));
 #endif
 }
+#endif
 
 #endif /* FALLOCATE_H */
diff --git a/testcases/kernel/syscalls/fallocate/fallocate02.c b/testcases/kernel/syscalls/fallocate/fallocate02.c
index 6412050..f2d466b 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate02.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate02.c
@@ -24,6 +24,7 @@
  *	check fallocate() with various error conditions that should produce
  *	EBADF, EINVAL and EFBIG.
  */
+#define _GNU_SOURCE
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -73,7 +74,6 @@ static struct test_data_t {
 	{&fdw, FNAMEW, DEFAULT_TEST_MODE, BLOCKS_WRITTEN, 0, EINVAL},
 	{&fdw, FNAMEW, DEFAULT_TEST_MODE, BLOCKS_WRITTEN, -1, EINVAL},
 	{&fdw, FNAMEW, DEFAULT_TEST_MODE, -(BLOCKS_WRITTEN+OFFSET), 1, EINVAL},
-	{&fdw, FNAMEW, DEFAULT_TEST_MODE, BLOCKS_WRITTEN-OFFSET, 1, 0},
 	{&fdw, FNAMEW, DEFAULT_TEST_MODE, MAX_FILESIZE, 1, EFBIG},
 	{&fdw, FNAMEW, DEFAULT_TEST_MODE, 1, MAX_FILESIZE, EFBIG},
 };
-- 
1.8.2.1


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [LTP] [PATCH] fallocate/fallocate02.c: fix compilation error on RHEL5.10
  2014-02-26  5:03 [LTP] [PATCH] fallocate/fallocate02.c: fix compilation error on RHEL5.10 Xiaoguang Wang
@ 2014-03-04 17:46 ` chrubis
  0 siblings, 0 replies; 2+ messages in thread
From: chrubis @ 2014-03-04 17:46 UTC (permalink / raw)
  To: Xiaoguang Wang; +Cc: ltp-list

Hi!
> add #define _GNU_SOURCE in order to have LLONG_MAX defined in RHEL5.10.
> 
> ltp-fallocate.m4: create a configure check for fallocate() syscall and
> define the wrapper only when it's not available.
> 
> fallocate02.c: delete this test item "{&fdw, FNAMEW, DEFAULT_TEST_MODE,
> BLOCKS_WRITTEN-OFFSET, 1, 0}". Fallocate02 is to test various error
> conditions for fallocate() syscall, usually these error conditions
> can be checked in vfs layer. Here this test item, which the expected
> return value is 0, is dependent on whether the underlying file systems
> implement fallocate. So here we choose to remove it, or may specify a
> block device, which contains a ext4 file system.

This is OK. But please split it into two patches, one that fixes
compilation and one that removes the testcase.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-04 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-26  5:03 [LTP] [PATCH] fallocate/fallocate02.c: fix compilation error on RHEL5.10 Xiaoguang Wang
2014-03-04 17:46 ` chrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.