Using devfs_add_devswf() instead of devfs_add_devsw()

Reviewed by:	julian@freebsd.org
This commit is contained in:
Marc G. Fournier 1996-03-28 14:33:59 +00:00
parent 0d5b12e38e
commit ccbc58d3ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=14877
7 changed files with 43 additions and 50 deletions

View File

@ -37,7 +37,7 @@
* *
* @(#)bpf.c 8.2 (Berkeley) 3/28/94 * @(#)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" #include "bpfilter.h"
@ -1300,26 +1300,29 @@ bpfattach(ifp, dlt, hdrlen)
printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit); printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit);
} }
#ifdef DEVFS
static void *bpf_devfs_token[NBPFILTER]; static void *bpf_devfs_token[NBPFILTER];
#endif
static bpf_devsw_installed = 0; static bpf_devsw_installed = 0;
static void bpf_drvinit(void *unused) static void bpf_drvinit(void *unused)
{ {
dev_t dev; dev_t dev;
int i; #ifdef DEVFS
char name[32]; int i;
#endif
if( ! bpf_devsw_installed ) { if( ! bpf_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0); dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&bpf_cdevsw, NULL); cdevsw_add(&dev,&bpf_cdevsw, NULL);
bpf_devsw_installed = 1; bpf_devsw_installed = 1;
#ifdef DEVFS #ifdef DEVFS
for ( i = 0 ; i < NBPFILTER ; i++ ) { for ( i = 0 ; i < NBPFILTER ; i++ ) {
sprintf(name,"bpf%d",i);
bpf_devfs_token[i] = bpf_devfs_token[i] =
devfs_add_devsw( "/", name, devfs_add_devswf(&bpf_cdevsw, i, DV_CHR, 0, 0,
&bpf_cdevsw, i, DV_CHR, 0, 0, 0600); 0600, "bpf%d", i);
} }
#endif #endif
} }

View File

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

View File

@ -14,7 +14,7 @@
* *
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * 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" #include "opt_bounce.h"
@ -206,7 +206,6 @@ cdattach(struct scsi_link *sc_link)
u_int32_t unit; u_int32_t unit;
struct cd_parms *dp; struct cd_parms *dp;
struct scsi_data *cd = sc_link->sd; struct scsi_data *cd = sc_link->sd;
char name[32];
unit = sc_link->dev_unit; unit = sc_link->dev_unit;
dp = &(cd->params); dp = &(cd->params);
@ -243,25 +242,18 @@ cdattach(struct scsi_link *sc_link)
#ifdef DEVFS #ifdef DEVFS
#define CD_UID 0 #define CD_UID 0
#define CD_GID 13 #define CD_GID 13
sprintf(name, "rcd%da",unit); cd->ra_devfs_token =
cd->ra_devfs_token = devfs_add_devsw( devfs_add_devswf(&cd_cdevsw, unit * 8, DV_CHR, CD_UID,
"/", name, &cd_cdevsw, unit * 8, CD_GID, 0660, "rcd%da", unit);
DV_CHR, CD_UID, CD_GID, 0660); cd->rc_devfs_token =
devfs_add_devswf(&cd_cdevsw, (unit * 8 ) + RAW_PART, DV_CHR,
sprintf(name, "rcd%dc",unit); CD_UID, CD_GID, 0600, "rcd%dc", unit);
cd->rc_devfs_token = devfs_add_devsw( cd->a_devfs_token =
"/", name, &cd_cdevsw, (unit * 8 ) + RAW_PART, devfs_add_devswf(&cd_bdevsw, unit * 8, DV_BLK, CD_UID,
DV_CHR, CD_UID, CD_GID, 0600); CD_GID, 0660, "cd%da", unit);
cd->c_devfs_token =
sprintf(name, "cd%da",unit); devfs_add_devswf(&cd_bdevsw, (unit * 8 ) + RAW_PART, DV_BLK,
cd->a_devfs_token = devfs_add_devsw( CD_UID, CD_GID, 0600, "cd%dc", unit);
"/", 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);
#endif #endif
return 0; return 0;

View File

@ -37,7 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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; static sctarg_devsw_installed = 0;
#ifdef DEVFS
static void *sctarg_devfs_token;
#endif
static void sctarg_drvinit(void *unused) static void sctarg_drvinit(void *unused)
{ {
dev_t dev; dev_t dev;
void *x;
if( ! sctarg_devsw_installed ) { if( ! sctarg_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0); dev = makedev(CDEV_MAJOR, 0);
@ -282,8 +284,9 @@ static void sctarg_drvinit(void *unused)
sctarg_devsw_installed = 1; sctarg_devsw_installed = 1;
#ifdef DEVFS #ifdef DEVFS
/* XXX should be in ADAPTER code */ /* XXX should be in ADAPTER code */
x=devfs_add_devsw( "/scsi", "sctarg", &sctarg_cdevsw, 0, sctarg_devfs_token =
DV_CHR, 0, 0, 0600); devfs_add_devswf(&sctarg_cdevsw, 0, DV_CHR, 0, 0,
0600, "sctarg");
#endif #endif
} }
} }

View File

@ -49,7 +49,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*End copyright *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> #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; static ssc_devsw_installed = 0;
#ifdev DEVFS
static void *ssc_devfs_token; static void *ssc_devfs_token;
#endif
static void static void
ssc_drvinit(void *unused) ssc_drvinit(void *unused)
@ -146,9 +148,9 @@ ssc_drvinit(void *unused)
cdevsw_add(&dev,&ssc_cdevsw, NULL); cdevsw_add(&dev,&ssc_cdevsw, NULL);
ssc_devsw_installed = 1; ssc_devsw_installed = 1;
#ifdef DEVFS #ifdef DEVFS
ssc_devfs_token = devfs_add_devsw( ssc_devfs_token =
"/scsi", "ssc", &ssc_cdevsw, 0, devfs_add_devswf(&ssc_cdevsw, 0, DV_CHR, 0, 0,
DV_CHR, 0, 0, 0600); 0600, "ssc");
#endif #endif
} }
} }

View File

@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct * on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances. * 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) stattach(struct scsi_link *sc_link)
{ {
u_int32_t unit; u_int32_t unit;
#ifdef DEVFS
char name[32];
#endif
struct scsi_data *st = sc_link->sd; 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 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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. /* XXX This is PRELIMINARY.
@ -235,7 +235,6 @@ static errval
wormattach(struct scsi_link *sc_link) wormattach(struct scsi_link *sc_link)
{ {
#ifdef DEVFS #ifdef DEVFS
char name[20];
int mynor; int mynor;
#endif #endif
struct scsi_data *worm = sc_link->sd; struct scsi_data *worm = sc_link->sd;
@ -250,15 +249,12 @@ wormattach(struct scsi_link *sc_link)
printf("with %ld blocks.", worm->n_blks); printf("with %ld blocks.", worm->n_blks);
#ifdef DEVFS #ifdef DEVFS
mynor = wormunit(sc_link->dev); mynor = wormunit(sc_link->dev);
sprintf(name, "rworm%d", mynor);
worm->devfs_token = worm->devfs_token =
devfs_add_devsw("/", name, &worm_cdevsw, mynor, devfs_add_devswf(&worm_cdevsw, mynor,
DV_CHR, 0, 0, 0600); DV_CHR, 0, 0, 0600, "rworm%d", mynor);
sprintf(name, "rworm%d.ctl", mynor);
worm->devfs_token = worm->devfs_token =
devfs_add_devsw("/", name, &worm_cdevsw, devfs_add_devswf(&worm_cdevsw, mynor | SCSI_CONTROL_MASK,
mynor | SCSI_CONTROL_MASK, DV_CHR, 0, 0, 0600, "rworm%d.ctl", mynor);
DV_CHR, 0, 0, 0600);
#endif #endif
return 0; return 0;
} }