Andreas Kling
5254a320d8
Kernel: Remove use of copy_ref() in favor of regular RefPtr copies.
...
This is obviously more readable. If we ever run into a situation where
ref count churn is actually causing trouble in the future, we can deal with
it then. For now, let's keep it simple. :^)
2019-07-11 15:40:04 +02:00
Andreas Kling
0e75aba7c3
StringView: Rename characters() to characters_without_null_termination().
...
This should make you think twice before trying to use the const char* from
a StringView as if it's a null-terminated string.
2019-07-08 15:38:44 +02:00
Andreas Kling
27f699ef0c
AK: Rename the common integer typedefs to make it obvious what they are.
...
These types can be picked up by including <AK/Types.h>:
* u8, u16, u32, u64 (unsigned)
* i8, i16, i32, i64 (signed)
2019-07-03 21:20:13 +02:00
Andreas Kling
90b1354688
AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr.
2019-06-21 18:37:47 +02:00
Andreas Kling
77b9fa89dd
AK: Rename Retainable => RefCounted.
...
(And various related renames that go along with it.)
2019-06-21 15:30:03 +02:00
Sergey Bugaev
75df45d709
Kernel: Fix comparing StringViews with strcmp().
...
StringView character buffer is not guaranteed to be null-terminated;
in particular it will not be null-terminated when making a substring.
This means that the buffer can not be used with C functions that expect
a null-terminated string. Instead, StringView provides a convinient
operator == for comparing it with Strings and C stirngs, so use that.
This fixes /proc/self/... resolution failures in ProcFS, since the name
("self") passed to ProcFSInode::lookup() would not be null-terminated.
2019-06-12 16:14:29 +02:00
Andreas Kling
51d70996ba
Ext2FS: The block numbers returned by allocate_blocks() should be 1-based.
...
e2fsck complained about two inodes sharing the same block, and this was why.
2019-06-09 14:59:46 +02:00
Andreas Kling
7562c0b7bf
Ext2FS: Fix wrong file mode being passed from create_inode() to add_child().
2019-06-09 12:48:34 +02:00
Andreas Kling
6873e7d016
Ext2FS: Move directory writing logic into Ext2FSInode.
2019-06-09 12:46:23 +02:00
Andreas Kling
8258b699db
Kernel: Use StringView more in Inode and subclasses.
2019-06-09 10:25:19 +02:00
Andreas Kling
891d4c4834
Kernel: Qualify a bunch of #include statements.
2019-06-07 19:29:34 +02:00
Andreas Kling
bc951ca565
Kernel: Run clang-format on everything.
2019-06-07 11:43:58 +02:00
Andreas Kling
08cd75ac4b
Kernel: Rename FileDescriptor to FileDescription.
...
After reading a bunch of POSIX specs, I've learned that a file descriptor
is the number that refers to a file description, not the description itself.
So this patch renames FileDescriptor to FileDescription, and Process now has
FileDescription* file_description(int fd).
2019-06-07 09:36:51 +02:00
Andreas Kling
bba2c062fe
FileSystem: Make Inode::lookup() take a StringView.
...
This avoids a lot of String allocation during path resolution.
2019-06-01 18:01:28 +02:00
Andreas Kling
2e14e5891c
FileSystem: Remove now-unused Inode::parent() and Inode::reverse_lookup().
...
These were only used to implement the old path resolution algorithm.
2019-06-01 17:46:37 +02:00
Andreas Kling
9ac95d1867
FileSystem: Pass mode_t to Inode::add_child().
...
This way the Ext2FS code can update its directory entry "file type" fields
correctly based on the file mode. This fixes some e2fsck whining.
2019-05-31 17:41:33 +02:00
Andreas Kling
75b0e5cce5
Ext2FS: Block #0 can terminate an inode block list early.
...
We were already handling this for the indirect blocks, but the direct ones
would happily consider #0 to be a valid block list entry.
2019-05-25 19:19:43 +02:00
Andreas Kling
728327df8a
Ext2FS: Fix build with EXT2_DEBUG enabled, and tweak some variable names.
2019-05-25 17:23:17 +02:00
Andreas Kling
8b249bd09b
Kernel+Userland: Implement mknod() syscall and add a /bin/mknod program.
2019-05-03 22:59:58 +02:00
Andreas Kling
a6d407fec5
Ext2FS: Put some debug spam behind EXT2_DEBUG.
2019-04-28 22:14:37 +02:00
Andreas Kling
899f6a5de2
Ext2FS: Support shrinking inode to a smaller size.
...
Factor out inode resizing into a separate Ext2FSInode::resize() function.
This is then called both from write_bytes() and truncate().
This patch finally implements freeing of blocks when an inode shrinks.
2019-04-28 22:07:25 +02:00
Andreas Kling
dde8d90747
Ext2FS: Fix accidental zero-fill when appending to a file.
...
We were using the old file size, rather than the new file size, to determine
how much to zero-fill in the last block of a file.
2019-04-27 17:14:27 +02:00
Andreas Kling
e0cdc5db0d
Ext2FS: Reduce debug spam in block allocation.
2019-04-25 22:05:32 +02:00
Andreas Kling
fd500c79d6
Ext2S: Fix off-by-one error in block allocation.
2019-04-23 16:38:45 +02:00
Andreas Kling
b041fc57de
Ext2FS: Bitmaps aren't always at full capacity.
...
Block bitmaps only have (blocks_per_group) entries, while inode bitmaps
only have (inodes_per_group) entries.
2019-04-23 16:21:07 +02:00
Andreas Kling
14ceabeca8
Ext2FS: More bitmap misunderstanding cleanups.
...
Inode bitmaps are also only ever one block.
2019-04-23 15:07:07 +02:00
Andreas Kling
1bf37db9a9
Ext2FS: Simplify block bitmap stuff.
...
Block bitmaps are only ever one block in size. I don't know why I thought
otherwise, but use this info to simplify the code. :^)
2019-04-23 14:51:47 +02:00
Andreas Kling
58240fdb33
Do a pass of compiler warning fixes.
...
This is really making me question not using 64-bit integers more.
2019-04-23 13:00:53 +02:00
Andreas Kling
f9864940eb
Kernel: Move FS-related files into Kernel/FileSystem/
2019-04-03 12:25:24 +02:00