1 Star 0 Fork 0

beyondsuntong/EagleTree

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
page.cpp 1009 Bytes
一键复制 编辑 原始数据 按行查看 历史
Niv Dayan 提交于 2015-02-05 01:32 . bug fixing in gecko
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdexcept>
#include "ssd.h"
namespace ssd {
/*
* Buffer used for accessing data pages.
*/
void *global_buffer;
}
using namespace ssd;
enum status Page::_read(Event &event)
{
event.incr_execution_time(PAGE_READ_DELAY);
/*if (PAGE_ENABLE_DATA)
global_buffer = (char*)page_data + event.get_address().get_linear_address() * PAGE_SIZE;
*/
return SUCCESS;
}
enum status Page::_write(Event &event)
{
event.incr_execution_time(PAGE_WRITE_DELAY);
/*if (PAGE_ENABLE_DATA && event.get_payload() != NULL && event.get_noop() == false)
{
void *data = (char*)page_data + event.get_address().get_linear_address() * PAGE_SIZE;
memcpy (data, event.get_payload(), PAGE_SIZE);
}*/
if (state != EMPTY) {
printf("You are trying to overwrite a page that is not free. This is illegal. The operations is: \n");
event.print();
}
logical_addr = event.get_logical_address();
assert(state == EMPTY);
state = VALID;
return SUCCESS;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/beyondsuntong/EagleTree.git
[email protected]:beyondsuntong/EagleTree.git
beyondsuntong
EagleTree
EagleTree
master

搜索帮助