diff --git a/audio/cdparanoia/Makefile b/audio/cdparanoia/Makefile index a4ffafa2b436..f839e511f9a6 100644 --- a/audio/cdparanoia/Makefile +++ b/audio/cdparanoia/Makefile @@ -1,28 +1,19 @@ PORTNAME= cdparanoia -PORTVERSION= 3.9.8 -PORTREVISION= 10 +PORTVERSION= 3.10.2 CATEGORIES= audio sysutils -MASTER_SITES= http://www.xiph.org/paranoia/download/ -DISTNAME= ${PORTNAME}-${PORTVERSION:C/^3\./III-alpha/} +MASTER_SITES= http://downloads.xiph.org/releases/cdparanoia/ +DISTNAME= ${PORTNAME}-${PORTVERSION:S/^3./III-/} EXTRACT_SUFX= .src.tgz MAINTAINER= danfe@FreeBSD.org COMMENT= CDDA extraction tool (also known as ripper) WWW= https://www.xiph.org/paranoia/ LICENSE= GPLv2 -LICENSE_FILE= ${WRKSRC}/GPL +LICENSE_FILE= ${WRKSRC}/COPYING-GPL USES= gmake GNU_CONFIGURE= yes -GNU_CONFIGURE_MANPREFIX= ${PREFIX}/share USE_LDCONFIG= yes -post-patch: - @${REINPLACE_CMD} -e 's/\(^ *default:\)/\1break;/' \ - ${WRKSRC}/interface/utils.h - -post-install: - @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libcdda_*.so - .include diff --git a/audio/cdparanoia/distinfo b/audio/cdparanoia/distinfo index 9ceea7f991e6..b7ca0666f4cd 100644 --- a/audio/cdparanoia/distinfo +++ b/audio/cdparanoia/distinfo @@ -1,2 +1,3 @@ -SHA256 (cdparanoia-III-alpha9.8.src.tgz) = 1b79fae1aedc692f87d1344410f5c6b666961afccdc78bc5c4c257c450dfa008 -SIZE (cdparanoia-III-alpha9.8.src.tgz) = 116591 +TIMESTAMP = 1221168964 +SHA256 (cdparanoia-III-10.2.src.tgz) = 005db45ef4ee017f5c32ec124f913a0546e77014266c6a1c50df902a55fe64df +SIZE (cdparanoia-III-10.2.src.tgz) = 183236 diff --git a/audio/cdparanoia/files/patch-Makefile.in b/audio/cdparanoia/files/patch-Makefile.in index 4137b02ec1aa..a56f00918e26 100644 --- a/audio/cdparanoia/files/patch-Makefile.in +++ b/audio/cdparanoia/files/patch-Makefile.in @@ -1,66 +1,66 @@ ---- Makefile.in.orig 2001-03-27 22:46:58 UTC +--- Makefile.in.orig 2019-07-25 21:55:03 UTC +++ Makefile.in @@ -8,7 +8,7 @@ VPATH=@srcdir@ srcdir=@srcdir@ @SET_MAKE@ -FLAGS=@TYPESIZES@ @CFLAGS@ +FLAGS=@TYPESIZES@ @CPPFLAGS@ @CFLAGS@ -I./interface OPT=@OPT@ $(FLAGS) - DEBUG=@DEBUG@ $(FLAGS) + DEBUG=@DEBUG@ CC=@CC@ @@ -32,7 +32,7 @@ export VERSION ifeq ($(STATIC),TRUE) LIBS = interface/libcdda_interface.a paranoia/libcdda_paranoia.a \ -- -static -lm -+ -lm -lcam +- -static -lm -lrt ++ -lm -lrt -lcam LIBDEP = interface/libcdda_interface.a paranoia/libcdda_paranoia.a else - LIBS = -lcdda_interface -lcdda_paranoia -lm -@@ -64,28 +64,27 @@ slib: + LIBS = -lcdda_interface -lcdda_paranoia -lm -lrt +@@ -63,28 +63,27 @@ slib: cd paranoia && $(MAKE) slib install: - $(INSTALL) -d -m 0755 $(BINDIR) -- $(INSTALL) -m 0755 $(srcdir)/cdparanoia $(BINDIR) +- $(INSTALL) -m 755 $(srcdir)/cdparanoia $(BINDIR) - $(INSTALL) -d -m 0755 $(MANDIR) - $(INSTALL) -d -m 0755 $(MANDIR)/man1 - $(INSTALL) -m 0644 $(srcdir)/cdparanoia.1 $(MANDIR)/man1 - $(INSTALL) -d -m 0755 $(INCLUDEDIR) - $(INSTALL) -m 0644 $(srcdir)/paranoia/cdda_paranoia.h $(INCLUDEDIR) - $(INSTALL) -d -m 0755 $(LIBDIR) - $(INSTALL) -m 0644 $(srcdir)/paranoia/libcdda_paranoia.so.0.$(VERSION) $(LIBDIR) - $(INSTALL) -m 0644 $(srcdir)/paranoia/libcdda_paranoia.a $(LIBDIR) - $(INSTALL) -m 0644 $(srcdir)/interface/cdda_interface.h $(INCLUDEDIR) - $(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.so.0.$(VERSION) $(LIBDIR) - $(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.a $(LIBDIR) - $(INSTALL) -m 0644 $(srcdir)/utils.h $(INCLUDEDIR) + $(INSTALL) -d -m 0755 $(DESTDIR)$(BINDIR) -+ $(INSTALL) -m 0755 $(srcdir)/cdparanoia $(DESTDIR)$(BINDIR) ++ $(BSD_INSTALL_PROGRAM) $(srcdir)/cdparanoia $(DESTDIR)$(BINDIR) + $(INSTALL) -d -m 0755 $(DESTDIR)$(MANDIR) + $(INSTALL) -d -m 0755 $(DESTDIR)$(MANDIR)/man1 + $(INSTALL) -m 0644 $(srcdir)/cdparanoia.1 $(DESTDIR)$(MANDIR)/man1 + $(INSTALL) -d -m 0755 $(DESTDIR)$(INCLUDEDIR) + $(INSTALL) -m 0644 $(srcdir)/paranoia/cdda_paranoia.h $(DESTDIR)$(INCLUDEDIR) + $(INSTALL) -d -m 0755 $(DESTDIR)$(LIBDIR) -+ $(INSTALL) -m 0644 $(srcdir)/paranoia/libcdda_paranoia.so.0.$(VERSION) $(DESTDIR)$(LIBDIR) ++ $(BSD_INSTALL_LIB) $(srcdir)/paranoia/libcdda_paranoia.so.0.$(VERSION) $(DESTDIR)$(LIBDIR) + $(INSTALL) -m 0644 $(srcdir)/paranoia/libcdda_paranoia.a $(DESTDIR)$(LIBDIR) + $(INSTALL) -m 0644 $(srcdir)/interface/cdda_interface.h $(DESTDIR)$(INCLUDEDIR) -+ $(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.so.0.$(VERSION) $(DESTDIR)$(LIBDIR) ++ $(BSD_INSTALL_LIB) $(srcdir)/interface/libcdda_interface.so.0.$(VERSION) $(DESTDIR)$(LIBDIR) + $(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.a $(DESTDIR)$(LIBDIR) ln -fs libcdda_interface.so.0.$(VERSION) \ - $(LIBDIR)/libcdda_interface.so.0 + $(DESTDIR)$(LIBDIR)/libcdda_interface.so.0 ln -fs libcdda_interface.so.0.$(VERSION) \ - $(LIBDIR)/libcdda_interface.so + $(DESTDIR)$(LIBDIR)/libcdda_interface.so ln -fs libcdda_paranoia.so.0.$(VERSION) \ - $(LIBDIR)/libcdda_paranoia.so.0 + $(DESTDIR)$(LIBDIR)/libcdda_paranoia.so.0 ln -fs libcdda_paranoia.so.0.$(VERSION) \ - $(LIBDIR)/libcdda_paranoia.so + $(DESTDIR)$(LIBDIR)/libcdda_paranoia.so cdparanoia: $(OFILES) $(LIBDEP) $(LD) $(CFLAGS) $(LDFLAGS) $(OFILES) \ diff --git a/audio/cdparanoia/files/patch-configure b/audio/cdparanoia/files/patch-configure deleted file mode 100644 index 8bbd2f313ccf..000000000000 --- a/audio/cdparanoia/files/patch-configure +++ /dev/null @@ -1,15 +0,0 @@ -Index: configure -=================================================================== -RCS file: /home/cvs/cdparanoia/configure,v -retrieving revision 1.1.1.1 -retrieving revision 1.2 ---- configure.orig 2000-04-15 15:13:01 UTC -+++ configure -@@ -1084,7 +1084,6 @@ EOF - fi - - --CFLAGS="" - - TYPESIZES="" - diff --git a/audio/cdparanoia/files/patch-interface_Makefile.in b/audio/cdparanoia/files/patch-interface_Makefile.in index fc54350e5acd..8111c1d30a03 100644 --- a/audio/cdparanoia/files/patch-interface_Makefile.in +++ b/audio/cdparanoia/files/patch-interface_Makefile.in @@ -1,56 +1,46 @@ Index: interface/Makefile.in =================================================================== RCS file: /home/cvs/cdparanoia/interface/Makefile.in,v retrieving revision 1.1.1.1 retrieving revision 1.3 ---- interface/Makefile.in.orig 1999-12-14 04:27:59 UTC +--- interface/Makefile.in.orig 2008-08-21 16:08:54 UTC +++ interface/Makefile.in @@ -9,13 +9,13 @@ srcdir=@srcdir@ @SET_MAKE@ FLAGS=@SBPCD_H@ @UCDROM_H@ @TYPESIZES@ @CFLAGS@ OPT=@OPT@ $(FLAGS) --DEBUG=@DEBUG@ $(FLAGS) -DCDDA_TEST +-DEBUG=@DEBUG@ -DCDDA_TEST +DEBUG=@DEBUG@ $(FLAGS) CC=@CC@ LD=@CC@ LDFLAGS=@LDFLAGS@ $(FLAGS) AR=@AR@ RANLIB=@RANLIB@ --LIBS = -lm -+LIBS = -lm -lcam +-LIBS = -lm -lrt ++LIBS = -lm -lrt -lcam CPPFLAGS+=-D_REENTRANT OFILES = scan_devices.o common_interface.o cooked_interface.o interface.o\ -@@ -23,19 +23,15 @@ OFILES = scan_devices.o common_interface +@@ -23,18 +23,14 @@ OFILES = scan_devices.o common_interface.o cooked_inte export VERSION -all: lib slib - -debug: - $(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)" - -lib: +all: $(MAKE) libcdda_interface.a CFLAGS="$(OPT)" - -slib: $(MAKE) lessmessy $(MAKE) libcdda_interface.so CFLAGS="$(OPT) -fpic" [ -e libcdda_interface.so.0 ] || ln -s libcdda_interface.so libcdda_interface.so.0 - ++ +debug: + $(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)" -+ + test: $(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)" - $(CC) $(DEBUG) -c test.c -@@ -46,7 +42,7 @@ libcdda_interface.a: $(OFILES) - $(RANLIB) libcdda_interface.a - - libcdda_interface.so: $(OFILES) -- $(CC) -fpic -shared -o libcdda_interface.so.0.$(VERSION) -Wl,-soname -Wl,libcdda_interface.so.0 $(OFILES) -+ $(CC) -fpic -shared -o libcdda_interface.so.0.$(VERSION) -Wl,-soname -Wl,libcdda_interface.so.0 $(OFILES) ${LIBS} - [ -e libcdda_interface.so.0 ] || ln -s libcdda_interface.so.0.$(VERSION) libcdda_interface.so.0 - [ -e libcdda_interface.so ] || ln -s libcdda_interface.so.0.$(VERSION) libcdda_interface.so - diff --git a/audio/cdparanoia/files/patch-interface_cdda__interface.h b/audio/cdparanoia/files/patch-interface_cdda__interface.h index 5a1e76b22cfa..d6a4a6ea3576 100644 --- a/audio/cdparanoia/files/patch-interface_cdda__interface.h +++ b/audio/cdparanoia/files/patch-interface_cdda__interface.h @@ -1,50 +1,38 @@ ---- interface/cdda_interface.h.orig 2001-03-24 01:15:46 UTC +--- interface/cdda_interface.h.orig 2008-09-11 10:43:52 UTC +++ interface/cdda_interface.h -@@ -21,6 +21,11 @@ +@@ -21,6 +21,13 @@ #include #include +#ifdef __FreeBSD__ +#include +#include ++ ++#define ENOMEDIUM 12345 +#endif + #define MAXTRK 100 typedef struct TOC { /* structure of table of contents */ -@@ -47,13 +52,19 @@ typedef struct cdrom_drive{ +@@ -49,13 +56,19 @@ typedef struct cdrom_drive{ int opened; /* This struct may just represent a candidate for opening */ char *cdda_device_name; +#ifdef Linux char *ioctl_device_name; int cdda_fd; - int ioctl_fd; - char *drive_model; int drive_type; +#elif defined(__FreeBSD__) + struct cam_device *dev; + union ccb *ccb; +#endif + + int ioctl_fd; + char *drive_model; int interface; int bigendianp; int nsectors; -@@ -83,9 +94,13 @@ typedef struct cdrom_drive{ - int is_mmc; - - /* SCSI command buffer and offset pointers */ -+#ifdef Linux - unsigned char *sg; - unsigned char *sg_buffer; - unsigned char inqbytes[4]; -+#elif defined(__FreeBSD__) -+ unsigned char *sg_buffer; -+#endif - - /* Scsi parameters and state */ - unsigned char density; diff --git a/audio/cdparanoia/files/patch-interface_common__interface.c b/audio/cdparanoia/files/patch-interface_common__interface.c index f631f86bae78..a086db6c417e 100644 --- a/audio/cdparanoia/files/patch-interface_common__interface.c +++ b/audio/cdparanoia/files/patch-interface_common__interface.c @@ -1,70 +1,85 @@ Index: interface/common_interface.c =================================================================== RCS file: /home/cvs/cdparanoia/interface/common_interface.c,v retrieving revision 1.1.1.1 retrieving revision 1.5 ---- interface/common_interface.c.orig 2000-04-19 22:41:04 UTC +--- interface/common_interface.c.orig 2008-08-21 16:08:54 UTC +++ interface/common_interface.c -@@ -13,12 +13,19 @@ +@@ -13,15 +13,25 @@ #include "utils.h" #include "smallft.h" +#ifdef Linux #include ++#elif defined(__FreeBSD__) ++#include +#endif /* Test for presence of a cdrom by pinging with the 'CDROMVOLREAD' ioctl() */ + /* Also test using CDROM_GET_CAPABILITY (if available) as some newer DVDROMs will + reject CDROMVOLREAD ioctl for god-knows-what reason */ int ioctl_ping_cdrom(int fd){ +#ifdef Linux struct cdrom_volctrl volctl; - if (ioctl(fd, CDROMVOLREAD, &volctl)) + if (ioctl(fd, CDROMVOLREAD, &volctl) && + ioctl(fd, CDROM_GET_CAPABILITY, NULL)<0) +#elif defined(__FreeBSD__) + struct ioc_vol volctl; -+ if (ioctl(fd, CDIOCGETVOL, &volctl)) ++ if (ioctl(fd, CDIOCGETVOL, &volctl) && ++ (ioctl(fd, CDIOCCAPABILITY, NULL)<0)) +#endif return(1); /* failure */ return(0); -@@ -26,6 +33,7 @@ int ioctl_ping_cdrom(int fd){ +@@ -29,6 +39,7 @@ int ioctl_ping_cdrom(int fd){ } +#ifdef Linux /* Use the ioctl thingy above ping the cdrom; this will get model info */ char *atapi_drive_info(int fd){ /* Work around the fact that the struct grew without warning in -@@ -46,6 +54,7 @@ char *atapi_drive_info(int fd){ +@@ -49,6 +60,7 @@ char *atapi_drive_info(int fd){ free(id); return(ret); } +#endif int data_bigendianp(cdrom_drive *d){ float lsb_votes=0; -@@ -171,7 +180,9 @@ int data_bigendianp(cdrom_drive *d){ - knows the leasoud/leadin size. */ +@@ -174,7 +186,9 @@ int data_bigendianp(cdrom_drive *d){ + knows the leadout/leadin size. */ int FixupTOC(cdrom_drive *d,int tracks){ +#ifdef Linux struct cdrom_multisession ms_str; +#endif int j; /* First off, make sure the 'starting sector' is >=0 */ -@@ -208,6 +219,8 @@ int FixupTOC(cdrom_drive *d,int tracks){ +@@ -211,6 +225,8 @@ int FixupTOC(cdrom_drive *d,int tracks){ /* For a scsi device, the ioctl must go to the specialized SCSI CDROM device, not the generic device. */ + /* XXX */ +#ifdef Linux if (d->ioctl_fd != -1) { int result; -@@ -231,6 +244,7 @@ int FixupTOC(cdrom_drive *d,int tracks){ +@@ -235,6 +251,16 @@ int FixupTOC(cdrom_drive *d,int tracks){ return 1; } } ++#elif defined(__FreeBSD__) ++ for (j = tracks-1; j >= 0; j--) { ++ if (j > 0 && !IS_AUDIO(d,j) && IS_AUDIO(d,j-1)) { ++ if ((d->disc_toc[j].dwStartSector > d->disc_toc[j].dwStartSector - 11400) && ++ (d->disc_toc[j].dwStartSector - 11400 > d->disc_toc[j-1].dwStartSector)) ++ d->disc_toc[j].dwStartSector = d->disc_toc[j].dwStartSector - 11400; ++ break; ++ } ++ } +#endif return 0; } diff --git a/audio/cdparanoia/files/patch-interface_interface.c b/audio/cdparanoia/files/patch-interface_interface.c index 3b8a43d48496..033d5753a564 100644 --- a/audio/cdparanoia/files/patch-interface_interface.c +++ b/audio/cdparanoia/files/patch-interface_interface.c @@ -1,27 +1,33 @@ ---- interface/interface.c.orig 2000-04-19 22:41:04 UTC +--- interface/interface.c.orig 2008-09-11 10:43:52 UTC +++ interface/interface.c -@@ -30,11 +30,24 @@ int cdda_close(cdrom_drive *d){ +@@ -35,10 +35,17 @@ int cdda_close(cdrom_drive *d){ _clean_messages(d); if(d->cdda_device_name)free(d->cdda_device_name); +#ifdef Linux if(d->ioctl_device_name)free(d->ioctl_device_name); if(d->drive_model)free(d->drive_model); if(d->cdda_fd!=-1)close(d->cdda_fd); if(d->ioctl_fd!=-1 && d->ioctl_fd!=d->cdda_fd)close(d->ioctl_fd); - if(d->sg)free(d->sg); +#elif defined(__FreeBSD__) -+ if (d->drive_model) -+ free(d->drive_model); -+ if (d->ccb) -+ cam_freeccb(d->ccb); -+ if (d->dev) -+ cam_close_device(d->dev); -+ if (d->sg_buffer) -+ free(d->sg_buffer); -+ if (d->ioctl_fd != -1) -+ close(d->ioctl_fd); ++ if(d->drive_model)free(d->drive_model); ++ if(d->ccb)cam_freeccb(d->ccb); ++ if(d->dev)cam_close_device(d->dev); ++ if(d->ioctl_fd != -1)close(d->ioctl_fd); +#endif - - free(d); + if(d->private){ + if(d->private->sg_hd)free(d->private->sg_hd); + free(d->private); +@@ -127,7 +134,12 @@ long cdda_read_timed(cdrom_drive *d, void *buffer, lon + } + } + } ++#ifdef Linux + if(ms)*ms=d->private->last_milliseconds; ++#elif defined(__FreeBSD__) ++ if(ms) ++ *ms = (d->private == NULL) ? 0 : d->private->last_milliseconds; ++#endif + return(sectors); } + diff --git a/audio/cdparanoia/files/patch-interface_low__interface.h b/audio/cdparanoia/files/patch-interface_low__interface.h index 4d8f491e4455..607db2429372 100644 --- a/audio/cdparanoia/files/patch-interface_low__interface.h +++ b/audio/cdparanoia/files/patch-interface_low__interface.h @@ -1,54 +1,52 @@ Index: interface/low_interface.h =================================================================== RCS file: /home/cvs/cdparanoia/interface/low_interface.h,v retrieving revision 1.1.1.1 retrieving revision 1.3 ---- interface/low_interface.h.orig 2001-03-26 06:12:11 UTC +--- interface/low_interface.h.orig 2008-09-11 10:43:52 UTC +++ interface/low_interface.h -@@ -25,6 +25,8 @@ +@@ -26,6 +26,8 @@ #include #include +#ifdef Linux + #include #include -@@ -48,12 +50,27 @@ +@@ -54,6 +56,17 @@ #include #include +#elif defined(__FreeBSD__) + +#include +#include + +#include ++#include +#include + +#endif + #include "cdda_interface.h" + #ifndef SG_EMULATED_HOST +@@ -107,10 +120,17 @@ struct cdda_private_data { #define MAX_RETRIES 8 #define MAX_BIG_BUFF_SIZE 65536 #define MIN_BIG_BUFF_SIZE 4096 + +#ifdef Linux #define SG_OFF sizeof(struct sg_header) +#else +#define SG_OFF (0) +#endif - #ifndef SG_EMULATED_HOST - /* old kernel version; the check for the ioctl is still runtime, this -@@ -64,7 +81,9 @@ - #endif - extern int cooked_init_drive (cdrom_drive *d); +#ifdef Linux extern unsigned char *scsi_inquiry (cdrom_drive *d); +#endif extern int scsi_init_drive (cdrom_drive *d); #ifdef CDDA_TEST extern int test_init_drive (cdrom_drive *d); diff --git a/audio/cdparanoia/files/patch-interface_scan__devices.c b/audio/cdparanoia/files/patch-interface_scan__devices.c index ce83179151b5..5e728437b8f8 100644 --- a/audio/cdparanoia/files/patch-interface_scan__devices.c +++ b/audio/cdparanoia/files/patch-interface_scan__devices.c @@ -1,242 +1,260 @@ ---- interface/scan_devices.c.orig 2001-03-26 05:44:01 UTC +--- interface/scan_devices.c.orig 2008-08-26 09:55:22 UTC +++ interface/scan_devices.c @@ -1,6 +1,8 @@ /****************************************************************** - * CopyPolicy: GNU Public License 2 applies - * Copyright (C) 1998 Monty xiphmont@mit.edu + * CopyPolicy: GNU Lesser General Public License 2.1 applies + * Copyright (C) 1998-2008 Monty xiphmont@mit.edu + * FreeBSD porting (c) 2003 + * Simon 'corecode' Schubert * * Autoscan for or verify presence of a cdrom device * -@@ -21,6 +23,8 @@ +@@ -24,6 +26,8 @@ #define MAX_DEV_LEN 20 /* Safe because strings only come from below */ /* must be absolute paths! */ + +#ifdef Linux static char *scsi_cdrom_prefixes[]={ "/dev/scd", "/dev/sr", -@@ -49,6 +53,17 @@ static char *cdrom_devices[]={ +@@ -52,6 +56,17 @@ static char *cdrom_devices[]={ "/dev/cm206cd", "/dev/gscd", "/dev/optcd",NULL}; +#elif defined(__FreeBSD__) +static char *cdrom_devices[] = { + "/dev/cd?", + "/dev/acd?", + "/dev/wcd?", + "/dev/mcd?", + "/dev/cd?c", + "/dev/acd?c", + "/dev/wcd?c", + "/dev/mcd?c", NULL}; +#endif /* Functions here look for a cdrom drive; full init of a drive type happens in interface.c */ -@@ -75,10 +90,12 @@ cdrom_drive *cdda_find_a_cdrom(int messa +@@ -61,6 +76,9 @@ cdrom_drive *cdda_find_a_cdrom(int messagedest,char ** + + int i=0; + cdrom_drive *d; ++#if defined(__FreeBSD__) ++ struct passwd *pwent; ++#endif + + while(cdrom_devices[i]!=NULL){ + +@@ -78,10 +96,12 @@ cdrom_drive *cdda_find_a_cdrom(int messagedest,char ** if((d=cdda_identify(buffer,messagedest,messages))) return(d); idmessage(messagedest,messages,"",NULL); +#ifdef Linux buffer[pos-(cdrom_devices[i])]=j+97; if((d=cdda_identify(buffer,messagedest,messages))) return(d); idmessage(messagedest,messages,"",NULL); +#endif } }else{ /* Name. Go for it. */ -@@ -117,8 +134,14 @@ cdrom_drive *cdda_identify(const char *d +@@ -92,9 +112,21 @@ cdrom_drive *cdda_find_a_cdrom(int messagedest,char ** + } + i++; } - #endif - -+#ifdef Linux /* is order of checks important? */ - d=cdda_identify_cooked(device,messagedest,messages); - if(!d)d=cdda_identify_scsi(device,NULL,messagedest,messages); ++ ++#if Linux + idmessage(messagedest,messages, + "\n\nNo cdrom drives accessible to %s found.\n", + cuserid(NULL)); +#elif defined(__FreeBSD__) -+ d = cdda_identify_scsi(device, NULL, messagedest, messages); -+ if (d == NULL) -+ d = cdda_identify_cooked(device, messagedest, messages); ++ pwent = getpwuid(geteuid()); ++ if (pwent == NULL) ++ idmessage(messagedest,messages, ++ "\n\nNo accessible cdrom drives found.\n", NULL); ++ else ++ idmessage(messagedest,messages, ++ "\n\nNo cdrom drives accessible to %s found.\n", ++ pwent->pw_name); +#endif + return(NULL); + } - #ifdef CDDA_TEST - if(!d)d=cdda_identify_test(device,messagedest,messages); -@@ -143,6 +166,7 @@ char *test_resolve_symlink(const char *f +@@ -145,6 +179,7 @@ char *test_resolve_symlink(const char *file,int messag } +#ifdef Linux cdrom_drive *cdda_identify_cooked(const char *dev, int messagedest, char **messages){ -@@ -275,6 +299,61 @@ cdrom_drive *cdda_identify_cooked(const +@@ -274,6 +309,61 @@ cdrom_drive *cdda_identify_cooked(const char *dev, int return(d); } +#elif defined(__FreeBSD__) +cdrom_drive * +cdda_identify_cooked(const char *dev, int messagedest, char **messages) +{ + cdrom_drive *d; + struct stat st; + + if (stat(dev, &st)) { + idperror(messagedest, messages, "\t\tCould not stat %s", dev); + return NULL; + } + + if (!S_ISCHR(st.st_mode)) { + idmessage(messagedest, messages, "\t\t%s is no block device", dev); + return NULL; + } + + if ((d = calloc(1, sizeof(*d))) == NULL) { + idperror(messagedest, messages, "\t\tCould not allocate memory", NULL); + return NULL; + } + d->ioctl_fd = -1; + + if ((d->ioctl_fd = open(dev, O_RDONLY)) == -1) { + idperror(messagedest, messages, "\t\tCould not open %s", dev); + goto cdda_identify_cooked_fail; + } + + if (ioctl_ping_cdrom(d->ioctl_fd)) { + idmessage(messagedest, messages, "\t\tDevice %s is not a CDROM", dev); + goto cdda_identify_cooked_fail; + } + + d->cdda_device_name = copystring(dev); + d->drive_model = copystring("Generic cooked ioctl CDROM"); + d->interface = COOKED_IOCTL; + d->bigendianp = -1; + d->nsectors = -1; + + idmessage(messagedest, messages, "\t\tCDROM sensed: %s\n", d->drive_model); + + return d; + +cdda_identify_cooked_fail: + if (d != NULL) { + if (d->ioctl_fd != -1) + close(d->ioctl_fd); + free(d); + } + return NULL; +} +#endif + + +#ifdef Linux struct sg_id { long l1; /* target | lun << 8 | channel << 16 | low_ino << 24 */ long l2; /* Unique id */ -@@ -390,6 +469,7 @@ matchfail: +@@ -400,6 +490,7 @@ matchfail: if(dev!=-1)close(dev); return(NULL); } +#endif void strscat(char *a,char *b,int n){ int i; -@@ -401,6 +481,7 @@ void strscat(char *a,char *b,int n){ +@@ -411,6 +502,7 @@ void strscat(char *a,char *b,int n){ strcat(a," "); } +#ifdef Linux /* At this point, we're going to punt compatability before SG2, and allow only SG2 and SG3 */ static int verify_SG_version(cdrom_drive *d,int messagedest, -@@ -653,6 +734,89 @@ cdda_identify_scsi_fail: - if(g_fd!=-1)close(g_fd); +@@ -780,6 +872,90 @@ cdda_identify_scsi_fail: + } return(NULL); } +#elif defined(__FreeBSD__) + -+cdrom_drive *cdda_identify_scsi(const char *device, -+ const char *dummy, ++cdrom_drive *cdda_identify_scsi(const char *dummy, ++ const char *device, + int messagedest, + char **messages) +{ + char *devname; + cdrom_drive *d = NULL; + + if (device == NULL) { + idperror(messagedest, messages, "\t\tNo device specified", NULL); + return NULL; + } + + if ((devname = test_resolve_symlink(device, messagedest, messages)) == NULL) + return NULL; + + if ((d = calloc(1, sizeof(*d))) == NULL) { + idperror(messagedest, messages, "\t\tCould not allocate memory", NULL); + free(devname); + return NULL; + } + + if ((d->dev = cam_open_device(devname, O_RDWR)) == NULL) { + idperror(messagedest, messages, "\t\tCould not open SCSI device: %s", cam_errbuf); + goto cdda_identify_scsi_fail; + } + + if ((d->ccb = cam_getccb(d->dev)) == NULL) { + idperror(messagedest, messages, "\t\tCould not allocate ccb", NULL); + goto cdda_identify_scsi_fail; + } + + if (strncmp(d->dev->inq_data.vendor, "TOSHIBA", 7) == 0 && + strncmp(d->dev->inq_data.product, "CD_ROM", 6) == 0 && + SID_TYPE(&d->dev->inq_data) == T_DIRECT) { + d->dev->inq_data.device = T_CDROM; + d->dev->inq_data.dev_qual2 |= 0x80; + } + + if (SID_TYPE(&d->dev->inq_data) != T_CDROM && + SID_TYPE(&d->dev->inq_data) != T_WORM) { + idmessage(messagedest, messages, + "\t\tDevice is neither a CDROM nor a WORM device\n", NULL); + goto cdda_identify_scsi_fail; + } + + d->cdda_device_name = copystring(devname); + d->ioctl_fd = -1; + d->bigendianp = -1; + d->nsectors = -1; + d->lun = d->dev->target_lun; + d->interface = GENERIC_SCSI; + -+ if ((d->sg_buffer = malloc(MAX_BIG_BUFF_SIZE)) == NULL) { ++ d->private=calloc(1,sizeof(*d->private)); ++ if ((d->private->sg_buffer=(unsigned char *)(d->private->sg_hd=malloc(MAX_BIG_BUFF_SIZE))) == NULL) { + idperror(messagedest, messages, "Could not allocate buffer memory", NULL); + goto cdda_identify_scsi_fail; + } + + if ((d->drive_model = calloc(36,1)) == NULL) { + } + + strscat(d->drive_model, d->dev->inq_data.vendor, SID_VENDOR_SIZE); + strscat(d->drive_model, d->dev->inq_data.product, SID_PRODUCT_SIZE); + strscat(d->drive_model, d->dev->inq_data.revision, SID_REVISION_SIZE); + + idmessage(messagedest, messages, "\nCDROM model sensed: %s", d->drive_model); + + return d; + +cdda_identify_scsi_fail: + free(devname); + if (d) { + if (d->ccb) + cam_freeccb(d->ccb); + if (d->dev) + cam_close_device(d->dev); + free(d); + } + return NULL; +} +#endif #ifdef CDDA_TEST diff --git a/audio/cdparanoia/files/patch-interface_scsi__interface.c b/audio/cdparanoia/files/patch-interface_scsi__interface.c index 15fe0300e0d7..a1bff608f9d5 100644 --- a/audio/cdparanoia/files/patch-interface_scsi__interface.c +++ b/audio/cdparanoia/files/patch-interface_scsi__interface.c @@ -1,313 +1,351 @@ ---- interface/scsi_interface.c.orig 2001-03-24 01:15:46 UTC +--- interface/scsi_interface.c.orig 2019-07-25 21:55:03 UTC +++ interface/scsi_interface.c @@ -3,6 +3,8 @@ * Original interface.c Copyright (C) 1994-1997 * Eissfeldt heiko@colossus.escape.de - * Current blenderization Copyright (C) 1998-1999 Monty xiphmont@mit.edu + * Current incarnation Copyright (C) 1998-2008 Monty xiphmont@mit.edu + * FreeBSD porting (c) 2003 + * Simon 'corecode' Schubert * * Generic SCSI interface specific code. * -@@ -23,6 +25,7 @@ static void tweak_SG_buffer(cdrom_drive - int table,reserved; +@@ -36,6 +38,7 @@ static void tweak_SG_buffer(cdrom_drive *d) { + int table, reserved, cur, err; char buffer[256]; +#ifdef Linux - /* maximum transfer size? */ - if(ioctl(d->cdda_fd,SG_GET_RESERVED_SIZE,&reserved)){ - /* Up, guess not. */ -@@ -59,8 +62,17 @@ static void tweak_SG_buffer(cdrom_drive - cdmessage(d,"\tCouldn't disable command queue! Continuing anyway...\n"); - } - -+#elif defined(__FreeBSD__) -+ d->nsectors = 26; /* FreeBSD only supports 64K I/O transfer size */ -+ d->bigbuff = d->nsectors * CD_FRAMESIZE_RAW; -+ -+ sprintf(buffer,"\tSetting default read size to %d sectors (%d bytes).\n\n", -+ d->nsectors,d->nsectors*CD_FRAMESIZE_RAW); -+ cdmessage(d,buffer); + /* SG_SET_RESERVED_SIZE doesn't actually allocate or reserve anything. + * what it _does_ do is give you an error if you ask for a value + * larger than q->max_sectors (the length of the device's bio request +@@ -54,6 +57,10 @@ static void tweak_SG_buffer(cdrom_drive *d) { + implement working sg lists with SG_IO devices, so who knows... */ + if (ioctl(d->cdda_fd, SG_GET_SG_TABLESIZE, &table) < 0) + table=1; ++#else ++ reserved = 26 * CD_FRAMESIZE_RAW; /* FreeBSD only supports 64K I/O transfer size */ ++ table = 1; +#endif - } -+#ifdef Linux - static void reset_scsi(cdrom_drive *d){ - int arg; - d->enable_cdda(d,0); -@@ -74,6 +86,30 @@ static void reset_scsi(cdrom_drive *d){ - d->enable_cdda(d,1); + sprintf(buffer,"\tDMA scatter/gather table entries: %d\n\t" + "table entry size: %d bytes\n\t" +@@ -93,6 +100,7 @@ static void tweak_SG_buffer(cdrom_drive *d) { + cdmessage(d,buffer); } -+#elif defined(__FreeBSD__) -+static void reset_scsi(cdrom_drive *d) { -+ d->enable_cdda(d,0); -+ -+ d->ccb->ccb_h.func_code = XPT_RESET_DEV; -+ d->ccb->ccb_h.timeout = 5000; -+ -+ cdmessage(d, "sending SCSI reset... "); -+ if (cam_send_ccb(d->dev, d->ccb)) { -+ cdmessage(d, "error sending XPT_RESET_DEV CCB"); -+ } else { -+ -+ if (((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) || -+ ((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_BDR_SENT)) -+ cdmessage(d,"OK\n"); -+ else -+ cdmessage(d,"FAILED\n"); -+ } -+ -+ d->enable_cdda(d,1); -+} -+#endif -+ +#ifdef Linux static void clear_garbage(cdrom_drive *d){ fd_set fdset; struct timeval tv; -@@ -104,8 +140,10 @@ static void clear_garbage(cdrom_drive *d +@@ -123,6 +131,7 @@ static void clear_garbage(cdrom_drive *d){ flag=1; } } +#endif + static int check_sbp_error(const unsigned char status, + const unsigned char *sbp) { +@@ -172,6 +181,7 @@ static int check_sbp_error(const unsigned char status, + return 0; + } + ++#ifdef Linux /* process a complete scsi command. */ + static int sg2_handle_scsi_cmd(cdrom_drive *d, + unsigned char *cmd, +@@ -332,7 +342,9 @@ static int sg2_handle_scsi_cmd(cdrom_drive *d, + } + return(0); + } ++#endif + ++#ifdef Linux + static int sgio_handle_scsi_cmd(cdrom_drive *d, + unsigned char *cmd, + unsigned int cmd_len, +@@ -417,7 +429,9 @@ static int sgio_handle_scsi_cmd(cdrom_drive *d, + errno = 0; + return 0; + } ++#endif + +#ifdef Linux static int handle_scsi_cmd(cdrom_drive *d, + unsigned char *cmd, unsigned int cmd_len, - unsigned int in_size, -@@ -284,6 +322,95 @@ static int handle_scsi_cmd(cdrom_drive * - return(0); +@@ -433,6 +447,117 @@ static int handle_scsi_cmd(cdrom_drive *d, + } +#elif defined(__FreeBSD__) +static int handle_scsi_cmd(cdrom_drive *d, -+ unsigned int cmd_len, -+ unsigned int out_size, ++ unsigned char *cmd, ++ unsigned int cmd_len, + unsigned int in_size, ++ unsigned int out_size, + unsigned char bytefill, -+ int bytecheck) { ++ int bytecheck, ++ unsigned char *sense){ + int result; + int error_code, sense_key, asc, ascq; + + bzero(&d->ccb->csio, sizeof(d->ccb->csio)); + -+ memcpy(d->ccb->csio.cdb_io.cdb_bytes, d->sg_buffer, cmd_len); ++ memcpy(d->ccb->csio.cdb_io.cdb_bytes, cmd, cmd_len); + -+ if (bytecheck && out_size == 0) -+ memset(d->sg_buffer, bytefill, in_size); ++ if (bytecheck && in_size == 0) ++ memset(d->private->sg_buffer, bytefill, out_size); + + cam_fill_csio(&d->ccb->csio, + /* retries */ 0, + /* cbfcnp */ NULL, -+ /* flags */ CAM_DEV_QFRZDIS | (out_size ? CAM_DIR_OUT : CAM_DIR_IN), ++ /* flags */ CAM_DEV_QFRZDIS | (in_size ? CAM_DIR_OUT : CAM_DIR_IN), + /* tag_action */ MSG_SIMPLE_Q_TAG, -+ /* data_ptr */ out_size ? d->sg_buffer + cmd_len : d->sg_buffer, ++ /* data_ptr */ in_size ? cmd + cmd_len : d->private->sg_buffer, + /* dxfer_len */ out_size ? out_size : in_size, + /* sense_len */ SSD_FULL_SIZE, + /* cdb_len */ cmd_len, + /* timeout */ 60000); /* XXX */ + ++ struct timespec tv1, tv2; ++ int tret1=clock_gettime(d->private->clock,&tv1); + if ((result = cam_send_ccb(d->dev, d->ccb)) < 0 || + (d->ccb->ccb_h.status & CAM_STATUS_MASK) == 0 /* hack? */) + return TR_EREAD; ++ int tret2=clock_gettime(d->private->clock,&tv2); + + if ((d->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP && + (d->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_SCSI_STATUS_ERROR) { + fprintf (stderr, "\t\terror returned from SCSI command:\n" + "\t\tccb->ccb_h.status == %d\n", d->ccb->ccb_h.status); + errno = EIO; + return TR_UNKNOWN; + } + -+ if (d->ccb->csio.dxfer_len != in_size) { ++ if (d->ccb->csio.dxfer_len != out_size) { + errno = EIO; + return TR_EREAD; + } + + scsi_extract_sense(&d->ccb->csio.sense_data, &error_code, &sense_key, + &asc, &ascq); + + switch (error_code) { + case SSD_CURRENT_ERROR: + case SSD_DEFERRED_ERROR: +#if (CAM_VERSION > 0x15) + case SSD_DESC_CURRENT_ERROR: + case SSD_DESC_DEFERRED_ERROR: +#endif + switch (sense_key) { + case SSD_KEY_NO_SENSE: + errno = EIO; + return TR_UNKNOWN; + case SSD_KEY_RECOVERED_ERROR: + break; + case SSD_KEY_NOT_READY: + errno = EBUSY; + return TR_BUSY; + case SSD_KEY_MEDIUM_ERROR: + errno = EIO; + if ((asc == 0x0c) && (ascq == 0x09)) + return TR_STREAMING; + else + return TR_MEDIUM; + case SSD_KEY_HARDWARE_ERROR: + errno = EIO; + return TR_FAULT; + case SSD_KEY_ILLEGAL_REQUEST: + errno = EINVAL; + return TR_ILLEGAL; + default: + errno = EIO; + return TR_UNKNOWN; + } + default: + break; + } + ++ if(bytecheck && out_size){ ++ long i, flag=0; ++ for(i=in_size;iprivate->sg_buffer[i]!=bytefill){ ++ flag=1; ++ break; ++ } ++ if(!flag){ ++ errno=EINVAL; ++ return(TR_ILLEGAL); ++ } ++ } ++ ++ if(tret1<0 || tret2<0) ++ d->private->last_milliseconds=-1; ++ else ++ d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.; ++ + return 0; +} +#endif + -+ - /* Group 1 (10b) command */ + static int test_unit_ready(cdrom_drive *d){ + unsigned char sense[SG_MAX_SENSE]; + unsigned char key, ASC, ASCQ; +@@ -453,6 +581,7 @@ static int test_unit_ready(cdrom_drive *d){ + return 1; + } - static int mode_sense_atapi(cdrom_drive *d,int size,int page){ -@@ -833,30 +960,37 @@ static long scsi_read_map (cdrom_drive * - while(1) { - if((err=map(d,(p?buffer:NULL),begin,sectors))){ - if(d->report_all){ +#ifdef Linux - struct sg_header *sg_hd=(struct sg_header *)d->sg; + static void reset_scsi(cdrom_drive *d){ + int arg,tries=0; + d->enable_cdda(d,0); +@@ -472,6 +601,27 @@ static void reset_scsi(cdrom_drive *d){ + d->enable_cdda(d,1); + } + +#elif defined(__FreeBSD__) ++static void reset_scsi(cdrom_drive *d) { ++ d->enable_cdda(d,0); ++ ++ d->ccb->ccb_h.func_code = XPT_RESET_DEV; ++ d->ccb->ccb_h.timeout = 5000; ++ ++ cdmessage(d, "sending SCSI reset... "); ++ if (cam_send_ccb(d->dev, d->ccb)) { ++ cdmessage(d, "error sending XPT_RESET_DEV CCB"); ++ } else { ++ if (((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) || ++ ((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_BDR_SENT)) ++ cdmessage(d,"OK\n"); ++ else ++ cdmessage(d,"FAILED\n"); ++ } ++ d->enable_cdda(d,1); ++} ++#endif ++ + static int mode_sense_atapi(cdrom_drive *d,int size,int page){ + unsigned char sense[SG_MAX_SENSE]; + unsigned char cmd[10]= {0x5A, /* MODE_SENSE */ +@@ -1074,29 +1226,35 @@ static long scsi_read_map (cdrom_drive *d, void *p, lo + + if((err=map(d,(p?buffer:NULL),begin,sectors,sense))){ + if(d->report_all){ ++#ifdef __FreeBSD__ + int error_code, sense_key, asc, ascq; +#endif char b[256]; sprintf(b,"scsi_read error: sector=%ld length=%ld retry=%d\n", begin,sectors,retry_count); + fputs(b, stderr); cdmessage(d,b); +#if defined(__FreeBSD__) + scsi_extract_sense(&d->ccb->csio.sense_data, &error_code, &sense_key, + &asc, &ascq); +#endif sprintf(b," Sense key: %x ASC: %x ASCQ: %x\n", +#ifdef Linux - (int)(sg_hd->sense_buffer[2]&0xf), - (int)(sg_hd->sense_buffer[12]), - (int)(sg_hd->sense_buffer[13])); + (int)(sense[2]&0xf), + (int)(sense[12]), + (int)(sense[13])); +#elif defined(__FreeBSD__) + sense_key, asc, ascq); +#endif + fputs(b, stderr); cdmessage(d,b); sprintf(b," Transport error: %s\n",strerror_tr[err]); + fputs(b, stderr); cdmessage(d,b); sprintf(b," System error: %s\n",strerror(errno)); + fputs(b, stderr); cdmessage(d,b); - - fprintf(stderr,"scsi_read error: sector=%ld length=%ld retry=%d\n", - begin,sectors,retry_count); - fprintf(stderr," Sense key: %x ASC: %x ASCQ: %x\n", -- (int)(sg_hd->sense_buffer[2]&0xf), -- (int)(sg_hd->sense_buffer[12]), -- (int)(sg_hd->sense_buffer[13])); +- (int)(sense[2]&0xf), +- (int)(sense[12]), +- (int)(sense[13])); - fprintf(stderr," Transport error: %s\n",strerror_tr[err]); - fprintf(stderr," System error: %s\n",strerror(errno)); } - - if(!d->error_retry)return(-7); -@@ -1307,6 +1441,7 @@ static void check_fua_bit(cdrom_drive *d - return; + + switch(errno){ +@@ -1583,6 +1741,7 @@ static void check_cache(cdrom_drive *d){ + } } +#ifdef Linux static int check_atapi(cdrom_drive *d){ int atapiret=-1; - int fd = d->cdda_fd; /* this is the correct fd (not ioctl_fd), as the -@@ -1333,6 +1468,53 @@ static int check_atapi(cdrom_drive *d){ + int fd = d->cdda_fd; /* check the device we'll actually be using to read */ +@@ -1614,6 +1773,53 @@ static int check_atapi(cdrom_drive *d){ } } +#elif defined(__FreeBSD__) +static int +check_atapi(cdrom_drive *d) +{ + bzero(&(&d->ccb->ccb_h)[1], sizeof(d->ccb->cpi) - sizeof(d->ccb->ccb_h)); + + d->ccb->ccb_h.func_code = XPT_PATH_INQ; + + cdmessage(d, "\nChecking for ATAPICAM...\n"); + + if (cam_send_ccb(d->dev, d->ccb) < 0) { + cderror(d, "\terror sending XPT_PATH_INQ CCB: "); + cderror(d, cam_errbuf); + cderror(d, "\n"); + return -1; + } + + if ((d->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + cderror(d, "\tXPT_PATH_INQ CCB failed: "); + cderror(d, cam_errbuf); + cderror(d, "\n"); + return -1; + } + + /* + * if the bus device name is `ata', we're (obviously) + * running ATAPICAM. + * same for the new ahci(4) and siis(4) drivers and future others + * which use SATA transport too... + */ + + if (strncmp(d->ccb->cpi.dev_name, "ata", 3) == 0 || +#if __FreeBSD_version >= 800102 + d->ccb->cpi.transport == XPORT_SATA || +#endif + d->ccb->cpi.transport == XPORT_ATA) { + cdmessage(d, "\tDrive is ATAPI (using ATAPICAM or direct CAM (S)ATA transport)\n"); + d->is_atapi = 1; + } else { + cdmessage(d, "\tDrive is SCSI\n"); + d->is_atapi = 0; + } + + return d->is_atapi; +} +#endif + static int check_mmc(cdrom_drive *d){ - char *b; + unsigned char *b; cdmessage(d,"\nChecking for MMC style command set...\n"); -@@ -1379,6 +1561,7 @@ static void check_exceptions(cdrom_drive +@@ -1660,6 +1866,7 @@ static void check_exceptions(cdrom_drive *d,exception } } +#ifdef Linux /* request vendor brand and model */ unsigned char *scsi_inquiry(cdrom_drive *d){ - memcpy(d->sg_buffer,(char[]){ 0x12,0,0,0,56,0},6); -@@ -1389,6 +1572,7 @@ unsigned char *scsi_inquiry(cdrom_drive + unsigned char sense[SG_MAX_SENSE]; +@@ -1671,6 +1878,7 @@ unsigned char *scsi_inquiry(cdrom_drive *d){ } - return (d->sg_buffer); + return (d->private->sg_buffer); } +#endif - int scsi_init_drive(cdrom_drive *d){ -@@ -1458,8 +1642,12 @@ int scsi_init_drive(cdrom_drive *d){ - check_fua_bit(d); - - d->error_retry=1; -+#ifdef Linux - d->sg=realloc(d->sg,d->nsectors*CD_FRAMESIZE_RAW + SG_OFF + 128); - d->sg_buffer=d->sg+SG_OFF; -+#elif defined(__FreeBSD__) -+ d->sg_buffer = realloc(d->sg_buffer, d->nsectors * CD_FRAMESIZE_RAW); -+#endif - d->report_all=1; - return(0); - } + int ret; diff --git a/audio/cdparanoia/files/patch-main.c b/audio/cdparanoia/files/patch-main.c new file mode 100644 index 000000000000..f34b292b307b --- /dev/null +++ b/audio/cdparanoia/files/patch-main.c @@ -0,0 +1,15 @@ +--- main.c.orig 2019-07-23 18:12:13 UTC ++++ main.c +@@ -588,10 +588,10 @@ static void callback(long inpos, int function){ + buffer[aheadposition+19]='>'; + } + +- fprintf(stderr,buffer); ++ fprintf(stderr,"%s",buffer); + + if (logfile != NULL && function==-1) { +- fprintf(logfile,buffer+1); ++ fprintf(logfile,"%s",buffer+1); + fprintf(logfile,"\n\n"); + fflush(logfile); + } diff --git a/audio/cdparanoia/files/patch-paranoia_overlap.c b/audio/cdparanoia/files/patch-paranoia_overlap.c new file mode 100644 index 000000000000..eddce74fb540 --- /dev/null +++ b/audio/cdparanoia/files/patch-paranoia_overlap.c @@ -0,0 +1,20 @@ +--- paranoia/overlap.c.orig 2019-07-23 18:06:02 UTC ++++ paranoia/overlap.c +@@ -107,7 +107,7 @@ void offset_adjust_settings(cdrom_paranoia *p, void(*c + sector, frob it. We just want a little hysteresis [sp?]*/ + long av=(p->stage2.offpoints?p->stage2.offaccum/p->stage2.offpoints:0); + +- if(abs(av)>p->dynoverlap/4){ ++ if(labs(av)>p->dynoverlap/4){ + av=(av/MIN_SECTOR_EPSILON)*MIN_SECTOR_EPSILON; + + if(callback)(*callback)(ce(p->root.vector),PARANOIA_CB_DRIFT); +@@ -207,7 +207,7 @@ void offset_add_value(cdrom_paranoia *p,offsets *o,lon + if(o->offpoints!=-1){ + + /* Track the average magnitude of jitter (in either direction) */ +- o->offdiff+=abs(value); ++ o->offdiff+=labs(value); + o->offpoints++; + o->newpoints++; + diff --git a/audio/cdparanoia/files/patch-upstream-r15314 b/audio/cdparanoia/files/patch-upstream-r15314 new file mode 100644 index 000000000000..5b25847ed78f --- /dev/null +++ b/audio/cdparanoia/files/patch-upstream-r15314 @@ -0,0 +1,312 @@ +Fix the cdda_enable bug that would cause the -A tests to fail on +drives that require a density set + +Correct a bug that would cause a failed density set to abort out of +verify_read_command + +Improve autosense order; non-density-set modes should be chacked +before even NULL-density modes because there's not necessarily any +going back (eg, Plextor lets you *set* the mode descriptor density, +but does not let you read it; it always reports '0') + +Index: interface/interface.c +=================================================================== +--- interface/interface.c (revision 15313) ++++ interface/interface.c (revision 15314) +@@ -90,11 +90,11 @@ + } + } + ++ if(d->bigendianp==-1)d->bigendianp=data_bigendianp(d); ++ + if((ret=d->enable_cdda(d,1))) + return(ret); + +- /* d->select_speed(d,d->maxspeed); most drives are full speed by default */ +- if(d->bigendianp==-1)d->bigendianp=data_bigendianp(d); + return(0); + } + +Index: interface/scsi_interface.c +=================================================================== +--- interface/scsi_interface.c (revision 15313) ++++ interface/scsi_interface.c (revision 15314) +@@ -1298,7 +1298,7 @@ + + static int verify_read_command(cdrom_drive *d){ + int i,j,k; +- int audioflag=0; ++ int audioflag=1; + + int (*enablecommand) (struct cdrom_drive *d, int speed); + long (*readcommand) (struct cdrom_drive *d, void *p, long begin, +@@ -1313,7 +1313,7 @@ + for data */ + + if(d->enable_cdda(d,1)==0){ +- ++ audioflag=0; + for(i=1;i<=d->tracks;i++){ + if(cdda_track_audiop(d,i)==1){ + long firstsector=cdda_track_firstsector(d,i); +@@ -1358,115 +1358,111 @@ + /* NEC test must come before sony; the nec drive expects d8 to be + 10 bytes, and a 12 byte verson (Sony) crashes the drive */ + +- for(j=0;j<15;j++){ +- int densitypossible=1; +- +- switch(j){ ++ for(i=0;i<5;i++){ ++ switch(i){ + case 0: +- d->read_audio=scsi_read_28; +- rs="28 0x,00"; ++ d->density=0; ++ d->enable_cdda=Dummy; ++ es="none "; + break; + case 1: +- d->read_audio=scsi_read_A8; +- rs="a8 0x,00"; ++ d->density=0; ++ d->enable_cdda=scsi_enable_cdda; ++ es="yes/0x00"; + break; +- + case 2: +- d->read_audio=scsi_read_mmcB; +- rs="be 02,10"; +- densitypossible=0; ++ d->density=0x04; ++ d->enable_cdda=scsi_enable_cdda; ++ es="yes/0x04"; + break; + case 3: +- d->read_audio=scsi_read_mmc2B; +- rs="be 02,f8"; +- densitypossible=0; ++ d->density=0x82; ++ d->enable_cdda=scsi_enable_cdda; ++ es="yes/0x82"; + break; + case 4: +- d->read_audio=scsi_read_mmc3B; +- rs="be 06,f8"; +- densitypossible=0; ++ d->density=0x81; ++ d->enable_cdda=scsi_enable_cdda; ++ es="yes/0x81"; + break; ++ } + +- case 5: +- d->read_audio=scsi_read_mmc; +- rs="be 00,10"; +- densitypossible=0; +- break; +- case 6: +- d->read_audio=scsi_read_mmc2; +- rs="be 00,f8"; +- densitypossible=0; +- break; +- case 7: +- d->read_audio=scsi_read_mmc3; +- rs="be 04,f8"; +- densitypossible=0; +- break; +- +- case 8: +- d->read_audio=scsi_read_msf; +- rs="b9 00,10"; +- densitypossible=0; +- break; +- case 9: +- d->read_audio=scsi_read_msf2; +- rs="b9 00,f8"; +- densitypossible=0; +- break; +- case 10: +- d->read_audio=scsi_read_msf3; +- rs="b9 04,f8"; +- densitypossible=0; +- break; +- +- case 11: +- d->read_audio=scsi_read_D4_10; +- rs="d4(10)0x"; +- break; +- case 12: +- d->read_audio=scsi_read_D4_12; +- rs="d4(12)0x"; +- break; +- case 13: +- d->read_audio=scsi_read_D5; +- rs="d5 0x,00"; +- break; +- case 14: +- d->read_audio=scsi_read_D8; +- rs="d8 0x,00"; +- break; +- } +- +- for(i=0;i<5;i++){ +- switch(i){ ++ for(j=0;j<15;j++){ ++ ++ switch(j){ + case 0: +- d->density=0; +- d->enable_cdda=Dummy; +- es="none "; +- if(!densitypossible)i=5; /* short circuit MMC style commands */ ++ d->read_audio=scsi_read_28; ++ rs="28 0x,00"; + break; + case 1: +- d->density=0; +- d->enable_cdda=scsi_enable_cdda; +- es="yes/0x00"; ++ d->read_audio=scsi_read_A8; ++ rs="a8 0x,00"; + break; ++ ++ /* 2 through 10 do not allow/require density */ + case 2: +- d->density=0x04; +- d->enable_cdda=scsi_enable_cdda; +- es="yes/0x04"; +- break; ++ d->read_audio=scsi_read_mmcB; ++ rs="be 02,10"; ++ if(i==0)break; + case 3: +- d->density=0x82; +- d->enable_cdda=scsi_enable_cdda; +- es="yes/0x82"; +- break; ++ j=3; ++ d->read_audio=scsi_read_mmc2B; ++ rs="be 02,f8"; ++ if(i==0)break; + case 4: +- d->density=0x81; +- d->enable_cdda=scsi_enable_cdda; +- es="yes/0x81"; ++ j=4; ++ d->read_audio=scsi_read_mmc3B; ++ rs="be 06,f8"; ++ if(i==0)break; ++ case 5: ++ j=5; ++ d->read_audio=scsi_read_mmc; ++ rs="be 00,10"; ++ if(i==0)break; ++ case 6: ++ j=6; ++ d->read_audio=scsi_read_mmc2; ++ rs="be 00,f8"; ++ if(i==0)break; ++ case 7: ++ j=7; ++ d->read_audio=scsi_read_mmc3; ++ rs="be 04,f8"; ++ if(i==0)break; ++ case 8: ++ j=8; ++ d->read_audio=scsi_read_msf; ++ rs="b9 00,10"; ++ if(i==0)break; ++ case 9: ++ j=9; ++ d->read_audio=scsi_read_msf2; ++ rs="b9 00,f8"; ++ if(i==0)break; ++ case 10: ++ j=10; ++ d->read_audio=scsi_read_msf3; ++ rs="b9 04,f8"; ++ if(i==0)break; ++ ++ case 11: ++ d->read_audio=scsi_read_D4_10; ++ rs="d4(10)0x"; + break; ++ case 12: ++ d->read_audio=scsi_read_D4_12; ++ rs="d4(12)0x"; ++ break; ++ case 13: ++ d->read_audio=scsi_read_D5; ++ rs="d5 0x,00"; ++ break; ++ case 14: ++ d->read_audio=scsi_read_D8; ++ rs="d8 0x,00"; ++ break; + } +- ++ + cdmessage(d,"\ttest -> density: ["); + cdmessage(d,es); + cdmessage(d,"] command: ["); +@@ -1525,21 +1521,21 @@ + if(zeroflag){ + char buffer[256]; + sprintf(buffer,"\t\tDrive returned %d packet(s), but contents\n" +- "\t\twere entirely zero\n",zeroflag); ++ "\t\twere entirely zero\n",zeroflag); + cdmessage(d,buffer); + } + } + } + } +- ++ + /* D'oh. */ + d->density=density; + d->read_audio=readcommand; + d->enable_cdda=enablecommand; +- ++ + cdmessage(d,"\tUnable to find any suitable command set from probe;\n" + "\tdrive probably not CDDA capable.\n"); +- ++ + cderror(d,"006: Could not read any data from drive\n"); + + } +@@ -1690,33 +1686,20 @@ + if(d->is_atapi)d->lun=0; /* it should already be; just to make sure */ + + if(d->is_mmc){ +- + d->read_audio = scsi_read_mmc2B; + d->bigendianp=0; +- + check_exceptions(d,mmc_list); +- + }else{ +- + if(d->is_atapi){ + /* Not MMC maybe still uses 0xbe */ +- + d->read_audio = scsi_read_mmc2B; + d->bigendianp=0; +- + check_exceptions(d,atapi_list); +- + }else{ +- + check_exceptions(d,scsi_list); +- + } + } + +- if(!d->is_atapi)set_sectorsize(d,2048); /* we really do want the +- sector size at 2048 to begin.*/ +- d->enable_cdda(d,0); +- + d->read_toc = (!memcmp(d->drive_model, "IMS", 3) && !d->is_atapi) ? scsi_read_toc2 : + scsi_read_toc; + d->set_speed = scsi_set_speed; diff --git a/audio/cdparanoia/files/patch-upstream-r15337 b/audio/cdparanoia/files/patch-upstream-r15337 new file mode 100644 index 000000000000..4db47a9ad3f9 --- /dev/null +++ b/audio/cdparanoia/files/patch-upstream-r15337 @@ -0,0 +1,31 @@ +Commit fix to make debug (no optimization, please) + +Commit fix to -p not actually outputting in host byte order (in fact, +it always get s it reversed regardless of endianness) + +Index: Makefile.in +=================================================================== +--- Makefile.in (revision 15336) ++++ Makefile.in (revision 15337) +@@ -10,7 +10,7 @@ + @SET_MAKE@ + FLAGS=@TYPESIZES@ @CFLAGS@ + OPT=@OPT@ $(FLAGS) +-DEBUG=@DEBUG@ $(FLAGS) ++DEBUG=@DEBUG@ + CC=@CC@ + LD=@CC@ + LDFLAGS=@LDFLAGS@ $(FLAGS) +Index: main.c +=================================================================== +--- main.c (revision 15336) ++++ main.c (revision 15337) +@@ -746,7 +746,7 @@ + break; + case 'p': + output_type=0; +- output_endian=-1; ++ output_endian=bigendianp(); + break; + case 'r': + output_type=0; diff --git a/audio/cdparanoia/files/patch-version.h b/audio/cdparanoia/files/patch-version.h deleted file mode 100644 index ef314df2e976..000000000000 --- a/audio/cdparanoia/files/patch-version.h +++ /dev/null @@ -1,17 +0,0 @@ -Index: version.h -=================================================================== -RCS file: /home/cvs/cdparanoia/version.h,v -retrieving revision 1.1.1.1 -retrieving revision 1.2 ---- version.h.orig 2001-03-24 01:15:45 UTC -+++ version.h -@@ -8,6 +8,8 @@ - - - #define VERSION "cdparanoia III release 9.8 (March 23, 2001)\n"\ -- "(C) 2001 Monty and Xiphophorus\n\n"\ -+ "(C) 2001 Monty and Xiphophorus\n"\ -+ "FreeBSD porting (c) 2003\n"\ -+ "\tSimon 'corecode' Schubert \n\n"\ - "Report bugs to paranoia@xiph.org\n"\ - "http://www.xiph.org/paranoia/\n" diff --git a/audio/cdparanoia/pkg-plist b/audio/cdparanoia/pkg-plist index a6e8d4d57b67..4be6b2a26b99 100644 --- a/audio/cdparanoia/pkg-plist +++ b/audio/cdparanoia/pkg-plist @@ -1,12 +1,12 @@ bin/cdparanoia include/cdda_interface.h include/cdda_paranoia.h lib/libcdda_interface.a lib/libcdda_interface.so lib/libcdda_interface.so.0 -lib/libcdda_interface.so.0.9.8 +lib/libcdda_interface.so.0.10.2 lib/libcdda_paranoia.a lib/libcdda_paranoia.so lib/libcdda_paranoia.so.0 -lib/libcdda_paranoia.so.0.9.8 +lib/libcdda_paranoia.so.0.10.2 share/man/man1/cdparanoia.1.gz