OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [linux/] [sysrq.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/* -*- linux-c -*-
2
 *
3
 *      $Id: sysrq.h,v 1.1.1.1 2004-04-15 02:36:19 phoenix Exp $
4
 *
5
 *      Linux Magic System Request Key Hacks
6
 *
7
 *      (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
8
 *
9
 *      (c) 2000 Crutcher Dunnavant <crutcher+kernel@datastacks.com>
10
 *      overhauled to use key registration
11
 *      based upon discusions in irc://irc.openprojects.net/#kernelnewbies
12
 */
13
#ifndef __LINUX_SYSRQ_H__
14
#define __LINUX_SYSRQ_H__
15
 
16
#include <linux/config.h>
17
 
18
struct pt_regs;
19
struct kbd_struct;
20
struct tty_struct;
21
 
22
struct sysrq_key_op {
23
        void (*handler)(int, struct pt_regs *,
24
                        struct kbd_struct *, struct tty_struct *);
25
        char *help_msg;
26
        char *action_msg;
27
};
28
 
29
#ifdef CONFIG_MAGIC_SYSRQ
30
 
31
/* Generic SysRq interface -- you may call it from any device driver, supplying
32
 * ASCII code of the key, pointer to registers and kbd/tty structs (if they
33
 * are available -- else NULL's).
34
 */
35
 
36
void handle_sysrq(int, struct pt_regs *,
37
                struct kbd_struct *, struct tty_struct *);
38
 
39
 
40
/*
41
 * Nonlocking version of handle sysrq, used by sysrq handlers that need to
42
 * call sysrq handlers
43
 */
44
 
45
void __handle_sysrq_nolock(int, struct pt_regs *,
46
                struct kbd_struct *, struct tty_struct *);
47
 
48
 
49
 
50
/*
51
 * Sysrq registration manipulation functions
52
 */
53
 
54
void __sysrq_lock_table (void);
55
void __sysrq_unlock_table (void);
56
struct sysrq_key_op *__sysrq_get_key_op (int key);
57
void __sysrq_put_key_op (int key, struct sysrq_key_op *op_p);
58
 
59
extern __inline__ int
60
__sysrq_swap_key_ops_nolock(int key, struct sysrq_key_op *insert_op_p,
61
                                struct sysrq_key_op *remove_op_p)
62
{
63
        int retval;
64
        if (__sysrq_get_key_op(key) == remove_op_p) {
65
                __sysrq_put_key_op(key, insert_op_p);
66
                retval = 0;
67
        } else {
68
                retval = -1;
69
        }
70
        return retval;
71
}
72
 
73
extern __inline__ int
74
__sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p,
75
                                struct sysrq_key_op *remove_op_p) {
76
        int retval;
77
        __sysrq_lock_table();
78
        retval = __sysrq_swap_key_ops_nolock(key, insert_op_p, remove_op_p);
79
        __sysrq_unlock_table();
80
        return retval;
81
}
82
 
83
static inline int register_sysrq_key(int key, struct sysrq_key_op *op_p)
84
{
85
        return __sysrq_swap_key_ops(key, op_p, NULL);
86
}
87
 
88
static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op_p)
89
{
90
        return __sysrq_swap_key_ops(key, NULL, op_p);
91
}
92
 
93
#else
94
 
95
static inline int __reterr(void)
96
{
97
        return -EINVAL;
98
}
99
 
100
#define register_sysrq_key(ig,nore) __reterr()
101
#define unregister_sysrq_key(ig,nore) __reterr()
102
 
103
#endif
104
 
105
 
106
/* Deferred actions */
107
 
108
extern volatile int emergency_sync_scheduled;
109
 
110
#define EMERG_SYNC 1
111
#define EMERG_REMOUNT 2
112
 
113
void do_emergency_sync(void);
114
 
115
#ifdef CONFIG_MAGIC_SYSRQ
116
#define CHECK_EMERGENCY_SYNC                    \
117
        if (emergency_sync_scheduled)           \
118
                do_emergency_sync();
119
#else
120
#define CHECK_EMERGENCY_SYNC
121
#endif
122
 
123
#endif /* __LINUX_SYSRQ_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.