All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: fstests@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH] src/splice-test.c: use memalign instead of aligned_alloc
Date: Tue,  9 Feb 2021 16:57:15 +0100	[thread overview]
Message-ID: <20210209155715.28804-1-dsterba@suse.com> (raw)

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 <dsterba@suse.com>
---
 src/splice-test.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/splice-test.c b/src/splice-test.c
index 11fb11fa8cc3..2f1ba2baaff0 100644
--- a/src/splice-test.c
+++ b/src/splice-test.c
@@ -17,6 +17,7 @@
 #include <stdbool.h>
 #include <string.h>
 #include <errno.h>
+#include <malloc.h>
 
 #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)
-- 
2.29.2


             reply	other threads:[~2021-02-09 16:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 15:57 David Sterba [this message]
2021-02-09 16:32 ` [PATCH] src/splice-test.c: use memalign instead of aligned_alloc Darrick J. Wong
2021-02-09 17:36 ` Zorro Lang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210209155715.28804-1-dsterba@suse.com \
    --to=dsterba@suse.com \
    --cc=fstests@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.