mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-22 15:47:37 +00:00
Convert ccd to a proper module vs. something started by PSEUDO_SET().
This commit is contained in:
parent
7613dbd346
commit
b7b98418bd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=43076
@ -1,4 +1,4 @@
|
|||||||
/* $Id: ccd.c,v 1.36 1998/08/19 10:50:32 sos Exp $ */
|
/* $Id: ccd.c,v 1.37 1998/09/15 08:15:26 gibbs Exp $ */
|
||||||
|
|
||||||
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
|
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
|
||||||
|
|
||||||
@ -93,6 +93,7 @@
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
|
#include <sys/module.h>
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
@ -184,9 +185,9 @@ static struct cdevsw ccd_cdevsw = {
|
|||||||
NULL, -1, ccddump, ccdsize,
|
NULL, -1, ccddump, ccdsize,
|
||||||
D_DISK, 0, -1 };
|
D_DISK, 0, -1 };
|
||||||
|
|
||||||
/* Called by main() during pseudo-device attachment */
|
/* called during module initialization */
|
||||||
static void ccdattach __P((void *));
|
static void ccdattach __P((void));
|
||||||
PSEUDO_SET(ccdattach, ccd);
|
static int ccd_modevent __P((module_t, int, void *));
|
||||||
|
|
||||||
/* called by biodone() at interrupt time */
|
/* called by biodone() at interrupt time */
|
||||||
static void ccdiodone __P((struct ccdbuf *cbp));
|
static void ccdiodone __P((struct ccdbuf *cbp));
|
||||||
@ -212,8 +213,6 @@ struct ccd_softc *ccd_softc;
|
|||||||
struct ccddevice *ccddevs;
|
struct ccddevice *ccddevs;
|
||||||
static int numccd = 0;
|
static int numccd = 0;
|
||||||
|
|
||||||
static int ccd_devsw_installed = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Number of blocks to untouched in front of a component partition.
|
* Number of blocks to untouched in front of a component partition.
|
||||||
* This is to avoid violating its disklabel area when it starts at the
|
* This is to avoid violating its disklabel area when it starts at the
|
||||||
@ -229,8 +228,7 @@ static int ccd_devsw_installed = 0;
|
|||||||
* add devsw entries.
|
* add devsw entries.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
ccdattach(dummy)
|
ccdattach()
|
||||||
void *dummy;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int num = NCCD;
|
int num = NCCD;
|
||||||
@ -259,16 +257,34 @@ ccdattach(dummy)
|
|||||||
/* XXX: is this necessary? */
|
/* XXX: is this necessary? */
|
||||||
for (i = 0; i < numccd; ++i)
|
for (i = 0; i < numccd; ++i)
|
||||||
ccddevs[i].ccd_dk = -1;
|
ccddevs[i].ccd_dk = -1;
|
||||||
|
|
||||||
if( ! ccd_devsw_installed ) {
|
|
||||||
cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &ccd_cdevsw);
|
|
||||||
ccd_devsw_installed = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("huh?\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
ccd_modevent(mod, type, data)
|
||||||
|
module_t mod;
|
||||||
|
int type;
|
||||||
|
void *data;
|
||||||
|
{
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case MOD_LOAD:
|
||||||
|
ccdattach();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_UNLOAD:
|
||||||
|
printf("ccd0: Unload not supported!\n");
|
||||||
|
error = EOPNOTSUPP;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: /* MOD_SHUTDOWN etc */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return (error);
|
||||||
|
}
|
||||||
|
|
||||||
|
BDEV_MODULE(ccd, BDEV_MAJOR, CDEV_MAJOR, ccd_cdevsw, ccd_modevent, NULL);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ccdinit(ccd, cpaths, p)
|
ccdinit(ccd, cpaths, p)
|
||||||
struct ccddevice *ccd;
|
struct ccddevice *ccd;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: ccd.c,v 1.36 1998/08/19 10:50:32 sos Exp $ */
|
/* $Id: ccd.c,v 1.37 1998/09/15 08:15:26 gibbs Exp $ */
|
||||||
|
|
||||||
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
|
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
|
||||||
|
|
||||||
@ -93,6 +93,7 @@
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
|
#include <sys/module.h>
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
@ -184,9 +185,9 @@ static struct cdevsw ccd_cdevsw = {
|
|||||||
NULL, -1, ccddump, ccdsize,
|
NULL, -1, ccddump, ccdsize,
|
||||||
D_DISK, 0, -1 };
|
D_DISK, 0, -1 };
|
||||||
|
|
||||||
/* Called by main() during pseudo-device attachment */
|
/* called during module initialization */
|
||||||
static void ccdattach __P((void *));
|
static void ccdattach __P((void));
|
||||||
PSEUDO_SET(ccdattach, ccd);
|
static int ccd_modevent __P((module_t, int, void *));
|
||||||
|
|
||||||
/* called by biodone() at interrupt time */
|
/* called by biodone() at interrupt time */
|
||||||
static void ccdiodone __P((struct ccdbuf *cbp));
|
static void ccdiodone __P((struct ccdbuf *cbp));
|
||||||
@ -212,8 +213,6 @@ struct ccd_softc *ccd_softc;
|
|||||||
struct ccddevice *ccddevs;
|
struct ccddevice *ccddevs;
|
||||||
static int numccd = 0;
|
static int numccd = 0;
|
||||||
|
|
||||||
static int ccd_devsw_installed = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Number of blocks to untouched in front of a component partition.
|
* Number of blocks to untouched in front of a component partition.
|
||||||
* This is to avoid violating its disklabel area when it starts at the
|
* This is to avoid violating its disklabel area when it starts at the
|
||||||
@ -229,8 +228,7 @@ static int ccd_devsw_installed = 0;
|
|||||||
* add devsw entries.
|
* add devsw entries.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
ccdattach(dummy)
|
ccdattach()
|
||||||
void *dummy;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int num = NCCD;
|
int num = NCCD;
|
||||||
@ -259,16 +257,34 @@ ccdattach(dummy)
|
|||||||
/* XXX: is this necessary? */
|
/* XXX: is this necessary? */
|
||||||
for (i = 0; i < numccd; ++i)
|
for (i = 0; i < numccd; ++i)
|
||||||
ccddevs[i].ccd_dk = -1;
|
ccddevs[i].ccd_dk = -1;
|
||||||
|
|
||||||
if( ! ccd_devsw_installed ) {
|
|
||||||
cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &ccd_cdevsw);
|
|
||||||
ccd_devsw_installed = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("huh?\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
ccd_modevent(mod, type, data)
|
||||||
|
module_t mod;
|
||||||
|
int type;
|
||||||
|
void *data;
|
||||||
|
{
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case MOD_LOAD:
|
||||||
|
ccdattach();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_UNLOAD:
|
||||||
|
printf("ccd0: Unload not supported!\n");
|
||||||
|
error = EOPNOTSUPP;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: /* MOD_SHUTDOWN etc */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return (error);
|
||||||
|
}
|
||||||
|
|
||||||
|
BDEV_MODULE(ccd, BDEV_MAJOR, CDEV_MAJOR, ccd_cdevsw, ccd_modevent, NULL);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ccdinit(ccd, cpaths, p)
|
ccdinit(ccd, cpaths, p)
|
||||||
struct ccddevice *ccd;
|
struct ccddevice *ccd;
|
||||||
|
Loading…
Reference in New Issue
Block a user