mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 20:19:07 +00:00
devices: virtio: console: move process_transmit_request around
Move this function to a place closer from its call site - this will make the following CL less cluttered. BUG=None TEST=cargo build Change-Id: I2837af9bb1f721967d7b7676140a8bd11973a34b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3600171 Commit-Queue: Alexandre Courbot <acourbot@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
2009824d86
commit
d160cd22cf
1 changed files with 15 additions and 15 deletions
|
@ -103,6 +103,21 @@ pub fn handle_input<I: SignalableInterrupt>(
|
|||
}
|
||||
}
|
||||
|
||||
/// Writes the available data from the reader into the given output queue.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `reader` - The Reader with the data we want to write.
|
||||
/// * `output` - The output sink we are going to write the data to.
|
||||
pub fn process_transmit_request(mut reader: Reader, output: &mut dyn io::Write) -> io::Result<()> {
|
||||
let len = reader.available_bytes();
|
||||
let mut data = vec![0u8; len];
|
||||
reader.read_exact(&mut data)?;
|
||||
output.write_all(&data)?;
|
||||
output.flush()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Processes the data taken from the given transmit queue into the output sink.
|
||||
///
|
||||
/// # Arguments
|
||||
|
@ -208,21 +223,6 @@ pub fn spawn_input_thread(
|
|||
Some(buffer_cloned)
|
||||
}
|
||||
|
||||
/// Writes the available data from the reader into the given output queue.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `reader` - The Reader with the data we want to write.
|
||||
/// * `output` - The output sink we are going to write the data to.
|
||||
pub fn process_transmit_request(mut reader: Reader, output: &mut dyn io::Write) -> io::Result<()> {
|
||||
let len = reader.available_bytes();
|
||||
let mut data = vec![0u8; len];
|
||||
reader.read_exact(&mut data)?;
|
||||
output.write_all(&data)?;
|
||||
output.flush()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl Worker {
|
||||
fn run(&mut self) {
|
||||
#[derive(PollToken)]
|
||||
|
|
Loading…
Reference in a new issue