Using devfs_add_devswf() instead of devfs_add_devsw()

Reviewed by:	julian@freebsd.org
This commit is contained in:
scrappy 1996-03-28 14:33:59 +00:00
parent 745bb4c905
commit 0567ca9a10
7 changed files with 43 additions and 50 deletions

View File

@ -37,7 +37,7 @@
*
* @(#)bpf.c 8.2 (Berkeley) 3/28/94
*
* $Id: bpf.c,v 1.21 1995/12/14 09:53:10 phk Exp $
* $Id: bpf.c,v 1.22 1996/02/06 18:51:04 wollman Exp $
*/
#include "bpfilter.h"
@ -1300,26 +1300,29 @@ bpfattach(ifp, dlt, hdrlen)
printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit);
}
#ifdef DEVFS
static void *bpf_devfs_token[NBPFILTER];
#endif
static bpf_devsw_installed = 0;
static void bpf_drvinit(void *unused)
{
dev_t dev;
int i;
char name[32];
#ifdef DEVFS
int i;
#endif
if( ! bpf_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&bpf_cdevsw, NULL);
bpf_devsw_installed = 1;
#ifdef DEVFS
for ( i = 0 ; i < NBPFILTER ; i++ ) {
sprintf(name,"bpf%d",i);
bpf_devfs_token[i] =
devfs_add_devsw( "/", name,
&bpf_cdevsw, i, DV_CHR, 0, 0, 0600);
devfs_add_devswf(&bpf_cdevsw, i, DV_CHR, 0, 0,
0600, "bpf%d", i);
}
#endif
}

View File

@ -954,8 +954,8 @@ met_attach(pcici_t tag, int unit)
mtr->flags |= METEOR_INITALIZED | METEOR_AUTOMODE | METEOR_DEV0 |
METEOR_RGB16;
#ifdef DEVFS
mtr->devfs_token = devfs_add_devsw( "/", "meteor", &meteor_cdevsw, unit,
DV_CHR, 0, 0, 0644);
mtr->devfs_token = devfs_add_devswf(&meteor_cdevsw, unit,
DV_CHR, 0, 0, 0644, "meteor");
#endif
}

View File

@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* $Id: cd.c,v 1.66 1996/02/13 03:46:48 ache Exp $
* $Id: cd.c,v 1.67 1996/03/10 07:13:04 gibbs Exp $
*/
#include "opt_bounce.h"
@ -206,7 +206,6 @@ cdattach(struct scsi_link *sc_link)
u_int32_t unit;
struct cd_parms *dp;
struct scsi_data *cd = sc_link->sd;
char name[32];
unit = sc_link->dev_unit;
dp = &(cd->params);
@ -243,25 +242,18 @@ cdattach(struct scsi_link *sc_link)
#ifdef DEVFS
#define CD_UID 0
#define CD_GID 13
sprintf(name, "rcd%da",unit);
cd->ra_devfs_token = devfs_add_devsw(
"/", name, &cd_cdevsw, unit * 8,
DV_CHR, CD_UID, CD_GID, 0660);
sprintf(name, "rcd%dc",unit);
cd->rc_devfs_token = devfs_add_devsw(
"/", name, &cd_cdevsw, (unit * 8 ) + RAW_PART,
DV_CHR, CD_UID, CD_GID, 0600);
sprintf(name, "cd%da",unit);
cd->a_devfs_token = devfs_add_devsw(
"/", name, &cd_bdevsw, (unit * 8 ) + 0,
DV_BLK, CD_UID, CD_GID, 0660);
sprintf(name, "cd%dc",unit);
cd->c_devfs_token = devfs_add_devsw(
"/", name, &cd_bdevsw, (unit * 8 ) + RAW_PART,
DV_BLK, CD_UID, CD_GID, 0600);
cd->ra_devfs_token =
devfs_add_devswf(&cd_cdevsw, unit * 8, DV_CHR, CD_UID,
CD_GID, 0660, "rcd%da", unit);
cd->rc_devfs_token =
devfs_add_devswf(&cd_cdevsw, (unit * 8 ) + RAW_PART, DV_CHR,
CD_UID, CD_GID, 0600, "rcd%dc", unit);
cd->a_devfs_token =
devfs_add_devswf(&cd_bdevsw, unit * 8, DV_BLK, CD_UID,
CD_GID, 0660, "cd%da", unit);
cd->c_devfs_token =
devfs_add_devswf(&cd_bdevsw, (unit * 8 ) + RAW_PART, DV_BLK,
CD_UID, CD_GID, 0600, "cd%dc", unit);
#endif
return 0;

View File

@ -37,7 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: sctarg.c,v 1.13 1996/01/05 20:12:47 wollman Exp $
* $Id: sctarg.c,v 1.14 1996/03/10 07:13:11 gibbs Exp $
*/
/*
@ -270,11 +270,13 @@ sctarg_strategy(struct buf *bp, struct scsi_link *sc_link)
}
static sctarg_devsw_installed = 0;
#ifdef DEVFS
static void *sctarg_devfs_token;
#endif
static void sctarg_drvinit(void *unused)
{
dev_t dev;
void *x;
if( ! sctarg_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0);
@ -282,8 +284,9 @@ static void sctarg_drvinit(void *unused)
sctarg_devsw_installed = 1;
#ifdef DEVFS
/* XXX should be in ADAPTER code */
x=devfs_add_devsw( "/scsi", "sctarg", &sctarg_cdevsw, 0,
DV_CHR, 0, 0, 0600);
sctarg_devfs_token =
devfs_add_devswf(&sctarg_cdevsw, 0, DV_CHR, 0, 0,
0600, "sctarg");
#endif
}
}

View File

@ -49,7 +49,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*End copyright
* $Id: ssc.c,v 1.9 1995/12/08 23:22:26 phk Exp $
* $Id: ssc.c,v 1.10 1995/12/10 20:34:49 bde Exp $
*/
#include <sys/types.h>
@ -134,7 +134,9 @@ sscioctl(dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)
*/
static ssc_devsw_installed = 0;
#ifdev DEVFS
static void *ssc_devfs_token;
#endif
static void
ssc_drvinit(void *unused)
@ -146,9 +148,9 @@ ssc_drvinit(void *unused)
cdevsw_add(&dev,&ssc_cdevsw, NULL);
ssc_devsw_installed = 1;
#ifdef DEVFS
ssc_devfs_token = devfs_add_devsw(
"/scsi", "ssc", &ssc_cdevsw, 0,
DV_CHR, 0, 0, 0600);
ssc_devfs_token =
devfs_add_devswf(&ssc_cdevsw, 0, DV_CHR, 0, 0,
0600, "ssc");
#endif
}
}

View File

@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
* $Id: st.c,v 1.63 1996/03/10 07:13:14 gibbs Exp $
* $Id: st.c,v 1.64 1996/03/27 18:50:10 bde Exp $
*/
/*
@ -275,9 +275,6 @@ static errval
stattach(struct scsi_link *sc_link)
{
u_int32_t unit;
#ifdef DEVFS
char name[32];
#endif
struct scsi_data *st = sc_link->sd;

View File

@ -43,7 +43,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: worm.c,v 1.25 1996/03/10 07:13:15 gibbs Exp $
* $Id: worm.c,v 1.26 1996/03/10 12:52:47 jkh Exp $
*/
/* XXX This is PRELIMINARY.
@ -235,7 +235,6 @@ static errval
wormattach(struct scsi_link *sc_link)
{
#ifdef DEVFS
char name[20];
int mynor;
#endif
struct scsi_data *worm = sc_link->sd;
@ -250,15 +249,12 @@ wormattach(struct scsi_link *sc_link)
printf("with %ld blocks.", worm->n_blks);
#ifdef DEVFS
mynor = wormunit(sc_link->dev);
sprintf(name, "rworm%d", mynor);
worm->devfs_token =
devfs_add_devsw("/", name, &worm_cdevsw, mynor,
DV_CHR, 0, 0, 0600);
sprintf(name, "rworm%d.ctl", mynor);
devfs_add_devswf(&worm_cdevsw, mynor,
DV_CHR, 0, 0, 0600, "rworm%d", mynor);
worm->devfs_token =
devfs_add_devsw("/", name, &worm_cdevsw,
mynor | SCSI_CONTROL_MASK,
DV_CHR, 0, 0, 0600);
devfs_add_devswf(&worm_cdevsw, mynor | SCSI_CONTROL_MASK,
DV_CHR, 0, 0, 0600, "rworm%d.ctl", mynor);
#endif
return 0;
}