📄 diskkey.hxx
字号:
#ifndef __DISKKEY_HXX__#define __DISKKEY_HXX__/* * 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. *//* DiskKey.hxx: Declaration of a the Disk format of a Key. * * A DiskKey is the form that a Key takes when it appears on disk. * DiskKeys live in DiskNodes in the same way that Keys live in Nodes. * * DiskKeys are VERY simple objects. They are just smart enough to * convert themselves to/from ordinary Keys, and to assign from each * other. */#include <eros/target.h>#include <disk/KeyStruct.hxx>#ifdef __KERNEL__class Key;#endifclass DiskKey : public KeyBits {#if 0protected: /* Misc and Schedule keys: */ DiskKey(KeyType kt, uint16_t keySubType = 0); DiskKey(KeyType kt, OID oid, uint32_t blss, bool readOnly); /* DiskKey(KeyType kt, OID oid, Memuint8_t mb); */public: /* Start/Resume/Domain/Node/Page/Segment/Fetch keys: * public so that Parse::MatchKey can do simple construction */ DiskKey(KeyType kt, uint16_t _keyData, OID oid);#endif protected: /* Used only by NumberKey */ DiskKey(uint32_t first, uint32_t second, uint32_t third);#if 0 /* Range keys */ DiskKey(KeyType kt, OID lo, OID hi);#endifpublic: /* Default constructor: (void key) */ DiskKey(); ~DiskKey() { } inline void UnsafeSet(KeyBits& kb) { KS_Set(kb); } DiskKey& operator=(const DiskKey& that);#ifdef __KERNEL__ /* Copy from an in-core Node: */ void operator=(const Key& that);#endif} ;/* FOLLOWING CLASS STUBS EXIST SOLELY FOR KEYTYPE CHECKING ON * CONSTRUCTION */class SchedKey : public DiskKey {public: SchedKey(uint16_t prio = Prio::Normal) { InitType(KT_Sched); SetUnprepared(); keyFlags = 0; keyData = prio; nk.value[2] = 0; nk.value[1] = 0; nk.value[0] = 0; }};class SegmentKey : public DiskKey {public: SegmentKey(OID oid, uint32_t blss, bool readOnly = false, bool noCall = false) { InitType(KT_Segment); SetUnprepared(); keyFlags = 0; keyData = blss; if (readOnly) SetReadOnly(); unprep.oid = oid; unprep.count = 0; if (noCall) SetNoCall(); }};class DataPageKey : public DiskKey {public: DataPageKey(OID oid, bool readOnly = false/* , bool zeroPage = false */) { InitType(KT_Page); SetUnprepared(); keyFlags = 0; keyData = EROS_PAGE_BLSS; if (readOnly) SetReadOnly(); unprep.oid = oid; unprep.count = 0; }};class StartKey : public DiskKey {public: StartKey(OID oid, uint16_t _keyData = 0) { InitType(KT_Start); SetUnprepared(); keyFlags = 0; keyData = _keyData; unprep.oid = oid; unprep.count = 0; }};class ResumeKey : public DiskKey {public: ResumeKey(OID oid) { InitType(KT_Resume); SetUnprepared(); keyFlags = 0; keyData = 0; unprep.oid = oid; unprep.count = 0; }};class ProcessKey : public DiskKey {public: ProcessKey(OID oid) { InitType(KT_Process); SetUnprepared(); keyFlags = 0; keyData = 0; unprep.oid = oid; unprep.count = 0; }};class NodeKey : public DiskKey {public: NodeKey(OID oid, uint16_t _keyData = 0) { InitType(KT_Node); SetUnprepared(); keyFlags = 0; keyData = _keyData; unprep.oid = oid; unprep.count = 0; }};class RangeKey : public DiskKey {public: RangeKey(OID oidlo, OID oidhi) { InitType(KT_Range); SetUnprepared(); keyFlags = 0; keyData = 0; rk.oid = oidlo; rk.count = oidhi - oidlo; }};class NumberKey : public DiskKey {public: NumberKey(uint32_t w) : DiskKey(w, 0, 0) { } NumberKey(uint32_t first, uint32_t second, uint32_t third) : DiskKey(first, second, third) { }};class MiscKey : public DiskKey {public: MiscKey(uint16_t ty) { InitType(ty); if (ty == KT_TimePage) keyData = (EROS_PAGE_BLSS | SEGMODE_RO); else keyData = 0; nk.value[2] = 0; nk.value[1] = 0; nk.value[0] = 0; }};/* VoidDiskKey is used to construct a void key, for clarity. */class VoidDiskKey : public DiskKey {public: VoidDiskKey() : DiskKey() {}};#endif /* __DISKKEY_HXX__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -