public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] src/t_attr_corruption: covert value to little endian order
@ 2019-04-09  4:54 Zorro Lang
  2019-04-09  6:01 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Zorro Lang @ 2019-04-09  4:54 UTC (permalink / raw)
  To: fstests

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

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

* Re: [PATCH] src/t_attr_corruption: covert value to little endian order
  2019-04-09  4:54 [PATCH] src/t_attr_corruption: covert value to little endian order Zorro Lang
@ 2019-04-09  6:01 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2019-04-09  6:01 UTC (permalink / raw)
  To: Zorro Lang; +Cc: fstests

On Tue, Apr 09, 2019 at 12:54:04PM +0800, Zorro Lang wrote:
> 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>

Heh, seems ok... :)

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  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
> 

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

end of thread, other threads:[~2019-04-09  6:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-09  4:54 [PATCH] src/t_attr_corruption: covert value to little endian order Zorro Lang
2019-04-09  6:01 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox