1- /* $Id: VBoxLnxModInline.h 110684 2025-08-11 17:18:47Z klaus.espenlaub @oracle.com $ */
1+ /* $Id: VBoxLnxModInline.h 111490 2025-10-24 12:40:53Z vadim.galitsyn @oracle.com $ */
22/** @file
33 * A common code for VirtualBox Linux kernel modules.
44 */
3737# include <linux/module.h>
3838# include <linux/types.h>
3939
40+ # if RTLNX_VER_MIN (2 ,5 ,52 )
41+ 4042/** Disable automatic module loading. */
43+ # define VBOX_MOD_DISABLED g_fDisabled
44+ # define VBOX_MOD_NAME module_name(THIS_MODULE)
4145static int g_fDisabled = -1 ;
42- MODULE_PARM_DESC (disabled , "Disable automatic module loading" );
4346module_param_named (disabled , g_fDisabled , int , 0400 );
4447
48+ # else /* < 2.5.52 */
49+ 50+ # define VBOX_MOD_DISABLED disabled
51+ # define VBOX_MOD_NAME THIS_MODULE->name
52+ static int disabled = -1 ;
53+ MODULE_PARM (disabled , "i" );
54+ 55+ # endif
56+ 57+ MODULE_PARM_DESC (disabled , "Disable automatic module loading" );
58+ 4559/**
4660 * Check if module loading was explicitly disabled.
4761 *
@@ -52,12 +66,11 @@ module_param_named(disabled, g_fDisabled, int, 0400);
5266 */
5367static inline bool vbox_mod_should_load (void )
5468{
55- bool fShouldLoad = (g_fDisabled != 1 );
69+ bool fShouldLoad = (VBOX_MOD_DISABLED != 1 );
5670
5771 /* Print message into dmesg log if module loading was disabled. */
5872 if (!fShouldLoad )
59- printk (KERN_WARNING "%s: automatic module loading disabled in kernel command line\n" ,
60- module_name (THIS_MODULE ));
73+ printk (KERN_WARNING "%s: automatic module loading disabled in kernel command line\n" , VBOX_MOD_NAME );
6174
6275 return fShouldLoad ;
6376}
0 commit comments