Commit Graph

44 Commits

Author SHA1 Message Date
Axel Dörfler
e8edb8545b A hash_lookup() to the module images was made without having the proper lock held.
Added kernel private calls load_module() and unload_module() that can be used to
load/unload modules by path.
load_module_image() now only mentions when it couldn't load a module when tracing
is enabled (because the device manager uses it to determine if an add-on is a
module or an old-style driver).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10821 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-18 02:37:38 +00:00
Axel Dörfler
2a5dafa804 recurse_directory() is no longer part of the build if SUPPORT_BOOTFS is
not defined. It will now also skip about all entries called "boot" (to
not load the boot modules again).
The path of preloaded images is now hacked together so that the module
image hash contains the correct path in case the images get replaced
while being used.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10600 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-06 21:46:03 +00:00
Axel Dörfler
b1e252f77f Added a SUPPORT_BOOTFS definition and made the vfs_get_module_path() the new
standard mechanism - recurse_directory() is now only used if SUPPORT_BOOTFS
is defined and vfs_get_module_path() failed.
Added standard system kernel add-ons directory to the search path list.
Renamed USER_MODULE_PATHS to FIRST_USER_MODULE_PATH as that's what it is.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10599 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-06 20:31:22 +00:00
Axel Dörfler
84a910b64f Updated because of header changes.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10439 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-12-13 23:02:18 +00:00
Axel Dörfler
43576fd35b Removed some debugging output that shouldn't have made it into the repository.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9886 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-09 13:57:03 +00:00
Axel Dörfler
d51a69a420 Removed some unneeded debug output.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8594 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-08-16 15:51:08 +00:00
Axel Dörfler
a8441c4fd2 During early boot, put_module_image() will no longer unload anything when
there is no boot device available - this will prevent modules from getting
lost.
Added a comment to open_module_list() about its limitations while booting.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8170 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-26 01:40:46 +00:00
Axel Dörfler
69debf9e84 get_module() didn't correctly maintain the module ref_count (in case
something went wrong) - this would have hidden circular dependencies
as well.
Recursive directory scan was broken, it didn't filter "." and ".." out.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7829 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-08 05:58:23 +00:00
Axel Dörfler
baae156b90 Added built-in file system modules.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7812 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-07 17:33:18 +00:00
Axel Dörfler
97dfc072d7 Added devfs module to the built-in modules.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7782 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-07 01:21:08 +00:00
Axel Dörfler
78ab9987c3 Modules out of preloaded images will now be registered and can be used
like any other module (yeeha!).
You can even unload preloaded images later on (to replace them with a
more up-to-date on disk version).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7532 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-05-11 23:44:58 +00:00
Axel Dörfler
b918b5035f Bye, bye elf_lookup_symbol(), hello get_image_symbol().
Also renamed elf_load_kspace() to load_kernel_add_on(), and friends.
The new unload_kernel_add_on() now has an image_id as parameter, no longer
a path (like the former elf_unload_kspace()).
Fixed missign file system unload.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7527 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-05-11 19:52:38 +00:00
Axel Dörfler
7a7c7d9c2f Added current device manager built-in modules - the device manager itself will
probably be available as public kernel API as well (or rather, only).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7492 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-05-10 13:29:47 +00:00
Axel Dörfler
b36321870c Renamed some global static variables to match our style guide.
Changed some comments.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7484 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-05-10 00:09:21 +00:00
Axel Dörfler
1792829685 Fixed prefix handling; previous version was broken. It now allows the prefix to
be any size, not just full path names (even without the file name...). Optimized
it to only traverse paths that match the prefix.
The built-in modules now honor the prefix as well.
Renamed module_iterator::path_stack to stack.
The system add-on path was even wrong (but that didn't matter yet, as we're
still do a recursive search for modules).
The user add-on path now matches the real one - but that should probably be
retrieved from calling find_directory(), anyway...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7483 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-05-10 00:02:20 +00:00
Axel Dörfler
0a4a7dee30 open_module_list()/read_next_module_name() now take built-in modules into account as well.
The prefix will obviously ignored currently!
Fixed get_next_loaded_module_name(); it will now work correctly (doesn't check, though,
if the module is currently loaded...).
Removed the module_test() function - doesn't belong here.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7465 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-05-09 00:41:19 +00:00
Axel Dörfler
4b5782942c Removed the unused argument from module_init().
Implemented the possibility for built-in modules - they have to be listed
in sBuiltInModules in module.c to be registered automatically.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7318 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-04-26 21:02:27 +00:00
Axel Dörfler
04ba0ff394 Implemented support for the module_dependency structure.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7317 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-04-26 17:13:36 +00:00
beveloper
8a3b6e2cfd fixed warnings
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4662 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-12 20:44:45 +00:00
Axel Dörfler
e4cf172727 Since Ingo found out that BeOS requires the module name and its location
on disk to match to be able to find it, changed the ToDo: comment in the
affected function, and added a test call to vfs_get_module_name(); our
bootfs cannot handle the path depth/length required to be a useful module
host, so we still have our recursive search algorithm in place for now.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4560 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-08 04:06:14 +00:00
Axel Dörfler
dbb3d1fc5b Fixed some warnings.
Added a comment about how to traverse the module path to find a given module -
could well be that we got that wrong (too loose, it will work perfectly, though,
just slower than it could be).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4516 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-06 17:35:05 +00:00
Axel Dörfler
650a32fb62 Fixed two very subtle and hidden bugs that prevented the module component
to work at all: recurse_directory() always returned failure, no matter what opendir()
returned (one semicolon too much), create_module() allocated only 4 bytes for
the module - sizeof(module) referred to the variable, not the structure name...
(the unfortunate consequences of the naming scheme I otherwise like very much -
it "just" took me 3 hours to hunt both bugs down).
Added some TRACE() and ASSERT()s.
Added a new debugger command "modules".


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4300 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-08-18 03:41:26 +00:00
Axel Dörfler
783f7b5ccd Now gives its recursive lock a name and checks its return code.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3679 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-06-27 03:25:24 +00:00
Axel Dörfler
fb101ff170 Completely rewritten the module iterator code. Fixed many bugs in that
code and made it much simpler (it now just uses a stack of path names
instead of this complex doubly-linked module_iterator_dir list).
Now works together with the rest of the code without making any problems.
Added a module_test() function which iterates over all existing modules.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2149 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-03 17:54:09 +00:00
Axel Dörfler
b9b1c1c4f5 Almost completely rewritten module.c. Locking now works correctly, memory
leak fixed, some other bugs fixed, removed the global queues as there weren't
needed and used at all, moved to the other hash table implementation
(because the new_hash_table stuff was buggy). Should really work okay now :-)

Added the last missing function get_next_loaded_module_name() - I am not
sure the Be version works this way, but we could easily change that after
actually having found out how that one is really working.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2113 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-29 08:33:57 +00:00
beveloper
7991b1a031 added a lot of debugging functions that should help fixing bugs
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2099 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-28 02:25:04 +00:00
Axel Dörfler
d5bb31991f Checked one of Marcus' comments in int.c, and changed the list initialization
to use the newly provided function for this.
module.c now also uses the initque() function, some minor cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1973 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-17 01:38:35 +00:00
Axel Dörfler
41691b996a Replaced kmalloc(), kfree(), and kstrdup() with the POSIX equivalents.
Implemented realloc().
Adapted all other sources, some minor cleanups in some files as well.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1773 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-10-29 23:07:06 +00:00
Axel Dörfler
88fae79de6 Moved queue functionality out of module.c and into kqueue.h.
Changed module.c and int.c to use that one.
Some minor cleanups in module.c.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1744 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-10-29 03:42:40 +00:00
Bruno G. Albuquerque
3afbe60d92 Fix a bug reported by BeFree. It looks the PCi stiff works now.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1567 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-10-17 23:11:00 +00:00
Axel Dörfler
f4e51a2dfb Added a new write_stat() call to the file descriptor operations (plus syscall).
Renamed sys_read_stat() to sys_read_path_stat() - sys_read_stat() is now
the fd operation (same for the corresponding write call).
Removed the sys_write_attr_stat() call because it is no longer needed.
Added stat(), fstat(), and other POSIX calls to the kernel - many are still
missing (mainly from stdio).
Added symbols (but no implementation) for unistd.h's process id functions.
Adapted libroot calls that used sys_read_stat() before to the new architecture.
module.c and bus_man.c now use stat() directly instead of the sys_read_path_stat()
call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1555 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-10-17 03:09:25 +00:00
Axel Dörfler
633275adee Fixed some int/int32/status_t issues.
Also kernel/module.h was hidden by os/drivers/module.h - fixed; kernel/module.h
is now called kmodule.h and only contains the module_init() function for the
kernel.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1122 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-09-23 02:41:52 +00:00
Axel Dörfler
2f5118ccdc Changed the argument order of sys_read/write() to be more intuitive.
Fixed a bug in module.c that I caused due to changes in the VFS.
Added the sys_write_link() call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@666 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-09 17:03:03 +00:00
Axel Dörfler
ae372703ce Big commit: Added symlink support to the kernel.
- added needed syscalls to access symlink support from userland
- implemented lstat(), symlink(), and readlink()
- added dev_t to ktypes.h (for now - should be in a public header anyway)
- added symlink support to the "ls" command (now calls lstat() and shows the
  link target with the -l option)
- changed the sys_read_stat() call to support symlinks, and updated files
  using that function (it gets an extra argument: bool traverseLink)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@560 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-03 02:03:27 +00:00
David Reid
eab8081ffd Change the modules code to use the new hash code.
This fixed a lot of ongoing segfaults which were both intermittent
and unpredicatble.
Also improve some logic so we take a shorter path in simple_module_info


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@323 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-19 01:32:42 +00:00
beveloper
08b993b215 remove use of unterminated strings
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@283 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-17 18:29:41 +00:00
David Reid
333119344a Another attempt to fix the module loading problem. I've also added
a load of comments explaining why it does the things it does.

In the get_module code we now correctly
call the init function, which was being missed before if we got
the module via search_module.

If people can test and confirm this works. It works here and has solved
all the issues I was trying to fix.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@276 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-17 16:08:53 +00:00
David Reid
b0bdff5216 Small fix to prevent a segfault.
Provide more info when a duplicate module name is detected during a scan.
Remove some code we no longer use.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@274 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-17 12:51:48 +00:00
David Reid
4b6ac4574c Remove the isa test case as it now works and maintaiing it was a waste of
time as we will have lots more cases to test with :)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@214 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-14 10:17:26 +00:00
Axel Dörfler
3b120ea240 Updated the code to reflect the changes in the VFS.
Fixed some bugs in fd.c (how many more bugs can be in a small file like this? :-).
Added the syscalls for sys_open_dir(), and sys_create_dir().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@209 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-14 05:15:34 +00:00
beveloper
5667d23a37 fixed a bug
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@142 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-12 17:47:38 +00:00
David Reid
d2de8b3867 Include kerrors.h where it's required.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@105 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-11 22:21:56 +00:00
Axel Dörfler
65dc706027 Converted module.c to use sys_read_dir() instead of sys_read(). But it really
should use opendir(), and readdir().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@60 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-10 21:48:27 +00:00
ejakowatz
52a3801208 It is accomplished ...
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-09 12:24:59 +00:00