2 * SPU file system -- system call stubs
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
6 * Author: Arnd Bergmann <arndb@de.ibm.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <linux/file.h>
23 #include <linux/module.h>
24 #include <linux/syscalls.h>
28 struct spufs_calls spufs_calls = {
32 /* These stub syscalls are needed to have the actual implementation
33 * within a loadable module. When spufs is built into the kernel,
34 * this file is not used and the syscalls directly enter the fs code */
36 asmlinkage long sys_spu_create(const char __user *name,
37 unsigned int flags, mode_t mode)
42 if (try_module_get(spufs_calls.owner)) {
43 ret = spufs_calls.create_thread(name, flags, mode);
44 module_put(spufs_calls.owner);
49 asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus)
56 if (try_module_get(spufs_calls.owner)) {
58 filp = fget_light(fd, &fput_needed);
60 ret = spufs_calls.spu_run(filp, unpc, ustatus);
61 fput_light(filp, fput_needed);
63 module_put(spufs_calls.owner);
68 int register_spu_syscalls(struct spufs_calls *calls)
70 if (spufs_calls.owner)
73 spufs_calls.create_thread = calls->create_thread;
74 spufs_calls.spu_run = calls->spu_run;
76 spufs_calls.owner = calls->owner;
79 EXPORT_SYMBOL_GPL(register_spu_syscalls);
81 void unregister_spu_syscalls(struct spufs_calls *calls)
83 BUG_ON(spufs_calls.owner != calls->owner);
84 spufs_calls.owner = NULL;
86 EXPORT_SYMBOL_GPL(unregister_spu_syscalls);