forked from M-Labs/artiq-zynq
drtio-mgmt: fmt
This commit is contained in:
parent
37945e3a29
commit
5a8db1dcf6
|
@ -1218,9 +1218,7 @@ fn process_aux_packet(
|
||||||
core_manager.clear_data();
|
core_manager.clear_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded: succeeded })?;
|
drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded: succeeded })
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
drtioaux::Packet::CoreMgmtConfigRemoveRequest {
|
drtioaux::Packet::CoreMgmtConfigRemoveRequest {
|
||||||
destination: _destination,
|
destination: _destination,
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub fn byte_to_level_filter(level_byte: u8) -> Result<log::LevelFilter> {
|
||||||
lv => {
|
lv => {
|
||||||
error!("unknown log level: {}", lv);
|
error!("unknown log level: {}", lv);
|
||||||
return Err(());
|
return Err(());
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,14 +70,13 @@ impl<'a> Manager<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fetch_config_value(&mut self, key: &str) -> Result<()> {
|
pub fn fetch_config_value(&mut self, key: &str) -> Result<()> {
|
||||||
self.cfg.read(&key)
|
self.cfg
|
||||||
|
.read(&key)
|
||||||
.map(|value| {
|
.map(|value| {
|
||||||
debug!("got value");
|
debug!("got value");
|
||||||
self.last_value = Sliceable::new(0, value)
|
self.last_value = Sliceable::new(0, value)
|
||||||
})
|
})
|
||||||
.map_err(|_| {
|
.map_err(|_| warn!("read error: no such key"))
|
||||||
warn!("read error: no such key")
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_config_value_slice(&mut self, data_slice: &mut [u8; CORE_MGMT_PAYLOAD_MAX_SIZE]) -> SliceMeta {
|
pub fn get_config_value_slice(&mut self, data_slice: &mut [u8; CORE_MGMT_PAYLOAD_MAX_SIZE]) -> SliceMeta {
|
||||||
|
@ -94,18 +93,22 @@ impl<'a> Manager<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_config(&mut self) -> Result<()> {
|
pub fn write_config(&mut self) -> Result<()> {
|
||||||
let key = self.current_payload.read_string().map_err(
|
let key = self
|
||||||
|_err| error!("error on reading key"))?;
|
.current_payload
|
||||||
|
.read_string()
|
||||||
|
.map_err(|_err| error!("error on reading key"))?;
|
||||||
let value = self.current_payload.read_bytes().unwrap();
|
let value = self.current_payload.read_bytes().unwrap();
|
||||||
|
|
||||||
self.cfg.write(&key, value)
|
self.cfg
|
||||||
|
.write(&key, value)
|
||||||
.map(|()| debug!("write success"))
|
.map(|()| debug!("write success"))
|
||||||
.map_err(|err| error!("failed to write: {:?}", err))
|
.map_err(|err| error!("failed to write: {:?}", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_config(&mut self, key: &str) -> Result<()> {
|
pub fn remove_config(&mut self, key: &str) -> Result<()> {
|
||||||
debug!("erase key: {}", key);
|
debug!("erase key: {}", key);
|
||||||
self.cfg.remove(&key)
|
self.cfg
|
||||||
|
.remove(&key)
|
||||||
.map(|()| debug!("erase success"))
|
.map(|()| debug!("erase success"))
|
||||||
.map_err(|err| warn!("failed to erase: {:?}", err))
|
.map_err(|err| warn!("failed to erase: {:?}", err))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue