The Pedigree Project  0.1
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
ConsoleFile Class Referenceabstract
+ Inheritance diagram for ConsoleFile:
+ Collaboration diagram for ConsoleFile:

Public Member Functions

 ConsoleFile (size_t consoleNumber, String consoleName, Filesystem *pFs)
 
virtual bool isMaster ()=0
 
void setEvent (Event *e)
 
virtual char getLast ()
 
EventgetEvent () const
 
void getControlCharacters (char *out)
 Grabs the current array of control characters.
 
virtual size_t getBlockSize () const
 
size_t getConsoleNumber () const
 
virtual size_t getPhysicalConsoleNumber () const
 
virtual void eventComplete ()
 
- Public Member Functions inherited from File
 File ()
 
 File (const String &name, Time::Timestamp accessedTime, Time::Timestamp modifiedTime, Time::Timestamp creationTime, uintptr_t inode, class Filesystem *pFs, size_t size, File *pParent)
 
virtual ~File ()
 
virtual uint64_t read (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final
 
virtual uint64_t write (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final
 
virtual physical_uintptr_t getPhysicalPage (size_t offset)
 
virtual void returnPhysicalPage (size_t offset)
 
virtual void sync ()
 
virtual void sync (size_t offset, bool async)
 
Time::Timestamp getCreationTime ()
 
void setCreationTime (Time::Timestamp t)
 
Time::Timestamp getAccessedTime ()
 
void setAccessedTime (Time::Timestamp t)
 
Time::Timestamp getModifiedTime ()
 
void setModifiedTime (Time::Timestamp t)
 
String getName () const
 
void getName (String &s) const
 
virtual String getFullPath (bool bWithLabel=true)
 
virtual void truncate ()
 
size_t getSize ()
 
void setSize (size_t sz)
 
virtual bool isSymlink ()
 
virtual bool isDirectory ()
 
virtual bool isPipe () const
 
virtual bool isFifo () const
 
virtual bool isSocket () const
 
uintptr_t getInode () const
 
virtual void setInode (uintptr_t inode)
 
FilesystemgetFilesystem () const
 
void setFilesystem (Filesystem *pFs)
 
virtual void fileAttributeChanged ()
 
virtual void increaseRefCount (bool bIsWriter)
 
virtual void decreaseRefCount (bool bIsWriter)
 
void setPermissions (uint32_t perms)
 
uint32_t getPermissions () const
 
void setUid (size_t uid)
 
size_t getUid () const
 
void setGid (size_t gid)
 
size_t getGid () const
 
FilegetParent () const
 
void monitor (Thread *pThread, Event *pEvent)
 
void cullMonitorTargets (Thread *pThread)
 
virtual bool supports (const size_t command) const
 
virtual int command (const size_t command, void *buffer)
 
void enableDirect ()
 
void disableDirect ()
 
virtual void preallocate (size_t expectedSize, bool zero=true)
 
virtual Fileopen ()
 

Protected Member Functions

virtual int select (bool bWriting, int timeout)
 select - check and optionally for a particular state.
 
void inject (char *buf, size_t len, bool canBlock)
 inject - inject bytes into the ring buffer
 
virtual void performInject (char *buf, size_t len, bool canBlock)
 
virtual void performEventTrigger (char cause)
 
size_t processInput (char *buf, size_t len)
 Input processing.
 
void inputLineDiscipline (char *buf, size_t len, size_t flags=~0U, const char *controlChars=0)
 Input line discipline. More...
 
- Protected Member Functions inherited from File
virtual uint64_t readBytewise (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
 
virtual uint64_t writeBytewise (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
 
virtual uintptr_t readBlock (uint64_t location)
 
virtual void writeBlock (uint64_t location, uintptr_t addr)
 
virtual void extend (size_t newSize)
 
virtual void extend (size_t newSize, uint64_t location, uint64_t size)
 
void dataChanged ()
 
void getFilesystemLabel (HugeStaticString &s)
 
virtual void pinBlock (uint64_t location)
 
virtual void unpinBlock (uint64_t location)
 
void evict (uint64_t location)
 
void setPermissionsOnly (uint32_t perms)
 
void setUidOnly (size_t uid)
 
void setGidOnly (size_t gid)
 

Static Protected Member Functions

static size_t outputLineDiscipline (char *buf, size_t len, size_t maxSz, size_t flags=0)
 Output line discipline.
 
- Static Protected Member Functions inherited from File
static void writeCallback (CacheConstants::CallbackCause cause, uintptr_t loc, uintptr_t page, void *meta)
 

Protected Attributes

ConsoleFilem_pOther
 Other side of the console.
 
size_t m_Flags
 
char m_ControlChars [MAX_CONTROL_CHAR]
 
unsigned short m_Rows
 
unsigned short m_Cols
 
char m_LineBuffer [LINEBUFFER_MAXIMUM]
 Input line buffer.
 
size_t m_LineBufferSize
 Size of the input line buffer.
 
size_t m_LineBufferFirstNewline
 Location of the first newline in the line buffer. ~0 if none.
 
char m_Last
 Character that triggered an event.
 
Buffer< char > m_Buffer
 
- Protected Attributes inherited from File
String m_Name
 
Time::Timestamp m_AccessedTime
 
Time::Timestamp m_ModifiedTime
 
Time::Timestamp m_CreationTime
 
uintptr_t m_Inode
 
class Filesystemm_pFilesystem
 
size_t m_Size
 
Filem_pParent
 
size_t m_nWriters
 
size_t m_nReaders
 
size_t m_Uid
 
size_t m_Gid
 
uint32_t m_Permissions
 
HashTable< DataCacheKey, uintptr_t > m_DataCache
 
bool m_bDirect
 
Cache m_FillCache
 
Mutex m_Lock
 
List< MonitorTarget * > m_MonitorTargets
 

Private Member Functions

bool checkForEvent (size_t flags, char check, const char *controlChars)
 Check if the given character requires an event.
 
void triggerEvent (char cause)
 Triggers our event.
 
virtual bool isBytewise () const
 

Private Attributes

size_t m_ConsoleNumber
 
String m_Name
 
Eventm_pEvent
 
Mutex m_EventTrigger
 Locked when we trigger an event, unlocked when eventComplete called.
 

Friends

class ConsoleMasterFile
 
class ConsoleSlaveFile
 
class ConsoleManager
 

Detailed Description

Definition at line 46 of file Console.h.

Member Function Documentation

virtual void ConsoleFile::eventComplete ( )
inlinevirtual

In order to ensure getLast is always the most recent character, the thread that wrote a special character to the input stream is put to sleep until the event handler calls this function.

Definition at line 111 of file Console.h.

References eventComplete(), inject(), m_EventTrigger, m_pOther, performEventTrigger(), performInject(), Semaphore::release(), and select().

Referenced by eventComplete().

+ Here is the caller graph for this function:

virtual size_t ConsoleFile::getBlockSize ( ) const
inlinevirtual

Function to retrieve the block size returned by readBlock.

Note
This must be constant throughout the life of the file.

Reimplemented from File.

Definition at line 91 of file Console.h.

virtual char ConsoleFile::getLast ( )
inlinevirtual

getLast - get the most recent character we handled. This is to be used by event handlers, which will be called when a special character is handled. The event handler can then call this function to identify the character and perform the relevant processing it needs to.

Reimplemented in ConsolePhysicalFile, and ConsoleSlaveFile.

Definition at line 75 of file Console.h.

References m_Last, and m_pEvent.

Referenced by ConsoleSlaveFile::getLast().

+ Here is the caller graph for this function:

void ConsoleFile::inputLineDiscipline ( char *  buf,
size_t  len,
size_t  flags = ~0U,
const char *  controlChars = 0 
)
protected

Input line discipline.

Todo:
remove me, this is because of the port

Definition at line 181 of file ConsoleCommon.cc.

References WARNING.

Referenced by ConsolePhysicalFile::readBytewise(), and ConsoleMasterFile::writeBytewise().

+ Here is the caller graph for this function:

virtual bool ConsoleFile::isBytewise ( ) const
inlineprivatevirtual

File subclasses can define this and return true if they require read() calls to perform actual data reads, and false if readBlock() is otherwise sufficient.

Reimplemented from File.

Definition at line 189 of file Console.h.

void ConsoleFile::performEventTrigger ( char  cause)
protectedvirtual

Performs an event trigger. The default is to call triggerEvent which uses m_pOther.

Definition at line 449 of file ConsoleCommon.cc.

Referenced by eventComplete().

+ Here is the caller graph for this function:

void ConsoleFile::performInject ( char *  buf,
size_t  len,
bool  canBlock 
)
protectedvirtual

Override to permit different injection semantics. The default is to call m_pOther->inject.

Reimplemented in ConsolePhysicalFile.

Definition at line 444 of file ConsoleCommon.cc.

Referenced by eventComplete(), and ConsolePhysicalFile::getLast().

+ Here is the caller graph for this function:

Member Data Documentation

Event* ConsoleFile::m_pEvent
private

Event to fire when an event takes place that needs action. For example, when ^C is typed. The handler for the event figures out what to do.

Definition at line 178 of file Console.h.

Referenced by getLast().


The documentation for this class was generated from the following files: