source: mainline/kernel/generic/include/ipc/sysipc_ops.h@ 6b83300

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 6b83300 was 6b83300, checked in by Jakub Jermar <jakub@…>, 13 years ago

Improve terminology.

  • Property mode set to 100644
File size: 5.7 KB
Line 
1/*
2 * Copyright (c) 2012 Jakub Jermar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup genericipc
30 * @{
31 */
32/** @file
33 */
34
35#ifndef KERN_SYSIPC_OPS_H_
36#define KERN_SYSIPC_OPS_H_
37
38#include <ipc/ipc.h>
39
40/**
41 * This header declares the per-method IPC callbacks. Using these callbacks,
42 * each IPC method (but system methods in particular), can define actions that
43 * will be called at specific moments in the call life-cycle.
44 *
45 * Normally, the kernel will attempt to invoke the following callbacks in the
46 * following order on each call:
47 *
48 * request_preprocess()
49 * request_process()
50 * answer_preprocess()
51 * answer_process()
52 *
53 * This callback invocation sequence is a natural order of processing. Note,
54 * however, that due to various special circumstances, callbacks may be called
55 * also in a different than natural order of processing. This means that some
56 * callbacks may be skipped and some others may be called instead.
57 *
58 * The additional callbacks that may be called are as follows:
59 *
60 * request_forget()
61 * answer_cleanup()
62 *
63 * There are several notable scenarios in which some callbacks of the natural
64 * order of processing will be skipped.
65 *
66 * The request_process(), answer_preprocess() and answer_process() callbacks
67 * will be skipped if the call cannot be delivered to the callee. This may
68 * happen when e.g. the request_preprocess() callback fails or the connection
69 * to the callee is not functional. The next callback that will be invoked on
70 * the call is request_forget().
71 *
72 * The request_process() callback will be skipped if the callee terminates
73 * before picking up the request. In this case, the terminating task will
74 * cleanup its incoming calls list and so the next callback invoked on the call
75 * will usually be answer_preprocess(). If, in the meantime, the caller
76 * terminates too, it may happen that the call will be forgotten instead of
77 * answered, in which case the kernel will invoke the request_forget() and
78 * answer_cleanup() callbacks instead. The order in which they are invoked is
79 * not defined.
80 *
81 * The answer_process() callback will be skipped if the caller terminates
82 * before picking up the answer. This means that this callback is not suitable
83 * for releasing system resources allocated by the preceding callbacks.
84 *
85 * The comments for each callback type describe the specifics of each callback
86 * such as the context in which it is invoked and various constraints.
87 */
88
89typedef struct {
90 /**
91 * This callback is called from request_preprocess().
92 *
93 * Context: caller
94 * Caller alive: guaranteed
95 * Races with: N/A
96 * Invoked on: all calls
97 */
98 int (* request_preprocess)(call_t *, phone_t *);
99
100 /**
101 * This callback is called when the IPC cleanup code wins the race to
102 * forget the call.
103 *
104 * Context: caller
105 * Caller alive: guaranteed
106 * Races with: request_process(), answer_cleanup(),
107 * _ipc_answer_free_call()
108 * Invoked on: all forgotten calls
109 */
110 void (* request_forget)(call_t *);
111
112 /**
113 * This callback is called from process_request().
114 *
115 * Context: callee
116 * Caller alive: no guarantee
117 * Races with: request_forget()
118 * Invoked on: calls that are explicitly received by the callee
119 */
120 int (* request_process)(call_t *, answerbox_t *);
121
122 /**
123 * This callback is called when answer_preprocess() loses the race to
124 * answer the call.
125 *
126 * Context: callee
127 * Caller alive: no guarantee
128 * Races with: request_forget()
129 * Invoked on: all forgotten calls
130 */
131 void (* answer_cleanup)(call_t *, ipc_data_t *);
132
133 /**
134 * This callback is called when answer_preprocess() wins the race to
135 * answer the call.
136 *
137 * Context: callee
138 * Caller alive: guaranteed
139 * Races with: N/A
140 * Invoked on: all answered calls
141 */
142 int (* answer_preprocess)(call_t *, ipc_data_t *);
143
144 /**
145 * This callback is called from process_answer().
146 *
147 * Context: caller
148 * Caller alive: guaranteed
149 * Races with: N/A
150 * Invoked on: answered calls explicitly received by the caller
151 */
152 int (* answer_process)(call_t *);
153} sysipc_ops_t;
154
155extern sysipc_ops_t *sysipc_ops_get(sysarg_t);
156
157extern int null_request_preprocess(call_t *, phone_t *);
158extern void null_request_forget(call_t *);
159extern int null_request_process(call_t *, answerbox_t *);
160extern void null_answer_cleanup(call_t *, ipc_data_t *);
161extern int null_answer_preprocess(call_t *, ipc_data_t *);
162extern int null_answer_process(call_t *);
163
164#endif
165
166/** @}
167 */
Note: See TracBrowser for help on using the repository browser.