⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msdos_raw_rwblock.c

📁 阿基米德操作系统的源代码
💻 C
字号:
//////////////////////////////////////////////////////////////////////////////
#include "general.h"
#include "sti_cli.h"

#include "hd_info_struct.h"
#include "dir_entry.h"
#include "msdos_dir_entry.h"
#include "d_inode.h"
#include "m_inode.h"
#include "buffer_head.h"
#include "fat_cache.h"
#include "file.h"
#include "hd_request_struct.h"
#include "super_block.h"

#include "common_head.h"

struct buffer_head * msdos_raw_rblock(struct buffer_head * bh)
{
	unsigned int temp_block,temp_block_0;
	unsigned int temp_cyl,temp_head,temp_sec;
	struct hd_request_struct * temp_req;

	///////////////////////////////////////////
	temp_block	 = bh->b_blocknr << 1;
	temp_block_0 = temp_block;

	temp_sec	 = temp_block % 18;
	temp_block	 = temp_block / 18;
	temp_head	 = temp_block % 2;
	temp_cyl	 = temp_block / 2;
	///////////////////////////////////////////
	
	temp_req = current_req;
	while (temp_req->hd >= 0){
		temp_req++;
		if (temp_req == hd_request + NR_REQUEST)
			temp_req = hd_request;		
	}
	current_req = temp_req;

	bh->b_uptodate	= bh->b_uptodate & 0xfe;
	bh->b_dirt		= 0;
	bh->b_lock		= 1;

	temp_req->hd		= 0;
	temp_req->block		= temp_block_0;
	temp_req->cyl		= temp_cyl;
	temp_req->head		= temp_head;
	temp_req->sector	= temp_sec + 1;	
	temp_req->nsector	= 2;
	temp_req->cmd		= 1;
	temp_req->errors	= 0;
	temp_req->bh		= bh;
	temp_req->next		= NULL;

	cli();
	start_request_f = temp_req;
	end_request_f	= temp_req;
	sti();
	fd_rwblock_1();	

	while (bh->b_lock);

	if (bh->b_uptodate & 0x01)
		return bh;
	else
		return NULL;
}

//////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -