块驱动与网络接口卡驱动技术解析
块驱动相关内容
块驱动在存储系统中起着关键作用,下面将详细介绍块驱动的相关操作、高级特性、调试方法以及关键数据结构和编程接口。
基本写扇区操作
以下是一个基本的写扇区操作代码示例:
/* Issue Write Sector Command */
outb(WRITE_SECTOR_CMD, COMMAND_REGISTER);
/* Traverse all requested sectors, byte by byte */
for (i = 0; i < 512*req->nr_sectors; i++) {
/* Wait until the disk is ready. Busy duration should be
in the order of microseconds. Sitting in a tight loop
for simplicity; more intelligence required in the real
world */
while ((status = inb(STATUS_REGISTER)) & BUSY_STATUS);
/* Write data to disk from the buffer associated with the
request */
outb(req->buffer[i], DATA_REGISTER);
}
good = 1;
break;
}
}
end_request(req, good);
超级会员免费看
订阅专栏 解锁全文
2248

被折叠的 条评论
为什么被折叠?



