History log of /haiku/src/system/kernel/device_manager/legacy_drivers.cpp
Revision Date Author Comments
# f0e187c3 30-Nov-2022 X512 <danger_mail@list.ru>

kernel: follow-up to hrev56619: use new(std::nothrow)

to handle allocation failures.

Change-Id: I15d84b24dcea17741382b1d5285acf6219a39811
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5868
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 80ae26e1 29-Nov-2022 Augustin Cavalier <waddlesplash@gmail.com>

kernel/legacy_drivers: Use new/delete instead of malloc/free.


# 8e17b43d 14-Oct-2022 Jérôme Duval <jerome.duval@gmail.com>

kernel/device_manager: Implement B_GET_DRIVER_FOR_DEVICE

for legacy and new drivers.

This is an opcode for ioctl that can be used on almost any device entry found in /dev.
When used, ioctl will fill a buffer with the absolute path to the driver file that is
being used by the device.

This opcode was available in BeOS R5, though remained unimplemented in Haiku since
the introduction of the Device Manager almost two decades ago.

Original change by Jacob Secunda.

Change-Id: Ic49141b677b4158a63918459d4048450c825447c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5078
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 96985b88 30-Sep-2022 Jérôme Duval <jerome.duval@gmail.com>

kernel/device_manager: make sure we can reload the driver before unloading it

for instance usb drivers are unloaded when unused, but they will be
loaded again when a matching device appears. this can only work when
the boot device is already mounted.

Change-Id: Ia92c679cffb6a1fac143c9f8b3bb570fb4555719
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5706
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# dedf24f7 03-Mar-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Don't load modules from non-packaged under "disable user add-ons".

This matches the behavior of the "new-style" module system.
Part of #14361.


# 56583ffb 14-Jan-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/legacy_drivers: Make asterisk style consistent.

Most of the file used space after asterisk, but some of it used spaces
before the asterisk. Now it's consistently after.


# fb95946e 14-Jan-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Don't watch the "dev" legacy driver directory.

We don't watch its children, and most drivers within it are within
subdirectories. Further, all drivers in it are really symlinks to "bin",
which we also watch. So there is really not much purpose in watching
"dev" directly.

Should fix #4638.


# 8e9c7a36 14-Jan-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel: B_BEOS_* -> B_SYSTEM_* for directory constants.

Also clean up legacy_drivers' usage of them a bit.


# c73d1301 08-Nov-2015 Michael Lotz <mmlr@mlotz.ch>

kernel: Use anonymous namespaces to avoid type collisions.

The anonymous namespace makes type definitions local to the translation
unit (like static does for objects). For pretty much any type not shared
across multiple files this is what one wants to happen (and might
erroneously expect to happen automatically).

This commit solves some actual collisions that were present:

* The VFS and the rootfs both used an incompatible VnodeHash struct for
their BOpenHashTable.
* XSI semaphores and message queues both used queued_thread, Ipc and
IpcHashTableDefinition.

For release builds these did not cause problems as the types were fully
inlined. Debug builds would crash at boot however because parts of a
BOpenHashTable<VnodeHash> from the rootfs meant to operate on struct
rootfs_vnode would be applied to one from the VFS expecting struct
vnode.

As such collisions are violations of the one definition rule, the code
is at fault and unfortunatley the compiler isn't required to diagnose
such problems across translation units (which isn't actually trivial).
This can lead to subtle and hard to debug problems and it's therefore
best to avoid leaking types into the global namespace whenever possible.


# 79b12613 12-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

legacy_drivers: convert to BOpenHashTable.


# de49e349 04-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add symbol versioning for find_directory()

Should already have been done back when the semantics for the
B_COMMON_*DIRECTORY constants was changed.

Currently old and new version behave the same. So this is just a
contingency measure ATM.


# 4b7e2196 03-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Remove /boot/common for good

* Remove support for the "common" installation location from packagefs,
package kit, package daemon, package managers.
* Rename the B_COMMON_*_DIRECTORY constants referring to writable
directories to B_SYSTEM_*_DIRECTORY.
* Remove/adjust the use of various B_COMMON_*_DIRECTORY constants.
I'm sure some occurrence still remain. They can be adjusted when the
remaining B_COMMON_*_DIRECTORY constants are removed.


# 237127fb 22-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix _user_entry_ref_to_path() in chroot

* Add "bool kernel" parameter to vfs_entry_ref_to_path(), so it can be
specified for which I/O context the entry ref shall be translated.
* _user_entry_ref_to_path(): Use the calling team's I/O context instead
of the kernel's. Fixes the bug that in a chroot the syscall would
return a path for outside the chroot.


# 294711f9 27-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Changed {,u}int64 to be long rather than long long on x86_64.


# f1244978 22-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Added an ELF64 version of preloaded_image.

* There is now 2 structures, preloaded_elf32_image and preloaded_elf64_image,
which both inherit from preloaded_image.
* For now I've just hardcoded in use of preloaded_elf32_image, but the
bootloader ELF code will shortly be converted to use templates which use
the appropriate structure. The kernel will be changed later when I add
ELF64 support to it.
* All kernel_args data is now compatible between 32-bit and 64-bit kernels.


# 4be4fc6b 15-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

More 64-bit compilation/safety fixes.


# 0e35d5d2 12-Dec-2011 John Scipione <jscipione@gmail.com>

Change instances of wether in comments to whether. No functional change intended.


# 5b82a6b6 26-Mar-2011 Axel Dörfler <axeld@pinc-software.de>

* Obviously forgot to compile after a last minute change, sorry!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41121 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ea8749b6 26-Mar-2011 Axel Dörfler <axeld@pinc-software.de>

* legacy_driver::devices_used was not taken into account when deciding to
unload a driver. This was causing bug #4608 depending on the order of events;
now you should have less worries removing your USB device before having it
unmounted.
* Added a "legacy_device" KDL command.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41119 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 097b4917 01-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Use the unnamed namespace instead of an unofficial one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40061 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 99f77939 26-Dec-2010 Jérôme Duval <korli@users.berlios.de>

adding a LegacyDrivers namespace to avoid clash with other components (see #7018).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39945 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 98e415e5 19-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* Corrected and improved debug output.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37577 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45bd7bb3 25-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed unnecessary inclusions of <boot/kernel_args.h> in private kernel
headers and respectively added includes in source files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37259 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fb407401 14-Feb-2010 Axel Dörfler <axeld@pinc-software.de>

* Restructured the notification driven addition/removal of drivers to
driver_events (ie. there is now only a single list to walk).
* Also, the DriverWatcher is now maintained using the driver_events.
This fixes bug #5005.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35463 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9837ec16 20-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed spelling.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34144 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a9689e84 30-Sep-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* VFS:
- Fixed vfs_get_vnode_from_fd() return type.
- Added vfs_open_vnode().
- Added a "bool traverseLeafLink" parameter to vfs_get_fs_node_from_path().
It was always resolving symlinks.
* device manager/devfs:
- devfs: get_node_for_path() no longer resolves leaf symlinks. That still
doesn't help with file disk devices, as creating partition wouldn't work
anyway.
- Pulled the module-related implementation part of BaseDevice into new class
AbstractModuleDevice and made all methods of BaseDevice virtual. Small
adjustments to devfs to be happy with the new BaseDevice interface.
- Added BaseDevice subclass FileDevice, which maps the interface to a file's
file descriptor. Still got a few TODOs, but should basically work.
- Use FileDevice for publishing file disk devices in devfs. Now those do
actually work, though there's some BFS trouble with one of the images I
tested.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33385 a95241bf-73f2-0310-859d-f6bbb57e9c96


# da11bb8d 14-Sep-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Use TRACE() instead of dprintf()


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33134 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4f5ca991 14-Sep-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added dprintf() to be able to see which driver hangs on load


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33133 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 86766d6a 06-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* handle_driver_events() kept the sDriversListLock locked over the whole
time. But since this is also locked from within the driver/directory watcher
(with the node monitor lock held), and handle_driver_events() could cause
node monitoring updates, the locking order could be reverted, causing a
deadlock (I just ran into).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32152 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5147963d 26-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than
Tracker's OpenHashTable.h which it should eventually replace. We've renamed the
class to BOpenHashTable and changed the interface slightly so that HashTableLink
became superfluous.
Adapted all the code that used it. Since the OpenHashTables no longer clash,
this should fix the GCC4 build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31791 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e0965f27 27-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* reload_driver() now also checks if the binary node changed, and will update
the node listener, to make sure it won't lose track.
* The DriverWatcher now also listens for B_ENTRY_REMOVED. This causes drivers to
be unpublished even if they are only symlinked.
* However, to detect new drivers in a symlinked location, we'd need special
support for those, and also need to watch the parent directory of the symlink
target - this is close to overkill, so I stayed away from implementing that
for now :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31267 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fa00207c 15-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Made the internal file systems correctly handle the timespec struct stat
times.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31059 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d88527df 16-May-2009 Axel Dörfler <axeld@pinc-software.de>

* Applied a patch by Rene that fixes bug #3856.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30770 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6015793f 12-May-2009 Axel Dörfler <axeld@pinc-software.de>

* Instead of deleting the device directly, we now only remove it from its
parent.
* Additionally, when a vnode is deleted, the new BaseDevice::Removed() method is
called that will remove the device from its parent if needed, and delete it
then.
* This should fix #3856.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30726 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fd0803f3 06-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Added RemoveTail() method.
* Renamed DoublyLinkedList::Size() to Count(), since it actually counts the
items (ie. O(n)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29979 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 73053099 18-Mar-2009 Jérôme Duval <korli@users.berlios.de>

* proposition to fix a deadlock between kernel daemon and package installer install thread (bug #3447)
to manage this, avoid locking the main sLock in notification handling methods. Instead fill up two lists which will be emptied later by the kernel daemon thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29603 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b36570e5 06-Feb-2009 François Revol <revol@free.fr>

Do proper unlocking of the KPath when find_directory() fails. This should help with CD boot where find_directory() can't create folders on a read-only media.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29139 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c33667d4 01-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

Fixing warnings under GCC4 in preparation to enable -Werror there as well:
* Replaced the use of offsetof() for structs that aren't PODs. Add a
offset_of_member() macro to util/khash.h because that's what it's used for
in our cases.
* Change the signature of add_debugger_command()/remove_debugger_command() on
GCC > 2 to avoid the depricated conversion from string constants to char *.
* Adding some "suggested" parenthesis. I know that not everyone likes that, but
it pointed out at least one bug that is fixed here as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29113 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f15da085 17-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Greatly simplified republish_driver(); it doesn't need to use the path_entry
stuff at all, anymore.
* Removed now unused get_device_for_path().
* unpublish_driver() now only deletes the device if unpublishing actually
worked out okay.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27038 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c35ab0c3 18-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added new devfs_unpublish_device() that gets a BaseDevice instead of a path.
* Added inode ID member to BaseDevice to make this possible.
* Removed unused and unmaintained legacy_driver::devices_published field.
* Implemented legacy driver's unpublish_driver().
* Reenabled legacy driver reloading on changes.
* Renamed devfs_driver_{added|removed}() to driver_{added|removed}(), and
made them private.
* Simplified deletion of device_node lists (no need to use an iterator here),
added device unpublishing.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27033 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a8f9741c 04-Jul-2008 Michael Lotz <mmlr@mlotz.ch>

* Removed -Wno-unused from all KernelMergeObjects in kernel Jamfiles.
* Fixed most of the warnings resulting from that by removing actually not used
variables or moving declaration into the #IF. Left unused functions there
though, as I wouldn't know if they are supposed to be used again.
* Fixed two statements with no effect (clamping to MAX_ANCILLARY_DATA_LEN in
socket.cpp and unsetting fCounterSem in MessagingService.cpp).
* Some style cleanups.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26253 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a47ceb2a 22-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

* Only set the select hook on the device module if we actually got a select
hook from the legacy driver.
* Add note explaining why it is set to an arbitrary invalid value (~0) and why
it still works by redirecting in the virtual Select() of LegacyDevice.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26079 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 139e442a 08-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Update the driver path and set binary_updated when we encounter a driver with
the same name but different path. In case of usb_disk that is now loaded as
a boot module the driver got registered with a different path, which prevented
later rescans from working. USB mass storage should now work again.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25862 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 065ef7eb 05-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Replace the legacy driver mutex with a recursive lock. This fixes the deadlock
when hot-plugging a USB mass storage device. The legacy driver (usb_disk in
this case) was rescanned which locked the legacy driver mutex. The insertion
of the new device node caused the disk device manager (notified through node
monitoring) to try to scan the new node. As opening the node triggers
LegacyDevice::InitDevice() that locks the legacy driver mutex again a deadlock
occured.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25807 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b4babdf4 03-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Move the device deletion after the unpublish call. Fixes crashes where a
device is still referenced through the devfs and used right between deleting
and unpublishing.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25775 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2ec83efb 30-May-2008 Michael Lotz <mmlr@mlotz.ch>

Fix one reason for crashing on legacy driver rescans, but there seems to be
more to it.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25724 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 368167ed 26-May-2008 Axel Dörfler <axeld@pinc-software.de>

* Integration of the new driver architecture.
* Moved devfs from fs/ to device_manager/, and separated the legacy driver
support from it.
* Removed fast_log module.
* There are a couple of (temporary) regressions, though:
- legacy SATA and ISA IDE support is disabled, the drivers haven't been
ported yet.
- The not yet used ATA bus manager hasn't been ported yet, either.
- AHCI changes have not been tested.
- the listdev command has been removed from the build (as it currently
doesn't work anymore).
- device manager generated IDs currently are not freed anymore when a device
node is removed.
- generic drivers can't yet use the new driver architecture.
- simple busses that do not support device types won't work yet.
- legacy driver publishing/unpublishing (ie. what USB needs) has not been
tested, and may be broken.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25662 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 79b12613f574cd1a7c9d407b7041e662f02e8700 12-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

legacy_drivers: convert to BOpenHashTable.


# de49e34927ea27d282f6e85c866db5073df379af 04-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add symbol versioning for find_directory()

Should already have been done back when the semantics for the
B_COMMON_*DIRECTORY constants was changed.

Currently old and new version behave the same. So this is just a
contingency measure ATM.


# 4b7e219688450694efc9d1890f83f816758c16d3 03-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Remove /boot/common for good

* Remove support for the "common" installation location from packagefs,
package kit, package daemon, package managers.
* Rename the B_COMMON_*_DIRECTORY constants referring to writable
directories to B_SYSTEM_*_DIRECTORY.
* Remove/adjust the use of various B_COMMON_*_DIRECTORY constants.
I'm sure some occurrence still remain. They can be adjusted when the
remaining B_COMMON_*_DIRECTORY constants are removed.


# 237127fbe4071abea20f3e5005f5a1e549f12788 22-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix _user_entry_ref_to_path() in chroot

* Add "bool kernel" parameter to vfs_entry_ref_to_path(), so it can be
specified for which I/O context the entry ref shall be translated.
* _user_entry_ref_to_path(): Use the calling team's I/O context instead
of the kernel's. Fixes the bug that in a chroot the syscall would
return a path for outside the chroot.


# 294711f98c107cf2d9d05b7fc34cd863e87bd358 27-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Changed {,u}int64 to be long rather than long long on x86_64.


# f1244978152350f9cc010e766d09c2e9ad34dfce 22-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Added an ELF64 version of preloaded_image.

* There is now 2 structures, preloaded_elf32_image and preloaded_elf64_image,
which both inherit from preloaded_image.
* For now I've just hardcoded in use of preloaded_elf32_image, but the
bootloader ELF code will shortly be converted to use templates which use
the appropriate structure. The kernel will be changed later when I add
ELF64 support to it.
* All kernel_args data is now compatible between 32-bit and 64-bit kernels.


# 4be4fc6b1faddbd037146214a0011d320842b4f3 15-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

More 64-bit compilation/safety fixes.


# 0e35d5d2e5ef3d288e056d60ef1b16dc399eaa0c 12-Dec-2011 John Scipione <jscipione@gmail.com>

Change instances of wether in comments to whether. No functional change intended.


# 5b82a6b61587071c3b5b8b3557478121bfda5bfc 26-Mar-2011 Axel Dörfler <axeld@pinc-software.de>

* Obviously forgot to compile after a last minute change, sorry!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41121 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ea8749b6b5a2fa82745b3653cd725a6b2038ade5 26-Mar-2011 Axel Dörfler <axeld@pinc-software.de>

* legacy_driver::devices_used was not taken into account when deciding to
unload a driver. This was causing bug #4608 depending on the order of events;
now you should have less worries removing your USB device before having it
unmounted.
* Added a "legacy_device" KDL command.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41119 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 097b4917d3c95eae39364bbed0a85cae4d89a271 01-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Use the unnamed namespace instead of an unofficial one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40061 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 99f77939d9f3888efe9a54d3ae99324b62583ba3 26-Dec-2010 Jérôme Duval <korli@users.berlios.de>

adding a LegacyDrivers namespace to avoid clash with other components (see #7018).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39945 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 98e415e567f0412c3e082078d654fded2d63228f 19-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* Corrected and improved debug output.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37577 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45bd7bb3db9d9e4dcb02b89a3e7c2bf382c0a88c 25-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed unnecessary inclusions of <boot/kernel_args.h> in private kernel
headers and respectively added includes in source files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37259 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fb40740174e40740b6520bf15c1d986097d9b2ff 14-Feb-2010 Axel Dörfler <axeld@pinc-software.de>

* Restructured the notification driven addition/removal of drivers to
driver_events (ie. there is now only a single list to walk).
* Also, the DriverWatcher is now maintained using the driver_events.
This fixes bug #5005.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35463 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9837ec16c86f0a533600230350e8e89203d1e9e8 20-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed spelling.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34144 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a9689e8492e520d532410c762bb3d5e3a5ac4819 30-Sep-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* VFS:
- Fixed vfs_get_vnode_from_fd() return type.
- Added vfs_open_vnode().
- Added a "bool traverseLeafLink" parameter to vfs_get_fs_node_from_path().
It was always resolving symlinks.
* device manager/devfs:
- devfs: get_node_for_path() no longer resolves leaf symlinks. That still
doesn't help with file disk devices, as creating partition wouldn't work
anyway.
- Pulled the module-related implementation part of BaseDevice into new class
AbstractModuleDevice and made all methods of BaseDevice virtual. Small
adjustments to devfs to be happy with the new BaseDevice interface.
- Added BaseDevice subclass FileDevice, which maps the interface to a file's
file descriptor. Still got a few TODOs, but should basically work.
- Use FileDevice for publishing file disk devices in devfs. Now those do
actually work, though there's some BFS trouble with one of the images I
tested.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33385 a95241bf-73f2-0310-859d-f6bbb57e9c96


# da11bb8dcbaab065591a7a3c4fa3a21050854aaa 14-Sep-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Use TRACE() instead of dprintf()


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33134 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4f5ca991567727a893b3166e389b76155d941998 14-Sep-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added dprintf() to be able to see which driver hangs on load


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33133 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 86766d6aca79d51865285f5956a48bb62fc1f23e 06-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* handle_driver_events() kept the sDriversListLock locked over the whole
time. But since this is also locked from within the driver/directory watcher
(with the node monitor lock held), and handle_driver_events() could cause
node monitoring updates, the locking order could be reverted, causing a
deadlock (I just ran into).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32152 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5147963dcd57fefa4f63c484eb88e9eaf4002976 26-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than
Tracker's OpenHashTable.h which it should eventually replace. We've renamed the
class to BOpenHashTable and changed the interface slightly so that HashTableLink
became superfluous.
Adapted all the code that used it. Since the OpenHashTables no longer clash,
this should fix the GCC4 build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31791 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e0965f2727623547ce67f3f51725ce370481e456 27-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* reload_driver() now also checks if the binary node changed, and will update
the node listener, to make sure it won't lose track.
* The DriverWatcher now also listens for B_ENTRY_REMOVED. This causes drivers to
be unpublished even if they are only symlinked.
* However, to detect new drivers in a symlinked location, we'd need special
support for those, and also need to watch the parent directory of the symlink
target - this is close to overkill, so I stayed away from implementing that
for now :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31267 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fa00207c50d24a0c867ec4123c351f85256fcbbf 15-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Made the internal file systems correctly handle the timespec struct stat
times.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31059 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d88527df5cbe4c836bab1ae5310881de4d24bc1f 16-May-2009 Axel Dörfler <axeld@pinc-software.de>

* Applied a patch by Rene that fixes bug #3856.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30770 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6015793f57d08929e6e27b7bdc690835ac98eedc 12-May-2009 Axel Dörfler <axeld@pinc-software.de>

* Instead of deleting the device directly, we now only remove it from its
parent.
* Additionally, when a vnode is deleted, the new BaseDevice::Removed() method is
called that will remove the device from its parent if needed, and delete it
then.
* This should fix #3856.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30726 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fd0803f3003a667986c914254b4735254cb4db4e 06-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Added RemoveTail() method.
* Renamed DoublyLinkedList::Size() to Count(), since it actually counts the
items (ie. O(n)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29979 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 73053099096e924b1c8b573b8c10cc89ea1fb6af 18-Mar-2009 Jérôme Duval <korli@users.berlios.de>

* proposition to fix a deadlock between kernel daemon and package installer install thread (bug #3447)
to manage this, avoid locking the main sLock in notification handling methods. Instead fill up two lists which will be emptied later by the kernel daemon thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29603 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b36570e51fd0d1fe52c19129c51e089ef93422bd 06-Feb-2009 François Revol <revol@free.fr>

Do proper unlocking of the KPath when find_directory() fails. This should help with CD boot where find_directory() can't create folders on a read-only media.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29139 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c33667d400856680a8e0122300861eda77d1847a 01-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

Fixing warnings under GCC4 in preparation to enable -Werror there as well:
* Replaced the use of offsetof() for structs that aren't PODs. Add a
offset_of_member() macro to util/khash.h because that's what it's used for
in our cases.
* Change the signature of add_debugger_command()/remove_debugger_command() on
GCC > 2 to avoid the depricated conversion from string constants to char *.
* Adding some "suggested" parenthesis. I know that not everyone likes that, but
it pointed out at least one bug that is fixed here as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29113 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f15da085fb891b6c15cc104a8552134e6f0d3ee9 17-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Greatly simplified republish_driver(); it doesn't need to use the path_entry
stuff at all, anymore.
* Removed now unused get_device_for_path().
* unpublish_driver() now only deletes the device if unpublishing actually
worked out okay.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27038 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c35ab0c38d10cbbaa712e06044a7cf49b942a64e 18-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added new devfs_unpublish_device() that gets a BaseDevice instead of a path.
* Added inode ID member to BaseDevice to make this possible.
* Removed unused and unmaintained legacy_driver::devices_published field.
* Implemented legacy driver's unpublish_driver().
* Reenabled legacy driver reloading on changes.
* Renamed devfs_driver_{added|removed}() to driver_{added|removed}(), and
made them private.
* Simplified deletion of device_node lists (no need to use an iterator here),
added device unpublishing.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27033 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a8f9741c8c2815234e87b78167738057b976b537 04-Jul-2008 Michael Lotz <mmlr@mlotz.ch>

* Removed -Wno-unused from all KernelMergeObjects in kernel Jamfiles.
* Fixed most of the warnings resulting from that by removing actually not used
variables or moving declaration into the #IF. Left unused functions there
though, as I wouldn't know if they are supposed to be used again.
* Fixed two statements with no effect (clamping to MAX_ANCILLARY_DATA_LEN in
socket.cpp and unsetting fCounterSem in MessagingService.cpp).
* Some style cleanups.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26253 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a47ceb2aecc097943a4504cc4af800c479240ea5 22-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

* Only set the select hook on the device module if we actually got a select
hook from the legacy driver.
* Add note explaining why it is set to an arbitrary invalid value (~0) and why
it still works by redirecting in the virtual Select() of LegacyDevice.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26079 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 139e442a621feea0a05fa8ae5f1b194db9706fb7 08-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Update the driver path and set binary_updated when we encounter a driver with
the same name but different path. In case of usb_disk that is now loaded as
a boot module the driver got registered with a different path, which prevented
later rescans from working. USB mass storage should now work again.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25862 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 065ef7eb5f0f5e124c6876b73dd47f95c5038395 05-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Replace the legacy driver mutex with a recursive lock. This fixes the deadlock
when hot-plugging a USB mass storage device. The legacy driver (usb_disk in
this case) was rescanned which locked the legacy driver mutex. The insertion
of the new device node caused the disk device manager (notified through node
monitoring) to try to scan the new node. As opening the node triggers
LegacyDevice::InitDevice() that locks the legacy driver mutex again a deadlock
occured.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25807 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b4babdf47e697da6599ce3d6008bd1c6841dacc0 03-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Move the device deletion after the unpublish call. Fixes crashes where a
device is still referenced through the devfs and used right between deleting
and unpublishing.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25775 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2ec83efbb2e8e793ca0c5f4fec7613801a264e10 30-May-2008 Michael Lotz <mmlr@mlotz.ch>

Fix one reason for crashing on legacy driver rescans, but there seems to be
more to it.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25724 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 368167ede8118f72da8c9ac5bb98ce9b46a8a639 26-May-2008 Axel Dörfler <axeld@pinc-software.de>

* Integration of the new driver architecture.
* Moved devfs from fs/ to device_manager/, and separated the legacy driver
support from it.
* Removed fast_log module.
* There are a couple of (temporary) regressions, though:
- legacy SATA and ISA IDE support is disabled, the drivers haven't been
ported yet.
- The not yet used ATA bus manager hasn't been ported yet, either.
- AHCI changes have not been tested.
- the listdev command has been removed from the build (as it currently
doesn't work anymore).
- device manager generated IDs currently are not freed anymore when a device
node is removed.
- generic drivers can't yet use the new driver architecture.
- simple busses that do not support device types won't work yet.
- legacy driver publishing/unpublishing (ie. what USB needs) has not been
tested, and may be broken.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25662 a95241bf-73f2-0310-859d-f6bbb57e9c96