Re: [PATCH 11/15] Combine spufs_coredump_calls with spufs_calls

2007-09-12 Thread Arnd Bergmann
On Wednesday 12 September 2007, Michael Ellerman wrote:
> Because spufs might be built as a module, we can't have other parts of the
> kernel calling directly into it, we need stub routines that check first if the
> module is loaded.
> 
> Currently we have two structures which hold callbacks for these stubs, the
> syscalls are in spufs_calls and the coredump calls are in 
> spufs_coredump_calls.
> In both cases the logic for registering/unregistering is essentially the same,
> so we can simplify things by combining the two.

Nice cleanup!

> Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>

Acked-by: Arnd Bergmann <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/15] Combine spufs_coredump_calls with spufs_calls

2007-09-12 Thread Michael Ellerman
Because spufs might be built as a module, we can't have other parts of the
kernel calling directly into it, we need stub routines that check first if the
module is loaded.

Currently we have two structures which hold callbacks for these stubs, the
syscalls are in spufs_calls and the coredump calls are in spufs_coredump_calls.
In both cases the logic for registering/unregistering is essentially the same,
so we can simplify things by combining the two.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/cell/Makefile |2 +-
 arch/powerpc/platforms/cell/spu_coredump.c   |   83 --
 arch/powerpc/platforms/cell/spu_syscalls.c   |   30 +
 arch/powerpc/platforms/cell/spufs/coredump.c |   10 +---
 arch/powerpc/platforms/cell/spufs/inode.c|6 --
 arch/powerpc/platforms/cell/spufs/spufs.h|4 +
 arch/powerpc/platforms/cell/spufs/syscalls.c |2 +
 include/asm-powerpc/spu.h|   12 +---
 8 files changed, 41 insertions(+), 108 deletions(-)

diff --git a/arch/powerpc/platforms/cell/Makefile 
b/arch/powerpc/platforms/cell/Makefile
index 40f78e9..61d12f1 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -19,7 +19,7 @@ spu-manage-$(CONFIG_PPC_CELLEB)   += spu_manage.o
 spu-manage-$(CONFIG_PPC_CELL_NATIVE)   += spu_manage.o
 
 obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \
-  spu_coredump.o spu_syscalls.o \
+  spu_syscalls.o \
   $(spu-priv1-y) \
   $(spu-manage-y) \
   spufs/
diff --git a/arch/powerpc/platforms/cell/spu_coredump.c 
b/arch/powerpc/platforms/cell/spu_coredump.c
deleted file mode 100644
index 656a8c5..000
--- a/arch/powerpc/platforms/cell/spu_coredump.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SPU core dump code
- *
- * (C) Copyright 2006 IBM Corp.
- *
- * Author: Dwayne Grant McConnell <[EMAIL PROTECTED]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include 
-#include 
-#include 
-
-#include 
-
-static struct spu_coredump_calls *spu_coredump_calls;
-static DEFINE_MUTEX(spu_coredump_mutex);
-
-int arch_notes_size(void)
-{
-   int ret;
-
-   mutex_lock(_coredump_mutex);
-
-   if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
-   ret = spu_coredump_calls->arch_notes_size();
-   module_put(spu_coredump_calls->owner);
-   } else {
-   ret = 0;
-   }
-
-   mutex_unlock(_coredump_mutex);
-
-   return ret;
-}
-
-void arch_write_notes(struct file *file)
-{
-   mutex_lock(_coredump_mutex);
-   if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
-   spu_coredump_calls->arch_write_notes(file);
-   module_put(spu_coredump_calls->owner);
-   }
-   mutex_unlock(_coredump_mutex);
-}
-
-int register_arch_coredump_calls(struct spu_coredump_calls *calls)
-{
-   int ret = 0;
-
-
-   mutex_lock(_coredump_mutex);
-   if (spu_coredump_calls)
-   ret = -EBUSY;
-   else
-   spu_coredump_calls = calls;
-   mutex_unlock(_coredump_mutex);
-   return ret;
-}
-EXPORT_SYMBOL_GPL(register_arch_coredump_calls);
-
-void unregister_arch_coredump_calls(struct spu_coredump_calls *calls)
-{
-   BUG_ON(spu_coredump_calls != calls);
-
-   mutex_lock(_coredump_mutex);
-   spu_coredump_calls = NULL;
-   mutex_unlock(_coredump_mutex);
-}
-EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls);
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c 
b/arch/powerpc/platforms/cell/spu_syscalls.c
index 76815c5..cf00251 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -2,6 +2,7 @@
  * SPU file system -- system call stubs
  *
  * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
+ * (C) Copyright 2006-2007, IBM Corporation
  *
  * Author: Arnd Bergmann <[EMAIL PROTECTED]>
  *
@@ -108,6 +109,35 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, 
__u32 __user *ustatus)
return ret;
 }
 
+int arch_notes_size(void)
+{
+   struct spufs_calls 

[PATCH 11/15] Combine spufs_coredump_calls with spufs_calls

2007-09-12 Thread Michael Ellerman
Because spufs might be built as a module, we can't have other parts of the
kernel calling directly into it, we need stub routines that check first if the
module is loaded.

Currently we have two structures which hold callbacks for these stubs, the
syscalls are in spufs_calls and the coredump calls are in spufs_coredump_calls.
In both cases the logic for registering/unregistering is essentially the same,
so we can simplify things by combining the two.

Signed-off-by: Michael Ellerman [EMAIL PROTECTED]
---
 arch/powerpc/platforms/cell/Makefile |2 +-
 arch/powerpc/platforms/cell/spu_coredump.c   |   83 --
 arch/powerpc/platforms/cell/spu_syscalls.c   |   30 +
 arch/powerpc/platforms/cell/spufs/coredump.c |   10 +---
 arch/powerpc/platforms/cell/spufs/inode.c|6 --
 arch/powerpc/platforms/cell/spufs/spufs.h|4 +
 arch/powerpc/platforms/cell/spufs/syscalls.c |2 +
 include/asm-powerpc/spu.h|   12 +---
 8 files changed, 41 insertions(+), 108 deletions(-)

diff --git a/arch/powerpc/platforms/cell/Makefile 
b/arch/powerpc/platforms/cell/Makefile
index 40f78e9..61d12f1 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -19,7 +19,7 @@ spu-manage-$(CONFIG_PPC_CELLEB)   += spu_manage.o
 spu-manage-$(CONFIG_PPC_CELL_NATIVE)   += spu_manage.o
 
 obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \
-  spu_coredump.o spu_syscalls.o \
+  spu_syscalls.o \
   $(spu-priv1-y) \
   $(spu-manage-y) \
   spufs/
diff --git a/arch/powerpc/platforms/cell/spu_coredump.c 
b/arch/powerpc/platforms/cell/spu_coredump.c
deleted file mode 100644
index 656a8c5..000
--- a/arch/powerpc/platforms/cell/spu_coredump.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SPU core dump code
- *
- * (C) Copyright 2006 IBM Corp.
- *
- * Author: Dwayne Grant McConnell [EMAIL PROTECTED]
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include linux/file.h
-#include linux/module.h
-#include linux/syscalls.h
-
-#include asm/spu.h
-
-static struct spu_coredump_calls *spu_coredump_calls;
-static DEFINE_MUTEX(spu_coredump_mutex);
-
-int arch_notes_size(void)
-{
-   int ret;
-
-   mutex_lock(spu_coredump_mutex);
-
-   if (spu_coredump_calls  try_module_get(spu_coredump_calls-owner)) {
-   ret = spu_coredump_calls-arch_notes_size();
-   module_put(spu_coredump_calls-owner);
-   } else {
-   ret = 0;
-   }
-
-   mutex_unlock(spu_coredump_mutex);
-
-   return ret;
-}
-
-void arch_write_notes(struct file *file)
-{
-   mutex_lock(spu_coredump_mutex);
-   if (spu_coredump_calls  try_module_get(spu_coredump_calls-owner)) {
-   spu_coredump_calls-arch_write_notes(file);
-   module_put(spu_coredump_calls-owner);
-   }
-   mutex_unlock(spu_coredump_mutex);
-}
-
-int register_arch_coredump_calls(struct spu_coredump_calls *calls)
-{
-   int ret = 0;
-
-
-   mutex_lock(spu_coredump_mutex);
-   if (spu_coredump_calls)
-   ret = -EBUSY;
-   else
-   spu_coredump_calls = calls;
-   mutex_unlock(spu_coredump_mutex);
-   return ret;
-}
-EXPORT_SYMBOL_GPL(register_arch_coredump_calls);
-
-void unregister_arch_coredump_calls(struct spu_coredump_calls *calls)
-{
-   BUG_ON(spu_coredump_calls != calls);
-
-   mutex_lock(spu_coredump_mutex);
-   spu_coredump_calls = NULL;
-   mutex_unlock(spu_coredump_mutex);
-}
-EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls);
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c 
b/arch/powerpc/platforms/cell/spu_syscalls.c
index 76815c5..cf00251 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -2,6 +2,7 @@
  * SPU file system -- system call stubs
  *
  * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
+ * (C) Copyright 2006-2007, IBM Corporation
  *
  * Author: Arnd Bergmann [EMAIL PROTECTED]
  *
@@ -108,6 +109,35 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, 
__u32 __user *ustatus)
return ret;
 }
 

Re: [PATCH 11/15] Combine spufs_coredump_calls with spufs_calls

2007-09-12 Thread Arnd Bergmann
On Wednesday 12 September 2007, Michael Ellerman wrote:
 Because spufs might be built as a module, we can't have other parts of the
 kernel calling directly into it, we need stub routines that check first if the
 module is loaded.
 
 Currently we have two structures which hold callbacks for these stubs, the
 syscalls are in spufs_calls and the coredump calls are in 
 spufs_coredump_calls.
 In both cases the logic for registering/unregistering is essentially the same,
 so we can simplify things by combining the two.

Nice cleanup!

 Signed-off-by: Michael Ellerman [EMAIL PROTECTED]

Acked-by: Arnd Bergmann [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/