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

📄 printkey.cxx

📁 C++ 编写的EROS RTOS
💻 CXX
字号:
/* * Copyright (C) 1998, 1999, 2001, 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 <assert.h>#include <sys/fcntl.h>#include <sys/stat.h>#include <string.h>#include <stdlib.h>#include <unistd.h>#include <eros/target.h>#include <eros/StdKeyType.h>#include <eros/Key.h>#include <disk/DiskKey.hxx>#include <erosimg/Diag.hxx>#define __EROS_PRIMARY_KEYDEF(name) #name,/* OLD_MISCKEY(name) "OBSOLETE" #name, */static const char *KeyNames[KT_NUM_KEYTYPE] = {#include <eros/StdKeyType.h>};voidPrintDiskKey(const DiskKey& key){  switch(key.GetType()) {  case KT_Number:    Diag::printf("Kt_Number(0x%08x %08x %08x)", key.nk.value[2],		 key.nk.value[1], key.nk.value[0]);    break;  case KT_Page:    Diag::printf("KT_Page(OID=");    Diag::print(key.unprep.oid);    Diag::printf(",blss=%x", key.GetBlss());    if (key.IsPrepared())      Diag::printf(",P");    if (key.IsReadOnly())      Diag::printf(",RO");    Diag::printf(")");    break;  case KT_Node:  case KT_Segment:    {      char *typeName = 0;      if (key.GetType() == KT_Node)	typeName = "KT_Node";      else	typeName = "KT_Segment";      Diag::printf("%s(OID=", typeName);      Diag::print(key.unprep.oid);      if (key.GetBlss())	Diag::printf(",blss=%d", key.GetBlss());      if (key.IsNoCall())	Diag::printf(",NC");      if (key.IsReadOnly())	Diag::printf(",RO");      if (key.IsWeak())	Diag::printf(",WK");      Diag::printf(")");      break;    }  case KT_Process:    Diag::printf("KT_Process(OID=");    Diag::print(key.unprep.oid);    Diag::printf(")");    break;  case KT_Timer:    Diag::printf("KT_Timer(??\?)");    break;  case KT_Sched:    Diag::printf("KT_Sched(prio=%d)", key.keyData);    break;  case KT_PrimeRange:    {      OID start = 0llu;      OID top = UINT64_MAX;      Diag::printf("KT_PrimeRange(OID=");      Diag::print(start);      Diag::printf(":");      Diag::print(top);      Diag::printf(")");      break;    }  case KT_PhysRange:    {      OID start = OID_RESERVED_PHYSRANGE;      OID top = (UINT64_MAX * EROS_OBJECTS_PER_FRAME);      Diag::printf("KT_PhysRange(OID=");      Diag::print(start);      Diag::printf(":");      Diag::print(top);      Diag::printf(")");      break;    }  case KT_Range:    {      OID start = key.rk.oid;      OID top = key.rk.oid + key.rk.count;            Diag::printf("KT_Range(OID=");      Diag::print(start);      Diag::printf(":");      Diag::print(top);      Diag::printf(")");      break;    }  case KT_Device:    Diag::printf("KT_Device(ty=%d)", key.keyData);    break;  case KT_Start:    Diag::printf("KT_Start(OID=");    Diag::print(key.unprep.oid);    Diag::printf(",data=%d)", key.keyData);    break;  case KT_Resume:    Diag::printf("KT_Resume(OID=");    Diag::print(key.unprep.oid);    Diag::printf(")");    break;  default:    if (key.IsMiscKey())      Diag::printf("misc(KT_%s)", KeyNames[key.GetType()]);    else      Diag::printf("KT_Unknown");  }}

⌨️ 快捷键说明

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