1 |
alexxy 11/02/23 11:19:04 |
2 |
|
3 |
Added: |
4 |
0001-wimaxll_cb_ctx-move-to-internal.h-to-wimaxll.h-fixin.patch |
5 |
Log: |
6 |
[net-wireless/wimax-tools] Add updates from git |
7 |
|
8 |
(Portage version: 2.2.0_alpha25/cvs/Linux x86_64) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 net-wireless/wimax-tools/files/updates/0001-wimaxll_cb_ctx-move-to-internal.h-to-wimaxll.h-fixin.patch |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-wireless/wimax-tools/files/updates/0001-wimaxll_cb_ctx-move-to-internal.h-to-wimaxll.h-fixin.patch?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-wireless/wimax-tools/files/updates/0001-wimaxll_cb_ctx-move-to-internal.h-to-wimaxll.h-fixin.patch?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: 0001-wimaxll_cb_ctx-move-to-internal.h-to-wimaxll.h-fixin.patch |
17 |
=================================================================== |
18 |
From 26da46f5756cdcdae963ea504fef27efcb63ba8b Mon Sep 17 00:00:00 2001 |
19 |
From: Inaky Perez-Gonzalez <inaky.perez-gonzalez@×××××.com> |
20 |
Date: Fri, 28 Jan 2011 12:11:35 -0800 |
21 |
Subject: [PATCH] wimaxll_cb_ctx: move to internal.h to wimaxll.h (fixing bug #20) |
22 |
|
23 |
The context declaration and macros are needed by client programs; they |
24 |
were misplaced. |
25 |
|
26 |
Reported-by: Mathieu Peresse <mathieu.peresse@×××××.com> |
27 |
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@×××××.com> |
28 |
--- |
29 |
include/wimaxll.h | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30 |
lib/internal.h | 126 ---------------------------------------------------- |
31 |
2 files changed, 127 insertions(+), 126 deletions(-) |
32 |
|
33 |
diff --git a/include/wimaxll.h b/include/wimaxll.h |
34 |
index c9dde3f..3149bf2 100644 |
35 |
--- a/include/wimaxll.h |
36 |
+++ b/include/wimaxll.h |
37 |
@@ -307,6 +307,133 @@ typedef int (*wimaxll_state_change_cb_f)( |
38 |
enum wimax_st old_state, enum wimax_st new_state); |
39 |
|
40 |
|
41 |
+ |
42 |
+/** |
43 |
+ * General structure for storing callback context |
44 |
+ * |
45 |
+ * \ingroup callbacks |
46 |
+ * |
47 |
+ * Callbacks set by the user receive a user-set pointer to a context |
48 |
+ * structure. The user can wrap this struct in a bigger context struct |
49 |
+ * and use wimaxll_container_of() during the callback to obtain its |
50 |
+ * pointer. |
51 |
+ * |
52 |
+ * Usage: |
53 |
+ * |
54 |
+ * \code |
55 |
+ * ... |
56 |
+ * struct wimaxll_handle *wmx; |
57 |
+ * ... |
58 |
+ * struct my_context { |
59 |
+ * struct wimaxll_cb_ctx ctx; |
60 |
+ * <my data> |
61 |
+ * } my_ctx = { |
62 |
+ * .ctx = WIMAXLL_CB_CTX_INIT(wmx), |
63 |
+ * <my data initialization> |
64 |
+ * }; |
65 |
+ * ... |
66 |
+ * wimaxll_set_cb_SOMECALLBACK(wmx, my_callback, &my_ctx.ctx); |
67 |
+ * ... |
68 |
+ * result = wimaxll_pipe_read(wmx); |
69 |
+ * ... |
70 |
+ * |
71 |
+ * // When my_callback() is called |
72 |
+ * my_callback(wmx, ctx, ...) |
73 |
+ * { |
74 |
+ * struct my_context *my_ctx = wimaxll_container_of( |
75 |
+ * ctx, struct my_callback, ctx); |
76 |
+ * ... |
77 |
+ * // do stuff with my_ctx |
78 |
+ * } |
79 |
+ * \endcode |
80 |
+ * |
81 |
+ * \param wmx WiMAX handle this context refers to (for usage by the |
82 |
+ * callback). |
83 |
+ * \param result Result of the handling of the message. For usage by |
84 |
+ * the callback. Should not be set to -EINPROGRESS, as this will |
85 |
+ * be interpreted by the message handler as no processing was done |
86 |
+ * on the message. |
87 |
+ * |
88 |
+ * \internal |
89 |
+ * |
90 |
+ * \param msg_done This is used internally to mark when the acks (or |
91 |
+ * errors) for a message have been received and the message |
92 |
+ * receiving loop can be considered done. |
93 |
+ */ |
94 |
+struct wimaxll_cb_ctx { |
95 |
+ struct wimaxll_handle *wmx; |
96 |
+ ssize_t result; |
97 |
+ unsigned msg_done:1; /* internal */ |
98 |
+}; |
99 |
+ |
100 |
+ |
101 |
+/** |
102 |
+ * Initialize a definition of struct wimaxll_cb_ctx |
103 |
+ * |
104 |
+ * \param _wmx pointer to the WiMAX device handle this will be |
105 |
+ * associated to |
106 |
+ * |
107 |
+ * Use as: |
108 |
+ * |
109 |
+ * \code |
110 |
+ * struct wimaxll_handle *wmx; |
111 |
+ * ... |
112 |
+ * struct wimaxll_cb_ctx my_context = WIMAXLL_CB_CTX_INIT(wmx); |
113 |
+ * \endcode |
114 |
+ * |
115 |
+ * \ingroup callbacks |
116 |
+ */ |
117 |
+#define WIMAXLL_CB_CTX_INIT(_wmx) { \ |
118 |
+ .wmx = (_wmx), \ |
119 |
+ .result = -EINPROGRESS, \ |
120 |
+} |
121 |
+ |
122 |
+ |
123 |
+static inline // ugly workaround for doxygen |
124 |
+/** |
125 |
+ * Initialize a struct wimaxll_cb_ctx |
126 |
+ * |
127 |
+ * \param ctx Pointer to the struct wimaxll_cb_ctx. |
128 |
+ * \param wmx pointer to the WiMAX device handle this will be |
129 |
+ * associated to |
130 |
+ * |
131 |
+ * Use as: |
132 |
+ * |
133 |
+ * \code |
134 |
+ * struct wimaxll_handle *wmx; |
135 |
+ * ... |
136 |
+ * struct wimaxll_cb_ctx my_context; |
137 |
+ * ... |
138 |
+ * wimaxll_cb_ctx(&my_context, wmx); |
139 |
+ * \endcode |
140 |
+ * |
141 |
+ * \ingroup callbacks |
142 |
+ * \fn static void wimaxll_cb_ctx_init(struct wimaxll_cb_ctx *ctx, struct wimaxll_handle *wmx) |
143 |
+ */ |
144 |
+void wimaxll_cb_ctx_init(struct wimaxll_cb_ctx *ctx, struct wimaxll_handle *wmx) |
145 |
+{ |
146 |
+ ctx->wmx = wmx; |
147 |
+ ctx->result = -EINPROGRESS; |
148 |
+} |
149 |
+ |
150 |
+ |
151 |
+static inline // ugly workaround for doxygen |
152 |
+/** |
153 |
+ * Set the result value in a callback context |
154 |
+ * |
155 |
+ * \param ctx Context where to set -- if NULL, no action will be taken |
156 |
+ * \param val value to set for \a result |
157 |
+ * |
158 |
+ * \ingroup callbacks |
159 |
+ * \fn static void wimaxll_cb_maybe_set_result(struct wimaxll_cb_ctx *ctx, int val) |
160 |
+ */ |
161 |
+void wimaxll_cb_maybe_set_result(struct wimaxll_cb_ctx *ctx, int val) |
162 |
+{ |
163 |
+ if (ctx != NULL && ctx->result == -EINPROGRESS) |
164 |
+ ctx->result = val; |
165 |
+} |
166 |
+ |
167 |
+ |
168 |
/* Basic handle management */ |
169 |
struct wimaxll_handle *wimaxll_open(const char *device_name); |
170 |
void *wimaxll_priv_get(struct wimaxll_handle *); |
171 |
diff --git a/lib/internal.h b/lib/internal.h |
172 |
index a5cd272..178ac1e 100644 |
173 |
--- a/lib/internal.h |
174 |
+++ b/lib/internal.h |
175 |
@@ -54,132 +54,6 @@ enum { |
176 |
|
177 |
|
178 |
/** |
179 |
- * General structure for storing callback context |
180 |
- * |
181 |
- * \ingroup callbacks |
182 |
- * |
183 |
- * Callbacks set by the user receive a user-set pointer to a context |
184 |
- * structure. The user can wrap this struct in a bigger context struct |
185 |
- * and use wimaxll_container_of() during the callback to obtain its |
186 |
- * pointer. |
187 |
- * |
188 |
- * Usage: |
189 |
- * |
190 |
- * \code |
191 |
- * ... |
192 |
- * struct wimaxll_handle *wmx; |
193 |
- * ... |
194 |
- * struct my_context { |
195 |
- * struct wimaxll_cb_ctx ctx; |
196 |
- * <my data> |
197 |
- * } my_ctx = { |
198 |
- * .ctx = WIMAXLL_CB_CTX_INIT(wmx), |
199 |
- * <my data initialization> |
200 |
- * }; |
201 |
- * ... |
202 |
- * wimaxll_set_cb_SOMECALLBACK(wmx, my_callback, &my_ctx.ctx); |
203 |
- * ... |
204 |
- * result = wimaxll_pipe_read(wmx); |
205 |
- * ... |
206 |
- * |
207 |
- * // When my_callback() is called |
208 |
- * my_callback(wmx, ctx, ...) |
209 |
- * { |
210 |
- * struct my_context *my_ctx = wimaxll_container_of( |
211 |
- * ctx, struct my_callback, ctx); |
212 |
- * ... |
213 |
- * // do stuff with my_ctx |
214 |
- * } |
215 |
- * \endcode |
216 |
- * |
217 |
- * \param wmx WiMAX handle this context refers to (for usage by the |
218 |
- * callback). |
219 |
- * \param result Result of the handling of the message. For usage by |
220 |
- * the callback. Should not be set to -EINPROGRESS, as this will |
221 |
- * be interpreted by the message handler as no processing was done |
222 |
- * on the message. |
223 |
- * |
224 |
- * \internal |
225 |
- * |
226 |
- * \param msg_done This is used internally to mark when the acks (or |
227 |
- * errors) for a message have been received and the message |
228 |
- * receiving loop can be considered done. |
229 |
- */ |
230 |
-struct wimaxll_cb_ctx { |
231 |
- struct wimaxll_handle *wmx; |
232 |
- ssize_t result; |
233 |
- unsigned msg_done:1; /* internal */ |
234 |
-}; |
235 |
- |
236 |
- |
237 |
-/** |
238 |
- * Initialize a definition of struct wimaxll_cb_ctx |
239 |
- * |
240 |
- * \param _wmx pointer to the WiMAX device handle this will be |
241 |
- * associated to |
242 |
- * |
243 |
- * Use as: |
244 |
- * |
245 |
- * \code |
246 |
- * struct wimaxll_handle *wmx; |
247 |
- * ... |
248 |
- * struct wimaxll_cb_ctx my_context = WIMAXLL_CB_CTX_INIT(wmx); |
249 |
- * \endcode |
250 |
- * |
251 |
- * \ingroup callbacks |
252 |
- */ |
253 |
-#define WIMAXLL_CB_CTX_INIT(_wmx) { \ |
254 |
- .wmx = (_wmx), \ |
255 |
- .result = -EINPROGRESS, \ |
256 |
-} |
257 |
- |
258 |
- |
259 |
-static inline // ugly workaround for doxygen |
260 |
-/** |
261 |
- * Initialize a struct wimaxll_cb_ctx |
262 |
- * |
263 |
- * \param ctx Pointer to the struct wimaxll_cb_ctx. |
264 |
- * \param wmx pointer to the WiMAX device handle this will be |
265 |
- * associated to |
266 |
- * |
267 |
- * Use as: |
268 |
- * |
269 |
- * \code |
270 |
- * struct wimaxll_handle *wmx; |
271 |
- * ... |
272 |
- * struct wimaxll_cb_ctx my_context; |
273 |
- * ... |
274 |
- * wimaxll_cb_ctx(&my_context, wmx); |
275 |
- * \endcode |
276 |
- * |
277 |
- * \ingroup callbacks |
278 |
- * \fn static void wimaxll_cb_ctx_init(struct wimaxll_cb_ctx *ctx, struct wimaxll_handle *wmx) |
279 |
- */ |
280 |
-void wimaxll_cb_ctx_init(struct wimaxll_cb_ctx *ctx, struct wimaxll_handle *wmx) |
281 |
-{ |
282 |
- ctx->wmx = wmx; |
283 |
- ctx->result = -EINPROGRESS; |
284 |
-} |
285 |
- |
286 |
- |
287 |
-static inline // ugly workaround for doxygen |
288 |
-/** |
289 |
- * Set the result value in a callback context |
290 |
- * |
291 |
- * \param ctx Context where to set -- if NULL, no action will be taken |
292 |
- * \param val value to set for \a result |
293 |
- * |
294 |
- * \ingroup callbacks |
295 |
- * \fn static void wimaxll_cb_maybe_set_result(struct wimaxll_cb_ctx *ctx, int val) |
296 |
- */ |
297 |
-void wimaxll_cb_maybe_set_result(struct wimaxll_cb_ctx *ctx, int val) |
298 |
-{ |
299 |
- if (ctx != NULL && ctx->result == -EINPROGRESS) |
300 |
- ctx->result = val; |
301 |
-} |
302 |
- |
303 |
- |
304 |
-/** |
305 |
* A WiMax control pipe handle |
306 |
* |
307 |
* This type is opaque to the user |
308 |
-- |
309 |
1.7.4.1 |