Commit Graph

124 Commits

Author SHA1 Message Date
bc5e8add19 Kernel: Make Ext2 filesystem use BlockDevice instead of Partition 2023-11-21 15:20:24 +02:00
95af728e39 Kernel: Don't calculate divisor in a for loop in ext2 inodes 2023-11-17 19:02:01 +02:00
fda0dfec30 Kernel: Make TmpFS enforce max page count. 2023-11-07 16:13:21 +02:00
d6ae1bcf36 Kernel: Remove now obsolete RamFS
Everything is using now the better TmpFS which uses physical pages
for page allocation instead of the static kmalloc memory.
2023-11-07 16:07:11 +02:00
5044810451 Kernel: Make DevFS use the new and better TmpFS instead of RamFS 2023-11-07 16:05:05 +02:00
07b5920f3f Kernel: Lock TmpFS in all its methods 2023-11-07 16:03:52 +02:00
2bcf934389 Kernel: Implement symlinks to TmpFS 2023-11-07 15:59:50 +02:00
b1f431d962 Kernel: /tmp is now TmpFS instead of RamFS 2023-11-07 02:36:22 +02:00
06e176e6b9 Kernel: Make ProcFS use the new TmpFS internally 2023-11-07 02:35:44 +02:00
b7771e95ac Kernel: Implement TmpFS Inode unlinking and deletion 2023-11-06 21:49:12 +02:00
3e33fc156b Kernel: TmpFS directory inodes now iterate over only valid entries 2023-11-06 21:41:51 +02:00
438f01a856 Kernel: Fix TmpFS directory entry enumeration early return 2023-11-06 21:06:10 +02:00
5dd8189048 Kernel: Fix ext2 directory listing for big directories 2023-11-06 21:05:58 +02:00
ff6b127c3a Kernel: Implement TmpFS directory listing 2023-11-06 21:05:58 +02:00
c3ed700324 Kernel: Implement TmpFS inode chmod 2023-11-06 20:11:34 +02:00
ba2f09a4e6 Kernel: Cleanup TmpFS code and block access doesn't require allocs
TmpFS blocks are now accessed with a simple wrapper
2023-11-06 20:07:09 +02:00
c92c1b8e2b Kernel: TmpInode blocks are on demand allocated 2023-11-06 10:44:37 +02:00
c27d20abd8 Kernel: Implement read/write/truncate for TmpFileInode 2023-11-05 02:28:43 +02:00
99d7b0917d Kernel: Start work on proper TmpFS in Heap instead of kmalloc memory 2023-11-04 18:18:45 +02:00
35f8f44510 Kernel: Fix ext2 small link deallocation
Also fix deallocation bug
2023-10-30 16:22:02 +02:00
76f48f095c Kernel: Rewrite a lot of ext2 code
This commit consists of multiple big changes

1. blocks for inodes are now allocated on demand
  - reading from non allocated block will just return zeroes
  - writing to non allocated block allocates it

2. code doesn't really use raw pointers anymore
  - all casts to uint32_t or structures are now replaced with
    spans. either as<T> or as_span<T> which both are bounds
	checked

3. code doesn't depend on random macros for accessing indirect blocks
  - i added some recursive functions which take care of this :)
2023-10-28 22:13:28 +03:00
240a687d8f Kernel: Fix ext2 inode block allocation with triply indirect blocks 2023-10-28 16:53:00 +03:00
35b46e37bb Kernel: Fix ext2 inode deletion cleanup
I now cleanup all blocks (including direct) in i_block array
2023-10-28 16:52:56 +03:00
38c267b4c8 Kernel: Fix ext2 inode deletion
fsck now reports clean filesystem even after deleting files
2023-10-26 02:05:05 +03:00
b7007016c0 BAN: Implement Ext2 file unlinking
Ext2 inodes can now be unlinked from directories and after last
inode closes (destructor gets called) we check if link count is 0
and cleanup the inode from filesystem
2023-10-25 21:43:36 +03:00
e9b7cf332d Kernel: Implement directory creation for RamFS 2023-10-25 19:41:34 +03:00
4ee2f0f789 Kernel: Implement Ext2 directory creation 2023-10-25 19:37:04 +03:00
18e90d305d Kernel: Add Inode API for creating directories 2023-10-25 19:36:04 +03:00
fd1b331b86 Kernel: Ext2FS now uses Ext2Inodes as cached values 2023-10-25 19:34:00 +03:00
5c51d09309 Kernel: Fix read offset of RamFileInode 2023-10-25 02:53:20 +03:00
627b8cc140 Kernel/LibC: implement chmod syscall + libc wrapper 2023-10-25 02:35:37 +03:00
f3d9da9549 Kernel: Rewrite all read/write functions to use BAN::ByteSpan
This allows us to not work with raw pointers and use sized containers
for reading and writing.
2023-10-24 11:56:00 +03:00
f21d4e794c Kernel: Rework whole ATA driver structure
Make ATA driver more compatible when we are adding SATA support
2023-10-08 02:50:23 +03:00
Bananymous
39bc6c43dc Kernel: Expose command line and environment to /proc 2023-09-30 23:01:33 +03:00
Bananymous
785de5f9b9 Kernel: /proc/{pid}/meminfo now reports per process memory usage 2023-09-30 21:20:18 +03:00
Bananymous
8f630a97df Kernel: Add procfs that contains only pids 2023-09-30 21:19:36 +03:00
Bananymous
9f0797047f Kernel/LibC: dirent now contains file type 2023-09-30 20:46:57 +03:00
Bananymous
e8a0eeb0b4 Kernel: RamInode verifies that you have not specified mode type
This is kinda weird behaviour, but it ensures the user cannot
create e.g. CharacterDevice with mode having IFLNK.

The Inode overrider is the only one setting the mode.
2023-09-30 20:46:57 +03:00
Bananymous
3e5645d453 Kernel: Add API for RamDirectoryInodes to delete containing inodes 2023-09-30 19:22:30 +03:00
Bananymous
2301654c4e Kernel: Rework RamInode API
RamInode is now a general RamInode with no data. RamFileInode is now
a inode for regular files. This is much cleaner and more intuitive
since there is no reason for most non-regular inodes to hold data
Vector.
2023-09-30 19:22:30 +03:00
Bananymous
1e6930a3bc Kernel: SYS_SYNC now schedules sync to happen soon
You can pass non-zero argument to the syscall to block until the
sync has finished.
2023-09-27 00:34:00 +03:00
Bananymous
9d55cf1d80 Kernel: Ext2 inodes are now stored in cache
This allows faster inode access and ensures working inodes when
opened in multiple places.
2023-09-25 20:31:40 +03:00
Bananymous
669b2ace4e Kernel: Ext2 filesystem now holds 10 preallocated block buffers
Inodes can query blocks from this buffer. This allows allocation of
blocks to not fail during normal operations. Also less stress on
kmalloc.
2023-09-25 14:32:25 +03:00
Bananymous
0e67c6318b Kernel: Fix ext2 block allocation
Redo ext2 block allocation. This is now much "cleaner" although
I'm not too fond of the macros.
2023-09-25 13:17:44 +03:00
Bananymous
63dc2b6aa6 Kernel: Implement SYS_SYNC and add sync executable to userspace
You can (and have to) manually sync disk after writes to it.
2023-09-11 01:26:27 +03:00
Bananymous
9b9a6b2cfc Kernel: Fix ext2 file write 2023-09-11 01:20:39 +03:00
Bananymous
921d95d18f All: Clear lines with only whitspace in them 2023-09-10 00:31:42 +03:00
Bananymous
1fcf122c50 Kernel: Add basic ZeroDevice to /dev/zero 2023-09-10 00:31:42 +03:00
Bananymous
dd9af56e21 Kernel: Start work on making inodes more thread safe
All inode operations are now locked and thread blocked
2023-09-10 00:31:42 +03:00
Bananymous
39a5c52088 Kernel: Fix directory permissions
We did not care about X bit in directories and instead used only the
R bit for search/read.
2023-09-08 11:46:53 +03:00