4
4
//!
5
5
//! C header: [`include/linux/security.h`](../../../../include/linux/security.h).
6
6
7
- use crate :: { bindings, c_types, error:: Error , file:: File , task:: Task , Result } ;
8
-
9
- extern "C" {
10
- #[ allow( improper_ctypes) ]
11
- fn rust_helper_security_binder_set_context_mgr (
12
- mgr : * mut bindings:: task_struct ,
13
- ) -> c_types:: c_int ;
14
- #[ allow( improper_ctypes) ]
15
- fn rust_helper_security_binder_transaction (
16
- from : * mut bindings:: task_struct ,
17
- to : * mut bindings:: task_struct ,
18
- ) -> c_types:: c_int ;
19
- #[ allow( improper_ctypes) ]
20
- fn rust_helper_security_binder_transfer_binder (
21
- from : * mut bindings:: task_struct ,
22
- to : * mut bindings:: task_struct ,
23
- ) -> c_types:: c_int ;
24
- #[ allow( improper_ctypes) ]
25
- fn rust_helper_security_binder_transfer_file (
26
- from : * mut bindings:: task_struct ,
27
- to : * mut bindings:: task_struct ,
28
- file : * mut bindings:: file ,
29
- ) -> c_types:: c_int ;
30
- }
7
+ use crate :: { bindings, error:: Error , file:: File , task:: Task , Result } ;
31
8
32
9
/// Calls the security modules to determine if the given task can become the manager of a binder
33
10
/// context.
34
11
pub fn binder_set_context_mgr ( mgr : & Task ) -> Result {
35
12
// SAFETY: By the `Task` invariants, `mgr.ptr` is valid.
36
- let ret = unsafe { rust_helper_security_binder_set_context_mgr ( mgr. ptr ) } ;
13
+ let ret = unsafe { bindings :: security_binder_set_context_mgr ( mgr. ptr ) } ;
37
14
if ret != 0 {
38
15
Err ( Error :: from_kernel_errno ( ret) )
39
16
} else {
@@ -45,7 +22,7 @@ pub fn binder_set_context_mgr(mgr: &Task) -> Result {
45
22
/// task `to`.
46
23
pub fn binder_transaction ( from : & Task , to : & Task ) -> Result {
47
24
// SAFETY: By the `Task` invariants, `from.ptr` and `to.ptr` are valid.
48
- let ret = unsafe { rust_helper_security_binder_transaction ( from. ptr , to. ptr ) } ;
25
+ let ret = unsafe { bindings :: security_binder_transaction ( from. ptr , to. ptr ) } ;
49
26
if ret != 0 {
50
27
Err ( Error :: from_kernel_errno ( ret) )
51
28
} else {
@@ -57,7 +34,7 @@ pub fn binder_transaction(from: &Task, to: &Task) -> Result {
57
34
/// (owned by itself or other processes) to task `to` through a binder transaction.
58
35
pub fn binder_transfer_binder ( from : & Task , to : & Task ) -> Result {
59
36
// SAFETY: By the `Task` invariants, `from.ptr` and `to.ptr` are valid.
60
- let ret = unsafe { rust_helper_security_binder_transfer_binder ( from. ptr , to. ptr ) } ;
37
+ let ret = unsafe { bindings :: security_binder_transfer_binder ( from. ptr , to. ptr ) } ;
61
38
if ret != 0 {
62
39
Err ( Error :: from_kernel_errno ( ret) )
63
40
} else {
@@ -70,7 +47,7 @@ pub fn binder_transfer_binder(from: &Task, to: &Task) -> Result {
70
47
pub fn binder_transfer_file ( from : & Task , to : & Task , file : & File ) -> Result {
71
48
// SAFETY: By the `Task` invariants, `from.ptr` and `to.ptr` are valid. Similarly, by the
72
49
// `File` invariants, `file.ptr` is also valid.
73
- let ret = unsafe { rust_helper_security_binder_transfer_file ( from. ptr , to. ptr , file. ptr ) } ;
50
+ let ret = unsafe { bindings :: security_binder_transfer_file ( from. ptr , to. ptr , file. ptr ) } ;
74
51
if ret != 0 {
75
52
Err ( Error :: from_kernel_errno ( ret) )
76
53
} else {
0 commit comments