Commit Graph

26 Commits

Author SHA1 Message Date
Andreas Kling
e6284a8774 Fix broken SpinLock.
The SpinLock was all backwards and didn't actually work. Fixing it exposed
how wrong most of the locking here is.

I need to come up with a better granularity here.
2018-10-29 22:04:26 +01:00
Andreas Kling
bea106fdb2 Fix up VFS::resolveSymbolicLink() to use a base inode instead of a base path.
Also more VFS error plumbing.
2018-10-28 14:25:51 +01:00
Andreas Kling
97726862dd Add basic symlink support.
- sys$readlink + readlink()
- Add a /proc/PID/exe symlink to the process's executable.
- Print symlink contents in ls output.
- Some work on plumbing options into VFS::open().
2018-10-28 14:11:51 +01:00
Andreas Kling
1d4af51250 Add a VFS::absolutePath(InodeIdentifier).
This is pretty inefficient for ext2fs. We walk the entire block group
containing the inode, searching through every directory for an entry
referencing this inode.

It might be a good idea to cache this information somehow. I'm not sure
how often we'll be searching for it.

Obviously there are multiple caching layers missing in the file system.
2018-10-28 12:20:25 +01:00
Andreas Kling
81627cf7d5 Add a simple /proc/mounts that enumerates the current VFS mounts. 2018-10-26 18:43:25 +02:00
Andreas Kling
edb81a635c Fix bug where you couldn't "cd .." into the root of a mounted fs. 2018-10-26 18:19:31 +02:00
Andreas Kling
a32b3a3ddf Implement /proc/PID/vm.
Refactored SyntheticFileSystem to maintain an arbitrary directory structure.
ProcFileSystem creates a directory entry in /proc for each new process.
2018-10-26 17:44:19 +02:00
Andreas Kling
2749e7f1c2 Implement sys$chdir() and teach sh+ls to cd around and browse different dirs. 2018-10-26 14:24:11 +02:00
Andreas Kling
bca4b71bfa Lots of hacking to make a very simple "ls" utility.
I added a dead-simple malloc that only allows allocations < 4096 bytes.
It just forwards the request to mmap() every time.

I also added simplified versions of opendir() and readdir().
2018-10-24 12:50:07 +02:00
Andreas Kling
018da1be11 Generalize the SpinLock and move it to AK.
Add a separate lock to protect the VFS. I think this might be a good idea.
I'm not sure it's a good approach though. I'll fiddle with it as I go along.

It's really fun to figure out all these things on my own.
2018-10-23 23:34:05 +02:00
Andreas Kling
ba185e3eba Zero out VirtualFileSystem::s_the in initializeGlobals().
This catches attempts to access the vfs before it's been constructed.
2018-10-22 12:54:19 +02:00
Andreas Kling
79ffdb7205 A lot of hacking:
- More work on funneling console output through Console.
- init() now breaks off into a separate task ASAP.
- ..this leaves the "colonel" task as a simple hlt idle loop.
- Mask all IRQs on startup (except IRQ2 for slave passthru)
- Fix underallocation bug in Task::allocateRegion().
- Remember how many times each Task has been scheduled.

The panel and scheduling banner are disabled until I get things
working nicely in the (brave) new Console world.
2018-10-22 11:15:16 +02:00
Andreas Kling
2d1d01661b 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.
2018-10-19 11:20:49 +02:00
Andreas Kling
e86cadc7af Add an fd field to FileHandle in Kernel builds. 2018-10-18 10:27:07 +02:00
Andreas Kling
f82b25d4f9 Fix some minor build warnings. 2018-10-17 16:48:43 +02:00
Andreas Kling
7580ac576f Make VFS host build work again. 2018-10-17 12:23:19 +02:00
Andreas Kling
d2425495ca VirtualFileSystem class builds inside Kernel. 2018-10-17 11:40:58 +02:00
Andreas Kling
9171521752 Integrate ext2 from VFS into Kernel. 2018-10-17 10:57:23 +02:00
Andreas Kling
f608629704 Implement creating a new directory. 2018-10-16 00:35:03 +02:00
Andreas Kling
9528edab92 Move readEntireInode() up to FileSystem (from ext2.)
It's just a wrapper around multiple calls to readInodeBytes() now.
2018-10-15 00:16:14 +02:00
Andreas Kling
0286b5ea48 Add a "stat" command to test FileHandle::stat(). 2018-10-14 23:39:11 +02:00
Andreas Kling
93556d6743 Add basic character device support. Start with null and zero. 2018-10-14 03:01:32 +02:00
Andreas Kling
fa3b11ac64 Parse out major/minor device from character and block device inodes. 2018-10-14 02:24:12 +02:00
Andreas Kling
6ea8ce500c Use HashMap::remove() in some places that I wanted it. 2018-10-13 14:26:37 +02:00
Andreas Kling
c2d42710bb Fix build. 2018-10-13 00:44:54 +02:00
Andreas Kling
5a30055157 Import all this stuff into a single repo called Serenity. 2018-10-10 11:53:07 +02:00