Initialize a connection to the cmap subsystem. map specifies which cmap "map" to use. Returns a [Handle] into the cmap library
(map: Map)
| 109 | /// map specifies which cmap "map" to use. |
| 110 | /// Returns a [Handle] into the cmap library |
| 111 | pub fn initialize(map: Map) -> Result<Handle> { |
| 112 | let mut handle: ffi::cmap_handle_t = 0; |
| 113 | let c_map = match map { |
| 114 | Map::Icmap => ffi::CMAP_MAP_ICMAP, |
| 115 | Map::Stats => ffi::CMAP_MAP_STATS, |
| 116 | }; |
| 117 | |
| 118 | unsafe { |
| 119 | let res = ffi::cmap_initialize_map(&mut handle, c_map); |
| 120 | if res == ffi::CS_OK { |
| 121 | let rhandle = Handle { |
| 122 | cmap_handle: handle, |
| 123 | clone: false, |
| 124 | }; |
| 125 | HANDLE_HASH.lock().unwrap().insert(handle, rhandle.clone()); |
| 126 | Ok(rhandle) |
| 127 | } else { |
| 128 | Err(CsError::from_c(res)) |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | /// Finish with a connection to corosync. |
| 134 | /// Takes a [Handle] as returned from [initialize] |
nothing calls this directly
no test coverage detected