亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? openfile.cc

?? nachos test nachos 有關實驗
?? CC
字號:
// openfile.cc //	Routines to manage an open Nachos file.  As in UNIX, a//	file must be open before we can read or write to it.//	Once we're all done, we can close it (in Nachos, by deleting//	the OpenFile data structure).////	Also as in UNIX, for convenience, we keep the file header in//	memory while the file is open.//// Copyright (c) 1992-1993 The Regents of the University of California.// All rights reserved.  See copyright.h for copyright notice and limitation // of liability and disclaimer of warranty provisions.#include "copyright.h"#include "filehdr.h"#include "openfile.h"#include "system.h"#ifdef HOST_SPARC#include <strings.h>#endif//----------------------------------------------------------------------// OpenFile::OpenFile// 	Open a Nachos file for reading and writing.  Bring the file header//	into memory while the file is open.////	"sector" -- the location on disk of the file header for this file//----------------------------------------------------------------------OpenFile::OpenFile(int sector){     hdr = new FileHeader;    hdr->FetchFrom(sector);    seekPosition = 0;}//----------------------------------------------------------------------// OpenFile::~OpenFile// 	Close a Nachos file, de-allocating any in-memory data structures.//----------------------------------------------------------------------OpenFile::~OpenFile(){    delete hdr;}//----------------------------------------------------------------------// OpenFile::Seek// 	Change the current location within the open file -- the point at//	which the next Read or Write will start from.////	"position" -- the location within the file for the next Read/Write//----------------------------------------------------------------------voidOpenFile::Seek(int position){    seekPosition = position;}	//----------------------------------------------------------------------// OpenFile::Read/Write// 	Read/write a portion of a file, starting from seekPosition.//	Return the number of bytes actually written or read, and as a//	side effect, increment the current position within the file.////	Implemented using the more primitive ReadAt/WriteAt.////	"into" -- the buffer to contain the data to be read from disk //	"from" -- the buffer containing the data to be written to disk //	"numBytes" -- the number of bytes to transfer//----------------------------------------------------------------------intOpenFile::Read(char *into, int numBytes){   int result = ReadAt(into, numBytes, seekPosition);   seekPosition += result;   return result;}intOpenFile::Write(char *into, int numBytes){   int result = WriteAt(into, numBytes, seekPosition);   seekPosition += result;   return result;}//----------------------------------------------------------------------// OpenFile::ReadAt/WriteAt// 	Read/write a portion of a file, starting at "position".//	Return the number of bytes actually written or read, but has//	no side effects (except that Write modifies the file, of course).////	There is no guarantee the request starts or ends on an even disk sector//	boundary; however the disk only knows how to read/write a whole disk//	sector at a time.  Thus:////	For ReadAt://	   We read in all of the full or partial sectors that are part of the//	   request, but we only copy the part we are interested in.//	For WriteAt://	   We must first read in any sectors that will be partially written,//	   so that we don't overwrite the unmodified portion.  We then copy//	   in the data that will be modified, and write back all the full//	   or partial sectors that are part of the request.////	"into" -- the buffer to contain the data to be read from disk //	"from" -- the buffer containing the data to be written to disk //	"numBytes" -- the number of bytes to transfer//	"position" -- the offset within the file of the first byte to be//			read/written//----------------------------------------------------------------------intOpenFile::ReadAt(char *into, int numBytes, int position){    int fileLength = hdr->FileLength();    int i, firstSector, lastSector, numSectors;    char *buf;    if ((numBytes <= 0) || (position >= fileLength))    	return 0; 				// check request    if ((position + numBytes) > fileLength)			numBytes = fileLength - position;    DEBUG('f', "Reading %d bytes at %d, from file of length %d.\n", 				numBytes, position, fileLength);    firstSector = divRoundDown(position, SectorSize);    lastSector = divRoundDown(position + numBytes - 1, SectorSize);    numSectors = 1 + lastSector - firstSector;    // read in all the full and partial sectors that we need    buf = new char[numSectors * SectorSize];    for (i = firstSector; i <= lastSector; i++)	        synchDisk->ReadSector(hdr->ByteToSector(i * SectorSize), 					&buf[(i - firstSector) * SectorSize]);    // copy the part we want    bcopy(&buf[position - (firstSector * SectorSize)], into, numBytes);    delete [] buf;    return numBytes;}intOpenFile::WriteAt(char *from, int numBytes, int position){    int fileLength = hdr->FileLength();    int i, firstSector, lastSector, numSectors;    bool firstAligned, lastAligned;    char *buf;    if ((numBytes <= 0) || (position >= fileLength))	return 0;				// check request    if ((position + numBytes) > fileLength)	numBytes = fileLength - position;    DEBUG('f', "Writing %d bytes at %d, from file of length %d.\n", 				numBytes, position, fileLength);    firstSector = divRoundDown(position, SectorSize);    lastSector = divRoundDown(position + numBytes - 1, SectorSize);    numSectors = 1 + lastSector - firstSector;    buf = new char[numSectors * SectorSize];    firstAligned = (position == (firstSector * SectorSize));    lastAligned = ((position + numBytes) == ((lastSector + 1) * SectorSize));// read in first and last sector, if they are to be partially modified    if (!firstAligned)        ReadAt(buf, SectorSize, firstSector * SectorSize);	    if (!lastAligned && ((firstSector != lastSector) || firstAligned))        ReadAt(&buf[(lastSector - firstSector) * SectorSize], 				SectorSize, lastSector * SectorSize);	// copy in the bytes we want to change     bcopy(from, &buf[position - (firstSector * SectorSize)], numBytes);// write modified sectors back    for (i = firstSector; i <= lastSector; i++)	        synchDisk->WriteSector(hdr->ByteToSector(i * SectorSize), 					&buf[(i - firstSector) * SectorSize]);    delete [] buf;    return numBytes;}//----------------------------------------------------------------------// OpenFile::Length// 	Return the number of bytes in the file.//----------------------------------------------------------------------intOpenFile::Length() {     return hdr->FileLength(); }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产福利一区在线| 日韩黄色片在线观看| 国产精品色在线观看| 一级女性全黄久久生活片免费| 日产精品久久久久久久性色| 99麻豆久久久国产精品免费| 91精品啪在线观看国产60岁| 亚洲少妇30p| 国产成人精品一区二区三区四区| 亚洲欧美激情一区二区| 欧美不卡一区二区三区四区| 综合婷婷亚洲小说| 精品一区二区av| 精品免费99久久| 亚洲一区二区三区视频在线| 粉嫩一区二区三区性色av| 91精品国产91热久久久做人人| 自拍偷自拍亚洲精品播放| 国产999精品久久久久久绿帽| 69堂国产成人免费视频| 一区二区久久久久| av中文一区二区三区| 国产亚洲精品资源在线26u| 美女性感视频久久| 欧美另类久久久品| 一二三四社区欧美黄| 97国产精品videossex| 中文无字幕一区二区三区| 另类综合日韩欧美亚洲| 欧美一区二区三区视频免费| 午夜亚洲国产au精品一区二区| 91蝌蚪国产九色| 亚洲日本青草视频在线怡红院| 岛国av在线一区| 日韩三级av在线播放| 日韩免费成人网| 日韩欧美在线网站| 午夜精品影院在线观看| 欧美午夜不卡视频| 亚洲chinese男男1069| 777a∨成人精品桃花网| 免费在线看成人av| 日韩视频永久免费| 九一久久久久久| 久久久噜噜噜久久中文字幕色伊伊 | 国产欧美一区二区精品久导航| 国产一区视频网站| 日本一区二区成人| 波多野结衣亚洲| 综合在线观看色| 欧美午夜电影在线播放| 日韩av电影天堂| www国产成人| 成人免费高清在线观看| 日韩美女视频19| 欧美日韩国产美| 精品一区二区三区蜜桃| 亚洲国产精品二十页| av在线播放成人| 日本怡春院一区二区| 中文字幕日韩av资源站| 不卡电影一区二区三区| 伊人色综合久久天天| 91精品国产免费| 国产一区91精品张津瑜| 亚洲另类在线一区| 欧美日本在线播放| 国内偷窥港台综合视频在线播放| 国产精品另类一区| 51久久夜色精品国产麻豆| 精品一区二区久久久| 亚洲日穴在线视频| 日韩精品一区二区三区中文精品| 国产成人99久久亚洲综合精品| 一区二区三区日韩欧美| 欧美成人aa大片| 日本二三区不卡| 国内精品国产成人国产三级粉色 | 欧美日韩一区高清| 久久精品国产亚洲高清剧情介绍| 中文字幕欧美一| 日韩视频免费直播| 色综合咪咪久久| 国产精品综合一区二区| 亚洲一二三级电影| 亚洲国产精品国自产拍av| 欧美一区中文字幕| jizzjizzjizz欧美| 精品在线观看视频| 亚洲123区在线观看| 中文字幕国产精品一区二区| 欧美一级高清片| 在线视频一区二区三| 大尺度一区二区| 精彩视频一区二区| 天天av天天翘天天综合网色鬼国产| 国产视频一区二区在线观看| 正在播放亚洲一区| 一本大道av一区二区在线播放| 国产精品 日产精品 欧美精品| 丝袜亚洲精品中文字幕一区| 亚洲色图欧美激情| 国产精品日日摸夜夜摸av| 亚洲欧美日韩一区二区| 欧美哺乳videos| 91精品国产91综合久久蜜臀| 色妞www精品视频| av在线这里只有精品| 国产不卡在线一区| 国产在线播精品第三| 久久精品国产秦先生| 日本不卡一区二区三区| 视频一区中文字幕| 香蕉成人啪国产精品视频综合网| 一区二区成人在线| 亚洲黄色小视频| 亚洲乱码国产乱码精品精小说 | 国产精品888| 国产在线观看一区二区| 久久av老司机精品网站导航| 日韩成人免费在线| 蜜桃久久久久久久| 九九精品一区二区| 国产乱码精品一品二品| 国产盗摄女厕一区二区三区 | 日本在线不卡视频| 热久久一区二区| 久久国产精品露脸对白| 精彩视频一区二区三区| 国产大片一区二区| 成人成人成人在线视频| 色综合久久中文字幕| 在线观看亚洲精品| 欧美一区二区三区视频免费 | 欧美在线色视频| 欧美日韩一区二区电影| 91麻豆精品国产| 久久亚洲综合色| 中文字幕亚洲精品在线观看| 亚洲一级片在线观看| 日韩电影在线免费看| 国产在线观看一区二区| proumb性欧美在线观看| 精品视频一区 二区 三区| 日韩一二三区不卡| 亚洲国产成人在线| 亚洲影视资源网| 韩日精品视频一区| 91一区二区在线观看| 91精品国产综合久久久久| 久久久精品日韩欧美| 亚洲天堂福利av| 男人的天堂亚洲一区| 国产精品亚洲综合一区在线观看| 91女人视频在线观看| 555夜色666亚洲国产免| 日本一区二区高清| 亚洲mv在线观看| 大白屁股一区二区视频| 欧美老肥妇做.爰bbww| 国产女人18毛片水真多成人如厕| 亚洲日本va午夜在线电影| 美女网站一区二区| 91丨九色丨蝌蚪富婆spa| 日韩一级免费观看| 中文字幕一区二区在线播放 | 欧美一区二区三区在线看| 国产情人综合久久777777| 亚洲丰满少妇videoshd| 国产成人激情av| 欧美一区二区国产| 亚洲人妖av一区二区| 国产一区二区三区久久悠悠色av| 欧美影院一区二区三区| 中文字幕第一页久久| 久久精品国产免费看久久精品| 欧美在线视频日韩| 国产精品国产三级国产普通话三级 | 国产91精品一区二区| 欧美日韩精品免费| 国产精品伦理在线| 精品亚洲porn| 欧美二区三区的天堂| 亚洲人成网站影音先锋播放| 国产精品18久久久久久久久久久久 | 国模一区二区三区白浆| 7777精品伊人久久久大香线蕉的| 亚洲美女精品一区| 国产999精品久久久久久| 精品99999| 麻豆一区二区在线| 欧美精品亚洲二区| 一二三四社区欧美黄| 色综合欧美在线视频区| 亚洲欧美影音先锋| 99国产精品国产精品毛片| 日本一区二区三级电影在线观看 | 欧美精品一区在线观看| 蜜桃视频一区二区三区在线观看| 欧美日韩一级视频|