4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2013, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
37 #define DEBUG_SUBSYSTEM S_LNET
38 #include <linux/module.h>
39 #include <linux/kernel.h>
40 #include <linux/fs_struct.h>
41 #include <linux/sched.h>
43 #include <libcfs/libcfs.h>
45 #if defined(CONFIG_KGDB)
49 void cfs_init_timer(struct timer_list *t)
53 EXPORT_SYMBOL(cfs_init_timer);
55 void cfs_timer_init(struct timer_list *t, cfs_timer_func_t *func, void *arg)
59 t->data = (unsigned long)arg;
61 EXPORT_SYMBOL(cfs_timer_init);
63 void cfs_timer_done(struct timer_list *t)
67 EXPORT_SYMBOL(cfs_timer_done);
69 void cfs_timer_arm(struct timer_list *t, cfs_time_t deadline)
71 mod_timer(t, deadline);
73 EXPORT_SYMBOL(cfs_timer_arm);
75 void cfs_timer_disarm(struct timer_list *t)
79 EXPORT_SYMBOL(cfs_timer_disarm);
81 int cfs_timer_is_armed(struct timer_list *t)
83 return timer_pending(t);
85 EXPORT_SYMBOL(cfs_timer_is_armed);
87 cfs_time_t cfs_timer_deadline(struct timer_list *t)
91 EXPORT_SYMBOL(cfs_timer_deadline);
93 void cfs_enter_debugger(void)
95 #if defined(CONFIG_KGDB)
101 EXPORT_SYMBOL(cfs_enter_debugger);
104 cfs_block_allsigs(void)
109 spin_lock_irqsave(¤t->sighand->siglock, flags);
110 old = current->blocked;
111 sigfillset(¤t->blocked);
113 spin_unlock_irqrestore(¤t->sighand->siglock, flags);
116 EXPORT_SYMBOL(cfs_block_allsigs);
118 sigset_t cfs_block_sigs(unsigned long sigs)
123 spin_lock_irqsave(¤t->sighand->siglock, flags);
124 old = current->blocked;
125 sigaddsetmask(¤t->blocked, sigs);
127 spin_unlock_irqrestore(¤t->sighand->siglock, flags);
130 EXPORT_SYMBOL(cfs_block_sigs);
132 /* Block all signals except for the @sigs */
133 sigset_t cfs_block_sigsinv(unsigned long sigs)
138 spin_lock_irqsave(¤t->sighand->siglock, flags);
139 old = current->blocked;
140 sigaddsetmask(¤t->blocked, ~sigs);
142 spin_unlock_irqrestore(¤t->sighand->siglock, flags);
145 EXPORT_SYMBOL(cfs_block_sigsinv);
148 cfs_restore_sigs(sigset_t old)
152 spin_lock_irqsave(¤t->sighand->siglock, flags);
153 current->blocked = old;
155 spin_unlock_irqrestore(¤t->sighand->siglock, flags);
157 EXPORT_SYMBOL(cfs_restore_sigs);
160 cfs_clear_sigpending(void)
164 spin_lock_irqsave(¤t->sighand->siglock, flags);
165 clear_tsk_thread_flag(current, TIF_SIGPENDING);
166 spin_unlock_irqrestore(¤t->sighand->siglock, flags);
168 EXPORT_SYMBOL(cfs_clear_sigpending);