Bananymous
0757834176
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
Bananymous
99bde9aa49
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
Bananymous
d09310f388
Kernel: Fix ext2 inode deletion
...
fsck now reports clean filesystem even after deleting files
2023-10-26 02:05:05 +03:00
Bananymous
091c5b6a66
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
Bananymous
1f794e4ac0
Kernel: Implement directory creation for RamFS
2023-10-25 19:41:34 +03:00
Bananymous
e85f9ac6a1
Kernel: Implement Ext2 directory creation
2023-10-25 19:37:04 +03:00
Bananymous
6ee5576dcc
Kernel: Add Inode API for creating directories
2023-10-25 19:36:04 +03:00
Bananymous
b890e2fc14
Kernel: Ext2FS now uses Ext2Inodes as cached values
2023-10-25 19:34:00 +03:00
Bananymous
15bb1804ef
Kernel/LibC: implement chmod syscall + libc wrapper
2023-10-25 02:35:37 +03:00
Bananymous
5bfeb9f3ca
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
Bananymous
27364f64a6
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
b712c70c75
Kernel: Expose command line and environment to /proc
2023-09-30 23:01:33 +03:00
Bananymous
a511441f7e
Kernel: /proc/{pid}/meminfo now reports per process memory usage
2023-09-30 21:20:18 +03:00
Bananymous
cd61d710df
Kernel: Add procfs that contains only pids
2023-09-30 21:19:36 +03:00
Bananymous
d883d212b1
Kernel/LibC: dirent now contains file type
2023-09-30 20:46:57 +03:00
Bananymous
dedb2a2399
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
8604c55de8
Kernel: Add API for RamDirectoryInodes to delete containing inodes
2023-09-30 19:22:30 +03:00
Bananymous
e949e8550c
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
f953f3d3ff
Kernel: Implement MAP_SHARED for regular files
...
Every inode holds a weak pointer to shared file data. This contains
physical addresses of pages for inode file data. Physical addresses
are allocated and read on demand.
When last shared mapping is unmapped. The inodes shared data is freed
and written to the inode.
2023-09-29 18:59:20 +03:00
Bananymous
05e57801e7
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
55d30a7cc3
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
8caba1e774
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
7bdb428938
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
5fae3cec2a
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
720bc418a6
All: Clear lines with only whitspace in them
2023-09-10 00:31:42 +03:00
Bananymous
7e08f0fb66
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
ddd36af0f1
Kernel: Add /dev/tty symlink that targets the current tty
2023-09-05 01:07:52 +03:00
Bananymous
35fd30ee29
Kernel: Implement basic RamSymlinkInode
2023-09-05 01:07:52 +03:00
Bananymous
55714b90cd
Kernel: Rework whole Terminal structure
...
Serial monitors can now be used as a output. This requires editing
init code for the stdio opening. Serial input is not supported, so qemu
still needs graphical window for ps/2 keyboard.
2023-09-04 19:34:18 +03:00
Bananymous
f1d4d5f995
Kernel: Add basic support for O_NONBLOCK (only for tty)
2023-09-04 12:57:52 +03:00
Bananymous
7933265095
Kernel: Split ext2 implementation to multiple files
2023-09-01 15:10:23 +03:00
Bananymous
d810644018
Kernel: Start work on writable ext2 filesystem
2023-08-31 23:40:31 +03:00
Bananymous
a7bfc1c2ec
Kernel: Add missing ififo() to Inode::Mode
2023-08-31 21:38:31 +03:00
Bananymous
f5f4bf58ad
Kernel: add is_tty() to inode
2023-07-24 22:19:59 +03:00
Bananymous
adbe13938e
Kernel: move Device.h to its own directory
2023-07-19 23:55:38 +03:00
Bananymous
74c79c7eff
Kernel: Rewrite whole device structure
...
We now have DevFileSystem which is derived from RamFileSystem. All
devices are RamInodes. We don't have separate DeviceManager anymore.
To iterate over devices, you can loop througn every inode in devfs.
2023-07-10 23:17:14 +03:00
Bananymous
5a5656b2d3
Kenrel: RamInode now implements truncate()
2023-07-10 16:07:09 +03:00
Bananymous
65fa05f998
Kernel: add O_TRUNC
...
this is not supported by anything yet
2023-07-10 15:48:18 +03:00
Bananymous
1e173c178d
Kernel: Ext2 fill now return ENOTSUP on write
...
We used to crash the kernel
2023-07-10 15:34:25 +03:00
Bananymous
45789fda08
Kernel: You can now read/write to RamInodes
...
RamFS should be stored on physical pages and not in kmalloc, but
that will be implemented later :)
2023-07-10 14:09:35 +03:00
Bananymous
3b5bc63d1b
Kernel: Inode::create_file() now takes uid and gid as parameters
2023-07-10 13:32:10 +03:00
Bananymous
f1089e2b8a
Kernel: start work on ram file system
2023-07-10 13:26:14 +03:00
Bananymous
363c325c79
Kenrel: Fix inode comparison
...
We should not compare rdevs
2023-07-10 11:48:11 +03:00
Bananymous
583504ebe0
Kernel: Inode rename directory functions
2023-07-10 11:48:11 +03:00
Bananymous
b354b77f8b
Kernel: Mark Ext2 classes final
2023-07-10 11:48:11 +03:00
Bananymous
4eb95c963d
Kernel/LibC: Add basic pipe() syscall and command
...
You can now create pipes :)
2023-07-06 22:16:26 +03:00
Bananymous
c62e820bcf
Kernel: Add basic Credentials for the system
...
Now filesystem access/open, etc confirm that you have access for rwxs
2023-06-11 20:06:06 +03:00
Bananymous
e209ca7c82
Kernel: Rewrite directory listing so it can be integrated to libc
2023-06-11 00:17:18 +03:00
Bananymous
a4cb5d8360
Kernel: Inode/Device detection is done with overridden bool functions
2023-06-03 13:28:15 +03:00
Bananymous
4d4d0e26a9
Kernel: Symlinks are now working
...
We still have to implement loop or depth detection
2023-06-02 11:43:46 +03:00