Commit Graph

67027 Commits

Author SHA1 Message Date
Augustin Cavalier
bab3f64413 RAMFS: Lock attribute iterators separate from entry iterators.
And clean up the code style while at it.
2024-11-22 20:29:18 -05:00
Augustin Cavalier
e2e7d84d21 RAMFS: Properly check that the Lockers are actually locked.
They pretty much always will be, but better to be safe. Also
de-indent one level and use an early return for this.
2024-11-22 18:07:26 -05:00
Augustin Cavalier
374d7a1eb1 RAMFS: Minor code style cleanups to Volume. 2024-11-22 17:42:00 -05:00
Augustin Cavalier
fe0e833f1f fat, exfat: Add acquire_vnode/put_vnode calls in the I/O hooks.
Same as was done in BFS.
2024-11-22 16:57:27 -05:00
Augustin Cavalier
9708b08060 KPath: Use a default buffer size of B_PATH_NAME_LENGTH without + 1.
B_PATH_NAME_LENGTH == PATH_MAX, and PATH_MAX is inclusive of the final
NULL terminator, so we don't need a + 1 here.

The original KPath default was to not use + 1, but that was changed in
42e3c6f978 due to all the consumers that did.

But all those consumers are wrong, it appears; they should just be
using the default length instead. So now we do that.
2024-11-22 16:56:15 -05:00
Augustin Cavalier
cc9ea55c59 file_systems/QueryParser: Coerce types up front, and handle B_TIME_TYPE better.
* If we coerce types inside the switch(), then the "type already converted"
   check at the beginning will fail every time, causing us to reconvert,
   which is surely bad for performance.

 * B_TIME_TYPE should be INT32 or INT64 depending on what its size is.

May help with #19080.
2024-11-21 23:19:09 -05:00
Augustin Cavalier
783b77b14f BFS: Fix handling of the last_modified index.
Its values must be shifted before comparing against them.
Also handle the last-modified times correctly in NodeGetLastModifiedTime.

Fixes an issue noticed in #19080 which was a regression from
the query refactor earlier this year.

Also while at it, remove a needless lock in EntryGetName;
Inode::GetName acquires this lock for us.
2024-11-21 22:38:41 -05:00
Augustin Cavalier
1abf2059a7 BFS: Adjust CachedNode::SetToWritable for consistency with SetTo.
Follow-up to an old review comment.
2024-11-21 22:38:41 -05:00
Jérôme Duval
fbdac8d61e headers: Don't define static_assert for C23 and C++
Change-Id: I1e67b09b2a310de5cf41c4eef9af46f78b4e9de0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8586
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-21 19:26:51 +00:00
Augustin Cavalier
7de59aee29 realtekwifi: Import changes from FreeBSD HEAD.
Same source commit as the previous import of net80211 changes.

May help with USB stalls and other issues.
Tested, WiFi still works.
2024-11-21 10:43:40 -05:00
Augustin Cavalier
da3ca31854 freebsd_wlan: Synchronize net80211 with FreeBSD.
From upstream commit d99eb8230eb717ab0b2eba948614d0f2f2b5dd2b.

Includes a variety of new macros that are used by drivers.
2024-11-21 10:40:37 -05:00
Augustin Cavalier
56c5e34285 freebsd_network: Use if_inc_counter and add to the "drops" counter in HANDOFF. 2024-11-20 18:46:55 -05:00
Augustin Cavalier
f42bea3139 freebsd_wlan: Use vap->iv_output as on FreeBSD.
We pass a NULL destination address, so we need to keep the added
NULL check, but after the previous commit we can now use the
real hook function here.

WiFi still works (tested with realtekwifi.)
2024-11-20 18:46:32 -05:00
Augustin Cavalier
99dcbd9716 freebsd_network: Use if_transmit in ether_output.
This is what FreeBSD does. The default implementation (in this
same file) does what ether_output did before, but the FreeBSD
net80211 stack overrides the method.
2024-11-20 18:45:44 -05:00
Augustin Cavalier
551a9b9a01 BFS: Keep references to vnodes during asynchronous I/O.
IORequest notifications begin by notifying the "finished" condition,
then invoking the request callback, then invoking the parent callback.

vfs_{read|write}_pages wait on the "finished" condition and then
return at once, potentially releasing their references to the vnode
in question, before the request callback is even invoked. The request
callback is what (eventually) invokes iterative_io_finished_hook,
which meant that we were accessing the Inode object after our reference
to it had already been released.

We can't really change IORequest notification order, as any one of the
notifications could delete the request, and indeed the first one does here.
So the solution is just to acquire another reference to the vnode and
release it in the finished hook.

Fixes #19122 and #8405.
2024-11-20 18:03:09 -05:00
Augustin Cavalier
138d92635d kernel/block_cache: More 32-bit fixes. 2024-11-20 17:25:50 -05:00
Augustin Cavalier
282ff4240a kernel/block_cache: Adjust declaration of _IOFinished. 2024-11-20 16:48:07 -05:00
Augustin Cavalier
f3884d7da0 kernel/block_cache: Correct callback parameter type.
Should fix x86 32-bit build.
2024-11-20 16:20:13 -05:00
Augustin Cavalier
d43d69f7da kernel/block_cache: Cleanups and fixes to the prefetcher.
* Use do_fd_io and drop the unnecessary iteration callback.

 * Make the callback call a non-static function to avoid needing
   to fetch values.

 * Unlock the cache before calling the I/O function.

Should fix #19259.
2024-11-20 15:54:21 -05:00
Augustin Cavalier
5c56d775a9 kernel/fs: Fix handling of partial requests in do_synchronous_iterative_vnode_io.
If get_vecs returns 0 and no vecs, then we need to quit iterating.
Otherwise we'll just loop forever and leak memory.

Also add an assert in IOBuffer::GetNextVirtualVec that would have caught
this problem, and the memory leak it results in.
2024-11-20 15:47:56 -05:00
Augustin Cavalier
e829154ffe kernel/fs: Implement do_fd_io using do_iterative_fd_io.
We need to hold a reference to the file descriptor throughout
the I/O operation, which do_iterative_fd_io already takes care of.
So just modify it to handle not having the additional callbacks.

Nothing actually uses do_fd_io at present, though it will be
in the next commits.
2024-11-20 15:47:02 -05:00
Augustin Cavalier
8f88247e04 kernel/device_manager: Add a io_scheduler_roster KDL command.
This way, the list of I/O schedulers can actually be retrieved.
2024-11-20 14:11:51 -05:00
Augustin Cavalier
e19a3418cb kernel/device_manager: Move I/O scheduler debug dumpers into IOSchedulerRoster.
No behavioral change intended.
2024-11-20 14:10:38 -05:00
Jérôme Duval
0edecdc00e BBitmap: Amend special-casing for B_RGB32 in SetBits.
* Spirograph uses SetBits with length 1 und 4, which can't work as
expected. As Spirograph uses the same source and target colorspace,
the memcpy codepath is used with the right length.
* fix #12931

Change-Id: I4f27e748fb842c2d81d4161e7c94586844995bdf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8562
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-11-20 10:03:58 +00:00
Augustin Cavalier
f72d1684e5 kernel/debug: Initialize the frame buffer console much earlier, if possible.
Previously it was not initialized until "post-VM", but there are
a number of ways VM initialization can go wrong that it would
be nice to know about without needing a serial port.

On arches which map the whole physical memory into the kernel
address space (x86_64, at least), we can get the bluescreen facility
initialized using KERNEL_PMAP_BASE. On other architectures, we
just fail to init then, and do the usual setup later on.

A slight bit of extra code cleanup in blue_screen_init_early:
we now just call module->info.std_ops() rather than a
frame-buffer-console specific method.
2024-11-19 21:35:31 -05:00
Augustin Cavalier
4550b3c025 kernel/block_cache: Minor code cleanup, and add a comment.
Detailing how we avoid use-after-frees in get_cached_block when reads
fail.
2024-11-19 18:14:29 -05:00
Augustin Cavalier
d8914ec8b0 kernel/fs: Add a fast path out of get_vnode.
If the vnode's reference count is already > 0 and we can increment
it from there, then we know it's already used and we don't need
to run any further checks. This saves us having to acquire the
vnode lock every single time we want to get the vnode.

(IsBusy() doesn't use an atomic get to fetch the flags value,
but as this is the first read of the value after having acquired
the vnode lock, that should not be a problem.)

Adjust free_vnode, while at it, to not set a positive reference count
during destruction, to be fully certain nothing will see this vnode
as being available for use, and add an assertion checking this.

Improves "git status" time significantly, at least in the case where
all vnodes are in the disk caches. This fast path also seems to be hit
very many times (> 100,000) on boot, and in compile jobs, too.

Change-Id: Ibcc65aecbfcdc4f3fca42baa3756e39aab8b9efb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8583
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-11-19 18:38:35 +00:00
PulkoMandy
f0427429e2 usb_rndis: fix handling of canceled transfers
When the transfer is canceled, there is no new data received. So we
should stop the processing and inform the network stack that the
transfer is canceled.

Change-Id: I5c991899292b84e6d9bc589348a5ab32384ea09a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8577
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-19 18:36:11 +00:00
PulkoMandy
9548274ed5 usb_rndis: remove reattach code
The MAC address is randomly generated each time the device is connected.
So there is no way to match with a previous session and reattach the
interface transparently.

Change-Id: I8aea95d5a09621a0dcdd7ce89787663a38435001
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8576
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2024-11-19 18:36:11 +00:00
Augustin Cavalier
87e00819ce ram_disk: Fix lock assertion failure and use VM_PRIORITY_USER in another place.
Change-Id: Iefd997e7e5838b51e4973f9f69bae6ea07f3b3cb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8584
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-18 21:42:21 +00:00
Augustin Cavalier
7af4c8a6a9 kernel/fs: Use a spinlock for the unused-vnodes lock.
This lock protects a linked-list. In all cases but one, the only
operation done while holding the lock is to remove a single item
from the list and decrement a counter. Acquiring a mutex itself
involves multiple linked-list operations protected by spinlocks,
so cut out the overhead and just use a spinlock directly.

In the one case where we do more than just remove an item, we
hold an additional write-lock, and so we don't run any risk of
causing "spinlock could not be acquired for a long time" KDLs,
as in that case the threads will be waiting on the rwlock instead.

Reduces lock contention in the VFS. Compiling HaikuDepot and the
mime_db with -j4 (in a VM), the sys time decreased a bit (~10.1s
to ~9.9s), and real time went down by more (~31s to ~29s.) "git status"
performance also improved a bit, but we seem to be contending for
vnode locks now in that case.
2024-11-18 13:59:25 -05:00
Augustin Cavalier
2f37cef1e4 kernel/fs: Use DoublyLinkedList for the unused vnodes list.
Avoids needing a nonstandard "offsetof", and inlines more methods.
No behavioral change intended.

Also rename "next" to "hash_next" for clarity, and remove an unused
"next" field from LockWaiter.
2024-11-18 13:27:31 -05:00
Augustin Cavalier
a9b5f684f1 kernel/fs: Make io_context rw_lock'ed.
Applications that don't call open() or like functions too often,
and call many FD-related methods across multiple threads at once
(like "git status") now don't wait on the context lock as much.

("git status" performance isn't much improved because threads just
hit the "unused vnodes" lock instead.)
2024-11-18 13:25:43 -05:00
PulkoMandy
344ded80d4 ioctl: Document in Haiku book and in comments
- Convert libroot from a page to a group, so that it can list the
  included file and functions in the generated book (like the kits)
- Add unistd.dox and move the relevant part of ioctl details there
- Make sure to use C89-compatible comments only in POSIX headers

Change-Id: I8f0412e4c75de6f48018a0436909f8b0076342a4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6369
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-11-18 17:12:04 +00:00
Andrew Lindesay
2ec05ec7ed HaikuDepot: Fix Search Term
Resolves #19257

Change-Id: Ifaefc98f51a3a88f8770f1ffa9ff0416a454b418
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8579
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-11-18 16:45:48 +00:00
Gustaf Alhäll
b08fdcde6f PadBlocker: Avoid blocking non-trackpad devices
Exposes a new field on mouse events named "device" that specifices what
type of device the event originates from. This is then used in
PadBlocker to ignore events that don't originate from trackpads.

This field should also be exposed to the public API in case any program
in userspace want to use it, as it may be useful for other purposes.

Fixes #19238 and #17821

Change-Id: Ic0f8c088cf5d2b0414a8e69498b48f2a3e370d73
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8557
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-18 16:45:04 +00:00
PulkoMandy
fd7bde29e9 listusb: decode color format descriptors in usb_video devices
Change-Id: I3de3b1a893ec02d32f1b10f80653d433ac4526ee
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8582
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-18 16:44:46 +00:00
PulkoMandy
d05ff048a2 uvc_webcam: use shared USB_video.h
The driver had its own header file with definitions from the USB video
specification. Use the system ones already in place for use in listusb.

Also recognize devices which advertise themselves as "miscellaneous" in
the device descriptor, this is the recommended way in the specification
as the usb_video interface may be only part of a device, with other
interfaces and endpoints used for audio or for HID for example.

Change-Id: I7e2e45328dcc1e81c407937e8dd3d77209c5c52a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8581
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-11-18 16:44:46 +00:00
Emmanuel Gil Peyrot
603521ecdc BTimeSource: Fix debugger message in RealTimeFor()
Likely a copy paste error

Change-Id: I4b7610b737daa72ba8f4b1b32d4de4f9c1233b0b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8580
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2024-11-18 11:54:43 +00:00
dalme
edac63079f BFS: Be explicit about blocks_per_ag field meaning
Superblock field blocks_per_ag is confusing, as it holds the number
of bitmap blocks that are in each allocation group, not the number
of disk blocks per allocation group. Try to clarify when possible.

Change-Id: I60dad9d3c5245dd126ecfea817108e2cefa4cf02
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8566
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-11-17 22:33:42 +00:00
Jim906
9bb1816c14 block_cache: enable prefetching
* Allocate blocks and add them to the hash table so they are
  available for a future block_cache_get call.
* Make use of prefetching in FAT driver.
* A client filesystem may request to prefetch a block run that
  contains some blocks that are already cached.  The request will
  be truncated at the first such block in the run.
* Fixes #19186.

Change-Id: I8d2e3cff15e5b46569438e0dc085e2b391aa57a5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8525
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-16 18:26:21 +00:00
Autocomitter
e6bf67457c Update translations from Pootle 2024-11-16 08:17:29 +00:00
Andrew Lindesay
6afa94a089 HaikuDepot: Render Native Desktop Icon
Render an icon to indicate that the
package provides a native application.

Change-Id: I3aa6468be488a62b317d3107ad1490916c857ca2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8528
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2024-11-15 17:58:07 +00:00
Andrew Lindesay
97a8cc6cc2 HaikuDepot: Refactor notification and screenshots
Changes to the package model to factor-out
screenshots, to adjust the notifications and to
adjust depots so that packages cannot be added
more than once under the same name.

Change-Id: I2f9219a1cbc0f42631bddff00852c447fd66c929
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8563
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2024-11-15 08:49:06 +00:00
Jérôme Duval
ba8970a3e0 haiku_loader.efi: add support for rgb16
Change-Id: I7634b8734d057f99d69c494ea941e1f38f94b757
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8564
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2024-11-15 02:06:28 +00:00
Augustin Cavalier
dcbba21430 ram_disk & ramfs: Pages aren't "accessed" outside the lock area.
This flag is only really needed for modifications to queues, mappings,
etc. on the page, and not on regular reads and writes. For that,
"busy" suffices.

This mirrors the file cache's behavior, and avoids invalidly
holding the page's "accessed" state without the cache lock.

Fixes #19233.
2024-11-13 14:11:35 -05:00
Augustin Cavalier
5c9dc91f64 network: Aggregate statistics from the device, if any are provided.
This way, we report the real receive/send statistics, not just
the ones the stack knows.

Adjust the FreeBSD compatibility layer to report its stats directly
so they are accounted for this way.
2024-11-13 13:55:58 -05:00
Augustin Cavalier
de8d5cfb5f bootloader & kernel: Unify computation of splash logo and icons placement.
Removes some more code duplication.

Change-Id: I9423be740015bef996b77bf2c30652fdadbd8a50
2024-11-12 23:51:52 -05:00
Augustin Cavalier
029e447bde bootloader & kernel: Unify bitmap blitting routines.
They were more-or-less duplicated between the two.
2024-11-12 23:44:31 -05:00
Augustin Cavalier
6a290d1dd1 network/stack: Don't special-case ENOBUFS and EMSGSIZE in update_send_stats.
These errors are always reported, so we want to count them as
an "error" on send, not a "drop".
2024-11-12 23:19:44 -05:00