tape: return current_file_number as u64

This commit is contained in:
Dietmar Maurer 2020-12-18 07:44:50 +01:00
parent 3e2984bcb9
commit 26aa9aca40
3 changed files with 5 additions and 5 deletions

View File

@ -308,7 +308,7 @@ impl TapeDriver for LinuxTapeHandle {
Ok(())
}
fn current_file_number(&mut self) -> Result<usize, Error> {
fn current_file_number(&mut self) -> Result<u64, Error> {
let mut status = mtget::default();
self.mtnop()?;
@ -320,7 +320,7 @@ impl TapeDriver for LinuxTapeHandle {
if status.mt_fileno < 0 {
bail!("current_file_number failed (got {})", status.mt_fileno);
}
Ok(status.mt_fileno as usize)
Ok(status.mt_fileno as u64)
}
fn erase_media(&mut self, fast: bool) -> Result<(), Error> {

View File

@ -49,7 +49,7 @@ pub trait TapeDriver {
fn move_to_eom(&mut self) -> Result<(), Error>;
/// Current file number
fn current_file_number(&mut self) -> Result<usize, Error>;
fn current_file_number(&mut self) -> Result<u64, Error>;
/// Completely erase the media
fn erase_media(&mut self, fast: bool) -> Result<(), Error>;

View File

@ -167,12 +167,12 @@ impl TapeDriver for VirtualTapeHandle {
Ok(()) // do nothing for now
}
fn current_file_number(&mut self) -> Result<usize, Error> {
fn current_file_number(&mut self) -> Result<u64, Error> {
let status = self.load_status()
.map_err(|err| format_err!("current_file_number failed: {}", err.to_string()))?;
match status.current_tape {
Some(VirtualTapeStatus { pos, .. }) => { Ok(pos)},
Some(VirtualTapeStatus { pos, .. }) => { Ok(pos as u64)},
None => bail!("current_file_number failed: drive is empty (no tape loaded)."),
}
}