ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / um / include / mconsole.h
1 /*
2  * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org)
3  * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
4  * Licensed under the GPL
5  */
6
7 #ifndef __MCONSOLE_H__
8 #define __MCONSOLE_H__
9
10 #ifndef __KERNEL__
11 #include <stdint.h>
12 #define u32 uint32_t
13 #endif
14
15 #define MCONSOLE_MAGIC (0xcafebabe)
16 #define MCONSOLE_MAX_DATA (512)
17 #define MCONSOLE_VERSION 2
18
19 struct mconsole_request {
20         u32 magic;
21         u32 version;
22         u32 len;
23         char data[MCONSOLE_MAX_DATA];
24 };
25
26 struct mconsole_reply {
27         u32 err;
28         u32 more;
29         u32 len;
30         char data[MCONSOLE_MAX_DATA];
31 };
32
33 struct mconsole_notify {
34         u32 magic;
35         u32 version;    
36         enum { MCONSOLE_SOCKET, MCONSOLE_PANIC, MCONSOLE_HANG,
37                MCONSOLE_USER_NOTIFY } type;
38         u32 len;
39         char data[MCONSOLE_MAX_DATA];
40 };
41
42 struct mc_request;
43
44 struct mconsole_command
45 {
46         char *command;
47         void (*handler)(struct mc_request *req);
48         int as_interrupt;
49 };
50
51 struct mc_request
52 {
53         int len;
54         int as_interrupt;
55
56         int originating_fd;
57         int originlen;
58         unsigned char origin[128];                      /* sockaddr_un */
59
60         struct mconsole_request request;
61         struct mconsole_command *cmd;
62 };
63
64 extern char mconsole_socket_name[];
65
66 extern int mconsole_unlink_socket(void);
67 extern int mconsole_reply(struct mc_request *req, char *reply, int err,
68                           int more);
69
70 extern void mconsole_version(struct mc_request *req);
71 extern void mconsole_help(struct mc_request *req);
72 extern void mconsole_halt(struct mc_request *req);
73 extern void mconsole_reboot(struct mc_request *req);
74 extern void mconsole_config(struct mc_request *req);
75 extern void mconsole_remove(struct mc_request *req);
76 extern void mconsole_sysrq(struct mc_request *req);
77 extern void mconsole_cad(struct mc_request *req);
78 extern void mconsole_stop(struct mc_request *req);
79 extern void mconsole_go(struct mc_request *req);
80
81 extern int mconsole_get_request(int fd, struct mc_request *req);
82 extern int mconsole_notify(char *sock_name, int type, const void *data, 
83                            int len);
84 extern char *mconsole_notify_socket(void);
85 extern void lock_notify(void);
86 extern void unlock_notify(void);
87
88 #endif
89
90 /*
91  * Overrides for Emacs so that we follow Linus's tabbing style.
92  * Emacs will notice this stuff at the end of the file and automatically
93  * adjust the settings for this buffer only.  This must remain at the end
94  * of the file.
95  * ---------------------------------------------------------------------------
96  * Local variables:
97  * c-file-style: "linux"
98  * End:
99  */