All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] Fix build with musl libc
@ 2018-01-22 15:57 Rostislav Skudnov
  2018-01-22 15:57 ` [PATCH v2 1/8] fsstress: Include stddef.h for ptrdiff_t Rostislav Skudnov
                   ` (7 more replies)
  0 siblings, 8 replies; 28+ messages in thread
From: Rostislav Skudnov @ 2018-01-22 15:57 UTC (permalink / raw)
  To: fstests

Replace some obsolete and non-standard data types, headers, macros and
symbols with standard and modern ones in order to allow building
xfstests with musl C library.

---

Changes since v1:

Split a single patch into multiple patches.


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

* [PATCH v2 1/8] fsstress: Include stddef.h for ptrdiff_t
  2018-01-22 15:57 [PATCH v2 0/8] Fix build with musl libc Rostislav Skudnov
@ 2018-01-22 15:57 ` Rostislav Skudnov
  2018-01-22 20:21   ` Christoph Hellwig
  2018-01-23  4:01   ` Eryu Guan
  2018-01-22 15:57 ` [PATCH v2 2/8] Replace all __[u]intNN_t types with standard [u]intNN_t Rostislav Skudnov
                   ` (6 subsequent siblings)
  7 siblings, 2 replies; 28+ messages in thread
From: Rostislav Skudnov @ 2018-01-22 15:57 UTC (permalink / raw)
  To: fstests

In musl C library headers ptrdiff_t is only defined in stddef.h.

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
---
 ltp/fsstress.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 4dea029..63c2eb4 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -19,6 +19,7 @@
 #include <linux/fs.h>
 #include <setjmp.h>
 #include <sys/uio.h>
+#include <stddef.h>
 #include "global.h"
 
 #ifdef HAVE_ATTR_XATTR_H
-- 
2.1.4


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

* [PATCH v2 2/8] Replace all __[u]intNN_t types with standard [u]intNN_t
  2018-01-22 15:57 [PATCH v2 0/8] Fix build with musl libc Rostislav Skudnov
  2018-01-22 15:57 ` [PATCH v2 1/8] fsstress: Include stddef.h for ptrdiff_t Rostislav Skudnov
@ 2018-01-22 15:57 ` Rostislav Skudnov
  2018-01-22 20:22   ` Christoph Hellwig
  2018-01-22 15:57 ` [PATCH v2 3/8] doio, growfiles: Use standard signal name SIGCHLD instead of SIGCLD Rostislav Skudnov
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 28+ messages in thread
From: Rostislav Skudnov @ 2018-01-22 15:57 UTC (permalink / raw)
  To: fstests

Integer types such as __uint32_t are non-standard and not supported by
some C libraries such as musl. This commit replaces them with standard
types such as uint32_t and includes stdint.h header where necessary.

The following command was used to do the changing of types:
sed -r -i 's/__(u?int[0-9]{2}_t)/\1/g' src/*.c ltp/*.c

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
---
 ltp/fsstress.c      | 84 ++++++++++++++++++++++++++---------------------------
 src/alloc.c         |  2 +-
 src/feature.c       |  2 +-
 src/getdevicesize.c |  3 +-
 src/global.h        |  1 +
 src/loggen.c        |  6 ++--
 src/makeextents.c   | 10 +++----
 src/randholes.c     | 30 +++++++++----------
 8 files changed, 70 insertions(+), 68 deletions(-)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 63c2eb4..935f5de 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -1811,7 +1811,7 @@ allocsp_f(int opno, long r)
 	pathname_t	f;
 	int		fd;
 	struct xfs_flock64	fl;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -1843,7 +1843,7 @@ allocsp_f(int opno, long r)
 		return;
 	}
 	inode_info(st, sizeof(st), &stb, v);
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
 	fl.l_whence = SEEK_SET;
@@ -1862,14 +1862,14 @@ allocsp_f(int opno, long r)
 void
 do_aio_rw(int opno, long r, int flags)
 {
-	__int64_t	align;
+	int64_t		align;
 	char		*buf;
 	struct dioattr	diob;
 	int		e;
 	pathname_t	f;
 	int		fd;
 	size_t		len;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -1926,8 +1926,8 @@ do_aio_rw(int opno, long r, int flags)
 	dio_env = getenv("XFS_DIO_MIN");
 	if (dio_env)
 		diob.d_mem = diob.d_miniosz = atoi(dio_env);
-	align = (__int64_t)diob.d_miniosz;
-	lr = ((__int64_t)random() << 32) + random();
+	align = (int64_t)diob.d_miniosz;
+	lr = ((int64_t)random() << 32) + random();
 	len = (random() % FILELEN_MAX) + 1;
 	len -= (len % align);
 	if (len <= 0)
@@ -2102,7 +2102,7 @@ bulkstat_f(int opno, long r)
 	__u64		last;
 	int		nent;
 	xfs_bstat_t	*t;
-	__int64_t	total;
+	int64_t		total;
         xfs_fsop_bulkreq_t bsr;
 
 	last = 0;
@@ -2293,7 +2293,7 @@ clonerange_f(
 	if (len > stat1.st_size)
 		len = stat1.st_size;
 
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	if (stat1.st_size == len)
 		off1 = 0;
 	else
@@ -2306,7 +2306,7 @@ clonerange_f(
 	 * until we find one that doesn't overlap the source range.
 	 */
 	do {
-		lr = ((__int64_t)random() << 32) + random();
+		lr = ((int64_t)random() << 32) + random();
 		off2 = (off64_t)(lr % MIN(stat2.st_size + (1024 * 1024), MAXFSIZE));
 		off2 %= maxfsize;
 		off2 &= ~(stat2.st_blksize - 1);
@@ -2497,7 +2497,7 @@ deduperange_f(
 		len = stat[0].st_size / 2;
 
 	/* Calculate offsets */
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	if (stat[0].st_size == len)
 		off[0] = 0;
 	else
@@ -2513,7 +2513,7 @@ deduperange_f(
 		int	tries = 0;
 
 		do {
-			lr = ((__int64_t)random() << 32) + random();
+			lr = ((int64_t)random() << 32) + random();
 			if (stat[i].st_size <= len)
 				off[i] = 0;
 			else
@@ -2702,14 +2702,14 @@ creat_f(int opno, long r)
 void
 dread_f(int opno, long r)
 {
-	__int64_t	align;
+	int64_t		align;
 	char		*buf;
 	struct dioattr	diob;
 	int		e;
 	pathname_t	f;
 	int		fd;
 	size_t		len;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -2764,8 +2764,8 @@ dread_f(int opno, long r)
 	if (dio_env)
 		diob.d_mem = diob.d_miniosz = atoi(dio_env);
 
-	align = (__int64_t)diob.d_miniosz;
-	lr = ((__int64_t)random() << 32) + random();
+	align = (int64_t)diob.d_miniosz;
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % stb.st_size);
 	off -= (off % align);
 	lseek64(fd, off, SEEK_SET);
@@ -2788,14 +2788,14 @@ dread_f(int opno, long r)
 void
 dwrite_f(int opno, long r)
 {
-	__int64_t	align;
+	int64_t		align;
 	char		*buf;
 	struct dioattr	diob;
 	int		e;
 	pathname_t	f;
 	int		fd;
 	size_t		len;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -2841,8 +2841,8 @@ dwrite_f(int opno, long r)
 	if (dio_env)
 		diob.d_mem = diob.d_miniosz = atoi(dio_env);
 
-	align = (__int64_t)diob.d_miniosz;
-	lr = ((__int64_t)random() << 32) + random();
+	align = (int64_t)diob.d_miniosz;
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off -= (off % align);
 	lseek64(fd, off, SEEK_SET);
@@ -2888,7 +2888,7 @@ do_fallocate(int opno, long r, int mode)
 	int		e;
 	pathname_t	f;
 	int		fd;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	off64_t		len;
 	struct stat64	stb;
@@ -2920,7 +2920,7 @@ do_fallocate(int opno, long r, int mode)
 		return;
 	}
 	inode_info(st, sizeof(st), &stb, v);
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
 	len = (off64_t)(random() % (1024 * 1024));
@@ -3003,7 +3003,7 @@ fiemap_f(int opno, long r)
 	int		e;
 	pathname_t	f;
 	int		fd;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -3047,14 +3047,14 @@ fiemap_f(int opno, long r)
 		close(fd);
 		return;
 	}
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
 	fiemap->fm_flags = random() & (FIEMAP_FLAGS_COMPAT | 0x10000);
 	fiemap->fm_extent_count = blocks_to_map;
 	fiemap->fm_mapped_extents = random() & 0xffff;
 	fiemap->fm_start = off;
-	fiemap->fm_length = ((__int64_t)random() << 32) + random();
+	fiemap->fm_length = ((int64_t)random() << 32) + random();
 
 	e = ioctl(fd, FS_IOC_FIEMAP, (unsigned long)fiemap);
 	if (v)
@@ -3075,7 +3075,7 @@ freesp_f(int opno, long r)
 	pathname_t	f;
 	int		fd;
 	struct xfs_flock64	fl;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -3107,7 +3107,7 @@ freesp_f(int opno, long r)
 		return;
 	}
 	inode_info(st, sizeof(st), &stb, v);
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
 	fl.l_whence = SEEK_SET;
@@ -3350,7 +3350,7 @@ do_mmap(int opno, long r, int prot)
 	pathname_t	f;
 	int		fd;
 	size_t		len;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	int		flags;
 	struct stat64	stb;
@@ -3393,7 +3393,7 @@ do_mmap(int opno, long r, int prot)
 		return;
 	}
 
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % stb.st_size);
 	off &= (off64_t)(~(sysconf(_SC_PAGE_SIZE) - 1));
 	len = (size_t)(random() % MIN(stb.st_size - off, FILELEN_MAX)) + 1;
@@ -3495,7 +3495,7 @@ read_f(int opno, long r)
 	pathname_t	f;
 	int		fd;
 	size_t		len;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -3535,7 +3535,7 @@ read_f(int opno, long r)
 		close(fd);
 		return;
 	}
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % stb.st_size);
 	lseek64(fd, off, SEEK_SET);
 	len = (random() % FILELEN_MAX) + 1;
@@ -3579,7 +3579,7 @@ readv_f(int opno, long r)
 	pathname_t	f;
 	int		fd;
 	size_t		len;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -3624,7 +3624,7 @@ readv_f(int opno, long r)
 		close(fd);
 		return;
 	}
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % stb.st_size);
 	lseek64(fd, off, SEEK_SET);
 	len = (random() % FILELEN_MAX) + 1;
@@ -3726,7 +3726,7 @@ resvsp_f(int opno, long r)
 	pathname_t	f;
 	int		fd;
 	struct xfs_flock64	fl;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -3758,7 +3758,7 @@ resvsp_f(int opno, long r)
 		return;
 	}
 	inode_info(st, sizeof(st), &stb, v);
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
 	fl.l_whence = SEEK_SET;
@@ -3910,7 +3910,7 @@ truncate_f(int opno, long r)
 {
 	int		e;
 	pathname_t	f;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -3933,7 +3933,7 @@ truncate_f(int opno, long r)
 		return;
 	}
 	inode_info(st, sizeof(st), &stb, v);
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
 	e = truncate64_path(&f, off) < 0 ? errno : 0;
@@ -3980,7 +3980,7 @@ unresvsp_f(int opno, long r)
 	pathname_t	f;
 	int		fd;
 	struct xfs_flock64	fl;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -4012,7 +4012,7 @@ unresvsp_f(int opno, long r)
 		return;
 	}
 	inode_info(st, sizeof(st), &stb, v);
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
 	fl.l_whence = SEEK_SET;
@@ -4035,7 +4035,7 @@ write_f(int opno, long r)
 	pathname_t	f;
 	int		fd;
 	size_t		len;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -4067,7 +4067,7 @@ write_f(int opno, long r)
 		return;
 	}
 	inode_info(st, sizeof(st), &stb, v);
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
 	lseek64(fd, off, SEEK_SET);
@@ -4091,7 +4091,7 @@ writev_f(int opno, long r)
 	pathname_t	f;
 	int		fd;
 	size_t		len;
-	__int64_t	lr;
+	int64_t		lr;
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
@@ -4128,7 +4128,7 @@ writev_f(int opno, long r)
 		return;
 	}
 	inode_info(st, sizeof(st), &stb, v);
-	lr = ((__int64_t)random() << 32) + random();
+	lr = ((int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
 	lseek64(fd, off, SEEK_SET);
diff --git a/src/alloc.c b/src/alloc.c
index 92139f7..10d654d 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -171,7 +171,7 @@ bozo!
 	int		tflag = 0;
         int             nflag = 0;
 	int		unlinkit = 0;
-	__int64_t	v;
+	int64_t		v;
 
 	while ((c = getopt(argc, argv, "b:d:f:rtn")) != -1) {
 		switch (c) {
diff --git a/src/feature.c b/src/feature.c
index b735468..0fb834a 100644
--- a/src/feature.c
+++ b/src/feature.c
@@ -87,7 +87,7 @@ int check_big_ID(char *filename)
 	}
 
 	/* 98789 is greater than 2^16 (65536) */
-	if ((__uint32_t)sbuf.st_uid == 98789 || (__uint32_t)sbuf.st_gid == 98789)
+	if ((uint32_t)sbuf.st_uid == 98789 || (uint32_t)sbuf.st_gid == 98789)
 		return(0);
 	if (verbose)
 		fprintf(stderr, "lstat64 on %s gave uid=%d, gid=%d\n",
diff --git a/src/getdevicesize.c b/src/getdevicesize.c
index 9672e91..a1745b0 100644
--- a/src/getdevicesize.c
+++ b/src/getdevicesize.c
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <stdint.h>
 #include <sys/ioctl.h>
 #include <sys/mount.h>
 
@@ -33,7 +34,7 @@
 
 int main(int argc, char **argv)
 {
-	__uint64_t	size;
+	uint64_t	size;
 	long long	sz = -1;
 	int		error, fd;
 
diff --git a/src/global.h b/src/global.h
index 3920c0d..9dec9d4 100644
--- a/src/global.h
+++ b/src/global.h
@@ -119,6 +119,7 @@
 
 #ifdef STDC_HEADERS
 #include <signal.h>
+#include <stdint.h>
 #endif
 
 #ifdef HAVE_STRINGS_H
diff --git a/src/loggen.c b/src/loggen.c
index a3d99f8..ed1ebbc 100644
--- a/src/loggen.c
+++ b/src/loggen.c
@@ -119,9 +119,9 @@ loggen_unmount(int count)
     xlog_op_header_t        *op;
     /* the data section must be 32 bit size aligned */
     struct {
-        __uint16_t magic;
-        __uint16_t pad1;
-        __uint32_t pad2; /* may as well make it 64 bits */
+        uint16_t magic;
+        uint16_t pad1;
+        uint32_t pad2; /* may as well make it 64 bits */
     } magic = { XLOG_UNMOUNT_TYPE, 0, 0 };
     
     if (!count) count=1;
diff --git a/src/makeextents.c b/src/makeextents.c
index 8183edb..a36685a 100644
--- a/src/makeextents.c
+++ b/src/makeextents.c
@@ -23,15 +23,15 @@
 #include "global.h"
 
 char *progname;
-__uint64_t num_holes = 1000;
-__uint64_t curr_holes;
+uint64_t num_holes = 1000;
+uint64_t curr_holes;
 int verbose_opt = 0;
 char *filename;
 int status_num = 100;
 int wsync;
 int preserve;
 unsigned int blocksize;
-__uint64_t fileoffset;
+uint64_t fileoffset;
 
 #define JUMP_SIZE (128 * 1024)
 #define NUMHOLES_TO_SIZE(i) (i * JUMP_SIZE)
@@ -51,8 +51,8 @@ main(int argc, char *argv[])
 	int c;
 	int fd;
 	int oflags;
-	__uint64_t i;
-	__uint64_t offset;
+	uint64_t i;
+	uint64_t offset;
 	int blocksize = 512;
 	unsigned char *buffer = NULL;
 	struct stat stat;
diff --git a/src/randholes.c b/src/randholes.c
index ee5b6b6..a16670f 100644
--- a/src/randholes.c
+++ b/src/randholes.c
@@ -21,7 +21,7 @@
 #include "global.h"
 
 #define	power_of_2(x)	((x) && !((x) & ((x) - 1)))
-#define	DEFAULT_FILESIZE	((__uint64_t) (256 * 1024 * 1024))
+#define	DEFAULT_FILESIZE	((uint64_t) (256 * 1024 * 1024))
 #define	DEFAULT_BLOCKSIZE	512
 
 #define	SETBIT(ARRAY, N)	((ARRAY)[(N)/8] |= (1 << ((N)%8)))
@@ -30,8 +30,8 @@
 /* Bit-vector array showing which blocks have been written */
 static unsigned char	*valid;
 
-static __uint64_t filesize;
-static __uint64_t fileoffset;
+static uint64_t filesize;
+static uint64_t fileoffset;
 
 static unsigned int blocksize;
 static int count;
@@ -72,7 +72,7 @@ usage(char *progname)
 	fprintf(stderr, "\tdefault count is %d block-sized writes\n",
 		(int) (DEFAULT_FILESIZE / DEFAULT_BLOCKSIZE));
 	fprintf(stderr, "\tdefault write_offset is %" PRIu64 " bytes\n",
-		(__uint64_t) 0);
+		(uint64_t) 0);
 	exit(1);
 }
 
@@ -174,7 +174,7 @@ findblock(void)
 }
 
 static void
-dumpblock(int *buffer, __uint64_t offset, int blocksize)
+dumpblock(int *buffer, uint64_t offset, int blocksize)
 {
 	int	i;
 
@@ -190,7 +190,7 @@ dumpblock(int *buffer, __uint64_t offset, int blocksize)
 static void
 writeblks(char *fname, int fd, size_t alignment)
 {
-	__uint64_t offset;
+	uint64_t offset;
 	char *buffer = NULL;
 	int block;
 	int ret;
@@ -226,7 +226,7 @@ writeblks(char *fname, int fd, size_t alignment)
 		    exit(1);
 		}
 
-		offset = (__uint64_t) block * blocksize;
+		offset = (uint64_t) block * blocksize;
 		if (alloconly) {
                         if (test) continue;
                         
@@ -252,8 +252,8 @@ writeblks(char *fname, int fd, size_t alignment)
 			 * into it.  We'll verify this when we read
 			 * it back in again.
 			 */
-			*(__uint64_t *) buffer = fileoffset + offset;
-			*(__uint64_t *) (buffer + 256) = fileoffset + offset;
+			*(uint64_t *) buffer = fileoffset + offset;
+			*(uint64_t *) (buffer + 256) = fileoffset + offset;
 
 		        if (write(fd, buffer, blocksize) < blocksize) {
 			        perror("write");
@@ -273,7 +273,7 @@ writeblks(char *fname, int fd, size_t alignment)
 static int
 readblks(int fd, size_t alignment)
 {
-	__uint64_t offset;
+	uint64_t offset;
 	char *buffer, *tmp;
 	unsigned int xfer, block, i;
         int err=0;
@@ -305,9 +305,9 @@ readblks(int fd, size_t alignment)
 		}
 		tmp = buffer;
 		for (i = 0; i < READ_XFER; i++) {
-			__uint64_t want;
-			__uint64_t first;
-			__uint64_t second;
+			uint64_t want;
+			uint64_t first;
+			uint64_t second;
 
 			if (verbose && ((block % 100) == 0)) {
 				printf("+");
@@ -315,8 +315,8 @@ readblks(int fd, size_t alignment)
 			}
 
 			want = BITVAL(valid, block) ? offset : 0;
-			first = *(__uint64_t *) tmp;
-			second = *(__uint64_t *) (tmp + 256);
+			first = *(uint64_t *) tmp;
+			second = *(uint64_t *) (tmp + 256);
 			if (first != want || second != want) {
 				printf("mismatched data at offset=0x%" PRIx64
 					", expected 0x%" PRIx64
-- 
2.1.4


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

* [PATCH v2 3/8] doio, growfiles: Use standard signal name SIGCHLD instead of SIGCLD
  2018-01-22 15:57 [PATCH v2 0/8] Fix build with musl libc Rostislav Skudnov
  2018-01-22 15:57 ` [PATCH v2 1/8] fsstress: Include stddef.h for ptrdiff_t Rostislav Skudnov
  2018-01-22 15:57 ` [PATCH v2 2/8] Replace all __[u]intNN_t types with standard [u]intNN_t Rostislav Skudnov
@ 2018-01-22 15:57 ` Rostislav Skudnov
  2018-01-22 20:22   ` Christoph Hellwig
  2018-01-22 15:57 ` [PATCH v2 4/8] metaperf: Include linux/param.h explicitly for HZ macro Rostislav Skudnov
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 28+ messages in thread
From: Rostislav Skudnov @ 2018-01-22 15:57 UTC (permalink / raw)
  To: fstests

SIGCLD is synonymous with SIGCHLD, but the former is non-standard and
not supported by some C libraries such as musl.

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
---
 ltp/doio.c      | 2 +-
 ltp/growfiles.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ltp/doio.c b/ltp/doio.c
index b937718..939a1ea 100644
--- a/ltp/doio.c
+++ b/ltp/doio.c
@@ -362,7 +362,7 @@ char	**argv;
 		case SIGTSTP:
 		case SIGSTOP:
 		case SIGCONT:
-		case SIGCLD:
+		case SIGCHLD:
 		case SIGBUS:
 		case SIGSEGV:
 		case SIGQUIT:
diff --git a/ltp/growfiles.c b/ltp/growfiles.c
index ad1ecdf..951b926 100644
--- a/ltp/growfiles.c
+++ b/ltp/growfiles.c
@@ -1389,7 +1389,7 @@ set_sig()
 #ifdef SIGRESTART
 	        case SIGRESTART:
 #endif /* SIGRESTART */
-                case SIGCLD:
+                case SIGCHLD:
                     break;
 
                 default:
-- 
2.1.4


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

* [PATCH v2 4/8] metaperf: Include linux/param.h explicitly for HZ macro
  2018-01-22 15:57 [PATCH v2 0/8] Fix build with musl libc Rostislav Skudnov
                   ` (2 preceding siblings ...)
  2018-01-22 15:57 ` [PATCH v2 3/8] doio, growfiles: Use standard signal name SIGCHLD instead of SIGCLD Rostislav Skudnov
@ 2018-01-22 15:57 ` Rostislav Skudnov
  2018-01-22 20:24   ` Christoph Hellwig
  2018-01-22 15:57 ` [PATCH v2 5/8] dmiperf: Include sys/types.h for u_int32_t Rostislav Skudnov
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 28+ messages in thread
From: Rostislav Skudnov @ 2018-01-22 15:57 UTC (permalink / raw)
  To: fstests

Glibc includes linux/param.h when we include sys/param.h, whereas musl
libc does not do that. HZ is a Linux-specific macro, therefore include
the header file that defines it explicitly.

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
---
 src/metaperf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/metaperf.c b/src/metaperf.c
index d06b589..5f5a971 100644
--- a/src/metaperf.c
+++ b/src/metaperf.c
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <dirent.h>
+#include <linux/param.h>
 
 typedef	void	*(*fpi_t)(void);
 typedef	void	(*fpt_t)(int, void *);
-- 
2.1.4


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

* [PATCH v2 5/8] dmiperf: Include sys/types.h for u_int32_t
  2018-01-22 15:57 [PATCH v2 0/8] Fix build with musl libc Rostislav Skudnov
                   ` (3 preceding siblings ...)
  2018-01-22 15:57 ` [PATCH v2 4/8] metaperf: Include linux/param.h explicitly for HZ macro Rostislav Skudnov
@ 2018-01-22 15:57 ` Rostislav Skudnov
  2018-01-22 20:24   ` Christoph Hellwig
  2018-01-24  4:00   ` Eryu Guan
  2018-01-22 15:57 ` [PATCH v2 6/8] fssum: Use bswap_64() instead of __bswap_64() Rostislav Skudnov
                   ` (2 subsequent siblings)
  7 siblings, 2 replies; 28+ messages in thread
From: Rostislav Skudnov @ 2018-01-22 15:57 UTC (permalink / raw)
  To: fstests

u_int32_t type is defined in sys/types.h, which is often included by
glibc implicitly when some other headers are used, but other C libraries
such as musl may not necessarily do so, therefore an explicit include is
needed.

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
---
 src/dmiperf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/dmiperf.c b/src/dmiperf.c
index 245e529..359324a 100644
--- a/src/dmiperf.c
+++ b/src/dmiperf.c
@@ -16,6 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <sys/types.h>
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/time.h>
-- 
2.1.4


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

* [PATCH v2 6/8] fssum: Use bswap_64() instead of __bswap_64()
  2018-01-22 15:57 [PATCH v2 0/8] Fix build with musl libc Rostislav Skudnov
                   ` (4 preceding siblings ...)
  2018-01-22 15:57 ` [PATCH v2 5/8] dmiperf: Include sys/types.h for u_int32_t Rostislav Skudnov
@ 2018-01-22 15:57 ` Rostislav Skudnov
  2018-01-22 20:26   ` Christoph Hellwig
  2018-01-22 15:57 ` [PATCH v2 7/8] t_mtab: Replace sys_siglist[] with strsignal() Rostislav Skudnov
  2018-01-22 15:57 ` [PATCH v2 8/8] pwrite_mmap_blocked: Include signal.h instead of sys/signal.h Rostislav Skudnov
  7 siblings, 1 reply; 28+ messages in thread
From: Rostislav Skudnov @ 2018-01-22 15:57 UTC (permalink / raw)
  To: fstests

Macros and functions starting with two underscores are usually internal
and shouldn't be used by applications when a version without "__" is
available.

Include byteswap.h explicitly since bswap_64() is defined there.

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
---
 src/fssum.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/fssum.c b/src/fssum.c
index 13111d6..46e02ba 100644
--- a/src/fssum.c
+++ b/src/fssum.c
@@ -40,6 +40,7 @@
 #include <netinet/in.h>
 #include <inttypes.h>
 #include <assert.h>
+#include <byteswap.h>
 
 #define CS_SIZE 16
 #define CHUNKS	128
@@ -51,7 +52,7 @@
 #endif
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
-#define htonll(x)     __bswap_64 (x)
+#define htonll(x)     bswap_64 (x)
 #else
 #define htonll(x)     (x)
 #endif
-- 
2.1.4


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

* [PATCH v2 7/8] t_mtab: Replace sys_siglist[] with strsignal()
  2018-01-22 15:57 [PATCH v2 0/8] Fix build with musl libc Rostislav Skudnov
                   ` (5 preceding siblings ...)
  2018-01-22 15:57 ` [PATCH v2 6/8] fssum: Use bswap_64() instead of __bswap_64() Rostislav Skudnov
@ 2018-01-22 15:57 ` Rostislav Skudnov
  2018-01-22 20:26   ` Christoph Hellwig
  2018-01-22 15:57 ` [PATCH v2 8/8] pwrite_mmap_blocked: Include signal.h instead of sys/signal.h Rostislav Skudnov
  7 siblings, 1 reply; 28+ messages in thread
From: Rostislav Skudnov @ 2018-01-22 15:57 UTC (permalink / raw)
  To: fstests

strsignal(3) says that strsignal() should be used instead of
sys_siglist[].

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
---
 src/t_mtab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/t_mtab.c b/src/t_mtab.c
index 5e9d521..fd85c6b 100644
--- a/src/t_mtab.c
+++ b/src/t_mtab.c
@@ -34,7 +34,7 @@ static int signals_have_been_setup = 0;
 /* Ensure that the lock is released if we are interrupted.  */
 static void
 handler (int sig) {
-    fprintf(stderr, "%s\n", sys_siglist[sig]);
+    fprintf(stderr, "%s\n", strsignal(sig));
     exit(1);
 }
 
-- 
2.1.4


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

* [PATCH v2 8/8] pwrite_mmap_blocked: Include signal.h instead of sys/signal.h
  2018-01-22 15:57 [PATCH v2 0/8] Fix build with musl libc Rostislav Skudnov
                   ` (6 preceding siblings ...)
  2018-01-22 15:57 ` [PATCH v2 7/8] t_mtab: Replace sys_siglist[] with strsignal() Rostislav Skudnov
@ 2018-01-22 15:57 ` Rostislav Skudnov
  2018-01-22 20:26   ` Christoph Hellwig
  7 siblings, 1 reply; 28+ messages in thread
From: Rostislav Skudnov @ 2018-01-22 15:57 UTC (permalink / raw)
  To: fstests

sys/signal.h is wrong and should not be used. Musl C library warns about
it.

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
---
 src/pwrite_mmap_blocked.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pwrite_mmap_blocked.c b/src/pwrite_mmap_blocked.c
index 26e2230..0ebd746 100644
--- a/src/pwrite_mmap_blocked.c
+++ b/src/pwrite_mmap_blocked.c
@@ -22,7 +22,7 @@
 #include <errno.h>
 #include <time.h>
 #include <sys/mman.h>
-#include <sys/signal.h>
+#include <signal.h>
 #include <sys/stat.h>
 
 
-- 
2.1.4


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

* Re: [PATCH v2 1/8] fsstress: Include stddef.h for ptrdiff_t
  2018-01-22 15:57 ` [PATCH v2 1/8] fsstress: Include stddef.h for ptrdiff_t Rostislav Skudnov
@ 2018-01-22 20:21   ` Christoph Hellwig
  2018-01-23  4:01   ` Eryu Guan
  1 sibling, 0 replies; 28+ messages in thread
From: Christoph Hellwig @ 2018-01-22 20:21 UTC (permalink / raw)
  To: Rostislav Skudnov; +Cc: fstests

On Mon, Jan 22, 2018 at 03:57:12PM +0000, Rostislav Skudnov wrote:
> In musl C library headers ptrdiff_t is only defined in stddef.h.
> 
> Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH v2 2/8] Replace all __[u]intNN_t types with standard [u]intNN_t
  2018-01-22 15:57 ` [PATCH v2 2/8] Replace all __[u]intNN_t types with standard [u]intNN_t Rostislav Skudnov
@ 2018-01-22 20:22   ` Christoph Hellwig
  0 siblings, 0 replies; 28+ messages in thread
From: Christoph Hellwig @ 2018-01-22 20:22 UTC (permalink / raw)
  To: Rostislav Skudnov; +Cc: fstests

On Mon, Jan 22, 2018 at 03:57:13PM +0000, Rostislav Skudnov wrote:
> Integer types such as __uint32_t are non-standard and not supported by
> some C libraries such as musl. This commit replaces them with standard
> types such as uint32_t and includes stdint.h header where necessary.
> 
> The following command was used to do the changing of types:
> sed -r -i 's/__(u?int[0-9]{2}_t)/\1/g' src/*.c ltp/*.c

Looks good nad matches what we've done to the kernel and xfsprogs:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH v2 3/8] doio, growfiles: Use standard signal name SIGCHLD instead of SIGCLD
  2018-01-22 15:57 ` [PATCH v2 3/8] doio, growfiles: Use standard signal name SIGCHLD instead of SIGCLD Rostislav Skudnov
@ 2018-01-22 20:22   ` Christoph Hellwig
  0 siblings, 0 replies; 28+ messages in thread
From: Christoph Hellwig @ 2018-01-22 20:22 UTC (permalink / raw)
  To: Rostislav Skudnov; +Cc: fstests

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH v2 4/8] metaperf: Include linux/param.h explicitly for HZ macro
  2018-01-22 15:57 ` [PATCH v2 4/8] metaperf: Include linux/param.h explicitly for HZ macro Rostislav Skudnov
@ 2018-01-22 20:24   ` Christoph Hellwig
  2018-01-24  3:58     ` Eryu Guan
  0 siblings, 1 reply; 28+ messages in thread
From: Christoph Hellwig @ 2018-01-22 20:24 UTC (permalink / raw)
  To: Rostislav Skudnov; +Cc: fstests

On Mon, Jan 22, 2018 at 03:57:15PM +0000, Rostislav Skudnov wrote:
> Glibc includes linux/param.h when we include sys/param.h, whereas musl
> libc does not do that. HZ is a Linux-specific macro, therefore include
> the header file that defines it explicitly.
> 
> Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>

Using HZ in userspace doesn't make any sense at all.  The kernel HZ
(as in the granulairy for jiffies) can vary between architectures
and even configurations.  I guess it wants a hard coded 100 here, but
someone will have to do a detailed analysis.

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

* Re: [PATCH v2 5/8] dmiperf: Include sys/types.h for u_int32_t
  2018-01-22 15:57 ` [PATCH v2 5/8] dmiperf: Include sys/types.h for u_int32_t Rostislav Skudnov
@ 2018-01-22 20:24   ` Christoph Hellwig
  2018-01-24  4:00   ` Eryu Guan
  1 sibling, 0 replies; 28+ messages in thread
From: Christoph Hellwig @ 2018-01-22 20:24 UTC (permalink / raw)
  To: Rostislav Skudnov; +Cc: fstests

On Mon, Jan 22, 2018 at 03:57:16PM +0000, Rostislav Skudnov wrote:
> u_int32_t type is defined in sys/types.h, which is often included by
> glibc implicitly when some other headers are used, but other C libraries
> such as musl may not necessarily do so, therefore an explicit include is
> needed.
> 
> Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

(alternatively we could switch to uint*_t types for consistency)

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

* Re: [PATCH v2 6/8] fssum: Use bswap_64() instead of __bswap_64()
  2018-01-22 15:57 ` [PATCH v2 6/8] fssum: Use bswap_64() instead of __bswap_64() Rostislav Skudnov
@ 2018-01-22 20:26   ` Christoph Hellwig
  2018-01-23  7:36     ` Rostislav
  0 siblings, 1 reply; 28+ messages in thread
From: Christoph Hellwig @ 2018-01-22 20:26 UTC (permalink / raw)
  To: Rostislav Skudnov; +Cc: fstests

On Mon, Jan 22, 2018 at 03:57:17PM +0000, Rostislav Skudnov wrote:
> Macros and functions starting with two underscores are usually internal
> and shouldn't be used by applications when a version without "__" is
> available.
> 
> Include byteswap.h explicitly since bswap_64() is defined there.

Shouldn't this use htobe64 instead?

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

* Re: [PATCH v2 7/8] t_mtab: Replace sys_siglist[] with strsignal()
  2018-01-22 15:57 ` [PATCH v2 7/8] t_mtab: Replace sys_siglist[] with strsignal() Rostislav Skudnov
@ 2018-01-22 20:26   ` Christoph Hellwig
  0 siblings, 0 replies; 28+ messages in thread
From: Christoph Hellwig @ 2018-01-22 20:26 UTC (permalink / raw)
  To: Rostislav Skudnov; +Cc: fstests

On Mon, Jan 22, 2018 at 03:57:18PM +0000, Rostislav Skudnov wrote:
> strsignal(3) says that strsignal() should be used instead of
> sys_siglist[].
> 
> Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH v2 8/8] pwrite_mmap_blocked: Include signal.h instead of sys/signal.h
  2018-01-22 15:57 ` [PATCH v2 8/8] pwrite_mmap_blocked: Include signal.h instead of sys/signal.h Rostislav Skudnov
@ 2018-01-22 20:26   ` Christoph Hellwig
  0 siblings, 0 replies; 28+ messages in thread
From: Christoph Hellwig @ 2018-01-22 20:26 UTC (permalink / raw)
  To: Rostislav Skudnov; +Cc: fstests

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH v2 1/8] fsstress: Include stddef.h for ptrdiff_t
  2018-01-22 15:57 ` [PATCH v2 1/8] fsstress: Include stddef.h for ptrdiff_t Rostislav Skudnov
  2018-01-22 20:21   ` Christoph Hellwig
@ 2018-01-23  4:01   ` Eryu Guan
  1 sibling, 0 replies; 28+ messages in thread
From: Eryu Guan @ 2018-01-23  4:01 UTC (permalink / raw)
  To: Rostislav Skudnov; +Cc: fstests

On Mon, Jan 22, 2018 at 03:57:12PM +0000, Rostislav Skudnov wrote:
> In musl C library headers ptrdiff_t is only defined in stddef.h.

It seems ptrdiff_t is only used to save the return value of xfsctl(),

	ptrdiff_t       srval;
	...
	srval = xfsctl(buf, fd, XFS_IOC_ERROR_INJECTION, &err_inj);

and xfsctl(3) shows that it returns an int.

	int xfsctl(const char *path, int fd, int cmd, void *ptr);

I think we could just change type of srval to int.

Thanks,
Eryu

>
> Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
> ---
>  ltp/fsstress.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> index 4dea029..63c2eb4 100644
> --- a/ltp/fsstress.c
> +++ b/ltp/fsstress.c
> @@ -19,6 +19,7 @@
>  #include <linux/fs.h>
>  #include <setjmp.h>
>  #include <sys/uio.h>
> +#include <stddef.h>
>  #include "global.h"
>  
>  #ifdef HAVE_ATTR_XATTR_H
> -- 
> 2.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 6/8] fssum: Use bswap_64() instead of __bswap_64()
  2018-01-22 20:26   ` Christoph Hellwig
@ 2018-01-23  7:36     ` Rostislav
  2018-01-23  7:44       ` Christoph Hellwig
  0 siblings, 1 reply; 28+ messages in thread
From: Rostislav @ 2018-01-23  7:36 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: fstests


> On Jan 22, 2018, at 10:26 PM, Christoph Hellwig <hch@infradead.org> wrote:
> 
> On Mon, Jan 22, 2018 at 03:57:17PM +0000, Rostislav Skudnov wrote:
>> Macros and functions starting with two underscores are usually internal
>> and shouldn't be used by applications when a version without "__" is
>> available.
>> 
>> Include byteswap.h explicitly since bswap_64() is defined there.
> 
> Shouldn't this use htobe64 instead?

Hello, Cristoph.

Thanks for your feedback! We can of course use htobe64(), but the file
src/fssum.c already defines htonll() in a way that takes endianness into
account, and using htobe64() would be equivalent to htonll(). My strategy when
writing this patch set was to make the least number of modifications required
to build with musl libc.

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

* Re: [PATCH v2 6/8] fssum: Use bswap_64() instead of __bswap_64()
  2018-01-23  7:36     ` Rostislav
@ 2018-01-23  7:44       ` Christoph Hellwig
  2018-01-23  8:08         ` [PATCH v3 6/8] fssum: Use htobe64() instead of a custom macro Rostislav Skudnov
  0 siblings, 1 reply; 28+ messages in thread
From: Christoph Hellwig @ 2018-01-23  7:44 UTC (permalink / raw)
  To: Rostislav; +Cc: Christoph Hellwig, fstests

On Tue, Jan 23, 2018 at 09:36:15AM +0200, Rostislav wrote:
> Thanks for your feedback! We can of course use htobe64(), but the file
> src/fssum.c already defines htonll() in a way that takes endianness into
> account, and using htobe64() would be equivalent to htonll(). My strategy when
> writing this patch set was to make the least number of modifications required
> to build with musl libc.

And normally our strategy in maintaining xfs related code is to do the
right thing even if it is a little more invasive.  Using htobe64 would
be the choice based on that.

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

* [PATCH v3 6/8] fssum: Use htobe64() instead of a custom macro
  2018-01-23  7:44       ` Christoph Hellwig
@ 2018-01-23  8:08         ` Rostislav Skudnov
  2018-01-23 11:21           ` Christoph Hellwig
  0 siblings, 1 reply; 28+ messages in thread
From: Rostislav Skudnov @ 2018-01-23  8:08 UTC (permalink / raw)
  To: hch; +Cc: fstests

Remove unnecessary htonll() macro definition.

Macros and functions starting with two underscores are usually internal
and shouldn't be used by applications when a version without "__" is
available.

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
---
Christoph, I agree with you about this. Using htobe64() is indeed the proper
function to use.
 src/fssum.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/fssum.c b/src/fssum.c
index 13111d6..2eaa236 100644
--- a/src/fssum.c
+++ b/src/fssum.c
@@ -40,6 +40,7 @@
 #include <netinet/in.h>
 #include <inttypes.h>
 #include <assert.h>
+#include <endian.h>
 
 #define CS_SIZE 16
 #define CHUNKS	128
@@ -49,12 +50,6 @@
 #define SEEK_DATA 3
 #define SEEK_HOLE 4
 #endif
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define htonll(x)     __bswap_64 (x)
-#else
-#define htonll(x)     (x)
-#endif
 #endif
 
 /* TODO: add hardlink recognition */
@@ -216,7 +211,7 @@ sum_add_sum(sum_t *dst, sum_t *src)
 void
 sum_add_u64(sum_t *dst, uint64_t val)
 {
-	uint64_t v = htonll(val);
+	uint64_t v = htobe64(val);
 	sum_add(dst, &v, sizeof(v));
 }
 
-- 
2.1.4


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

* Re: [PATCH v3 6/8] fssum: Use htobe64() instead of a custom macro
  2018-01-23  8:08         ` [PATCH v3 6/8] fssum: Use htobe64() instead of a custom macro Rostislav Skudnov
@ 2018-01-23 11:21           ` Christoph Hellwig
  0 siblings, 0 replies; 28+ messages in thread
From: Christoph Hellwig @ 2018-01-23 11:21 UTC (permalink / raw)
  To: Rostislav Skudnov; +Cc: hch, fstests

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH v2 4/8] metaperf: Include linux/param.h explicitly for HZ macro
  2018-01-22 20:24   ` Christoph Hellwig
@ 2018-01-24  3:58     ` Eryu Guan
  2018-01-25  0:02       ` Dave Chinner
  2018-01-27  3:16       ` Dave Chinner
  0 siblings, 2 replies; 28+ messages in thread
From: Eryu Guan @ 2018-01-24  3:58 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Rostislav Skudnov, fstests

On Mon, Jan 22, 2018 at 12:24:06PM -0800, Christoph Hellwig wrote:
> On Mon, Jan 22, 2018 at 03:57:15PM +0000, Rostislav Skudnov wrote:
> > Glibc includes linux/param.h when we include sys/param.h, whereas musl
> > libc does not do that. HZ is a Linux-specific macro, therefore include
> > the header file that defines it explicitly.
> > 
> > Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
> 
> Using HZ in userspace doesn't make any sense at all.  The kernel HZ
> (as in the granulairy for jiffies) can vary between architectures
> and even configurations.  I guess it wants a hard coded 100 here, but
> someone will have to do a detailed analysis.

No one is using metaperf now, all the old benchmark infrastructure was
removed by commit b020416d51ff ("xfstests: remove bench infrastructure")

I think we can remove src/metaperf.c too.

Thanks,
Eryu

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

* Re: [PATCH v2 5/8] dmiperf: Include sys/types.h for u_int32_t
  2018-01-22 15:57 ` [PATCH v2 5/8] dmiperf: Include sys/types.h for u_int32_t Rostislav Skudnov
  2018-01-22 20:24   ` Christoph Hellwig
@ 2018-01-24  4:00   ` Eryu Guan
  1 sibling, 0 replies; 28+ messages in thread
From: Eryu Guan @ 2018-01-24  4:00 UTC (permalink / raw)
  To: Rostislav Skudnov; +Cc: fstests

On Mon, Jan 22, 2018 at 03:57:16PM +0000, Rostislav Skudnov wrote:
> u_int32_t type is defined in sys/types.h, which is often included by
> glibc implicitly when some other headers are used, but other C libraries
> such as musl may not necessarily do so, therefore an explicit include is
> needed.
> 
> Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>

Hmm, no one is using dmiperf either, remove it too?

Thanks,
Eryu

> ---
>  src/dmiperf.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/dmiperf.c b/src/dmiperf.c
> index 245e529..359324a 100644
> --- a/src/dmiperf.c
> +++ b/src/dmiperf.c
> @@ -16,6 +16,7 @@
>   * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
>   */
>  
> +#include <sys/types.h>
>  #include <sys/param.h>
>  #include <sys/stat.h>
>  #include <sys/time.h>
> -- 
> 2.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 4/8] metaperf: Include linux/param.h explicitly for HZ macro
  2018-01-24  3:58     ` Eryu Guan
@ 2018-01-25  0:02       ` Dave Chinner
  2018-01-28 10:46         ` Eryu Guan
  2018-01-27  3:16       ` Dave Chinner
  1 sibling, 1 reply; 28+ messages in thread
From: Dave Chinner @ 2018-01-25  0:02 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Christoph Hellwig, Rostislav Skudnov, fstests

On Wed, Jan 24, 2018 at 11:58:59AM +0800, Eryu Guan wrote:
> On Mon, Jan 22, 2018 at 12:24:06PM -0800, Christoph Hellwig wrote:
> > On Mon, Jan 22, 2018 at 03:57:15PM +0000, Rostislav Skudnov wrote:
> > > Glibc includes linux/param.h when we include sys/param.h, whereas musl
> > > libc does not do that. HZ is a Linux-specific macro, therefore include
> > > the header file that defines it explicitly.
> > > 
> > > Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
> > 
> > Using HZ in userspace doesn't make any sense at all.  The kernel HZ
> > (as in the granulairy for jiffies) can vary between architectures
> > and even configurations.  I guess it wants a hard coded 100 here, but
> > someone will have to do a detailed analysis.
> 
> No one is using metaperf now, all the old benchmark infrastructure was
> removed by commit b020416d51ff ("xfstests: remove bench infrastructure")
> 
> I think we can remove src/metaperf.c too.

I use metaperf (and dirperf) quite regularly when testing my
patches, so I'd really like them to remin available on all my test
machines that have fstests installed....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH v2 4/8] metaperf: Include linux/param.h explicitly for HZ macro
  2018-01-24  3:58     ` Eryu Guan
  2018-01-25  0:02       ` Dave Chinner
@ 2018-01-27  3:16       ` Dave Chinner
  2018-01-27  3:56         ` Dave Chinner
  1 sibling, 1 reply; 28+ messages in thread
From: Dave Chinner @ 2018-01-27  3:16 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Christoph Hellwig, Rostislav Skudnov, fstests

On Wed, Jan 24, 2018 at 11:58:59AM +0800, Eryu Guan wrote:
> On Mon, Jan 22, 2018 at 12:24:06PM -0800, Christoph Hellwig wrote:
> > On Mon, Jan 22, 2018 at 03:57:15PM +0000, Rostislav Skudnov wrote:
> > > Glibc includes linux/param.h when we include sys/param.h, whereas musl
> > > libc does not do that. HZ is a Linux-specific macro, therefore include
> > > the header file that defines it explicitly.
> > > 
> > > Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
> > 
> > Using HZ in userspace doesn't make any sense at all.  The kernel HZ
> > (as in the granulairy for jiffies) can vary between architectures
> > and even configurations.  I guess it wants a hard coded 100 here, but
> > someone will have to do a detailed analysis.
> 
> No one is using metaperf now, all the old benchmark infrastructure was
> removed by commit b020416d51ff ("xfstests: remove bench infrastructure")
> 
> I think we can remove src/metaperf.c too.

FYI I use dirperf and metaperf for standalone ismoke testing of my
kernel changes quite a lot...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH v2 4/8] metaperf: Include linux/param.h explicitly for HZ macro
  2018-01-27  3:16       ` Dave Chinner
@ 2018-01-27  3:56         ` Dave Chinner
  0 siblings, 0 replies; 28+ messages in thread
From: Dave Chinner @ 2018-01-27  3:56 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Christoph Hellwig, Rostislav Skudnov, fstests

On Sat, Jan 27, 2018 at 02:16:59PM +1100, Dave Chinner wrote:
> On Wed, Jan 24, 2018 at 11:58:59AM +0800, Eryu Guan wrote:
> > On Mon, Jan 22, 2018 at 12:24:06PM -0800, Christoph Hellwig wrote:
> > > On Mon, Jan 22, 2018 at 03:57:15PM +0000, Rostislav Skudnov wrote:
> > > > Glibc includes linux/param.h when we include sys/param.h, whereas musl
> > > > libc does not do that. HZ is a Linux-specific macro, therefore include
> > > > the header file that defines it explicitly.
> > > > 
> > > > Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
> > > 
> > > Using HZ in userspace doesn't make any sense at all.  The kernel HZ
> > > (as in the granulairy for jiffies) can vary between architectures
> > > and even configurations.  I guess it wants a hard coded 100 here, but
> > > someone will have to do a detailed analysis.
> > 
> > No one is using metaperf now, all the old benchmark infrastructure was
> > removed by commit b020416d51ff ("xfstests: remove bench infrastructure")
> > 
> > I think we can remove src/metaperf.c too.
> 
> FYI I use dirperf and metaperf for standalone ismoke testing of my
> kernel changes quite a lot...

Sorry for the duplicate response, I thought it had been lost and
hadn't realised the mail queue on my laptop had got stuck a couple
of days ago...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH v2 4/8] metaperf: Include linux/param.h explicitly for HZ macro
  2018-01-25  0:02       ` Dave Chinner
@ 2018-01-28 10:46         ` Eryu Guan
  0 siblings, 0 replies; 28+ messages in thread
From: Eryu Guan @ 2018-01-28 10:46 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Christoph Hellwig, Rostislav Skudnov, fstests

On Thu, Jan 25, 2018 at 11:02:15AM +1100, Dave Chinner wrote:
> On Wed, Jan 24, 2018 at 11:58:59AM +0800, Eryu Guan wrote:
> > On Mon, Jan 22, 2018 at 12:24:06PM -0800, Christoph Hellwig wrote:
> > > On Mon, Jan 22, 2018 at 03:57:15PM +0000, Rostislav Skudnov wrote:
> > > > Glibc includes linux/param.h when we include sys/param.h, whereas musl
> > > > libc does not do that. HZ is a Linux-specific macro, therefore include
> > > > the header file that defines it explicitly.
> > > > 
> > > > Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
> > > 
> > > Using HZ in userspace doesn't make any sense at all.  The kernel HZ
> > > (as in the granulairy for jiffies) can vary between architectures
> > > and even configurations.  I guess it wants a hard coded 100 here, but
> > > someone will have to do a detailed analysis.
> > 
> > No one is using metaperf now, all the old benchmark infrastructure was
> > removed by commit b020416d51ff ("xfstests: remove bench infrastructure")
> > 
> > I think we can remove src/metaperf.c too.
> 
> I use metaperf (and dirperf) quite regularly when testing my
> patches, so I'd really like them to remin available on all my test
> machines that have fstests installed....

Thanks for the heads-up! Let's keep dmiperf.c and metaperf.c then.

I tend to take this patch as is for now to fix the build problem with
musl libc first. I think the "using HZ in userspace problem" is another
issue which can be fixed by a separate patch (if necessary and someone
has interest).

Thanks,
Eryu

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

end of thread, other threads:[~2018-01-28 10:46 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 15:57 [PATCH v2 0/8] Fix build with musl libc Rostislav Skudnov
2018-01-22 15:57 ` [PATCH v2 1/8] fsstress: Include stddef.h for ptrdiff_t Rostislav Skudnov
2018-01-22 20:21   ` Christoph Hellwig
2018-01-23  4:01   ` Eryu Guan
2018-01-22 15:57 ` [PATCH v2 2/8] Replace all __[u]intNN_t types with standard [u]intNN_t Rostislav Skudnov
2018-01-22 20:22   ` Christoph Hellwig
2018-01-22 15:57 ` [PATCH v2 3/8] doio, growfiles: Use standard signal name SIGCHLD instead of SIGCLD Rostislav Skudnov
2018-01-22 20:22   ` Christoph Hellwig
2018-01-22 15:57 ` [PATCH v2 4/8] metaperf: Include linux/param.h explicitly for HZ macro Rostislav Skudnov
2018-01-22 20:24   ` Christoph Hellwig
2018-01-24  3:58     ` Eryu Guan
2018-01-25  0:02       ` Dave Chinner
2018-01-28 10:46         ` Eryu Guan
2018-01-27  3:16       ` Dave Chinner
2018-01-27  3:56         ` Dave Chinner
2018-01-22 15:57 ` [PATCH v2 5/8] dmiperf: Include sys/types.h for u_int32_t Rostislav Skudnov
2018-01-22 20:24   ` Christoph Hellwig
2018-01-24  4:00   ` Eryu Guan
2018-01-22 15:57 ` [PATCH v2 6/8] fssum: Use bswap_64() instead of __bswap_64() Rostislav Skudnov
2018-01-22 20:26   ` Christoph Hellwig
2018-01-23  7:36     ` Rostislav
2018-01-23  7:44       ` Christoph Hellwig
2018-01-23  8:08         ` [PATCH v3 6/8] fssum: Use htobe64() instead of a custom macro Rostislav Skudnov
2018-01-23 11:21           ` Christoph Hellwig
2018-01-22 15:57 ` [PATCH v2 7/8] t_mtab: Replace sys_siglist[] with strsignal() Rostislav Skudnov
2018-01-22 20:26   ` Christoph Hellwig
2018-01-22 15:57 ` [PATCH v2 8/8] pwrite_mmap_blocked: Include signal.h instead of sys/signal.h Rostislav Skudnov
2018-01-22 20:26   ` Christoph Hellwig

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.