History log of /haiku/headers/private/kernel/kmodule.h
Revision Date Author Comments
# 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>


# 6075e354 26-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Call module_init_post_boot_device() right after the boot volume has
been mounted, before anyone could try to load any modules from it.
Also pass it a flag whether the boot volume is where the boot loader
pre-loaded the modules from.
* module_init_post_boot_device() changes the pre-loaded module image
paths to normalized boot volume paths, now. Got rid of the code in
register_preloaded_module_image() which tried something like this.
* Changed module image ref counting. A referenced module has single
reference to its image, which is released when the module becomes
unreferenced.
* get_module() for a reference module will not try to re-get and re-set
the module's image anymore. That could lead to a similar module (from
different paths) being loaded at the same time. A module from a new
file can only be loaded when the old one has been put completely.
* Simplified B_KEEP_ALIVE module handling a bit. When the module is
initialized, we add another reference, which we'll never free. Thus
the module remains loaded without special handling. Removed
module_image::keep_loaded. A B_KEEP_ALIVE module remains referenced
and thus its image remains referenced, too.
* Removed module::file, a cached path to the module's image. An
optimization that wouldn't work with multiple root directories for
modules (/boot/beos/..., /boot/common/...) or when module files were
moved. get_module() does now always search the image file, when the
module is still unreferenced. This should be a bit slower than before,
but I didn't notice any difference in VMware at least. If it turns out
to be a problem we could introduce a more intelligent cache that stays
up to date by using node monitoring.


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


# 5a123e35 22-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a post boot device module init function that unloads all unused modules,
as they aren't unloaded when there is no boot device yet.


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


# 423fcd43 04-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Shuffled initializers around: the team, ELF, and module initializers come
now a lot earlier.
* That makes it now possible to use modules pretty early in the kernel (like
before timer_init(), or int_init_post_vm()).


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


# 0875ae98 03-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Preparations for a module listener API - this will be used in the (disk)
device managers.
* Cleanup.


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


# ceba1053 17-Jan-2005 Axel Dörfler <axeld@pinc-software.de>

Added function prototypes for the kernel private load_module() and unload_module() calls.
Made the header C++ safe.


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


# 179fd098 26-Apr-2004 Axel Dörfler <axeld@pinc-software.de>

Removed the unused argument from module_init().


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


# 564cba31 03-May-2003 Axel Dörfler <axeld@pinc-software.de>

Some header work: removed unnecessary dependencies to stage2.h, fixed
some broken C++ export definitions, added missing licenses etc.


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


# 11d4dc0b 03-Dec-2002 Axel Dörfler <axeld@pinc-software.de>

Added a module_test() function.


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


# 4e3c12c0 22-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Moved <types.h> to <sys/types.h>.
Removed dependencies on arch/x86/types.h - this file is not really used
anymore, now. Might prevent compiling on Windows, though.
Replaced "int" with "int32" for the id types.
Removed some stuff from ktypes.h because it didn't belong there.


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


# 6075e354abea9c571e3e74ecdc56662de736c4eb 26-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Call module_init_post_boot_device() right after the boot volume has
been mounted, before anyone could try to load any modules from it.
Also pass it a flag whether the boot volume is where the boot loader
pre-loaded the modules from.
* module_init_post_boot_device() changes the pre-loaded module image
paths to normalized boot volume paths, now. Got rid of the code in
register_preloaded_module_image() which tried something like this.
* Changed module image ref counting. A referenced module has single
reference to its image, which is released when the module becomes
unreferenced.
* get_module() for a reference module will not try to re-get and re-set
the module's image anymore. That could lead to a similar module (from
different paths) being loaded at the same time. A module from a new
file can only be loaded when the old one has been put completely.
* Simplified B_KEEP_ALIVE module handling a bit. When the module is
initialized, we add another reference, which we'll never free. Thus
the module remains loaded without special handling. Removed
module_image::keep_loaded. A B_KEEP_ALIVE module remains referenced
and thus its image remains referenced, too.
* Removed module::file, a cached path to the module's image. An
optimization that wouldn't work with multiple root directories for
modules (/boot/beos/..., /boot/common/...) or when module files were
moved. get_module() does now always search the image file, when the
module is still unreferenced. This should be a bit slower than before,
but I didn't notice any difference in VMware at least. If it turns out
to be a problem we could introduce a more intelligent cache that stays
up to date by using node monitoring.


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


# 5a123e35911db0e706f1376638fb67d10c94d464 22-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a post boot device module init function that unloads all unused modules,
as they aren't unloaded when there is no boot device yet.


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


# 423fcd43ae4e19a6799924f121b1b12d9303f560 04-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Shuffled initializers around: the team, ELF, and module initializers come
now a lot earlier.
* That makes it now possible to use modules pretty early in the kernel (like
before timer_init(), or int_init_post_vm()).


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


# 0875ae984f7adc968782ff98d01071f1dc799a59 03-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Preparations for a module listener API - this will be used in the (disk)
device managers.
* Cleanup.


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


# ceba105306d70cbfa5b59bf77cd0500119ceae0d 17-Jan-2005 Axel Dörfler <axeld@pinc-software.de>

Added function prototypes for the kernel private load_module() and unload_module() calls.
Made the header C++ safe.


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


# 179fd0987978b5659bcce7a81c7ba0142adba3fc 26-Apr-2004 Axel Dörfler <axeld@pinc-software.de>

Removed the unused argument from module_init().


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


# 564cba312ebe49860fbb8416737c4de3e6ccd5f2 03-May-2003 Axel Dörfler <axeld@pinc-software.de>

Some header work: removed unnecessary dependencies to stage2.h, fixed
some broken C++ export definitions, added missing licenses etc.


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


# 11d4dc0bf5f11069c8e2e9541c6acb504bf844dd 03-Dec-2002 Axel Dörfler <axeld@pinc-software.de>

Added a module_test() function.


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


# 4e3c12c0afa8bb6c5f314e5bc305cc5b6c835a5a 22-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Moved <types.h> to <sys/types.h>.
Removed dependencies on arch/x86/types.h - this file is not really used
anymore, now. Might prevent compiling on Windows, though.
Replaced "int" with "int32" for the id types.
Removed some stuff from ktypes.h because it didn't belong there.


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