4 * (C) Copyright 2006 IBM Corp.
6 * Author: Dwayne Grant McConnell <decimal@us.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.
23 #include <linux/file.h>
24 #include <linux/module.h>
25 #include <linux/syscalls.h>
29 static struct spu_coredump_calls spu_coredump_calls;
30 static DEFINE_MUTEX(spu_coredump_mutex);
32 int arch_notes_size(void)
35 struct module *owner = spu_coredump_calls.owner;
38 mutex_lock(&spu_coredump_mutex);
39 if (owner && try_module_get(owner)) {
40 ret = spu_coredump_calls.arch_notes_size();
43 mutex_unlock(&spu_coredump_mutex);
47 void arch_write_notes(struct file *file)
49 struct module *owner = spu_coredump_calls.owner;
51 mutex_lock(&spu_coredump_mutex);
52 if (owner && try_module_get(owner)) {
53 spu_coredump_calls.arch_write_notes(file);
56 mutex_unlock(&spu_coredump_mutex);
59 int register_arch_coredump_calls(struct spu_coredump_calls *calls)
61 if (spu_coredump_calls.owner)
64 mutex_lock(&spu_coredump_mutex);
65 spu_coredump_calls.arch_notes_size = calls->arch_notes_size;
66 spu_coredump_calls.arch_write_notes = calls->arch_write_notes;
67 spu_coredump_calls.owner = calls->owner;
68 mutex_unlock(&spu_coredump_mutex);
71 EXPORT_SYMBOL_GPL(register_arch_coredump_calls);
73 void unregister_arch_coredump_calls(struct spu_coredump_calls *calls)
75 BUG_ON(spu_coredump_calls.owner != calls->owner);
77 mutex_lock(&spu_coredump_mutex);
78 spu_coredump_calls.owner = NULL;
79 mutex_unlock(&spu_coredump_mutex);
81 EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls);