From 47fc53c4bfbee2b62ddaab1d3b9b6d3676975a16 Mon Sep 17 00:00:00 2001 From: occheung Date: Mon, 18 Nov 2024 13:13:10 +0800 Subject: [PATCH] drtio_tuple -> drtio_context --- src/runtime/src/comms.rs | 2 +- src/runtime/src/mgmt.rs | 40 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/runtime/src/comms.rs b/src/runtime/src/comms.rs index 8824344..e30b87a 100644 --- a/src/runtime/src/comms.rs +++ b/src/runtime/src/comms.rs @@ -788,7 +788,7 @@ pub fn main(timer: GlobalTimer, cfg: Config) { mgmt::start( cfg.clone(), restart_idle.clone(), - Some(mgmt::DrtioTuple(aux_mutex.clone(), drtio_routing_table.clone(), timer)), + Some(mgmt::DrtioContext(aux_mutex.clone(), drtio_routing_table.clone(), timer)), ); task::spawn(async move { diff --git a/src/runtime/src/mgmt.rs b/src/runtime/src/mgmt.rs index b398ee7..d325c33 100644 --- a/src/runtime/src/mgmt.rs +++ b/src/runtime/src/mgmt.rs @@ -881,10 +881,10 @@ mod local_coremgmt { #[cfg(has_drtio)] macro_rules! process { - ($stream: ident, $drtio_tuple:ident, $destination:expr, $func:ident $(, $param:expr)*) => {{ + ($stream: ident, $drtio_context:ident, $destination:expr, $func:ident $(, $param:expr)*) => {{ if $destination == 0 { local_coremgmt::$func($stream, $($param, )*).await - } else if let Some(DrtioTuple(ref aux_mutex, ref routing_table, timer)) = $drtio_tuple { + } else if let Some(DrtioContext(ref aux_mutex, ref routing_table, timer)) = $drtio_context { let routing_table = routing_table.borrow(); let linkno = routing_table.0[$destination as usize][0] - 1 as u8; remote_coremgmt::$func($stream, &aux_mutex, &routing_table, timer, linkno, $destination, $($param, )*).await @@ -898,20 +898,20 @@ macro_rules! process { #[cfg(not(has_drtio))] macro_rules! process { - ($stream: ident, $drtio_tuple:ident, $destination:expr, $func:ident $(, $param:expr)*) => {{ + ($stream: ident, $drtio_context:ident, $destination:expr, $func:ident $(, $param:expr)*) => {{ local_coremgmt::$func($stream, $($param, )*).await }} } #[derive(Clone)] -pub struct DrtioTuple(pub Rc>, pub Rc>, pub GlobalTimer); +pub struct DrtioContext(pub Rc>, pub Rc>, pub GlobalTimer); async fn handle_connection( stream: &mut TcpStream, pull_id: Rc>, cfg: Rc, restart_idle: Rc, - _drtio_tuple: Option, + _drtio_context: Option, ) -> Result<()> { if !expect(&stream, b"ARTIQ management\n").await? { return Err(Error::UnexpectedPattern); @@ -927,20 +927,20 @@ async fn handle_connection( } let msg: Request = FromPrimitive::from_i8(msg?).ok_or(Error::UnrecognizedPacket)?; match msg { - Request::GetLog => process!(stream, _drtio_tuple, _destination, get_log), - Request::ClearLog => process!(stream, _drtio_tuple, _destination, clear_log), - Request::PullLog => process!(stream, _drtio_tuple, _destination, pull_log, &pull_id), + Request::GetLog => process!(stream, _drtio_context, _destination, get_log), + Request::ClearLog => process!(stream, _drtio_context, _destination, clear_log), + Request::PullLog => process!(stream, _drtio_context, _destination, pull_log, &pull_id), Request::SetLogFilter => { let lvl = read_log_level_filter(stream).await?; - process!(stream, _drtio_tuple, _destination, set_log_filter, lvl) + process!(stream, _drtio_context, _destination, set_log_filter, lvl) } Request::SetUartLogFilter => { let lvl = read_log_level_filter(stream).await?; - process!(stream, _drtio_tuple, _destination, set_uart_log_filter, lvl) + process!(stream, _drtio_context, _destination, set_uart_log_filter, lvl) } Request::ConfigRead => { let key = read_key(stream).await?; - process!(stream, _drtio_tuple, _destination, config_read, &cfg, &key) + process!(stream, _drtio_context, _destination, config_read, &cfg, &key) } Request::ConfigWrite => { let key = read_key(stream).await?; @@ -953,7 +953,7 @@ async fn handle_connection( read_chunk(stream, &mut buffer).await?; process!( stream, - _drtio_tuple, + _drtio_context, _destination, config_write, &cfg, @@ -966,7 +966,7 @@ async fn handle_connection( let key = read_key(stream).await?; process!( stream, - _drtio_tuple, + _drtio_context, _destination, config_remove, &cfg, @@ -975,13 +975,13 @@ async fn handle_connection( ) } Request::Reboot => { - process!(stream, _drtio_tuple, _destination, reboot) + process!(stream, _drtio_context, _destination, reboot) } Request::ConfigErase => { - process!(stream, _drtio_tuple, _destination, config_erase) + process!(stream, _drtio_context, _destination, config_erase) } Request::DebugAllocator => { - process!(stream, _drtio_tuple, _destination, debug_allocator) + process!(stream, _drtio_context, _destination, debug_allocator) } Request::Flash => { let len = read_i32(stream).await?; @@ -994,13 +994,13 @@ async fn handle_connection( buffer.set_len(len as usize); } read_chunk(stream, &mut buffer).await?; - process!(stream, _drtio_tuple, _destination, image_write, &cfg, buffer) + process!(stream, _drtio_context, _destination, image_write, &cfg, buffer) } }?; } } -pub fn start(cfg: Rc, restart_idle: Rc, drtio_tuple: Option) { +pub fn start(cfg: Rc, restart_idle: Rc, drtio_context: Option) { task::spawn(async move { let pull_id = Rc::new(RefCell::new(0u32)); loop { @@ -1008,10 +1008,10 @@ pub fn start(cfg: Rc, restart_idle: Rc, drtio_tuple: Option