Commit 4462c2b
rust: map
The following FFI types are replaced compared to `core::ffi`:
1. `char` type is now always mapped to `u8`, since kernel uses
`-funsigned-char` on the C code. `core::ffi` maps it to platform
default ABI, which can be either signed or unsigned.
2. `long` is now always mapped to `isize`. It's very common in the
kernel to use `long` to represent a pointer-sized integer, and in
fact `intptr_t` is a typedef of `long` in the kernel. Enforce this
mapping rather than mapping to `i32/i64` depending on platform can
save us a lot of unnecessary casts.
Signed-off-by: Gary Guo <[email protected]>
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Moved `uaccess` changes from the next commit, since they were
irrefutable patterns that Rust >= 1.82.0 warns about. Reworded
slightly and reformatted a few documentation comments. Rebased on
top of `rust-next`. Added the removal of two casts to avoid Clippy
warnings. - Miguel ]
Signed-off-by: Miguel Ojeda <[email protected]>long to isize and char to u8
1 parent e1157ae commit 4462c2b
File tree
5 files changed
+47
-28
lines changed- rust
- kernel
5 files changed
+47
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | 156 | | |
158 | | - | |
159 | | - | |
160 | | - | |
| 157 | + | |
161 | 158 | | |
162 | 159 | | |
163 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
| 228 | + | |
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 227 | + | |
231 | 228 | | |
232 | | - | |
233 | | - | |
| 229 | + | |
234 | 230 | | |
235 | 231 | | |
236 | 232 | | |
| |||
259 | 255 | | |
260 | 256 | | |
261 | 257 | | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | 258 | | |
266 | 259 | | |
267 | 260 | | |
| |||
272 | 265 | | |
273 | 266 | | |
274 | 267 | | |
275 | | - | |
| 268 | + | |
276 | 269 | | |
277 | 270 | | |
278 | 271 | | |
| |||
335 | 328 | | |
336 | 329 | | |
337 | 330 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
| 331 | + | |
342 | 332 | | |
343 | | - | |
| 333 | + | |
344 | 334 | | |
345 | 335 | | |
346 | 336 | | |
| |||
359 | 349 | | |
360 | 350 | | |
361 | 351 | | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | 352 | | |
366 | 353 | | |
367 | 354 | | |
| |||
372 | 359 | | |
373 | 360 | | |
374 | 361 | | |
375 | | - | |
| 362 | + | |
376 | 363 | | |
377 | 364 | | |
378 | 365 | | |
| |||
0 commit comments