mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
Add a way to initialize VFS globals.
This is needed since the kernel loader doesn't even zero out bss, much less call any static constructors.
This commit is contained in:
parent
97e0d75bcb
commit
2d1d01661b
Notes:
sideshowbarker
2024-07-19 18:46:13 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2d1d01661b0
4 changed files with 16 additions and 2 deletions
|
@ -2,16 +2,22 @@
|
|||
#include <AK/HashMap.h>
|
||||
#include "FileSystem.h"
|
||||
|
||||
static dword s_lastFileSystemID = 0;
|
||||
static dword s_lastFileSystemID;
|
||||
static HashMap<dword, FileSystem*>* map;
|
||||
|
||||
static HashMap<dword, FileSystem*>& fileSystems()
|
||||
{
|
||||
static HashMap<dword, FileSystem*>* map;
|
||||
if (!map)
|
||||
map = new HashMap<dword, FileSystem*>();
|
||||
return *map;
|
||||
}
|
||||
|
||||
void FileSystem::initializeGlobals()
|
||||
{
|
||||
s_lastFileSystemID = 0;
|
||||
map = 0;
|
||||
}
|
||||
|
||||
FileSystem::FileSystem()
|
||||
: m_id(++s_lastFileSystemID)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@ static const dword mepoch = 476763780;
|
|||
|
||||
class FileSystem : public Retainable<FileSystem> {
|
||||
public:
|
||||
static void initializeGlobals();
|
||||
virtual ~FileSystem();
|
||||
|
||||
dword id() const { return m_id; }
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
|
||||
//#define VFS_DEBUG
|
||||
|
||||
void VirtualFileSystem::initializeGlobals()
|
||||
{
|
||||
FileSystem::initializeGlobals();
|
||||
}
|
||||
|
||||
static dword encodedDevice(unsigned major, unsigned minor)
|
||||
{
|
||||
return (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12);
|
||||
|
|
|
@ -14,6 +14,8 @@ class FileSystem;
|
|||
|
||||
class VirtualFileSystem {
|
||||
public:
|
||||
static void initializeGlobals();
|
||||
|
||||
struct Node {
|
||||
InodeIdentifier inode;
|
||||
|
||||
|
|
Loading…
Reference in a new issue