mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Russell King <linux@arm.linux.org.uk>, linux-kernel@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH 1/8] arm: generalize IPC header files
Date: Wed,  6 Oct 2010 20:06:13 +0200	[thread overview]
Message-ID: <1286388380-20646-2-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1286388380-20646-1-git-send-email-arnd@arndb.de>

The IPC structure definitions in ARM are all compatible
with the generic definitions. Make them look identical
as a preparation for actually using the files in
include/asm-generic.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/include/asm/ipcbuf.h |   15 ++++++++++-----
 arch/arm/include/asm/msgbuf.h |   20 ++++++++++++++++++--
 arch/arm/include/asm/sembuf.h |   27 ++++++++++++++++++++-------
 arch/arm/include/asm/shmbuf.h |   21 +++++++++++++++++++--
 4 files changed, 67 insertions(+), 16 deletions(-)

diff --git a/arch/arm/include/asm/ipcbuf.h b/arch/arm/include/asm/ipcbuf.h
index 9768397..40e492d 100644
--- a/arch/arm/include/asm/ipcbuf.h
+++ b/arch/arm/include/asm/ipcbuf.h
@@ -2,24 +2,29 @@
 #define __ASMARM_IPCBUF_H
 
 /*
- * The ipc64_perm structure for arm architecture.
+ * The generic ipc64_perm structure:
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
  *
+ * ipc64_perm was originally meant to be architecture specific, but
+ * everyone just ended up making identical copies without specific
+ * optimizations, so we may just as well all use the same one.
+ *
  * Pad space is left for:
- * - 32-bit mode_t and seq
+ * - 32-bit mode_t on architectures that only had 16 bit
+ * - 32-bit seq
  * - 2 miscellaneous 32-bit values
  */
 
-struct ipc64_perm
-{
+struct ipc64_perm {
 	__kernel_key_t		key;
 	__kernel_uid32_t	uid;
 	__kernel_gid32_t	gid;
 	__kernel_uid32_t	cuid;
 	__kernel_gid32_t	cgid;
 	__kernel_mode_t		mode;
-	unsigned short		__pad1;
+				/* pad if mode_t is u16: */
+	unsigned char		__pad1[4 - sizeof(__kernel_mode_t)];
 	unsigned short		seq;
 	unsigned short		__pad2;
 	unsigned long		__unused1;
diff --git a/arch/arm/include/asm/msgbuf.h b/arch/arm/include/asm/msgbuf.h
index 33b35b9..ca4e383 100644
--- a/arch/arm/include/asm/msgbuf.h
+++ b/arch/arm/include/asm/msgbuf.h
@@ -1,11 +1,21 @@
 #ifndef _ASMARM_MSGBUF_H
 #define _ASMARM_MSGBUF_H
 
-/* 
- * The msqid64_ds structure for arm architecture.
+#include <asm/bitsperlong.h>
+/*
+ * generic msqid64_ds structure.
+ *
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
  *
+ * msqid64_ds was originally meant to be architecture specific, but
+ * everyone just ended up making identical copies without specific
+ * optimizations, so we may just as well all use the same one.
+ *
+ * 64 bit architectures typically define a 64 bit __kernel_time_t,
+ * so they do not need the first three padding words.
+ * On big-endian systems, the padding is in the wrong place.
+ *
  * Pad space is left for:
  * - 64-bit time_t to solve y2038 problem
  * - 2 miscellaneous 32-bit values
@@ -14,11 +24,17 @@
 struct msqid64_ds {
 	struct ipc64_perm msg_perm;
 	__kernel_time_t msg_stime;	/* last msgsnd time */
+#if __BITS_PER_LONG != 64
 	unsigned long	__unused1;
+#endif
 	__kernel_time_t msg_rtime;	/* last msgrcv time */
+#if __BITS_PER_LONG != 64
 	unsigned long	__unused2;
+#endif
 	__kernel_time_t msg_ctime;	/* last change time */
+#if __BITS_PER_LONG != 64
 	unsigned long	__unused3;
+#endif
 	unsigned long  msg_cbytes;	/* current number of bytes on queue */
 	unsigned long  msg_qnum;	/* number of messages in queue */
 	unsigned long  msg_qbytes;	/* max number of bytes on queue */
diff --git a/arch/arm/include/asm/sembuf.h b/arch/arm/include/asm/sembuf.h
index 1c02839..f7131b7 100644
--- a/arch/arm/include/asm/sembuf.h
+++ b/arch/arm/include/asm/sembuf.h
@@ -1,23 +1,36 @@
 #ifndef _ASMARM_SEMBUF_H
 #define _ASMARM_SEMBUF_H
 
-/* 
- * The semid64_ds structure for arm architecture.
+#include <asm/bitsperlong.h>
+
+/*
+ * The semid64_ds structure for x86 architecture.
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
  *
+ * semid64_ds was originally meant to be architecture specific, but
+ * everyone just ended up making identical copies without specific
+ * optimizations, so we may just as well all use the same one.
+ *
+ * 64 bit architectures typically define a 64 bit __kernel_time_t,
+ * so they do not need the first two padding words.
+ * On big-endian systems, the padding is in the wrong place.
+ *
  * Pad space is left for:
  * - 64-bit time_t to solve y2038 problem
  * - 2 miscellaneous 32-bit values
  */
-
 struct semid64_ds {
-	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */
-	__kernel_time_t	sem_otime;		/* last semop time */
+	struct ipc64_perm sem_perm;	/* permissions .. see ipc.h */
+	__kernel_time_t	sem_otime;	/* last semop time */
+#if __BITS_PER_LONG != 64
 	unsigned long	__unused1;
-	__kernel_time_t	sem_ctime;		/* last change time */
+#endif
+	__kernel_time_t	sem_ctime;	/* last change time */
+#if __BITS_PER_LONG != 64
 	unsigned long	__unused2;
-	unsigned long	sem_nsems;		/* no. of semaphores in array */
+#endif
+	unsigned long	sem_nsems;	/* no. of semaphores in array */
 	unsigned long	__unused3;
 	unsigned long	__unused4;
 };
diff --git a/arch/arm/include/asm/shmbuf.h b/arch/arm/include/asm/shmbuf.h
index 2e5c67b..39b1ab0 100644
--- a/arch/arm/include/asm/shmbuf.h
+++ b/arch/arm/include/asm/shmbuf.h
@@ -1,11 +1,22 @@
 #ifndef _ASMARM_SHMBUF_H
 #define _ASMARM_SHMBUF_H
 
-/* 
- * The shmid64_ds structure for arm architecture.
+#include <asm/bitsperlong.h>
+
+/*
+ * The shmid64_ds structure for x86 architecture.
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
  *
+ * shmid64_ds was originally meant to be architecture specific, but
+ * everyone just ended up making identical copies without specific
+ * optimizations, so we may just as well all use the same one.
+ *
+ * 64 bit architectures typically define a 64 bit __kernel_time_t,
+ * so they do not need the first two padding words.
+ * On big-endian systems, the padding is in the wrong place.
+ *
+ *
  * Pad space is left for:
  * - 64-bit time_t to solve y2038 problem
  * - 2 miscellaneous 32-bit values
@@ -15,11 +26,17 @@ struct shmid64_ds {
 	struct ipc64_perm	shm_perm;	/* operation perms */
 	size_t			shm_segsz;	/* size of segment (bytes) */
 	__kernel_time_t		shm_atime;	/* last attach time */
+#if __BITS_PER_LONG != 64
 	unsigned long		__unused1;
+#endif
 	__kernel_time_t		shm_dtime;	/* last detach time */
+#if __BITS_PER_LONG != 64
 	unsigned long		__unused2;
+#endif
 	__kernel_time_t		shm_ctime;	/* last change time */
+#if __BITS_PER_LONG != 64
 	unsigned long		__unused3;
+#endif
 	__kernel_pid_t		shm_cpid;	/* pid of creator */
 	__kernel_pid_t		shm_lpid;	/* pid of last operator */
 	unsigned long		shm_nattch;	/* no. of current attaches */
-- 
1.7.1


  reply	other threads:[~2010-10-06 18:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-06 18:06 [PATCH 0/8] arm: use generic header files where possible Arnd Bergmann
2010-10-06 18:06 ` Arnd Bergmann [this message]
2010-10-06 18:06 ` [PATCH 2/8] arm: trivial changes to make headers more generic Arnd Bergmann
2010-10-06 18:06 ` [PATCH 3/8] arm: remove unused asm/segment.h contents Arnd Bergmann
2010-10-06 18:06 ` [PATCH 4/8] arm: make asm/ioctls.h mostly generic Arnd Bergmann
2010-10-06 18:06 ` [PATCH 5/8] arm: generalize asm/posix_types.h Arnd Bergmann
2010-10-06 18:06 ` [PATCH 6/8] arm: generalize asm/signal.h Arnd Bergmann
2010-10-06 18:06 ` [PATCH 7/8] arm: generalize asm/termios.h Arnd Bergmann
2010-10-06 18:06 ` [PATCH 8/8] arm: remove generic asm header file contents Arnd Bergmann

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=1286388380-20646-2-git-send-email-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /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

all inboxes | Powered by JetHome®