aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/module.h
Commit message (Collapse)AuthorAgeFilesLines
* Reapply, with minor tweaks, r338025, from the original commit:Warner Losh2018-09-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused and easy to misuse PNP macro parameter Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Approved by: re (glen) Notes: svn path=/head/; revision=338948
* Back out r338035 until Warner is finished churning GSoC PNP patchesConrad Meyer2018-08-191-2/+2
| | | | | | | | | | I was not aware Warner was making or planning to make forward progress in this area and have since been informed of that. It's easy to apply/reapply when churn dies down. Notes: svn path=/head/; revision=338037
* Remove unused and easy to misuse PNP macro parameterConrad Meyer2018-08-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Notes: svn path=/head/; revision=338035
* inline atomics and allow tied modules to inline locksMatt Macy2018-07-021-0/+5
| | | | | | | | | | | | | | - inline atomics in modules on i386 and amd64 (they were always inline on other arches) - allow modules to opt in to inlining locks by specifying MODULE_TIED=1 in the makefile Reviewed by: kib Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D16079 Notes: svn path=/head/; revision=335873
* Fix minor whitespace nitsWarner Losh2018-04-041-2/+2
| | | | Notes: svn path=/head/; revision=331975
* Fixup minor nits in the PNP_INFO protocol.Warner Losh2018-02-171-1/+1
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=329437
* sys/sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326256
* Improve description of the PNP string a bit.Warner Losh2017-09-271-2/+4
| | | | Notes: svn path=/head/; revision=324068
* Add the infrastructure to support loading multiple versions of TCPJonathan T. Looney2017-06-081-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | stack modules. It adds support for mangling symbols exported by a module by prepending a string to them. (This avoids overlapping symbols in the kernel linker.) It allows the use of a macro as the module name in the DECLARE_MACRO() and MACRO_VERSION() macros. It allows the code to register stack aliases (e.g. both a generic name ["default"] and version-specific name ["default_10_3p1"]). With these changes, it is trivial to compile TCP stack modules with the name defined in the Makefile and to load multiple versions of the same stack simultaneously. This functionality can be used to enable side-by-side testing of an old and new version of the same TCP stack. It also could support upgrading the TCP stack without a reboot. Reviewed by: gnn, sjg (makefiles only) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D11086 Notes: svn path=/head/; revision=319719
* sys/module.h: Unbreak MOD_DPF printfConrad Meyer2016-10-081-1/+1
| | | | | | | | | | MOD_DPF's args parameter already has parentheses around it. This was broken 14 years ago in r91472. Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=306874
* Fix typos (intenral -> internal) in commentsEnji Cooper2016-04-151-1/+1
| | | | Notes: svn path=/head/; revision=298023
* Fix typos in comments.Warner Losh2015-12-131-1/+1
| | | | Notes: svn path=/head/; revision=292146
* Create the MDT_PNP_INFO metadata record to communicate PNP info aboutWarner Losh2015-12-111-1/+48
| | | | | | | | | | modules. External agents may use this data to automatically load those modules. Differential Review: https://reviews.freebsd.org/D3461 Notes: svn path=/head/; revision=292077
* Ensure that the static structs emitted by the MODULE_DEPEND() andDimitry Andric2015-05-211-2/+4
| | | | | | | | | | | | | | | | | MODULE_VERSION() macros don't end up as .comm symbols, when all the version fields are zero. Normally, such symbols will end up in .bss, but for kernel module version objects, this can lead to "garbage" version numbers. Fix this by instructing the compiler to always put these structs in the .data segment instead. Reported by: delphij, ae MFC after: 1 week Notes: svn path=/head/; revision=283254
* Fix a very minor typo.Mark Murray2015-04-121-1/+1
| | | | Notes: svn path=/head/; revision=281463
* Reserve and ignore the a new module metadata type MDT_PNP_INFO forWarner Losh2015-01-151-0/+1
| | | | | | | | | | | | | associating an optional PNP hint table with this module. In the future, when these are added, these changes will silently ignore the new type they would otherwise warn about. It will always be safe to ignore this data. Get this into the builds today for some future proofing. MFC After: 3 days Notes: svn path=/head/; revision=277205
* Add macro DECLARE_MODULE_TIED to denote a module as requiring theKonstantin Belousov2010-10-121-2/+15
| | | | | | | | | | | | | | | | | | kernel of exactly the same __FreeBSD_version as the headers module was compiled against. Mark our in-tree ABI emulators with DECLARE_MODULE_TIED. The modules use kernel interfaces that the Release Engineering Team feel are not stable enough to guarantee they will not change during the life cycle of a STABLE branch. In particular, the layout of struct sysentvec is declared to be not part of the STABLE KBI. Discussed with: bz, rwatson Approved by: re (bz, kensmith) MFC after: 2 weeks Notes: svn path=/head/; revision=213716
* - Invoke MOD_QUIESCE on all modules in a linker file (kld) beforeJohn Baldwin2008-12-051-1/+3
| | | | | | | | | | | | | | | | | unloading any modules. As a result, if any module veto's an unload request via MOD_QUIESCE, the entire set of modules for that linker file will remain loaded and active now rather than leaving the kld in a weird state where some modules are loaded and some are unloaded. - This also moves the logic for handling the "forced" unload flag out of kern_module.c and into kern_linker.c which is a bit cleaner. - Add a module_name() routine that returns the name of a module and use that instead of printing pointer values in debug messages when a module fails MOD_QUIESCE or MOD_UNLOAD. MFC after: 1 month Notes: svn path=/head/; revision=185635
* In keeping with style(9)'s recommendations on macros, use a ';'Robert Watson2008-03-161-1/+1
| | | | | | | | | | | | after each SYSINIT() macro invocation. This makes a number of lightweight C parsers much happier with the FreeBSD kernel source, including cflow's prcc and lxr. MFC after: 1 month Discussed with: imp, rink Notes: svn path=/head/; revision=177253
* Add an automatic kernel module version dependency to prevent loadingJohn Baldwin2008-02-131-0/+13
| | | | | | | | | | | | | | | | modules using invalid ABI versions (e.g. a 7.x module with an 8.x kernel) for a given kernel: - Add a 'kernel' module version whose value is __FreeBSD_version. - Add a version dependency on 'kernel' in every module that has an acceptable version range of __FreeBSD_version up to the end of the branch __FreeBSD_version is part of. E.g. a module compiled on 701000 would work on kernels with versions between 701000 and 799999 inclusive. Discussed on: arch@ MFC after: 1 week Notes: svn path=/head/; revision=176252
* Add a new module_file() function that returns the linker_file_t associatedJohn Baldwin2006-04-171-0/+1
| | | | | | | | | | | | | with a given module_t. I use this in some the MOD_LOAD event handler for some test kernel modules to ask the kernel linker to look up the linker sets in my test modules. (I use linker sets to generate the list of possible events that I then signal to execute via a sysctl. On non-amd64, ld(8) would resolve the entire linker set, but on amd64 I have to ask the kernel linker to do it for me, and having the kernel linker do it works on all archs.) Notes: svn path=/head/; revision=157818
* Give kldunload a -f(orce) argument.Poul-Henning Kamp2004-07-131-2/+3
| | | | | | | | | | | | | | | | | | | | Add a MOD_QUIESCE event for modules. This should return error (EBUSY) of the module is in use. MOD_UNLOAD should now only fail if it is impossible (as opposed to inconvenient) to unload the module. Valid reasons are memory references into the module which cannot be tracked down and eliminated. When kldunloading, we abandon if MOD_UNLOAD fails, and if -force is not given, MOD_QUIESCE failing will also prevent the unload. For backwards compatibility, we treat EOPNOTSUPP from MOD_QUIESCE as success. Document that modules should return EOPNOTSUPP for unknown events. Notes: svn path=/head/; revision=132117
* - Lock down the ``module'' structure by adding an SX lock that is used byAndrew R. Reiter2002-03-181-0/+9
| | | | | | | | | | | | all the global bits of ``module'' data. This commit adds a few generic macros, MOD_SLOCK, MOD_XLOCK, etc., that are meant to be used as ways of accessing the SX lock. It is also the first step in helping to lock down the kernel linker and module systems. Reviewed by: jhb, jake, smp@ Notes: svn path=/head/; revision=92547
* Fix syntax error, where this was not compile tested after style(9)'ing.David E. O'Brien2002-03-011-1/+1
| | | | Notes: svn path=/head/; revision=91520
* - Style(9) makeover.Andrew R. Reiter2002-02-281-85/+80
| | | | | | | Reviewed by: chris, mike Notes: svn path=/head/; revision=91472
* Use protected variables names in prototypes visible to the userland asDima Dorfman2001-09-091-4/+4
| | | | | | | per style(9) and most other header files in sys/. Notes: svn path=/head/; revision=83248
* Constify the module name. This silences a few warnings ("initializationDag-Erling Smørgrav2001-06-191-2/+2
| | | | | | | | | | discards qualifier"), and probably adds a few where module names are compared to or passed as non-const strings. Not-objected-to-by: bde Notes: svn path=/head/; revision=78478
* First round implementation of a fine grain enhanced module to modulePeter Wemm2000-04-291-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | version dependency system. This isn't quite finished, but it is at a useful stage to do a functional checkpoint. Highlights: - version and dependency metadata is gathered via linker sets, so things are handled the same for static kernels and code built to live in a kld. - The dependencies are at module level (versus at file level). - Dependencies determine kld symbol search order - this means that you cannot link against symbols in another file unless you depend on it. This is so that you cannot accidently unload the target out from underneath the ones referencing it. - It is flexible enough that we can put tags in #include files and macros so that we can get decent hooks for enforcing recompiles on incompatable ABI changes. eg: if we change struct proc, we could force a recompile for all kld's that reference the proc struct. - Tangled dependency references at boot time are sorted. Files are relocated once all their dependencies are already relocated. Caveats: - Loader support is incomplete, but has been worked on seperately. - Actual enforcement of the version number tags is not active yet - just the module dependencies are live. The actual structure of versioning hasn't been agreed on yet. (eg: major.minor, or whatever) - There is some backwards compatability for old modules without metadata but I'm not sure how good it is. This is based on work originally done by Boris Popov (bp@freebsd.org), but I'm not sure he'd recognize much of it now. Don't blame him. :-) Also, ideas have been borrowed from Mike Smith. Notes: svn path=/head/; revision=59751
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"Peter Wemm1999-12-291-3/+3
| | | | | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come. Notes: svn path=/head/; revision=55205
* modfind(char *) -> modfind(const char *)Brian Somers1999-11-161-1/+1
| | | | | | | Ok'd by: dfr Notes: svn path=/head/; revision=53240
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* First stages of a module dependency cleanup. This part fixes aPeter Wemm1999-05-081-4/+3
| | | | | | | | | | | | | | | particularly annoying hack, namely having the linker bash the moduledata to set the container pointer, preventing it being const. In the process, a stack of warnings were fixed and will probably allow a revisit of the const C_SYSINIT() changes. This explicitly registers modules in files or preload areas with the module system first, and let them initialize via SYSINIT/DECLARE_MODULE later in their SI_ORDER_xxx order. The kludge of finding the containing file is no longer needed since the registration of modules onto the modules list is done in the context of initializing the linker file. Notes: svn path=/head/; revision=46693
* More -Wall / -Wcast-qual cleanup. Also, EXEC_SET can't useMatthew Dillon1999-01-291-6/+2
| | | | | | | | C_DECLARE_MODULE due to the linker_file_sysinit() function making modifications to the data. Notes: svn path=/head/; revision=43387
* Have EXEC_SET use C_DECLARE_MODULE instead of DECLARE_MODULE.Matthew Dillon1999-01-291-3/+7
| | | | | | | | | | | Add C_DECLARE_MODULE - same as DECLARE_MODULE but uses C_SYSINIT instead of SYSINIT. The C_ items are going to be used for items passing const data to sysinit. Notes: svn path=/head/; revision=43381
* Fix warnings in preparation for adding -Wall -Wcast-qual to theMatthew Dillon1999-01-271-2/+2
| | | | | | | kernel compile Notes: svn path=/head/; revision=43301
* Fix warnings preparing for -Wall -Wcast-qualMatthew Dillon1999-01-271-2/+2
| | | | | | | | Also disable one usb module in LINT due to fatal compilation errors, temporary. Notes: svn path=/head/; revision=43295
* Implement a mechanism for a module to report a small amount of moduleDoug Rabson1999-01-091-1/+14
| | | | | | | | specific data back to the user via kldstat(2). Use that mechanism in the syscall handler to report the syscall number used. Notes: svn path=/head/; revision=42435
* My changes to the new device interface:Garrett Wollman1998-11-141-9/+9
| | | | | | | | | | | | | | | | | - Interface wth the new resource manager. - Allow for multiple drivers implementing a single devclass. - Remove ordering dependencies between header files. - Style cleanup. - Add DEVICE_SUSPEND and DEVICE_RESUME methods. - Move to a single-phase interrupt setup scheme. Kernel builds on the Alpha are brken until Doug gets a chance to incorporate these changes on that side. Agreed to in principle by: dfr Notes: svn path=/head/; revision=41153
* A hook for storing the origin of a module, this is important whenPeter Wemm1998-10-091-4/+6
| | | | | | | it's being registered in sorted sysinit sequence and not in load order. Notes: svn path=/head/; revision=40137
* Add initial support for the FreeBSD/alpha kernel. This is very much aDoug Rabson1998-06-101-2/+3
| | | | | | | | | | | | | work in progress and has never booted a real machine. Initial development and testing was done using SimOS (see http://simos.stanford.edu for details). On the SimOS simulator, this port successfully reaches single-user mode and has been tested with loads as high as one copy of /bin/ls :-). Obtained from: partly from NetBSD/alpha Notes: svn path=/head/; revision=36849
* make a couple functions static...John-Mark Gurney1997-10-241-3/+3
| | | | | | | | also change module_register_static to module_register_init as this function initalizes the module for both dynamic and static modules... Notes: svn path=/head/; revision=30683
* This is the kernel linker. To use it, you will first need to applyDoug Rabson1997-05-071-0/+107
the patches in freefall:/home/dfr/ld.diffs to your ld sources and set BINFORMAT to aoutkld when linking the kernel. Library changes and userland utilities will appear in a later commit. Notes: svn path=/head/; revision=25537