mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-19 04:56:30 +00:00
修正文件open和写入的错误 (#429)
1. 修正文件open的时候可能错误的把inode清空的问题(如果当前inode是mknod创建的) 2. 修正fat和block device中,对文件写入部分的错误问题
This commit is contained in:
@ -261,7 +261,7 @@ pub trait BlockDevice: Device {
|
||||
let mut temp = Vec::new();
|
||||
temp.resize(1usize << self.blk_size_log2(), 0);
|
||||
// 由于块设备每次读写都是整块的,在不完整写入之前,必须把不完整的地方补全
|
||||
self.write_at(range.lba_start, 1, &mut temp[..])?;
|
||||
self.read_at(range.lba_start, 1, &mut temp[..])?;
|
||||
// 把数据从临时buffer复制到目标buffer
|
||||
temp[range.begin..range.end].copy_from_slice(&buf_slice);
|
||||
self.write_at(range.lba_start, 1, &temp[..])?;
|
||||
|
Reference in New Issue
Block a user