public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Chung-Lin Tang <cltang@codesourcery.com>
To: Chris Metcalf <cmetcalf@tilera.com>,
	"Joseph S. Myers"	<joseph@codesourcery.com>
Cc: "libc-ports@sourceware.org" <libc-ports@sourceware.org>,
	Andrew Pinski	<pinskia@gmail.com>
Subject: Re: struct statfs/statfs64 in linux-generic
Date: Fri, 15 Nov 2013 07:39:00 -0000	[thread overview]
Message-ID: <5285CFA6.8020700@codesourcery.com> (raw)
In-Reply-To: <52851656.1070303@tilera.com>

[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]

On 13/11/15 2:28 AM, Chris Metcalf wrote:
> On 11/13/2013 11:34 PM, Chung-Lin Tang wrote:
>> On 13/11/13 8:58 PM, Joseph S. Myers wrote:
>>> On Wed, 13 Nov 2013, Chung-Lin Tang wrote:
>>>
>>>> 	(struct statfs): Use __alignof__(__u64) in alignment attribute
>>>> 	instead of 8.
>>>> 	(struct statfs64): Likewise.
>>> I don't like the use of __u64 here - that's a kernel type, not a glibc 
>>> one, and glibc headers shouldn't be using it.
>>>
>> Sure, how about __U64_TYPE? This seems in line with using __SWORD_TYPE
>> from <bits/types.h>
> 
> Looking at this, I wonder if we need the alignment attribute on the structure at all.  Given that the __field64 macro fields have that alignment attribute, the structure as a whole should also automatically have it, so it seems superfluous.  Does it work on nios2 if you remove the struct alignment directive?
> 
> The kernel version of the structure doesn't have any forced alignment on it.
> 

Yes, that works for nios2. Appears that struct stat/stat64 in
bits/stat.h doesn't have the struct alignment attributes either.
Updated patch attached.

Chung-Lin

2013-11-13  Chung-Lin Tang  <cltang@codesourcery.com>

	ports/
	* sysdeps/unix/sysv/linux/generic/bits/stat.h (__field64): Use
	__alignof__(type64) in alignment attribute instead of 8.
	* sysdeps/unix/sysv/linux/generic/bits/statfs.h (__field64): Use
	__alignof__(type64) in alignment attribute instead of 8.
	(struct statfs): Remove alignment attribute.
	(struct statfs64): Likewise.


[-- Attachment #2: x.diff --]
[-- Type: text/plain, Size: 1967 bytes --]

diff --git a/ports/sysdeps/unix/sysv/linux/generic/bits/stat.h b/ports/sysdeps/unix/sysv/linux/generic/bits/stat.h
index 6e74cec..feb5f2b 100644
--- a/ports/sysdeps/unix/sysv/linux/generic/bits/stat.h
+++ b/ports/sysdeps/unix/sysv/linux/generic/bits/stat.h
@@ -46,10 +46,10 @@
 # define __field64(type, type64, name) type name
 #elif __BYTE_ORDER == __LITTLE_ENDIAN
 # define __field64(type, type64, name) \
-  type name __attribute__((__aligned__(8))); int __##name##_pad
+  type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
 #else
 # define __field64(type, type64, name) \
-  int __##name##_pad __attribute__((__aligned__(8))); type name
+  int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
 #endif
 
 struct stat
diff --git a/ports/sysdeps/unix/sysv/linux/generic/bits/statfs.h b/ports/sysdeps/unix/sysv/linux/generic/bits/statfs.h
index 7063c7a..8aecb04 100644
--- a/ports/sysdeps/unix/sysv/linux/generic/bits/statfs.h
+++ b/ports/sysdeps/unix/sysv/linux/generic/bits/statfs.h
@@ -38,10 +38,10 @@
 # define __field64(type, type64, name) type name
 #elif __BYTE_ORDER == __LITTLE_ENDIAN
 # define __field64(type, type64, name) \
-  type name __attribute__((__aligned__(8))); int __##name##_pad
+  type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
 #else
 # define __field64(type, type64, name) \
-  int __##name##_pad __attribute__((__aligned__(8))); type name
+  int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
 #endif
 
 struct statfs
@@ -58,7 +58,7 @@ struct statfs
     __SWORD_TYPE f_frsize;
     __SWORD_TYPE f_flags;
     __SWORD_TYPE f_spare[4];
-  } __attribute__((__aligned__(8)));
+  };
 
 #undef __field64
 
@@ -77,7 +77,7 @@ struct statfs64
     __SWORD_TYPE f_frsize;
     __SWORD_TYPE f_flags;
     __SWORD_TYPE f_spare[4];
-  } __attribute__((__aligned__(8)));
+  };
 #endif
 
 /* Tell code we have these members.  */

  reply	other threads:[~2013-11-15  7:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04  7:18 Chung-Lin Tang
2013-11-04  8:19 ` Andrew Pinski
2013-11-05  4:23   ` Chung-Lin Tang
2013-11-07 19:55 ` Chris Metcalf
2013-11-10  8:24   ` Chung-Lin Tang
2013-11-11 17:48     ` Joseph S. Myers
2013-11-13  8:17       ` Chung-Lin Tang
2013-11-13 12:59         ` Joseph S. Myers
2013-11-14  4:34           ` Chung-Lin Tang
2013-11-14 13:36             ` Joseph S. Myers
2013-11-14 18:28             ` Chris Metcalf
2013-11-15  7:39               ` Chung-Lin Tang [this message]
2013-11-18 23:39                 ` Chris Metcalf
2013-11-19 13:50                   ` Chung-Lin Tang
2013-11-22  2:43                     ` Chris Metcalf

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=5285CFA6.8020700@codesourcery.com \
    --to=cltang@codesourcery.com \
    --cc=cmetcalf@tilera.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-ports@sourceware.org \
    --cc=pinskia@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).