FreeNOS
Public Member Functions | Protected Attributes
Device Class Reference

Abstract device class interface. More...

#include <Device.h>

Inheritance diagram for Device:
File ATAController Keyboard NetworkDevice SerialDevice Terminal Time VGA Loopback Sun8iEmac i8250 NS16550 PL011

Public Member Functions

 Device (const u32 inode, const FileSystem::FileType type)
 Constructor. More...
 
virtual ~Device ()
 Destructor. More...
 
virtual const StringgetIdentifier () const
 Get unique device identifier. More...
 
virtual FileSystem::Result initialize ()
 Initialize the device. More...
 
virtual FileSystem::Result interrupt (const Size vector)
 Called when an interrupt has been triggered for this device. More...
 
- Public Member Functions inherited from File
 File (const u32 inode, const FileSystem::FileType type=FileSystem::RegularFile, const UserID uid=ZERO, const GroupID gid=ZERO)
 Constructor function. More...
 
virtual ~File ()
 Destructor function. More...
 
u32 getInode () const
 Get inode number. More...
 
FileSystem::FileType getType () const
 Retrieve our filetype. More...
 
virtual FileSystem::Result read (IOBuffer &buffer, Size &size, const Size offset)
 Read bytes from the file. More...
 
virtual FileSystem::Result write (IOBuffer &buffer, Size &size, const Size offset)
 Write bytes to the file. More...
 
virtual FileSystem::Result status (FileSystem::FileStat &st)
 Retrieve file statistics. More...
 
virtual bool canRead () const
 Check if the File has data ready for reading. More...
 
virtual bool canWrite () const
 Check if the File can be written to. More...
 

Protected Attributes

String m_identifier
 Unique identifier for this Device. More...
 
- Protected Attributes inherited from File
const u32 m_inode
 Inode number. More...
 
const FileSystem::FileType m_type
 Type of this file. More...
 
UserID m_uid
 Owner of the file. More...
 
GroupID m_gid
 Group of the file. More...
 
FileSystem::FileModes m_access
 Access permissions. More...
 
Size m_size
 Size of the file, in bytes. More...
 

Detailed Description

Abstract device class interface.

Definition at line 35 of file Device.h.

Constructor & Destructor Documentation

◆ Device()

Device::Device ( const u32  inode,
const FileSystem::FileType  type 
)

Constructor.

Parameters
inodeInode number for this Device
typeType of file

Definition at line 20 of file Device.cpp.

◆ ~Device()

Device::~Device ( )
virtual

Destructor.

Definition at line 26 of file Device.cpp.

Member Function Documentation

◆ getIdentifier()

const String & Device::getIdentifier ( ) const
virtual

Get unique device identifier.

Returns
String object

Definition at line 30 of file Device.cpp.

References m_identifier.

Referenced by DeviceServer::initialize().

◆ initialize()

FileSystem::Result Device::initialize ( )
virtual

Initialize the device.

Returns
Result code

Reimplemented in ATAController, Sun8iEmac, Terminal, VGA, Time, NS16550, PL011, i8250, NetworkDevice, Keyboard, and Loopback.

Definition at line 35 of file Device.cpp.

References FileSystem::Success.

Referenced by NetworkDevice::initialize(), and DeviceServer::initialize().

◆ interrupt()

FileSystem::Result Device::interrupt ( const Size  vector)
virtual

Called when an interrupt has been triggered for this device.

Parameters
vectorVector number of the interrupt.
Returns
Result code

Reimplemented in Sun8iEmac, ATAController, NS16550, PL011, i8250, and Keyboard.

Definition at line 40 of file Device.cpp.

References FileSystem::Success.

Field Documentation

◆ m_identifier

String Device::m_identifier
protected

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