@@ -36,6 +36,13 @@
#include <float.h>
#include "tst_test.h"
+#if _FILE_OFFSET_BITS == 64
+# define FSIZE_MIN LONG_MIN
+# define FSIZE_MAX LONG_MAX
+#else
+# define FSIZE_MIN INT_MIN
+# define FSIZE_MAX INT_MAX
+#endif
#define MAXLOOPS 500 /* max pages for map children to write */
#define TEST_FILE "mmapstress01.out"
@@ -83,18 +90,10 @@ static void setup(void)
{
int pagesize = sysconf(_SC_PAGE_SIZE);
-#if _FILE_OFFSET_BITS == 64
- if (tst_parse_filesize(opt_filesize, &filesize, 0, LONG_MAX))
-#else
- if (tst_parse_filesize(opt_filesize, &filesize, 0, INT_MAX))
-#endif
+ if (tst_parse_filesize(opt_filesize, &filesize, 0, FSIZE_MAX))
tst_brk(TBROK, "invalid initial filesize '%s'", opt_filesize);
-#if _FILE_OFFSET_BITS == 64
- if (tst_parse_filesize(opt_sparseoffset, &sparseoffset, LONG_MIN, LONG_MAX))
-#else
- if (tst_parse_filesize(opt_sparseoffset, &sparseoffset, INT_MIN, INT_MAX))
-#endif
+ if (tst_parse_filesize(opt_sparseoffset, &sparseoffset, FSIZE_MIN, FSIZE_MAX))
tst_brk(TBROK, "invalid sparse offset '%s'", opt_sparseoffset);
if (sparseoffset % pagesize != 0)
tst_brk(TBROK, "sparseoffset must be pagesize multiple");
Signed-off-by: Edward Liaw <edliaw@google.com> --- .../kernel/mem/mmapstress/mmapstress01.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)