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.
This could be tail-call-optimized but it's not, so we end up overflowing the
stack space if we recurse too many times. This was causing crashes when
resizing Minesweeper.
FileDescriptor is getting out of control, and the layering isn't quite right
so let's make a File class that everything can inherit from. Then we can
stop worrying about all kinds of specifics in FileDescriptor.
It was wrong to do a reverse name lookup on the old inode after adding
a new name for it, since we might very well get the new inode instead of
the old one, depending on hash table layouts.
Memory returned by malloc() is normally memset with 0x85.
Memory passed to free() is normally memset with 0x82.
These behaviors can now be disabled by setting one or both of
LIBC_NOSCRUB_MALLOC and LIBC_NOSCRUB_FREE in your environment. :^)
This is a really naive implementation that makes fwrite() call fputc()
internally, but it still performs a lot better due to avoiding the write()
syscall every time.
This is just to avoid chewing through all of the kernel memory. There is a
lot of room for improvement here, and 32 is just a number from the place
where numbers come from.
They show up as checkable GButtons in GToolBar, and with (or without) check
marks in menus.
There are a bunch of places to make use of this. This patch only takes
advantage of it in the FileManager for the view type actions.
We throw away the backing store if the window rect changes size. Since the
resizing happens asynchronously at the mercy of the WindowServer, we might
end up in set_rect() again before gaining a new backing store. So there are
no guarantees that the back/front bitmaps exist here.
Someone was playing this game and suggested a number of improvements so here
we go trying to address them:
- Add "chording" support, where you can click a numbered square using both
mouse buttons simultaneously to sweep all non-flagged adjacent squares.
- Mis-flagged squares are now revealed as such on game over, with a special
"bad flag" icon.
- The game timer now shows tenths of seconds. It also doesn't start until
you click the first square.
- Add the three difficulty modes from the classic Windows version.
This way you can spam small write()s on a file without the kernel writing
to disk every single time. Flushes are included in the FS::sync() operation
and will get triggered regularly by syncd. :^)