scd.c (36767) | scd.c (37389) |
---|---|
1/*- 2 * Copyright (c) 1995 Mikael Hybsch 3 * All rights reserved. 4 * 5 * Portions of this file are copied from mcd.c 6 * which has the following copyrights: 7 * 8 * Copyright 1993 by Holger Veit (data part) --- 27 unchanged lines hidden (view full) --- 36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 39 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 * 41 */ 42 43 | 1/*- 2 * Copyright (c) 1995 Mikael Hybsch 3 * All rights reserved. 4 * 5 * Portions of this file are copied from mcd.c 6 * which has the following copyrights: 7 * 8 * Copyright 1993 by Holger Veit (data part) --- 27 unchanged lines hidden (view full) --- 36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 39 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 * 41 */ 42 43 |
44/* $Id: scd.c,v 1.37 1998/06/07 17:10:56 dfr Exp $ */ | 44/* $Id: scd.c,v 1.38 1998/06/08 09:47:36 bde Exp $ */ |
45 46/* Please send any comments to micke@dynas.se */ 47 48#define SCD_DEBUG 0 49 50#include "scd.h" 51#if NSCD > 0 52#include "opt_devfs.h" --- 128 unchanged lines hidden (view full) --- 181static int scd_probe(struct isa_device *dev); 182static int scd_attach(struct isa_device *dev); 183struct isa_driver scddriver = { scd_probe, scd_attach, "scd" }; 184 185/* For canceling our timeout */ 186static struct callout_handle tohandle = CALLOUT_HANDLE_INITIALIZER(&tohanle); 187 188static d_open_t scdopen; | 45 46/* Please send any comments to micke@dynas.se */ 47 48#define SCD_DEBUG 0 49 50#include "scd.h" 51#if NSCD > 0 52#include "opt_devfs.h" --- 128 unchanged lines hidden (view full) --- 181static int scd_probe(struct isa_device *dev); 182static int scd_attach(struct isa_device *dev); 183struct isa_driver scddriver = { scd_probe, scd_attach, "scd" }; 184 185/* For canceling our timeout */ 186static struct callout_handle tohandle = CALLOUT_HANDLE_INITIALIZER(&tohanle); 187 188static d_open_t scdopen; |
189static d_read_t scdread; |
|
189static d_close_t scdclose; 190static d_ioctl_t scdioctl; 191static d_strategy_t scdstrategy; 192 193#define CDEV_MAJOR 45 194#define BDEV_MAJOR 16 | 190static d_close_t scdclose; 191static d_ioctl_t scdioctl; 192static d_strategy_t scdstrategy; 193 194#define CDEV_MAJOR 45 195#define BDEV_MAJOR 16 |
195static struct cdevsw scd_cdevsw; 196static struct bdevsw scd_bdevsw = 197 { scdopen, scdclose, scdstrategy, scdioctl, /*16*/ 198 nodump, nopsize, D_DISK, "scd", &scd_cdevsw, -1 }; | 196static struct cdevsw scd_cdevsw = { 197 scdopen, scdclose, scdread, nowrite, 198 scdioctl, nostop, nullreset, nodevtotty, 199 seltrue, nommap, scdstrategy, "scd", 200 NULL, -1, nodump, nopsize, 201 D_DISK, 0, -1 }; |
199 | 202 |
203 |
|
200int scd_attach(struct isa_device *dev) 201{ 202 int unit = dev->id_unit; 203 struct scd_data *cd = scd_data + unit; 204 205 cd->iobase = dev->id_iobase; /* Already set by probe, but ... */ 206 207 /* name filled in probe */ --- 10 unchanged lines hidden (view full) --- 218 devfs_add_devswf(&scd_cdevsw, dkmakeminor(unit, 0, 0), 219 DV_CHR, UID_ROOT, GID_OPERATOR, 0640, 220 "rscd%da", unit); 221 cd->rc_devfs_token = 222 devfs_add_devswf(&scd_cdevsw, dkmakeminor(unit, 0, RAW_PART), 223 DV_CHR, UID_ROOT, GID_OPERATOR, 0640, 224 "rscd%dc", unit); 225 cd->a_devfs_token = | 204int scd_attach(struct isa_device *dev) 205{ 206 int unit = dev->id_unit; 207 struct scd_data *cd = scd_data + unit; 208 209 cd->iobase = dev->id_iobase; /* Already set by probe, but ... */ 210 211 /* name filled in probe */ --- 10 unchanged lines hidden (view full) --- 222 devfs_add_devswf(&scd_cdevsw, dkmakeminor(unit, 0, 0), 223 DV_CHR, UID_ROOT, GID_OPERATOR, 0640, 224 "rscd%da", unit); 225 cd->rc_devfs_token = 226 devfs_add_devswf(&scd_cdevsw, dkmakeminor(unit, 0, RAW_PART), 227 DV_CHR, UID_ROOT, GID_OPERATOR, 0640, 228 "rscd%dc", unit); 229 cd->a_devfs_token = |
226 devfs_add_devswf(&scd_bdevsw, dkmakeminor(unit, 0, 0), | 230 devfs_add_devswf(&scd_cdevsw, dkmakeminor(unit, 0, 0), |
227 DV_BLK, UID_ROOT, GID_OPERATOR, 0640, 228 "scd%da", unit); 229 cd->c_devfs_token = | 231 DV_BLK, UID_ROOT, GID_OPERATOR, 0640, 232 "scd%da", unit); 233 cd->c_devfs_token = |
230 devfs_add_devswf(&scd_bdevsw, dkmakeminor(unit, 0, RAW_PART), | 234 devfs_add_devswf(&scd_cdevsw, dkmakeminor(unit, 0, RAW_PART), |
231 DV_BLK, UID_ROOT, GID_OPERATOR, 0640, 232 "scd%dc", unit); 233#endif 234 return 1; 235} 236 237static int 238scdopen(dev_t dev, int flags, int fmt, struct proc *p) --- 71 unchanged lines hidden (view full) --- 310 311 312 /* close channel */ 313 cd->openflag = 0; 314 315 return 0; 316} 317 | 235 DV_BLK, UID_ROOT, GID_OPERATOR, 0640, 236 "scd%dc", unit); 237#endif 238 return 1; 239} 240 241static int 242scdopen(dev_t dev, int flags, int fmt, struct proc *p) --- 71 unchanged lines hidden (view full) --- 314 315 316 /* close channel */ 317 cd->openflag = 0; 318 319 return 0; 320} 321 |
322static int 323scdread(dev_t dev, struct uio *uio, int ioflag) 324{ 325 return (physio(scdstrategy, NULL, dev, 1, minphys, uio)); 326} 327 |
|
318static void 319scdstrategy(struct buf *bp) 320{ 321 struct scd_data *cd; 322 int s; 323 int unit = scd_unit(bp->b_dev); 324 325 cd = scd_data + unit; --- 1232 unchanged lines hidden (view full) --- 1558 1559 1560static scd_devsw_installed = 0; 1561 1562static void scd_drvinit(void *unused) 1563{ 1564 1565 if( ! scd_devsw_installed ) { | 328static void 329scdstrategy(struct buf *bp) 330{ 331 struct scd_data *cd; 332 int s; 333 int unit = scd_unit(bp->b_dev); 334 335 cd = scd_data + unit; --- 1232 unchanged lines hidden (view full) --- 1568 1569 1570static scd_devsw_installed = 0; 1571 1572static void scd_drvinit(void *unused) 1573{ 1574 1575 if( ! scd_devsw_installed ) { |
1566 bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &scd_bdevsw); | 1576 cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &scd_cdevsw); |
1567 scd_devsw_installed = 1; 1568 } 1569} 1570 1571SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL) 1572 1573 1574#endif /* NSCD > 0 */ | 1577 scd_devsw_installed = 1; 1578 } 1579} 1580 1581SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL) 1582 1583 1584#endif /* NSCD > 0 */ |