pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/misc/libcdio NetBSD support has been integrated upstre...
details: https://anonhg.NetBSD.org/pkgsrc/rev/b6dfa9c2a04c
branches: trunk
changeset: 552458:b6dfa9c2a04c
user: wiz <wiz%pkgsrc.org@localhost>
date: Sun Jan 04 12:42:20 2009 +0000
description:
NetBSD support has been integrated upstream in 0.81, remove local
override. Noted by rocky.
Bump PKGREVISION to be on the safe side.
diffstat:
misc/libcdio/Makefile | 11 +-
misc/libcdio/files/_cdio_netbsd.c | 583 --------------------------------------
2 files changed, 2 insertions(+), 592 deletions(-)
diffs (truncated from 614 to 300 lines):
diff -r 8a6c1017541a -r b6dfa9c2a04c misc/libcdio/Makefile
--- a/misc/libcdio/Makefile Sun Jan 04 11:30:16 2009 +0000
+++ b/misc/libcdio/Makefile Sun Jan 04 12:42:20 2009 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.37 2008/11/10 22:30:43 wiz Exp $
+# $NetBSD: Makefile,v 1.38 2009/01/04 12:42:20 wiz Exp $
DISTNAME= libcdio-0.81
+PKGREVISION= 1
CATEGORIES= misc
MASTER_SITES= ${MASTER_SITE_GNU:=libcdio/}
@@ -27,14 +28,6 @@
CONFIGURE_ARGS+= --enable-cpp-progs
INFO_FILES= # PLIST
-.include "../../mk/bsd.prefs.mk"
-
-.if ${OPSYS} == "NetBSD"
-# XXX we just replace the freebsd module so save patches
-pre-patch:
- ${CP} ${FILESDIR}/_cdio_netbsd.c ${WRKSRC}/lib/driver/FreeBSD/freebsd.c
-.endif
-
.include "../../devel/ncurses/buildlink3.mk"
.include "../../devel/popt/buildlink3.mk"
.include "../../audio/libcddb/buildlink3.mk"
diff -r 8a6c1017541a -r b6dfa9c2a04c misc/libcdio/files/_cdio_netbsd.c
--- a/misc/libcdio/files/_cdio_netbsd.c Sun Jan 04 11:30:16 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,583 +0,0 @@
-/* $NetBSD: _cdio_netbsd.c,v 1.5 2008/04/15 16:13:12 tron Exp $ */
-
-/*
- * Copyright (c) 2003
- * Matthias Drochner. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * XXX This is for NetBSD but uses "freebsd" function names to plug
- * nicely into the existing libcdio.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <cdio/sector.h>
-#include <cdio/util.h>
-#include "cdio_assert.h"
-#include "cdio_private.h"
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/cdio.h>
-#include <sys/scsiio.h>
-
-#ifdef __i386__
-#define DEFAULT_CDIO_DEVICE "/dev/rcd0d"
-#else
-#define DEFAULT_CDIO_DEVICE "/dev/rcd0c"
-#endif
-
-#define TOTAL_TRACKS (_obj->tochdr.ending_track \
- - _obj->tochdr.starting_track + 1)
-#define FIRST_TRACK_NUM (_obj->tochdr.starting_track)
-
-typedef struct {
- generic_img_private_t gen;
-
- bool toc_valid;
- struct ioc_toc_header tochdr;
- struct cd_toc_entry tocent[100];
-
- bool sessionformat_valid;
- int sessionformat[100]; /* format of the session the track is in */
-} _img_private_t;
-
-static driver_return_code_t
-run_scsi_cmd_freebsd(void *p_user_data, unsigned int i_timeout_ms,
- unsigned int i_cdb, const mmc_cdb_t *p_cdb,
- cdio_mmc_direction_t e_direction,
- unsigned int i_buf, void *p_buf )
-{
- const _img_private_t *_obj = p_user_data;
- scsireq_t req;
-
- memset(&req, 0, sizeof(req));
- memcpy(&req.cmd[0], p_cdb, i_cdb);
- req.cmdlen = i_cdb;
- req.datalen = i_buf;
- req.databuf = p_buf;
- req.timeout = i_timeout_ms;
- req.flags = e_direction == SCSI_MMC_DATA_READ ? SCCMD_READ : SCCMD_WRITE;
-
- if (ioctl(_obj->gen.fd, SCIOCCOMMAND, &req) < 0) {
- perror("SCIOCCOMMAND");
- return -1;
- }
- if (req.retsts != SCCMD_OK) {
- fprintf(stderr, "SCIOCCOMMAND cmd 0x%02x sts %d\n", req.cmd[0], req.retsts);
- return -1;
- }
-
- return 0;
-}
-
-static int
-_cdio_read_audio_sectors(void *user_data, void *data, lsn_t lsn,
- unsigned int nblocks)
-{
- scsireq_t req;
- _img_private_t *_obj = user_data;
-
- memset(&req, 0, sizeof(req));
- req.cmd[0] = 0xbe;
- req.cmd[1] = 0;
- req.cmd[2] = (lsn >> 24) & 0xff;
- req.cmd[3] = (lsn >> 16) & 0xff;
- req.cmd[4] = (lsn >> 8) & 0xff;
- req.cmd[5] = (lsn >> 0) & 0xff;
- req.cmd[6] = (nblocks >> 16) & 0xff;
- req.cmd[7] = (nblocks >> 8) & 0xff;
- req.cmd[8] = (nblocks >> 0) & 0xff;
- req.cmd[9] = 0x78;
- req.cmdlen = 10;
-
- req.datalen = nblocks * CDIO_CD_FRAMESIZE_RAW;
- req.databuf = data;
- req.timeout = 10000;
- req.flags = SCCMD_READ;
-
- if (ioctl(_obj->gen.fd, SCIOCCOMMAND, &req) < 0) {
- perror("SCIOCCOMMAND");
- return 1;
- }
- if (req.retsts != SCCMD_OK) {
- fprintf(stderr, "SCIOCCOMMAND cmd 0xbe sts %d\n", req.retsts);
- return 1;
- }
-
- return 0;
-}
-
-static int
-_cdio_read_mode2_sector(void *user_data, void *data, lsn_t lsn,
- bool mode2_form2)
-{
- scsireq_t req;
- _img_private_t *_obj = user_data;
- char buf[M2RAW_SECTOR_SIZE] = { 0, };
-
- memset(&req, 0, sizeof(req));
- req.cmd[0] = 0xbe;
- req.cmd[1] = 0;
- req.cmd[2] = (lsn >> 24) & 0xff;
- req.cmd[3] = (lsn >> 16) & 0xff;
- req.cmd[4] = (lsn >> 8) & 0xff;
- req.cmd[5] = (lsn >> 0) & 0xff;
- req.cmd[6] = 0;
- req.cmd[7] = 0;
- req.cmd[8] = 1;
- req.cmd[9] = 0x58; /* subheader + userdata + ECC */
- req.cmdlen = 10;
-
- req.datalen = M2RAW_SECTOR_SIZE;
- req.databuf = buf;
- req.timeout = 10000;
- req.flags = SCCMD_READ;
-
- if (ioctl(_obj->gen.fd, SCIOCCOMMAND, &req) < 0) {
- perror("SCIOCCOMMAND");
- return 1;
- }
- if (req.retsts != SCCMD_OK) {
- fprintf(stderr, "SCIOCCOMMAND cmd %0xbe sts %d\n", req.retsts);
- return 1;
- }
-
- if (mode2_form2)
- memcpy(data, buf, M2RAW_SECTOR_SIZE);
- else
- memcpy(data, buf + CDIO_CD_SUBHEADER_SIZE, CDIO_CD_FRAMESIZE);
-
- return 0;
-}
-
-static int
-_cdio_read_mode2_sectors(void *user_data, void *data, lsn_t lsn,
- bool mode2_form2, unsigned int nblocks)
-{
- int i, res;
- char *buf = data;
-
- for (i = 0; i < nblocks; i++) {
- res = _cdio_read_mode2_sector(user_data, buf, lsn, mode2_form2);
- if (res)
- return res;
-
- buf += (mode2_form2 ? M2RAW_SECTOR_SIZE : CDIO_CD_FRAMESIZE);
- lsn++;
- }
-
- return 0;
-}
-
-static uint32_t
-_cdio_stat_size(void *user_data)
-{
- _img_private_t *_obj = user_data;
- struct ioc_read_toc_entry req;
- struct cd_toc_entry tocent;
-
- req.address_format = CD_LBA_FORMAT;
- req.starting_track = 0xaa;
- req.data_len = sizeof(tocent);
- req.data = &tocent;
-
- if (ioctl(_obj->gen.fd, CDIOREADTOCENTRIES, &req) < 0) {
- perror("ioctl(CDIOREADTOCENTRY) leadout");
- exit(EXIT_FAILURE);
- }
-
- return (tocent.addr.lba);
-}
-
-static int
-_cdio_set_arg(void *user_data, const char key[], const char value[])
-{
- _img_private_t *_obj = user_data;
-
- if (!strcmp(key, "source")) {
- if (!value)
- return -2;
-
- free(_obj->gen.source_name);
- _obj->gen.source_name = strdup(value);
- } else if (!strcmp(key, "access-mode")) {
- if (strcmp(value, "READ_CD"))
- cdio_error("unknown access type: %s ignored.", value);
- } else
- return -1;
-
- return 0;
-}
-
-static bool
-_cdio_read_toc(_img_private_t *_obj)
-{
- int res;
- struct ioc_read_toc_entry req;
-
- res = ioctl(_obj->gen.fd, CDIOREADTOCHEADER, &_obj->tochdr);
- if (res < 0) {
- cdio_error("error in ioctl(CDIOREADTOCHEADER): %s\n",
- strerror(errno));
- return false;
- }
-
- req.address_format = CD_MSF_FORMAT;
- req.starting_track = FIRST_TRACK_NUM;
- req.data_len = (TOTAL_TRACKS + 1) /* leadout! */
- * sizeof(struct cd_toc_entry);
- req.data = _obj->tocent;
-
- res = ioctl(_obj->gen.fd, CDIOREADTOCENTRIES, &req);
- if (res < 0) {
- cdio_error("error in ioctl(CDROMREADTOCENTRIES): %s\n",
- strerror(errno));
- return false;
- }
-
- _obj->toc_valid = 1;
Home |
Main Index |
Thread Index |
Old Index