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)
37 mutex_lock(&spu_coredump_mutex
);
38 if (spu_coredump_calls
&& try_module_get(spu_coredump_calls
->owner
)) {
39 ret
= spu_coredump_calls
->arch_notes_size();
40 module_put(spu_coredump_calls
->owner
);
42 mutex_unlock(&spu_coredump_mutex
);
46 void arch_write_notes(struct file
*file
)
48 mutex_lock(&spu_coredump_mutex
);
49 if (spu_coredump_calls
&& try_module_get(spu_coredump_calls
->owner
)) {
50 spu_coredump_calls
->arch_write_notes(file
);
51 module_put(spu_coredump_calls
->owner
);
53 mutex_unlock(&spu_coredump_mutex
);
56 int register_arch_coredump_calls(struct spu_coredump_calls
*calls
)
61 mutex_lock(&spu_coredump_mutex
);
62 if (spu_coredump_calls
)
65 spu_coredump_calls
= calls
;
66 mutex_unlock(&spu_coredump_mutex
);
69 EXPORT_SYMBOL_GPL(register_arch_coredump_calls
);
71 void unregister_arch_coredump_calls(struct spu_coredump_calls
*calls
)
73 BUG_ON(spu_coredump_calls
!= calls
);
75 mutex_lock(&spu_coredump_mutex
);
76 spu_coredump_calls
= NULL
;
77 mutex_unlock(&spu_coredump_mutex
);
79 EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls
);