mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 00:42:44 +00:00 
			
		
		
		
	Add an fd field to FileHandle in Kernel builds.
This commit is contained in:
		
							parent
							
								
									9d5de91cf3
								
							
						
					
					
						commit
						e86cadc7af
					
				
					 3 changed files with 20 additions and 0 deletions
				
			
		|  | @ -14,11 +14,20 @@ public: | |||
| 
 | ||||
|     ByteBuffer readEntireFile(); | ||||
| 
 | ||||
| #ifdef SERENITY_KERNEL | ||||
|     int fd() const { return m_fd; } | ||||
|     void setFD(int fd) { m_fd = fd; } | ||||
| #endif | ||||
| 
 | ||||
| private: | ||||
|     friend class VirtualFileSystem; | ||||
| 
 | ||||
|     RetainPtr<VirtualFileSystem::Node> m_vnode; | ||||
| 
 | ||||
|     Unix::off_t m_currentOffset { 0 }; | ||||
| 
 | ||||
| #ifdef SERENITY_KERNEL | ||||
|     int m_fd { -1 }; | ||||
| #endif | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -12,8 +12,17 @@ static dword encodedDevice(unsigned major, unsigned minor) | |||
|     return (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12); | ||||
| } | ||||
| 
 | ||||
| static VirtualFileSystem* s_the; | ||||
| 
 | ||||
| VirtualFileSystem& VirtualFileSystem::the() | ||||
| { | ||||
|     ASSERT(s_the); | ||||
|     return *s_the; | ||||
| } | ||||
| 
 | ||||
| VirtualFileSystem::VirtualFileSystem() | ||||
| { | ||||
|     s_the = this; | ||||
|     m_maxNodeCount = 16; | ||||
|     m_nodes = reinterpret_cast<Node*>(kmalloc(sizeof(Node) * maxNodeCount())); | ||||
|     memset(m_nodes, 0, sizeof(Node) * maxNodeCount()); | ||||
|  |  | |||
|  | @ -35,6 +35,8 @@ public: | |||
|         CharacterDevice* m_characterDevice { nullptr }; | ||||
|     }; | ||||
| 
 | ||||
|     static VirtualFileSystem& the(); | ||||
| 
 | ||||
|     VirtualFileSystem(); | ||||
|     ~VirtualFileSystem(); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling