linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] asm-generic headers: modify stat.h in include/asm-generic to be applicable to more architectures
@ 2011-01-08 13:23 Guan Xuetao
  2011-01-09  0:28 ` Arnd Bergmann
  0 siblings, 1 reply; 6+ messages in thread
From: Guan Xuetao @ 2011-01-08 13:23 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arch, linux-kernel

From: Guan Xuetao <guanxuetao@mprc.pku.edu.cn>

 This patch modifies stat.h in include/asm-generic to be applicable to more architectures.
 STAT64_HAS_BROKEN_ST_INO is defined in most architecture's asm/stat.h, and it need 
 32-bit __st_ino member to be defined in different position of 64-bit st_ino member.
 STAT64_PAD_BEFORE_ST_SIZE is the pad before st_size member, with default value 8 bytes.
 STAT64_PAD_BEFORE_ST_BLOCKS is the pad before st_blocks member, with default value
 4 bytes to align the following member to 64-bit.

Signed-off-by: Guan Xuetao <guanxuetao@mprc.pku.edu.cn>
---
 include/asm-generic/stat.h |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/stat.h b/include/asm-generic/stat.h
index bd8cad2..82d1108 100644
--- a/include/asm-generic/stat.h
+++ b/include/asm-generic/stat.h
@@ -45,18 +45,36 @@ struct stat {
 
 /* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
 #if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64)
+
+#ifndef STAT64_PAD_BEFORE_ST_SIZE
+#define STAT64_PAD_BEFORE_ST_SIZE	8
+#endif
+
+#ifndef STAT64_PAD_BEFORE_ST_BLOCKS
+#define STAT64_PAD_BEFORE_ST_BLOCKS	4
+#endif
+
 struct stat64 {
 	unsigned long long st_dev;	/* Device.  */
+#ifndef STAT64_HAS_BROKEN_ST_INO
 	unsigned long long st_ino;	/* File serial number.  */
+#else /* STAT64_HAS_BROKEN_ST_INO */
+	unsigned int	__unused1;	/* aligned to 64-bit. */
+	unsigned int	__st_ino;	/* File serial number.  */
+#endif /* STAT64_HAS_BROKEN_ST_INO */
 	unsigned int	st_mode;	/* File mode.  */
 	unsigned int	st_nlink;	/* Link count.  */
 	unsigned int	st_uid;		/* User ID of the file's owner.  */
 	unsigned int	st_gid;		/* Group ID of the file's group. */
 	unsigned long long st_rdev;	/* Device number, if device.  */
-	unsigned long long __pad1;
+#if STAT64_PAD_BEFORE_ST_SIZE != 0
+	unsigned char	__unused2[STAT64_PAD_BEFORE_ST_SIZE];
+#endif
 	long long	st_size;	/* Size of file, in bytes.  */
 	int		st_blksize;	/* Optimal block size for I/O.  */
-	int		__pad2;
+#if STAT64_PAD_BEFORE_ST_BLOCKS != 0
+	unsigned char	__unused3[STAT64_PAD_BEFORE_ST_BLOCKS];
+#endif
 	long long	st_blocks;	/* Number 512-byte blocks allocated. */
 	int		st_atime;	/* Time of last access.  */
 	unsigned int	st_atime_nsec;
@@ -64,8 +82,12 @@ struct stat64 {
 	unsigned int	st_mtime_nsec;
 	int		st_ctime;	/* Time of last status change.  */
 	unsigned int	st_ctime_nsec;
+#ifndef STAT64_HAS_BROKEN_ST_INO
 	unsigned int	__unused4;
 	unsigned int	__unused5;
+#else /* STAT64_HAS_BROKEN_ST_INO */
+	unsigned long long st_ino;	/* File serial number.  */
+#endif /* STAT64_HAS_BROKEN_ST_INO */
 };
 #endif



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

end of thread, other threads:[~2011-01-17  4:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-08 13:23 [PATCH] asm-generic headers: modify stat.h in include/asm-generic to be applicable to more architectures Guan Xuetao
2011-01-09  0:28 ` Arnd Bergmann
2011-01-10 13:58   ` Guan Xuetao
2011-01-11  4:40     ` Arnd Bergmann
2011-01-11  8:50       ` Guan Xuetao
     [not found]   ` <lapr25MsLHA.5972@exchange1.tad.internal.tilera.com>
2011-01-17  4:27     ` Chris Metcalf

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 NNTP newsgroup(s).