|
The Pedigree Project 0.1
|
#include <InputFile.h>
Inheritance diagram for EvdevFile:
Collaboration diagram for EvdevFile:Public Types | |
| enum | DeviceType { Keyboard , Pointer , AbsolutePointer } |
Public Types inherited from File | |
| enum | AttributeMask : uint32_t { AccessTime = 1U << 0 , ModifyTime = 1U << 1 , ChangeTime = 1U << 2 , Owner = 1U << 3 , Group = 1U << 4 , Permissions = 1U << 5 } |
Public Member Functions | |
| EvdevFile (String name, size_t inode, Filesystem *filesystem, File *parent, DeviceType type, bool endpoint=false) | |
| bool | initialise () |
| File * | open () override |
| uint64_t | readBytewise (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) override |
| uint64_t | writeBytewise (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) override |
| int | select (bool bWriting=false, int timeout=0) override |
| ReadinessGenerations | readinessGenerations () override |
| bool | supportsReadinessNotifications () const override |
| bool | supports (size_t command) const override |
| int | command (size_t command, void *buffer) override |
| bool | isSeekable () const override |
| bool | retainVfsReference () override |
| void | releaseVfsReference () override |
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 |
| size_t | readCached (uint64_t location, size_t size, uintptr_t buffer, bool(*prepare)(uintptr_t, size_t)=nullptr) |
| virtual uint64_t | write (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final |
| uint64_t | append (uint64_t size, uintptr_t buffer, uint64_t &location, bool bCanBlock=true) |
| WriteGuard | lockWrites () |
| virtual physical_uintptr_t | getPhysicalPage (size_t offset) |
| virtual bool | isDirectPhysicalMapping () const |
| size_t | physicalMappingFlags () const |
| virtual void | returnPhysicalPage (size_t offset) |
| virtual bool | tryBeginMappingRelease () |
| void | endMappingRelease () |
| bool | syncAndReturnPhysicalPage (size_t offset, bool async) |
| virtual bool | sync () |
| bool | syncRange (size_t offset, size_t length) |
| virtual bool | sync (size_t offset, bool async) |
| virtual bool | syncPages (const uint64_t *offsets, size_t count) |
| Time::Timestamp | getCreationTime () |
| void | setCreationTime (Time::Timestamp t) |
| Time::Timestamp | getAccessedTime () |
| void | setAccessedTime (Time::Timestamp t) |
| Time::Timestamp | getModifiedTime () |
| void | setModifiedTime (Time::Timestamp t) |
| void | setTimes (Time::Timestamp accessed, Time::Timestamp modified, bool changeAccessed, bool changeModified) |
| virtual Attributes | getAttributes () const |
| virtual XattrStatus | getExtendedAttribute (const StringView &name, void *buffer, size_t capacity, size_t &required) |
| virtual XattrStatus | listExtendedAttributes (void *buffer, size_t capacity, size_t &required) |
| virtual XattrStatus | setExtendedAttribute (const StringView &name, const void *value, size_t length, unsigned flags) |
| virtual XattrStatus | removeExtendedAttribute (const StringView &name) |
| virtual bool | prepareSharedMapping (size_t offset, size_t length) |
| String | getName () const |
| void | getName (String &s) const |
| virtual void | getFullPath (String &result, bool bWithMount=true) |
| virtual String | getFullPath (bool bWithMount=true) |
| virtual void | truncate () |
| bool | resize (size_t size) |
| virtual size_t | getSize () |
| void | setSize (size_t sz) |
| virtual bool | isSymlink () |
| virtual bool | isDirectory () |
| virtual bool | isBlockDevice () const |
| virtual uint64_t | deviceNumber () const |
| virtual bool | isPipe () const |
| virtual bool | isFifo () const |
| virtual bool | isSocket () const |
| bool | supportsRegularFileOperations () |
| virtual bool | isCharacterDevice () const |
| virtual bool | isConsole () const |
| virtual uint64_t | maximumFileSize () const |
| virtual bool | allowMapping (bool shared, bool writeRequested, bool &mayWrite) |
| bool | acquireMappingUse (bool executable, bool sharedWrite) |
| void | releaseMappingUse (bool executable, bool sharedWrite) |
| uintptr_t | getInode () const |
| virtual void | setInode (uintptr_t inode) |
| virtual uintptr_t | futexIdentity () |
| Filesystem * | getFilesystem () const |
| void | setFilesystem (Filesystem *pFs) |
| virtual void | fileAttributeChanged () |
| void | publishEvent (FileEventMask mask, const StringView &name=StringView(), bool targetIsDirectory=false) |
| virtual FileHandleStatus | subscribeInodeEvents (FileEventMask mask, const SharedPointer< FileEventObserver > &observer, FileEventSubscription &subscription) |
| virtual void | finishInodeRetirement () |
| virtual void | increaseRefCount (bool bIsWriter) |
| virtual void | decreaseRefCount (bool bIsWriter) |
| virtual bool | isStableVfsRoot () const |
| void | setPermissions (uint32_t perms) |
| uint32_t | getPermissions () const |
| bool | setOwnership (size_t uid, size_t gid, bool changeUid, bool changeGid) |
| void | setUid (size_t uid) |
| size_t | getUid () const |
| void | setGid (size_t gid) |
| size_t | getGid () const |
| File * | getParent () const |
| void | getNamespace (ParentLease &parent, String &name) const |
| virtual ReadyMask | queryReady (bool reading, bool writing) |
| void | monitor (Thread *pThread, Event *pEvent) |
| void | cullMonitorTargets (Thread *pThread) |
| void | cullMonitorTargets (Event *pEvent) |
| virtual size_t | getBlockSize () const |
| void | markPageExternallyWritable (size_t offset) |
| size_t | populateRange (size_t offset, size_t length) |
| void | enableDirect () |
| void | disableDirect () |
| virtual void | preallocate (size_t expectedSize, bool zero=true) |
| bool | allocateRange (size_t offset, size_t length, bool keepSize=false) |
| virtual File * | openForDescriptor (RetainedFile &owner) |
Public Member Functions inherited from ReadinessSource | |
| MUST_USE_RESULT bool | subscribeReadiness (ReadyMask interest, const SharedPointer< ReadinessObserver > &observer, ReadinessSubscription &subscription) |
Public Member Functions inherited from FileEventSource | |
| MUST_USE_RESULT bool | subscribeFileEvents (FileEventMask interest, const SharedPointer< FileEventObserver > &observer, FileEventSubscription &subscription) |
Private Member Functions | |
| void | handleInput (const InputManager::InputNotification ¬ification) |
| void | emit (const LinuxInputEvent *events, size_t count) |
| bool | isBytewise () const override |
Static Private Member Functions | |
| static void | subscriber (InputManager::InputNotification ¬ification) |
Private Attributes | |
| const DeviceType | m_Type |
| const bool | m_Endpoint |
| Mutex | m_Lock |
| Buffer< uint8_t > | m_Buffer |
| uint8_t | m_KeyState [96] |
| bool | m_ButtonState [5] |
| uint32_t | m_AbsoluteX = 0 |
| uint32_t | m_AbsoluteY = 0 |
| bool | m_HaveAbsolute = false |
| size_t | m_LifetimePins = 0 |
| bool | m_Registered = false |
Additional Inherited Members | |
Static Public Attributes inherited from File | |
| static constexpr size_t | MaxReadPages = 32 |
Protected Member Functions inherited from File | |
| bool | tryAcquireFilesystemOperation (OperationBarrier::Lease &operation) const |
| virtual void | updateAttributes (const Attributes &attributes, uint32_t mask) |
| virtual bool | changeOwnership (size_t uid, size_t gid, bool changeUid, bool changeGid) |
| virtual bool | allowPhysicalPage () const |
| virtual bool | prepareWrite (uint64_t location, uint64_t size) |
| virtual bool | allowResize (size_t oldSize, size_t newSize) |
| virtual bool | prepareShrink (const ShrinkContext &context, UniquePointer< PreparedShrink > &prepared) |
| virtual bool | resizeFile (size_t size) |
| virtual bool | allocateFileRange (size_t offset, size_t length) |
| virtual Mutex & | writeSerializationLock () |
| virtual Mutex & | dataMutationLock () |
| virtual size_t & | physicalPageLoans () |
| bool | clearDataCache () |
| virtual uintptr_t | readBlock (uint64_t location) |
| virtual bool | readPage (uint64_t location, uintptr_t destination) |
| virtual bool | readPages (ReadPage *pages, size_t count) |
| virtual void | writeBlock (uint64_t location, uintptr_t addr) |
| virtual void | writeBlocks (uint64_t location, uintptr_t addr, size_t length) |
| virtual void | extend (size_t newSize) |
| virtual void | extend (size_t newSize, uint64_t location, uint64_t size) |
| virtual void | publishInodeEvent (const FileEvent &event) |
| void | dataChanged () |
| void | getFilesystemLabel (HugeStaticString &s) |
| void | enableFillCacheWriteback () |
| void | shutdownFillCacheWriteback () |
| bool | syncFillCache (size_t offset, bool async, bool &present) |
| virtual bool | useFillCache () const |
| virtual MUST_USE_RESULT bool | pinBlock (uint64_t location) |
| virtual MUST_USE_RESULT uintptr_t | acquireCachedBlock (uint64_t location, bool retryChanged) |
| 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) |
| void | retainDetachedParent () |
| void | moveNamespace (const String &name, File *parent) |
| bool | snapshotNamespace (ParentLease &parent, String &name, FileEventMask interest) const |
| virtual CacheState & | cacheState () |
| void | setPhysicalMappingFlags (size_t flags) |
Protected Member Functions inherited from ReadinessSource | |
| void | notifyReadiness (ReadyMask mask) |
| void | closeReadiness (ReadyMask mask=ReadyInvalid|ReadyHangup) |
Protected Member Functions inherited from FileEventSource | |
| bool | hasFileEventObservers (FileEventMask mask) const |
| void | notifyFileEvent (const FileEvent &event) |
| void | notifyFinalFileEvent (const FileEvent &event) |
| void | beginFinalFileEvent (const FileEvent &event) |
| void | drainFileEvents () |
| void | closeFileEvents () |
Static Protected Member Functions inherited from File | |
| static bool | writeCallback (CacheConstants::CallbackCause cause, uintptr_t loc, uintptr_t page, void *meta) |
| static bool | fillCacheCallback (CacheConstants::CallbackCause cause, uintptr_t loc, uintptr_t page, void *meta) |
Static Protected Member Functions inherited from FileEventSource | |
| static bool | anyFileEventObservers () |
Protected Attributes inherited from File | |
| String | m_Name |
| Time::Timestamp | m_AccessedTime |
| Time::Timestamp | m_ModifiedTime |
| Time::Timestamp | m_CreationTime |
| uintptr_t | m_Inode |
| uintptr_t | m_FutexIdentity = 0 |
| class Filesystem * | m_pFilesystem |
| size_t | m_Size |
| File * | m_pParent |
| Mutex | m_MetadataLock |
| File * | m_pDetachedParent |
| bool | m_bDetachedParentHandled |
| size_t | m_nWriters |
| size_t | m_nReaders |
| size_t | m_Uid |
| size_t | m_Gid |
| uint32_t | m_Permissions |
| CacheState | m_CacheState |
| bool | m_bDirect |
| Mutex | m_WriteLock |
| Mutex | m_DataMutationLock |
| size_t | m_PhysicalPageLoans = 0 |
| size_t | m_PhysicalMappingFlags = 0 |
| Mutex | m_Lock |
| List< MonitorTarget * > | m_MonitorTargets |
A Linux evdev-compatible keyboard or pointer endpoint.
Definition at line 73 of file InputFile.h.
| enum EvdevFile::DeviceType |
Definition at line 75 of file InputFile.h.
| EvdevFile::EvdevFile | ( | String | name, |
| size_t | inode, | ||
| Filesystem * | filesystem, | ||
| File * | parent, | ||
| DeviceType | type, | ||
| bool | endpoint = false |
||
| ) |
Definition at line 302 of file InputFile.cc.
|
override |
Definition at line 313 of file InputFile.cc.
|
overridevirtual |
Handle a command.
Reimplemented from File.
Definition at line 396 of file InputFile.cc.
References PosixSubsystem::copyToUser().
|
private |
Definition at line 550 of file InputFile.cc.
|
private |
Definition at line 557 of file InputFile.cc.
| bool EvdevFile::initialise | ( | ) |
Definition at line 325 of file InputFile.cc.
|
inlineoverrideprivatevirtual |
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 108 of file InputFile.h.
|
inlineoverridevirtual |
Whether ordinary reads and writes consume a persistent byte offset.
Reimplemented from File.
Definition at line 96 of file InputFile.h.
|
overridevirtual |
Obtain the actual File object to use when opening this file.
This allows a File to exist and perform logic on an open() before returning either itself or some other File object. Some files require side effects as part of their opening, this facilitates that.
Reimplemented from File.
Definition at line 344 of file InputFile.cc.
References File::getName().
|
overridevirtual |
Reads bytes from the file, if isBytewise() == true.
Reimplemented from File.
Definition at line 356 of file InputFile.cc.
References Buffer< T, allowShortOperation >::read().
|
overridevirtual |
Return source-serialized rising-edge sequences where available.
A source increments the corresponding sequence while holding the same lock which changes its readiness predicate. Consumers can then recover a drain/refill transition even if the two callback deliveries are reordered.
Reimplemented from ReadinessSource.
Definition at line 377 of file InputFile.cc.
References Buffer< T, allowShortOperation >::readableGeneration().
|
overridevirtual |
Releases a reference acquired by retainVfsReference().
Reimplemented from File.
Definition at line 517 of file InputFile.cc.
References InputManager::instance(), File::releaseVfsReference(), and InputManager::removeCallback().
|
overridevirtual |
Attempts to retain this File through its existing VFS ownership record. Untracked filesystem roots remain borrowed and return false. Virtual dispatch lets kernel-owned contexts use the loadable VFS lifetime model without creating a kernel-to-module link dependency.
Reimplemented from File.
Definition at line 508 of file InputFile.cc.
References File::retainVfsReference().
|
overridevirtual |
Similar to POSIX's select() function
Reimplemented from File.
Definition at line 370 of file InputFile.cc.
References Buffer< T, allowShortOperation >::canRead().
|
staticprivate |
Definition at line 544 of file InputFile.cc.
|
overridevirtual |
Does this File object support the given integer-based command?
Reimplemented from File.
Definition at line 383 of file InputFile.cc.
|
inlineoverridevirtual |
Whether readiness transitions are reported through ReadinessSource.
Reimplemented from File.
Definition at line 90 of file InputFile.h.
|
overridevirtual |
Writes bytes to the file, if isBytewise() == true.
Reimplemented from File.
Definition at line 365 of file InputFile.cc.
|
private |
Definition at line 118 of file InputFile.h.
|
private |
Definition at line 119 of file InputFile.h.
|
private |
Definition at line 115 of file InputFile.h.
|
private |
Definition at line 117 of file InputFile.h.
|
private |
Definition at line 113 of file InputFile.h.
|
private |
Definition at line 120 of file InputFile.h.
|
private |
Definition at line 116 of file InputFile.h.
|
private |
Definition at line 121 of file InputFile.h.
|
private |
Definition at line 114 of file InputFile.h.
|
private |
Definition at line 122 of file InputFile.h.
|
private |
Definition at line 112 of file InputFile.h.