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

📄 kern_objectsource.cxx

📁 C++ 编写的EROS RTOS
💻 CXX
字号:
/* * Copyright (C) 1998, 1999, Jonathan S. Shapiro. * * This file is part of the EROS Operating System. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2, * or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#include <kerninc/kernel.hxx>#include <disk/DiskKey.hxx>#include <disk/LowVolume.hxx>#include <kerninc/BootInfo.h>#include <kerninc/Node.hxx>#include <kerninc/ObjectSource.hxx>#include <kerninc/Thread.hxx>ObCacheSource::ObCacheSource()  :ObjectSource("obcache", 0llu, ~0llu){}ObjectHeader *ObCacheSource::GetObject(OID oid, ObType::Type obType, 			 ObCount count, bool useCount){  ObjectHeader *pObj = 0;  if (obType == ObType::NtUnprepared) {    pObj = ObjectHeader::Lookup(ObType::NtUnprepared, oid);    assertex(pObj, (pObj == 0) || ((Node *) pObj)->Validate());  }  else {    pObj = ObjectHeader::Lookup(ObType::PtDataPage, oid);  }  return pObj;}boolObCacheSource::WriteBack(ObjectHeader *pObj, bool inBackground){  return false;}boolObCacheSource::Invalidate(ObjectHeader *pObj){  return false;}boolObCacheSource::Detach(){  fatal("ObCacheSource::Detach(): cannot detach object cache!\n");  return false;}ObjectSource::ObjectSource(const char *nm, OID first, OID last){  name = nm;  start = first;  end = last;}boolObjectSource::IsRemovable(ObjectHeader *){  /* Until proven otherwise: */  return false;}/* A source can publish an incompletely populated OID range. For * example, the user source claims the entire persistent OID range, * but the machine is unlikely to have that much disk space actually * attached. * * For most in-kernel sources (ROM, Preload), the claimed range is the * real range, so it's useful to have a "generic" implementation * here. The exceptional case is the ResidentRange, because the number * of available resident frames can change as the kernel dynamically * (de)allocates memory. * * FIX: Perhaps this is a bug and we should implement a separate * persistent source for each range? */void ObjectSource::FindFirstSubrange(OID limStart, OID limEnd,				OID& subStart, OID& subEnd){  /* Validate that the requested range and this source really do   * overlap:   */  assert (end >= limStart && start < limEnd);  /* We shouldn't have been called unless we might have a better   * answer:    */  assert(start < subStart);  subStart = max(start, limStart);  subEnd = min(end, limEnd);}

⌨️ 快捷键说明

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