Define a new module class for the bufq_strategy modules. These need to

be loaded and intialized before autoconfigure runs, since some devices
(like disks and floppy drives) want to call bufq_alloc().
This commit is contained in:
pgoyette 2016-11-16 10:42:14 +00:00
parent b6ee83e3c8
commit 219154eeef
7 changed files with 26 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bufq_disksort.c,v 1.12 2016/11/16 00:46:46 pgoyette Exp $ */
/* $NetBSD: bufq_disksort.c,v 1.13 2016/11/16 10:42:14 pgoyette Exp $ */
/* NetBSD: subr_disk.c,v 1.61 2004/09/25 03:30:44 thorpej Exp */
/*-
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bufq_disksort.c,v 1.12 2016/11/16 00:46:46 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: bufq_disksort.c,v 1.13 2016/11/16 10:42:14 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -229,7 +229,7 @@ bufq_disksort_init(struct bufq_state *bufq)
TAILQ_INIT(&disksort->bq_head);
}
MODULE(MODULE_CLASS_MISC, bufq_disksort, NULL);
MODULE(MODULE_CLASS_BUFQ, bufq_disksort, NULL);
static int
bufq_disksort_modcmd(modcmd_t cmd, void *opaque)

View File

@ -1,4 +1,4 @@
/* $NetBSD: bufq_fcfs.c,v 1.11 2016/11/16 00:46:46 pgoyette Exp $ */
/* $NetBSD: bufq_fcfs.c,v 1.12 2016/11/16 10:42:14 pgoyette Exp $ */
/* NetBSD: subr_disk.c,v 1.61 2004/09/25 03:30:44 thorpej Exp */
/*-
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bufq_fcfs.c,v 1.11 2016/11/16 00:46:46 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: bufq_fcfs.c,v 1.12 2016/11/16 10:42:14 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -153,7 +153,7 @@ bufq_fcfs_init(struct bufq_state *bufq)
TAILQ_INIT(&fcfs->bq_head);
}
MODULE(MODULE_CLASS_MISC, bufq_fcfs, NULL);
MODULE(MODULE_CLASS_BUFQ, bufq_fcfs, NULL);
static int
bufq_fcfs_modcmd(modcmd_t cmd, void *opaque)

View File

@ -1,4 +1,4 @@
/* $NetBSD: bufq_priocscan.c,v 1.19 2016/11/16 00:46:46 pgoyette Exp $ */
/* $NetBSD: bufq_priocscan.c,v 1.20 2016/11/16 10:42:14 pgoyette Exp $ */
/*-
* Copyright (c)2004,2005,2006,2008,2009,2011,2012 YAMAMOTO Takashi,
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bufq_priocscan.c,v 1.19 2016/11/16 00:46:46 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: bufq_priocscan.c,v 1.20 2016/11/16 10:42:14 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -444,7 +444,7 @@ bufq_priocscan_init(struct bufq_state *bufq)
}
}
MODULE(MODULE_CLASS_MISC, bufq_priocscan, NULL);
MODULE(MODULE_CLASS_BUFQ, bufq_priocscan, NULL);
static int
bufq_priocscan_modcmd(modcmd_t cmd, void *opaque)

View File

@ -1,4 +1,4 @@
/* $NetBSD: bufq_readprio.c,v 1.14 2016/11/16 00:46:46 pgoyette Exp $ */
/* $NetBSD: bufq_readprio.c,v 1.15 2016/11/16 10:42:14 pgoyette Exp $ */
/* NetBSD: subr_disk.c,v 1.61 2004/09/25 03:30:44 thorpej Exp */
/*-
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bufq_readprio.c,v 1.14 2016/11/16 00:46:46 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: bufq_readprio.c,v 1.15 2016/11/16 10:42:14 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -281,7 +281,7 @@ bufq_readprio_init(struct bufq_state *bufq)
TAILQ_INIT(&prio->bq_write);
}
MODULE(MODULE_CLASS_MISC, bufq_readprio, NULL);
MODULE(MODULE_CLASS_BUFQ, bufq_readprio, NULL);
static int
bufq_readprio_modcmd(modcmd_t cmd, void *opaque)

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.485 2016/11/16 00:46:46 pgoyette Exp $ */
/* $NetBSD: init_main.c,v 1.486 2016/11/16 10:42:14 pgoyette Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@ -97,7 +97,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.485 2016/11/16 00:46:46 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.486 2016/11/16 10:42:14 pgoyette Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@ -484,6 +484,12 @@ main(void)
/* Initialize sockets thread(s) */
soinit1();
/*
* Initialize the bufq strategy modules - they may be needed
* by some devices during configuration
*/
module_init_class(MODULE_CLASS_BUFQ);
/* Configure the system hardware. This will enable interrupts. */
configure();

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_bufq.c,v 1.22 2016/11/16 00:46:46 pgoyette Exp $ */
/* $NetBSD: subr_bufq.c,v 1.23 2016/11/16 10:42:14 pgoyette Exp $ */
/* NetBSD: subr_disk.c,v 1.70 2005/08/20 12:00:01 yamt Exp $ */
/*-
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_bufq.c,v 1.22 2016/11/16 00:46:46 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_bufq.c,v 1.23 2016/11/16 10:42:14 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -182,7 +182,7 @@ bufq_alloc(struct bufq_state **bufqp, const char *strategy, int flags)
strlcpy(module_name, "bufq_", sizeof(module_name));
strlcat(module_name, strategy, sizeof(module_name));
mutex_exit(&bufq_mutex);
(void) module_autoload(module_name, MODULE_CLASS_MISC);
(void) module_autoload(module_name, MODULE_CLASS_BUFQ);
mutex_enter(&bufq_mutex);
} while (gen != module_gen);

View File

@ -1,4 +1,4 @@
/* $NetBSD: module.h,v 1.40 2016/01/18 16:46:08 pooka Exp $ */
/* $NetBSD: module.h,v 1.41 2016/11/16 10:42:14 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -45,7 +45,8 @@ typedef enum modclass {
MODULE_CLASS_VFS,
MODULE_CLASS_DRIVER,
MODULE_CLASS_EXEC,
MODULE_CLASS_SECMODEL
MODULE_CLASS_SECMODEL,
MODULE_CLASS_BUFQ
} modclass_t;
/* Module sources: where did it come from? */