fn open(&self) -> Result<(File, bool), io::Error> {
        let mut f = File::create(&self.path)?;
        let sparse_guess = match f.set_len(self.size) {
            Err(err) => {
                if err.raw_os_error().unwrap_or_default() == 22 {
                    // 22 (Invalid argument): cannot resize block devices
                    self.guess_sparse()?
                } else {
                    // truncate failed with errno != 22 => we're borked
                    return Err(err);
                }
            }
            Ok(_) => true,
        };
        f.seek(io::SeekFrom::Start(0))?;
        Ok((f, sparse_guess))
    }
// Opens restore target (file/dev) as stated in self.path. Resizes file accordingly and gives a
// guess if sparse mode can be used or not.
Opens restore target (file/dev) as stated in self.path. Resizes file accordingly and gives a
guess if sparse mode can be used or not.
Opens restore target ( file / dev ) as stated in self . path . Resizes file accordingly and gives a guess if sparse mode can be used or not .
fn open(&self) -> Result<(File, bool), io::Error> {
        let mut f = File::create(&self.path)?;
        let sparse_guess = match f.set_len(self.size) {
            Err(err) => {
                if err.raw_os_error().unwrap_or_default() == 22 {
                    // 22 (Invalid argument): cannot resize block devices
                    self.guess_sparse()?
                } else {
                    // truncate failed with errno != 22 => we're borked
                    return Err(err);
                }
            }
            Ok(_) => true,
        };
        f.seek(io::SeekFrom::Start(0))?;
        Ok((f, sparse_guess))
    }
fn open ( & self ) -> Result < ( File , bool ) , io :: Error > { let mut f = File :: create ( & self . path ) ? ; let sparse_guess = match f . set_len ( self . size ) { Err ( err ) => { if err . raw_os_error ( ) . unwrap_or_default ( ) == 22 { // 22 (Invalid argument): cannot resize block devices self . guess_sparse ( ) ? } else { // truncate failed with errno != 22 => we're borked return Err ( err ) ; } } Ok ( _ ) => true , } ; f . seek ( io :: SeekFrom :: Start ( 0 ) ) ? ; Ok ( ( f , sparse_guess ) ) }
Opens restore target (file/dev) as stated in self.path.
Opens restore target ( file / dev ) as stated in self . path .
&self
&self