scd.c (14873) | scd.c (15574) |
---|---|
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.17 1996/01/15 10:28:32 phk Exp $ */ | 44/* $Id: scd.c,v 1.18 1996/03/28 14:28:50 scrappy 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 <sys/types.h> --- 84 unchanged lines hidden (view full) --- 137 unsigned char ctl :4; /* xcdplayer needs this */ 138 unsigned char start_msf[3]; 139 } toc[MAX_TRACKS]; 140 short first_track; 141 short last_track; 142 struct ioc_play_msf last_play; 143 144 short audio_status; | 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 <sys/types.h> --- 84 unchanged lines hidden (view full) --- 137 unsigned char ctl :4; /* xcdplayer needs this */ 138 unsigned char start_msf[3]; 139 } toc[MAX_TRACKS]; 140 short first_track; 141 short last_track; 142 struct ioc_play_msf last_play; 143 144 short audio_status; |
145 struct buf head; /* head of buf queue */ | 145 struct buf_queue_head head; /* head of buf queue */ |
146 struct scd_mbx mbx; 147#ifdef DEVFS 148 void *ra_devfs_token; 149 void *rc_devfs_token; 150 void *a_devfs_token; 151 void *c_devfs_token; 152#endif 153} scd_data[NSCD]; --- 192 unchanged lines hidden (view full) --- 346 347 return 0; 348} 349 350static void 351scdstrategy(struct buf *bp) 352{ 353 struct scd_data *cd; | 146 struct scd_mbx mbx; 147#ifdef DEVFS 148 void *ra_devfs_token; 149 void *rc_devfs_token; 150 void *a_devfs_token; 151 void *c_devfs_token; 152#endif 153} scd_data[NSCD]; --- 192 unchanged lines hidden (view full) --- 346 347 return 0; 348} 349 350static void 351scdstrategy(struct buf *bp) 352{ 353 struct scd_data *cd; |
354 struct buf *qp; | |
355 int s; 356 int unit = scd_unit(bp->b_dev); 357 358 cd = scd_data + unit; 359 360 XDEBUG(2, ("scd%d: DEBUG: strategy: block=%ld, bcount=%ld\n", unit, bp->b_blkno, bp->b_bcount)); 361 362 if (unit >= NSCD || bp->b_blkno < 0 || (bp->b_bcount % SCDBLKSIZE)) { --- 28 unchanged lines hidden (view full) --- 391 /* adjust transfer if necessary */ 392 if (bounds_check_with_label(bp,&cd->dlabel,1) <= 0) 393 goto done; 394 395 bp->b_pblkno = bp->b_blkno; 396 bp->b_resid = 0; 397 398 /* queue it */ | 354 int s; 355 int unit = scd_unit(bp->b_dev); 356 357 cd = scd_data + unit; 358 359 XDEBUG(2, ("scd%d: DEBUG: strategy: block=%ld, bcount=%ld\n", unit, bp->b_blkno, bp->b_bcount)); 360 361 if (unit >= NSCD || bp->b_blkno < 0 || (bp->b_bcount % SCDBLKSIZE)) { --- 28 unchanged lines hidden (view full) --- 390 /* adjust transfer if necessary */ 391 if (bounds_check_with_label(bp,&cd->dlabel,1) <= 0) 392 goto done; 393 394 bp->b_pblkno = bp->b_blkno; 395 bp->b_resid = 0; 396 397 /* queue it */ |
399 qp = &cd->head; | |
400 s = splbio(); | 398 s = splbio(); |
401 disksort(qp,bp); | 399 tqdisksort(&cd->head, bp); |
402 splx(s); 403 404 /* now check whether we can perform processing */ 405 scd_start(unit); 406 return; 407 408bad: 409 bp->b_flags |= B_ERROR; 410done: 411 bp->b_resid = bp->b_bcount; 412 biodone(bp); 413 return; 414} 415 416static void 417scd_start(int unit) 418{ 419 struct scd_data *cd = scd_data + unit; | 400 splx(s); 401 402 /* now check whether we can perform processing */ 403 scd_start(unit); 404 return; 405 406bad: 407 bp->b_flags |= B_ERROR; 408done: 409 bp->b_resid = bp->b_bcount; 410 biodone(bp); 411 return; 412} 413 414static void 415scd_start(int unit) 416{ 417 struct scd_data *cd = scd_data + unit; |
420 struct buf *bp, *qp = &cd->head; | 418 struct buf *bp; |
421 struct partition *p; 422 register s = splbio(); 423 424 if (cd->flags & SCDMBXBSY) { 425 splx(s); 426 return; 427 } 428 | 419 struct partition *p; 420 register s = splbio(); 421 422 if (cd->flags & SCDMBXBSY) { 423 splx(s); 424 return; 425 } 426 |
429 if ((bp = qp->b_actf) != 0) { | 427 bp = TAILQ_FIRST(&cd->head); 428 if (bp != 0) { |
430 /* block found to process, dequeue */ | 429 /* block found to process, dequeue */ |
431 qp->b_actf = bp->b_actf; | 430 TAILQ_REMOVE(&cd->head, bp, b_act); |
432 cd->flags |= SCDMBXBSY; 433 splx(s); 434 } else { 435 /* nothing to do */ 436 splx(s); 437 return; 438 } 439 --- 1127 unchanged lines hidden --- | 431 cd->flags |= SCDMBXBSY; 432 splx(s); 433 } else { 434 /* nothing to do */ 435 splx(s); 436 return; 437 } 438 --- 1127 unchanged lines hidden --- |