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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [include/] [linux/] [kerneld.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
#ifndef _LINUX_KERNELD_H
2
#define _LINUX_KERNELD_H
3
 
4
#include <linux/posix_types.h>
5
 
6
#define KERNELD_SYSTEM 1
7
#define KERNELD_REQUEST_MODULE 2 /* "insmod" */
8
#define KERNELD_RELEASE_MODULE 3 /* "rmmod" */
9
#define KERNELD_DELAYED_RELEASE_MODULE 4 /* "rmmod" */
10
#define KERNELD_CANCEL_RELEASE_MODULE 5 /* "rmmod" */
11
#define KERNELD_REQUEST_ROUTE 6 /* from net/ipv4/route.c */
12
#define KERNELD_BLANKER 7 /* from drivers/char/console.c */
13
#define KERNELD_ARP 256 /* from net/ipv4/arp.c */
14
 
15
/*
16
 * Uncomment the following line for the new kerneld protocol
17
 * This includes the pid of the kernel level requester into the kerneld header
18
 */
19
/*
20
#define NEW_KERNELD_PROTOCOL
21
 */
22
#ifdef NEW_KERNELD_PROTOCOL
23
#define OLDIPC_KERNELD 00040000   /* use the kerneld message channel */
24
#define IPC_KERNELD 00140000   /* use the kerneld message channel, new protocol */
25
#define KDHDR (sizeof(long) + sizeof(short) + sizeof(short))
26
#define NULL_KDHDR 0, 2, 0
27
#else
28
#define IPC_KERNELD 00040000   /* use the kerneld message channel */
29
#define KDHDR (sizeof(long))
30
#define NULL_KDHDR 0
31
#endif
32
#define KERNELD_MAXCMD 0x7ffeffff
33
#define KERNELD_MINSEQ 0x7fff0000 /* "commands" legal up to 0x7ffeffff */
34
#define KERNELD_WAIT 0x80000000
35
#define KERNELD_NOWAIT 0
36
 
37
struct kerneld_msg {
38
        long mtype;
39
        long id;
40
#ifdef NEW_KERNELD_PROTOCOL
41
        short version;
42
        short pid;
43
#endif
44
#ifdef __KERNEL__
45
        char *text;
46
#else
47
        char text[1];
48
#endif /* __KERNEL__ */
49
};
50
 
51
#ifdef __KERNEL__
52
extern int kerneld_send(int msgtype, int ret_size, int msgsz,
53
                const char *text, const char *ret_val);
54
 
55
/*
56
 * Request that a module should be loaded.
57
 * Wait for the exit status from insmod/modprobe.
58
 * If it fails, it fails... at least we tried...
59
 */
60
static inline int request_module(const char *name)
61
{
62
        return kerneld_send(KERNELD_REQUEST_MODULE,
63
 
64
                        strlen(name), name, NULL);
65
}
66
 
67
/*
68
 * Request the removal of a module, maybe don't wait for it.
69
 * It doesn't matter if the removal fails, now does it?
70
 */
71
static inline int release_module(const char *name, int waitflag)
72
{
73
        return kerneld_send(KERNELD_RELEASE_MODULE,
74
 
75
                        strlen(name), name, NULL);
76
}
77
 
78
/*
79
 * Request a delayed removal of a module, but don't wait for it.
80
 * The delay is done by kerneld (default: 60 seconds)
81
 */
82
static inline int delayed_release_module(const char *name)
83
{
84
        return kerneld_send(KERNELD_DELAYED_RELEASE_MODULE,
85
 
86
                        strlen(name), name, NULL);
87
}
88
 
89
/*
90
 * Attempt to cancel a previous request for removal of a module,
91
 * but don't wait for it.
92
 * This call can be made if the kernel wants to prevent a delayed
93
 * unloading of a module.
94
 */
95
static inline int cancel_release_module(const char *name)
96
{
97
        return kerneld_send(KERNELD_CANCEL_RELEASE_MODULE,
98
 
99
                        strlen(name), name, NULL);
100
}
101
 
102
/*
103
 * Perform an "inverted" system call, maybe return the exit status
104
 */
105
static inline int ksystem(const char *cmd, int waitflag)
106
{
107
        return kerneld_send(KERNELD_SYSTEM,
108
 
109
                        strlen(cmd), cmd, NULL);
110
}
111
 
112
/*
113
 * Try to create a route, possibly by opening a ppp-connection
114
 */
115
static inline int kerneld_route(const char *ip_route)
116
{
117
        return kerneld_send(KERNELD_REQUEST_ROUTE,
118
 
119
                        strlen(ip_route), ip_route, NULL);
120
}
121
 
122
/*
123
 * Handle an external screen blanker
124
 */
125
static inline int kerneld_blanker(int on_off) /* 0 => "off", else "on" */
126
{
127
        return kerneld_send(KERNELD_BLANKER,
128
 
129
                        strlen(on_off?"on":"off"), on_off?"on":"off", NULL);
130
}
131
 
132
#endif /* __KERNEL__ */
133
#endif

powered by: WebSVN 2.1.0

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