From: David Sterba Date: Tue, 9 Feb 2021 15:57:15 +0000 (+0100) Subject: src/splice-test.c: use memalign instead of aligned_alloc X-Git-Tag: v2022.05.01~562 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=48aa331f2181f298ea76a88ae3d114093057632a;p=xfstests-dev.git src/splice-test.c: use memalign instead of aligned_alloc The build fails on SLE11 as the function aligned_alloc is not available there. Replace it by memalign that has the same semantics and is commonly used in fstests code base. aligned_alloc has additional requirements on the alignment and buffer size but that is ok as the buffer is defined in multiples of the alignment. Signed-off-by: David Sterba Reviewed-by: Darrick J. Wong Reviewed-by: Zorro Lang Signed-off-by: Eryu Guan --- diff --git a/src/splice-test.c b/src/splice-test.c index 11fb11fa..2f1ba2ba 100644 --- a/src/splice-test.c +++ b/src/splice-test.c @@ -17,6 +17,7 @@ #include #include #include +#include #define SECTOR_SIZE 512 #define BUFFER_SIZE (150 * SECTOR_SIZE) @@ -143,9 +144,9 @@ int main(int argc, char *argv[]) do_splice == do_splice1 ? "sequential" : "concurrent", (open_flags & O_DIRECT) ? "with" : "without"); - buffer = aligned_alloc(SECTOR_SIZE, BUFFER_SIZE); + buffer = memalign(SECTOR_SIZE, BUFFER_SIZE); if (buffer == NULL) - err(1, "aligned_alloc"); + err(1, "memalign"); fd = open(filename, open_flags, 0666); if (fd == -1)