geom_ccd.c (37384) | geom_ccd.c (37389) |
---|---|
1/* $Id: ccd.c,v 1.33 1998/06/07 17:09:41 dfr Exp $ */ | 1/* $Id: ccd.c,v 1.34 1998/07/04 20:45:29 julian Exp $ */ |
2 3/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ 4 5/* 6 * Copyright (c) 1995 Jason R. Thorpe. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without --- 150 unchanged lines hidden (view full) --- 160 ((struct ccdbuf *)malloc(sizeof(struct ccdbuf), M_DEVBUF, M_WAITOK)) 161#define putccdbuf(cbp) \ 162 free((caddr_t)(cbp), M_DEVBUF) 163 164#define CCDLABELDEV(dev) \ 165 (makedev(major((dev)), dkmakeminor(ccdunit((dev)), 0, RAW_PART))) 166 167static d_open_t ccdopen; | 2 3/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ 4 5/* 6 * Copyright (c) 1995 Jason R. Thorpe. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without --- 150 unchanged lines hidden (view full) --- 160 ((struct ccdbuf *)malloc(sizeof(struct ccdbuf), M_DEVBUF, M_WAITOK)) 161#define putccdbuf(cbp) \ 162 free((caddr_t)(cbp), M_DEVBUF) 163 164#define CCDLABELDEV(dev) \ 165 (makedev(major((dev)), dkmakeminor(ccdunit((dev)), 0, RAW_PART))) 166 167static d_open_t ccdopen; |
168static d_read_t ccdread; 169static d_write_t ccdwrite; |
|
168static d_close_t ccdclose; 169static d_strategy_t ccdstrategy; 170static d_ioctl_t ccdioctl; 171static d_dump_t ccddump; 172static d_psize_t ccdsize; 173 174#define CDEV_MAJOR 74 175#define BDEV_MAJOR 21 176 | 170static d_close_t ccdclose; 171static d_strategy_t ccdstrategy; 172static d_ioctl_t ccdioctl; 173static d_dump_t ccddump; 174static d_psize_t ccdsize; 175 176#define CDEV_MAJOR 74 177#define BDEV_MAJOR 21 178 |
177static struct cdevsw ccd_cdevsw; 178static struct bdevsw ccd_bdevsw = { 179 ccdopen, ccdclose, ccdstrategy, ccdioctl, 180 ccddump, ccdsize, 0, 181 "ccd", &ccd_cdevsw, -1 182}; | 179static struct cdevsw ccd_cdevsw = { 180 ccdopen, ccdclose, ccdread, ccdwrite, 181 ccdioctl, nostop, nullreset, nodevtotty, 182 seltrue, nommap, ccdstrategy, "ccd", 183 NULL, -1, ccddump, ccdsize, 184 D_DISK, 0, -1 }; |
183 184/* Called by main() during pseudo-device attachment */ 185static void ccdattach __P((void *)); 186PSEUDO_SET(ccdattach, ccd); 187 188/* called by biodone() at interrupt time */ 189static void ccdiodone __P((struct ccdbuf *cbp)); 190 --- 62 unchanged lines hidden (view full) --- 253 bzero(ccd_softc, num * sizeof(struct ccd_softc)); 254 bzero(ccddevs, num * sizeof(struct ccddevice)); 255 256 /* XXX: is this necessary? */ 257 for (i = 0; i < numccd; ++i) 258 ccddevs[i].ccd_dk = -1; 259 260 if( ! ccd_devsw_installed ) { | 185 186/* Called by main() during pseudo-device attachment */ 187static void ccdattach __P((void *)); 188PSEUDO_SET(ccdattach, ccd); 189 190/* called by biodone() at interrupt time */ 191static void ccdiodone __P((struct ccdbuf *cbp)); 192 --- 62 unchanged lines hidden (view full) --- 255 bzero(ccd_softc, num * sizeof(struct ccd_softc)); 256 bzero(ccddevs, num * sizeof(struct ccddevice)); 257 258 /* XXX: is this necessary? */ 259 for (i = 0; i < numccd; ++i) 260 ccddevs[i].ccd_dk = -1; 261 262 if( ! ccd_devsw_installed ) { |
261 bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &ccd_bdevsw); | 263 cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &ccd_cdevsw); |
262 ccd_devsw_installed = 1; 263 } 264 else { 265 printf("huh?\n"); 266 } 267} 268 269static int --- 422 unchanged lines hidden (view full) --- 692 } 693 cs->sc_dkdev.dk_openmask = 694 cs->sc_dkdev.dk_copenmask | cs->sc_dkdev.dk_bopenmask; 695 696 ccdunlock(cs); 697 return (0); 698} 699 | 264 ccd_devsw_installed = 1; 265 } 266 else { 267 printf("huh?\n"); 268 } 269} 270 271static int --- 422 unchanged lines hidden (view full) --- 694 } 695 cs->sc_dkdev.dk_openmask = 696 cs->sc_dkdev.dk_copenmask | cs->sc_dkdev.dk_bopenmask; 697 698 ccdunlock(cs); 699 return (0); 700} 701 |
702static int 703ccdread(dev_t dev, struct uio *uio, int ioflag) 704{ 705 return (physio(ccdstrategy, NULL, dev, 1, minphys, uio)); 706} 707 708static int 709ccdwrite(dev_t dev, struct uio *uio, int ioflag) 710{ 711 return (physio(ccdstrategy, NULL, dev, 0, minphys, uio)); 712} 713 |
|
700static void 701ccdstrategy(bp) 702 register struct buf *bp; 703{ 704 register int unit = ccdunit(bp->b_dev); 705 register struct ccd_softc *cs = &ccd_softc[unit]; 706 register int s; 707 int wlabel; --- 835 unchanged lines hidden --- | 714static void 715ccdstrategy(bp) 716 register struct buf *bp; 717{ 718 register int unit = ccdunit(bp->b_dev); 719 register struct ccd_softc *cs = &ccd_softc[unit]; 720 register int s; 721 int wlabel; --- 835 unchanged lines hidden --- |