driver_symbols/
symbols.rs1use crate::bindings;
6use std::ffi::{CStr, CString};
7use zx::{AsHandleRef, Status};
8
9pub fn find_restricted_symbols(vmo: &zx::Vmo, driver_url: &str) -> Result<Vec<String>, Status> {
10 let mut out_symbols: *mut bindings::restricted_symbols = std::ptr::null_mut();
11 let mut out_symbols_size: usize = 0;
12 let driver_url_c_str = CString::new(driver_url).unwrap();
13 Status::ok(unsafe {
15 bindings::restricted_symbols_find(
16 vmo.raw_handle(),
17 driver_url_c_str.as_ptr(),
18 &mut out_symbols,
19 &mut out_symbols_size,
20 )
21 })?;
22
23 let mut symbols = Vec::with_capacity(out_symbols_size);
24 for i in 0..out_symbols_size {
25 let symbol = unsafe { CStr::from_ptr(bindings::restricted_symbols_get(out_symbols, i)) };
27 symbols.push(symbol.to_str().unwrap().to_string());
28 }
29
30 unsafe {
32 bindings::restricted_symbols_free(out_symbols);
33 }
34
35 Ok(symbols)
36}