Deleted Added
full compact
mcd.c (13738) mcd.c (13743)
1/*
2 * Copyright 1993 by Holger Veit (data part)
3 * Copyright 1993 by Brian Moore (audio part)
4 * Changes Copyright 1993 by Gary Clark II
5 * Changes Copyright (C) 1994-1995 by Andrey A. Chernov, Moscow, Russia
6 *
7 * Rewrote probe routine to work on newer Mitsumi drives.
8 * Additional changes (C) 1994 by Jordan K. Hubbard

--- 26 unchanged lines hidden (view full) ---

35 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
36 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
37 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
38 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 *
1/*
2 * Copyright 1993 by Holger Veit (data part)
3 * Copyright 1993 by Brian Moore (audio part)
4 * Changes Copyright 1993 by Gary Clark II
5 * Changes Copyright (C) 1994-1995 by Andrey A. Chernov, Moscow, Russia
6 *
7 * Rewrote probe routine to work on newer Mitsumi drives.
8 * Additional changes (C) 1994 by Jordan K. Hubbard

--- 26 unchanged lines hidden (view full) ---

35 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
36 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
37 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
38 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 *
43 * $Id: mcd.c,v 1.60 1996/01/30 10:31:06 ache Exp $
43 * $Id: mcd.c,v 1.61 1996/01/30 12:07:06 ache Exp $
44 */
45static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
46
47#include "mcd.h"
48#if NMCD > 0
49#include <sys/types.h>
50#include <sys/param.h>
51#include <sys/systm.h>

--- 1374 unchanged lines hidden (view full) ---

1426}
1427
1428static int
1429mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te)
1430{
1431 struct mcd_data *cd = mcd_data + unit;
1432 struct cd_toc_entry entries[MCD_MAXTOCS];
1433 struct ioc_toc_header th;
44 */
45static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
46
47#include "mcd.h"
48#if NMCD > 0
49#include <sys/types.h>
50#include <sys/param.h>
51#include <sys/systm.h>

--- 1374 unchanged lines hidden (view full) ---

1426}
1427
1428static int
1429mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te)
1430{
1431 struct mcd_data *cd = mcd_data + unit;
1432 struct cd_toc_entry entries[MCD_MAXTOCS];
1433 struct ioc_toc_header th;
1434 int rc, n, trk, len = te->data_len;
1434 int rc, n, trk, len;
1435
1435
1436 if ( len < sizeof(entries[0])
1437 || (len % sizeof(entries[0])) != 0
1436 if ( te->data_len < sizeof(entries[0])
1437 || (te->data_len % sizeof(entries[0])) != 0
1438 || te->address_format != CD_MSF_FORMAT
1439 && te->address_format != CD_LBA_FORMAT
1438 )
1439 return EINVAL;
1440 )
1441 return EINVAL;
1440 if (te->address_format != CD_MSF_FORMAT &&
1441 te->address_format != CD_LBA_FORMAT)
1442 return EINVAL;
1443
1444 /* Copy the toc header */
1445 if ((rc = mcd_toc_header(unit, &th)) != 0)
1446 return rc;
1447
1448 /* verify starting track */
1449 trk = te->starting_track;
1450 if (trk == 0)
1451 trk = th.starting_track;
1452 else if (trk == MCD_LASTPLUS1)
1453 trk = th.ending_track + 1;
1454 else if (trk < th.starting_track || trk > th.ending_track + 1)
1455 return EINVAL;
1456
1442
1443 /* Copy the toc header */
1444 if ((rc = mcd_toc_header(unit, &th)) != 0)
1445 return rc;
1446
1447 /* verify starting track */
1448 trk = te->starting_track;
1449 if (trk == 0)
1450 trk = th.starting_track;
1451 else if (trk == MCD_LASTPLUS1)
1452 trk = th.ending_track + 1;
1453 else if (trk < th.starting_track || trk > th.ending_track + 1)
1454 return EINVAL;
1455
1456 len = ((th.ending_track + 1 - trk) + 1) *
1457 sizeof(entries[0]);
1458 if (te->data_len < len)
1459 len = te->data_len;
1460 if (len > sizeof(entries))
1461 return EINVAL;
1462
1457 /* Make sure we have a valid toc */
1458 if ((rc=mcd_read_toc(unit)) != 0)
1459 return rc;
1460
1461 /* Copy the TOC data. */
1462 for (n = 0; len > 0 && trk <= th.ending_track + 1; trk++) {
1463 if (cd->toc[trk].idx_no == 0)
1464 continue;

--- 267 unchanged lines hidden ---
1463 /* Make sure we have a valid toc */
1464 if ((rc=mcd_read_toc(unit)) != 0)
1465 return rc;
1466
1467 /* Copy the TOC data. */
1468 for (n = 0; len > 0 && trk <= th.ending_track + 1; trk++) {
1469 if (cd->toc[trk].idx_no == 0)
1470 continue;

--- 267 unchanged lines hidden ---