public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@redhat.com>
To: fstests@vger.kernel.org
Subject: [PATCH] src/t_attr_corruption: covert value to little endian order
Date: Tue,  9 Apr 2019 12:54:04 +0800	[thread overview]
Message-ID: <20190409045404.20215-1-zlang@redhat.com> (raw)

generic/529 always fails on ppc64 or s390x big-endian machine as:

  set posix acl: Operation not supported

Due to the members of struct posix_acl_xattr_entry/header need to be
little-endian byte order, so use htole*() helper to make sure that.

Signed-off-by: Zorro Lang <zlang@redhat.com>
---
 src/t_attr_corruption.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/t_attr_corruption.c b/src/t_attr_corruption.c
index 9101024e..e7d435b1 100644
--- a/src/t_attr_corruption.c
+++ b/src/t_attr_corruption.c
@@ -32,6 +32,7 @@
 #include <stdint.h>
 #include <unistd.h>
 #include <sys/xattr.h>
+#include <endian.h>
 
 void die(const char *msg)
 {
@@ -52,13 +53,14 @@ struct myacl {
 
 int main(int argc, char *argv[])
 {
+	/* posix_acl_xattr_entry/header need little-endian order */
 	struct myacl acl = {
-		.d = 2,
+		.d = htole32(2),
 		.e = {
-			{1, 0, 0},
-			{4, 0, 0},
-			{0x10, 0, 0},
-			{0x20, 0, 0},
+			{htole16(1), 0, 0},
+			{htole16(4), 0, 0},
+			{htole16(0x10), 0, 0},
+			{htole16(0x20), 0, 0},
 		},
 	};
 	char buf[64];
-- 
2.17.2

             reply	other threads:[~2019-04-09  4:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09  4:54 Zorro Lang [this message]
2019-04-09  6:01 ` [PATCH] src/t_attr_corruption: covert value to little endian order Darrick J. Wong

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=20190409045404.20215-1-zlang@redhat.com \
    --to=zlang@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox