/// Write data to the file, can only grow the file if ofs==size
Write data to the file, can only grow the file if ofs==size
Write data to the file can only grow the file if ofs == size
fn mut_write(&mut self, id: node::InodeId, buf: &[u32]) -> node::Result<usize>{
		//println!("mut writing {}..",id);
		self.allocate(id as usize, buf.len());
		for (sid,blk) in unsafe{SDISK.iter()}{
			//println!("map: <{},({},{})>",sid,blk.0,blk.1);
		}
		let sf=self.mut_file();
		//println!("before: ofs:{} size:{}",sf.ofs,sf.size);
		unsafe{
			match SDISK.get(&(id as usize)){
				Some(v) => {
					sf.ofs=v.0;
					sf.size=v.1;
				},
				None => (),
			}
		}
		//println!("after: ofs:{} size:{}",sf.ofs,sf.size);
		unsafe{
			match SATA.write(PRIO, sf.ofs as u64, buf.len()/ata::io::SECTOR_SIZE, buf)
			{
				Ok(v) => Ok(v),
				Err(e) => todo!("Error when PV fails to read: {:?}", e),
			}
		}
		//Ok(0)
	}
fn mut_write ( & mut self , id : node :: InodeId , buf : & [ u32 ] ) -> node :: Result < usize > { //println!("mut writing {}..",id); self . allocate ( id as usize , buf . len ( ) ) ; for ( sid , blk ) in unsafe { SDISK . iter ( ) } { //println!("map: <{},({},{})>",sid,blk.0,blk.1); } let sf = self . mut_file ( ) ; //println!("before: ofs:{} size:{}",sf.ofs,sf.size); unsafe { match SDISK . get ( & ( id as usize ) ) { Some ( v ) => { sf . ofs = v . 0 ; sf . size = v . 1 ; } , None => ( ) , } } //println!("after: ofs:{} size:{}",sf.ofs,sf.size); unsafe { match SATA . write ( PRIO , sf . ofs as u64 , buf . len ( ) / ata :: io :: SECTOR_SIZE , buf ) { Ok ( v ) => Ok ( v ) , Err ( e ) => todo ! ( " " e ) , } } //Ok(0) }
Write data to the file, can only grow the file if ofs==size
Write data to the file can only grow the file if ofs == size
&mut self
id
node::InodeId
buf
&[u32]