View | Details | Raw Unified | Return to bug 200925 | Differences between
and this patch

Collapse All | Expand All

(-)b/audio/cdparanoia/Makefile (-6 / +13 lines)
Lines 1-9 Link Here
1
PORTNAME=	cdparanoia
1
PORTNAME=	cdparanoia
2
PORTVERSION=	3.9.8
2
PORTVERSION=	3.10.2
3
PORTREVISION=	10
4
CATEGORIES=	audio sysutils
3
CATEGORIES=	audio sysutils
5
MASTER_SITES=	http://www.xiph.org/paranoia/download/
4
MASTER_SITES=	http://downloads.xiph.org/releases/cdparanoia/
6
DISTNAME=	${PORTNAME}-${PORTVERSION:C/^3\./III-alpha/}
5
DISTNAME=	${PORTNAME}-${PORTVERSION:C/^3\./III-/}
7
EXTRACT_SUFX=	.src.tgz
6
EXTRACT_SUFX=	.src.tgz
8
7
9
MAINTAINER=	danfe@FreeBSD.org
8
MAINTAINER=	danfe@FreeBSD.org
Lines 11-27 COMMENT= CDDA extraction tool (also known as ripper) Link Here
11
WWW=		https://www.xiph.org/paranoia/
10
WWW=		https://www.xiph.org/paranoia/
12
11
13
LICENSE=	GPLv2
12
LICENSE=	GPLv2
14
LICENSE_FILE=	${WRKSRC}/GPL
13
LICENSE_FILE=	${WRKSRC}/COPYING-GPL
15
14
16
GNU_CONFIGURE=	yes
17
USES=		gmake
15
USES=		gmake
18
USE_LDCONFIG=	yes
16
USE_LDCONFIG=	yes
19
17
18
GNU_CONFIGURE=	yes
19
20
# Selected fixes commited to upstream SVN but not released for years.
21
# To keep these apart from FreeBSD specific patches keep these as EXTRA_PATCHES.
22
EXTRA_PATCHES=	${PATCHDIR}/extra-patch-upstream-patch-r15314 \
23
		${PATCHDIR}/extra-patch-upstream-patch-r15337 \
24
		${PATCHDIR}/extra-patch-upstream-patch-r15338
25
20
post-patch:
26
post-patch:
21
	@${REINPLACE_CMD} -e 's/\(^ *default:\)/\1break;/' \
27
	@${REINPLACE_CMD} -e 's/\(^ *default:\)/\1break;/' \
22
		${WRKSRC}/interface/utils.h
28
		${WRKSRC}/interface/utils.h
23
29
24
post-install:
30
post-install:
31
	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/cdparanoia
25
	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libcdda_*.so
32
	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libcdda_*.so
26
33
27
.include <bsd.port.mk>
34
.include <bsd.port.mk>
(-)b/audio/cdparanoia/distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (cdparanoia-III-alpha9.8.src.tgz) = 1b79fae1aedc692f87d1344410f5c6b666961afccdc78bc5c4c257c450dfa008
1
TIMESTAMP = 1563302547
2
SIZE (cdparanoia-III-alpha9.8.src.tgz) = 116591
2
SHA256 (cdparanoia-III-10.2.src.tgz) = 005db45ef4ee017f5c32ec124f913a0546e77014266c6a1c50df902a55fe64df
3
SIZE (cdparanoia-III-10.2.src.tgz) = 183236
(-)b/audio/cdparanoia/files/extra-patch-upstream-patch-r15314 (+312 lines)
Added Link Here
1
Fix the cdda_enable bug that would cause the -A tests to fail on
2
drives that require a density set
3
4
Correct a bug that would cause a failed density set to abort out of
5
verify_read_command
6
7
Improve autosense order; non-density-set modes should be chacked
8
before even NULL-density modes because there's not necessarily any
9
going back (eg, Plextor lets you *set* the mode descriptor density,
10
but does not let you read it; it always reports '0')
11
12
Index: interface/interface.c
13
===================================================================
14
--- interface/interface.c	(revision 15313)
15
+++ interface/interface.c	(revision 15314)
16
@@ -90,11 +90,11 @@
17
       }
18
   }
19
 
20
+  if(d->bigendianp==-1)d->bigendianp=data_bigendianp(d);
21
+
22
   if((ret=d->enable_cdda(d,1)))
23
     return(ret);
24
     
25
-  /*  d->select_speed(d,d->maxspeed); most drives are full speed by default */
26
-  if(d->bigendianp==-1)d->bigendianp=data_bigendianp(d);
27
   return(0);
28
 }
29
 
30
Index: interface/scsi_interface.c
31
===================================================================
32
--- interface/scsi_interface.c	(revision 15313)
33
+++ interface/scsi_interface.c	(revision 15314)
34
@@ -1298,7 +1298,7 @@
35
 
36
 static int verify_read_command(cdrom_drive *d){
37
   int i,j,k;
38
-  int audioflag=0;
39
+  int audioflag=1;
40
 
41
   int  (*enablecommand)  (struct cdrom_drive *d, int speed);
42
   long (*readcommand)   (struct cdrom_drive *d, void *p, long begin, 
43
@@ -1313,7 +1313,7 @@
44
      for data */
45
 
46
   if(d->enable_cdda(d,1)==0){
47
-    
48
+    audioflag=0;
49
     for(i=1;i<=d->tracks;i++){
50
       if(cdda_track_audiop(d,i)==1){
51
 	long firstsector=cdda_track_firstsector(d,i);
52
@@ -1358,115 +1358,111 @@
53
     /* NEC test must come before sony; the nec drive expects d8 to be
54
        10 bytes, and a 12 byte verson (Sony) crashes the drive */
55
 
56
-    for(j=0;j<15;j++){
57
-      int densitypossible=1;
58
-
59
-      switch(j){
60
+    for(i=0;i<5;i++){
61
+      switch(i){
62
       case 0:
63
-	d->read_audio=scsi_read_28;
64
-	rs="28 0x,00";
65
+	d->density=0;
66
+	d->enable_cdda=Dummy;
67
+	es="none    ";
68
 	break;
69
       case 1:
70
-	d->read_audio=scsi_read_A8;
71
-	rs="a8 0x,00";
72
+	d->density=0;
73
+	d->enable_cdda=scsi_enable_cdda;
74
+	es="yes/0x00";
75
 	break;
76
-
77
       case 2:
78
-	d->read_audio=scsi_read_mmcB;
79
-	rs="be 02,10";
80
-	densitypossible=0;
81
+	d->density=0x04;
82
+	d->enable_cdda=scsi_enable_cdda;
83
+	es="yes/0x04";
84
 	break;
85
       case 3:
86
-	d->read_audio=scsi_read_mmc2B;
87
-	rs="be 02,f8";
88
-	densitypossible=0;
89
+	d->density=0x82;
90
+	d->enable_cdda=scsi_enable_cdda;
91
+	es="yes/0x82";
92
 	break;
93
       case 4:
94
-	d->read_audio=scsi_read_mmc3B;
95
-	rs="be 06,f8";
96
-	densitypossible=0;
97
+	d->density=0x81;
98
+	d->enable_cdda=scsi_enable_cdda;
99
+	es="yes/0x81";
100
 	break;
101
+      }
102
 
103
-      case 5:
104
-	d->read_audio=scsi_read_mmc;
105
-	rs="be 00,10";
106
-	densitypossible=0;
107
-	break;
108
-      case 6:
109
-	d->read_audio=scsi_read_mmc2;
110
-	rs="be 00,f8";
111
-	densitypossible=0;
112
-	break;
113
-      case 7:
114
-	d->read_audio=scsi_read_mmc3;
115
-	rs="be 04,f8";
116
-	densitypossible=0;
117
-	break;
118
-
119
-      case 8:
120
-	d->read_audio=scsi_read_msf;
121
-	rs="b9 00,10";
122
-	densitypossible=0;
123
-	break;
124
-      case 9:
125
-	d->read_audio=scsi_read_msf2;
126
-	rs="b9 00,f8";
127
-	densitypossible=0;
128
-	break;
129
-      case 10:
130
-	d->read_audio=scsi_read_msf3;
131
-	rs="b9 04,f8";
132
-	densitypossible=0;
133
-	break;
134
-
135
-      case 11:
136
-	d->read_audio=scsi_read_D4_10;
137
-	rs="d4(10)0x";
138
-	break;
139
-      case 12:
140
-	d->read_audio=scsi_read_D4_12;
141
-	rs="d4(12)0x";
142
-	break;
143
-      case 13:
144
-	d->read_audio=scsi_read_D5;
145
-	rs="d5 0x,00";
146
-	break;
147
-      case 14:
148
-	d->read_audio=scsi_read_D8;
149
-	rs="d8 0x,00";
150
-	break;
151
-      }
152
-      
153
-      for(i=0;i<5;i++){
154
-	switch(i){
155
+      for(j=0;j<15;j++){
156
+	
157
+	switch(j){
158
 	case 0:
159
-	  d->density=0;
160
-	  d->enable_cdda=Dummy;
161
-	  es="none    ";
162
-	  if(!densitypossible)i=5; /* short circuit MMC style commands */
163
+	  d->read_audio=scsi_read_28;
164
+	  rs="28 0x,00";
165
 	  break;
166
 	case 1:
167
-	  d->density=0;
168
-	  d->enable_cdda=scsi_enable_cdda;
169
-	  es="yes/0x00";
170
+	  d->read_audio=scsi_read_A8;
171
+	  rs="a8 0x,00";
172
 	  break;
173
+	  
174
+	  /* 2 through 10 do not allow/require density */
175
 	case 2:
176
-	  d->density=0x04;
177
-	  d->enable_cdda=scsi_enable_cdda;
178
-	  es="yes/0x04";
179
-	  break;
180
+	  d->read_audio=scsi_read_mmcB;
181
+	  rs="be 02,10";
182
+	  if(i==0)break;
183
 	case 3:
184
-	  d->density=0x82;
185
-	  d->enable_cdda=scsi_enable_cdda;
186
-	  es="yes/0x82";
187
-	  break;
188
+	  j=3;
189
+	  d->read_audio=scsi_read_mmc2B;
190
+	  rs="be 02,f8";
191
+	  if(i==0)break;
192
 	case 4:
193
-	  d->density=0x81;
194
-	  d->enable_cdda=scsi_enable_cdda;
195
-	  es="yes/0x81";
196
+	  j=4;
197
+	  d->read_audio=scsi_read_mmc3B;
198
+	  rs="be 06,f8";
199
+	  if(i==0)break;
200
+	case 5:
201
+	  j=5;
202
+	  d->read_audio=scsi_read_mmc;
203
+	  rs="be 00,10";
204
+	  if(i==0)break;
205
+	case 6:
206
+	  j=6;
207
+	  d->read_audio=scsi_read_mmc2;
208
+	  rs="be 00,f8";
209
+	  if(i==0)break;
210
+	case 7:
211
+	  j=7;
212
+	  d->read_audio=scsi_read_mmc3;
213
+	  rs="be 04,f8";
214
+	  if(i==0)break;
215
+	case 8:
216
+	  j=8;
217
+	  d->read_audio=scsi_read_msf;
218
+	  rs="b9 00,10";
219
+	  if(i==0)break;
220
+	case 9:
221
+	  j=9;
222
+	  d->read_audio=scsi_read_msf2;
223
+	  rs="b9 00,f8";
224
+	  if(i==0)break;
225
+	case 10:
226
+	  j=10;
227
+	  d->read_audio=scsi_read_msf3;
228
+	  rs="b9 04,f8";
229
+	  if(i==0)break;
230
+	
231
+	case 11:
232
+	  d->read_audio=scsi_read_D4_10;
233
+	  rs="d4(10)0x";
234
 	  break;
235
+	case 12:
236
+	  d->read_audio=scsi_read_D4_12;
237
+	  rs="d4(12)0x";
238
+	  break;
239
+	case 13:
240
+	  d->read_audio=scsi_read_D5;
241
+	  rs="d5 0x,00";
242
+	  break;
243
+	case 14:
244
+	  d->read_audio=scsi_read_D8;
245
+	  rs="d8 0x,00";
246
+	  break;
247
 	}
248
-
249
+	
250
 	cdmessage(d,"\ttest -> density: [");
251
 	cdmessage(d,es);
252
 	cdmessage(d,"]  command: [");
253
@@ -1525,21 +1521,21 @@
254
 	  if(zeroflag){
255
 	    char buffer[256];
256
 	    sprintf(buffer,"\t\tDrive returned %d packet(s), but contents\n"
257
-		        "\t\twere entirely zero\n",zeroflag);
258
+		    "\t\twere entirely zero\n",zeroflag);
259
 	    cdmessage(d,buffer);
260
 	  }
261
 	}
262
       }
263
     }
264
-
265
+    
266
     /* D'oh. */
267
     d->density=density;
268
     d->read_audio=readcommand;
269
     d->enable_cdda=enablecommand;
270
-
271
+    
272
     cdmessage(d,"\tUnable to find any suitable command set from probe;\n"
273
 	      "\tdrive probably not CDDA capable.\n");
274
-
275
+    
276
     cderror(d,"006: Could not read any data from drive\n");
277
 
278
   }
279
@@ -1690,33 +1686,20 @@
280
   if(d->is_atapi)d->lun=0; /* it should already be; just to make sure */
281
       
282
   if(d->is_mmc){
283
-
284
     d->read_audio = scsi_read_mmc2B;
285
     d->bigendianp=0;
286
-
287
     check_exceptions(d,mmc_list);
288
-
289
   }else{
290
-    
291
     if(d->is_atapi){
292
       /* Not MMC maybe still uses 0xbe */
293
-
294
       d->read_audio = scsi_read_mmc2B;
295
       d->bigendianp=0;
296
-
297
       check_exceptions(d,atapi_list);
298
-
299
     }else{
300
-
301
       check_exceptions(d,scsi_list);
302
-
303
     }
304
   }
305
 
306
-  if(!d->is_atapi)set_sectorsize(d,2048); /* we really do want the
307
-					     sector size at 2048 to begin.*/
308
-  d->enable_cdda(d,0);
309
-
310
   d->read_toc = (!memcmp(d->drive_model, "IMS", 3) && !d->is_atapi) ? scsi_read_toc2 : 
311
     scsi_read_toc;
312
   d->set_speed = scsi_set_speed;
(-)b/audio/cdparanoia/files/extra-patch-upstream-patch-r15337 (+31 lines)
Added Link Here
1
Commit fix to make debug (no optimization, please)
2
3
Commit fix to -p not actually outputting in host byte order (in fact,
4
it always get s it reversed regardless of endianness)
5
6
Index: Makefile.in
7
===================================================================
8
--- Makefile.in	(revision 15336)
9
+++ Makefile.in	(revision 15337)
10
@@ -10,7 +10,7 @@
11
 @SET_MAKE@
12
 FLAGS=@TYPESIZES@ @CFLAGS@
13
 OPT=@OPT@ $(FLAGS)
14
-DEBUG=@DEBUG@ $(FLAGS)
15
+DEBUG=@DEBUG@
16
 CC=@CC@
17
 LD=@CC@
18
 LDFLAGS=@LDFLAGS@ $(FLAGS)
19
Index: main.c
20
===================================================================
21
--- main.c	(revision 15336)
22
+++ main.c	(revision 15337)
23
@@ -746,7 +746,7 @@
24
       break;
25
     case 'p':
26
       output_type=0;
27
-      output_endian=-1;
28
+      output_endian=bigendianp();
29
       break;
30
     case 'r':
31
       output_type=0;
(-)b/audio/cdparanoia/files/extra-patch-upstream-patch-r15338 (+584 lines)
Added Link Here
1
Commit fix for 'private' becoming a reserved keyword as of GCC 4.3+
2
3
Index: interface/test_interface.c
4
===================================================================
5
--- interface/test_interface.c	(revision 15337)
6
+++ interface/test_interface.c	(revision 15338)
7
@@ -66,9 +66,9 @@
8
   if(!fd)fd=fdopen(d->cdda_fd,"r");
9
 
10
   if(begin<lastread)
11
-    d->private->last_milliseconds=20;
12
+    d->private_data->last_milliseconds=20;
13
   else
14
-    d->private->last_milliseconds=sectors;
15
+    d->private_data->last_milliseconds=sectors;
16
 
17
 #ifdef CDDA_TEST_UNDERRUN
18
   sectors-=1;
19
Index: interface/cdda_interface.h
20
===================================================================
21
--- interface/cdda_interface.h	(revision 15337)
22
+++ interface/cdda_interface.h	(revision 15338)
23
@@ -84,7 +84,7 @@
24
   int is_atapi;
25
   int is_mmc;
26
 
27
-  cdda_private_data_t *private;
28
+  cdda_private_data_t *private_data;
29
   void         *reserved;
30
   unsigned char inqbytes[4];
31
 
32
Index: interface/interface.c
33
===================================================================
34
--- interface/interface.c	(revision 15337)
35
+++ interface/interface.c	(revision 15338)
36
@@ -39,9 +39,9 @@
37
     if(d->drive_model)free(d->drive_model);
38
     if(d->cdda_fd!=-1)close(d->cdda_fd);
39
     if(d->ioctl_fd!=-1 && d->ioctl_fd!=d->cdda_fd)close(d->ioctl_fd);
40
-    if(d->private){
41
-      if(d->private->sg_hd)free(d->private->sg_hd);
42
-      free(d->private);
43
+    if(d->private_data){
44
+      if(d->private_data->sg_hd)free(d->private_data->sg_hd);
45
+      free(d->private_data);
46
     }
47
 
48
     free(d);
49
@@ -127,7 +127,7 @@
50
 	}
51
       }	
52
     }
53
-    if(ms)*ms=d->private->last_milliseconds;
54
+    if(ms)*ms=d->private_data->last_milliseconds;
55
     return(sectors);
56
   }
57
   
58
Index: interface/scsi_interface.c
59
===================================================================
60
--- interface/scsi_interface.c	(revision 15337)
61
+++ interface/scsi_interface.c	(revision 15338)
62
@@ -15,13 +15,13 @@
63
 static int timed_ioctl(cdrom_drive *d, int fd, int command, void *arg){
64
   struct timespec tv1;
65
   struct timespec tv2;
66
-  int ret1=clock_gettime(d->private->clock,&tv1);
67
+  int ret1=clock_gettime(d->private_data->clock,&tv1);
68
   int ret2=ioctl(fd, command,arg);
69
-  int ret3=clock_gettime(d->private->clock,&tv2);
70
+  int ret3=clock_gettime(d->private_data->clock,&tv2);
71
   if(ret1<0 || ret3<0){
72
-    d->private->last_milliseconds=-1;
73
+    d->private_data->last_milliseconds=-1;
74
   }else{
75
-    d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
76
+    d->private_data->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
77
   }
78
   return ret2;
79
 }
80
@@ -96,7 +96,7 @@
81
 static void clear_garbage(cdrom_drive *d){
82
   fd_set fdset;
83
   struct timeval tv;
84
-  struct sg_header *sg_hd=d->private->sg_hd;
85
+  struct sg_header *sg_hd=d->private_data->sg_hd;
86
   int flag=0;
87
 
88
   /* clear out any possibly preexisting garbage */
89
@@ -185,7 +185,7 @@
90
   struct timespec tv2;
91
   int tret1,tret2;
92
   int status = 0;
93
-  struct sg_header *sg_hd=d->private->sg_hd;
94
+  struct sg_header *sg_hd=d->private_data->sg_hd;
95
   long writebytes=SG_OFF+cmd_len+in_size;
96
 
97
   /* generic scsi device services */
98
@@ -195,7 +195,7 @@
99
 
100
   memset(sg_hd,0,sizeof(sg_hd)); 
101
   memset(sense_buffer,0,SG_MAX_SENSE); 
102
-  memcpy(d->private->sg_buffer,cmd,cmd_len+in_size);
103
+  memcpy(d->private_data->sg_buffer,cmd,cmd_len+in_size);
104
   sg_hd->twelve_byte = cmd_len == 12;
105
   sg_hd->result = 0;
106
   sg_hd->reply_len = SG_OFF + out_size;
107
@@ -209,7 +209,7 @@
108
      tell if the command failed.  Scared yet? */
109
 
110
   if(bytecheck && out_size>in_size){
111
-    memset(d->private->sg_buffer+cmd_len+in_size,bytefill,out_size-in_size); 
112
+    memset(d->private_data->sg_buffer+cmd_len+in_size,bytefill,out_size-in_size); 
113
     /* the size does not remove cmd_len due to the way the kernel
114
        driver copies buffers */
115
     writebytes+=(out_size-in_size);
116
@@ -243,7 +243,7 @@
117
   }
118
 
119
   sigprocmask (SIG_BLOCK, &(d->sigset), NULL );
120
-  tret1=clock_gettime(d->private->clock,&tv1);  
121
+  tret1=clock_gettime(d->private_data->clock,&tv1);  
122
   errno=0;
123
   status = write(d->cdda_fd, sg_hd, writebytes );
124
 
125
@@ -289,7 +289,7 @@
126
     }
127
   }
128
 
129
-  tret2=clock_gettime(d->private->clock,&tv2);  
130
+  tret2=clock_gettime(d->private_data->clock,&tv2);  
131
   errno=0;
132
   status = read(d->cdda_fd, sg_hd, SG_OFF + out_size);
133
   sigprocmask ( SIG_UNBLOCK, &(d->sigset), NULL );
134
@@ -313,7 +313,7 @@
135
   if(bytecheck && in_size+cmd_len<out_size){
136
     long i,flag=0;
137
     for(i=in_size;i<out_size;i++)
138
-      if(d->private->sg_buffer[i]!=bytefill){
139
+      if(d->private_data->sg_buffer[i]!=bytefill){
140
 	flag=1;
141
 	break;
142
       }
143
@@ -326,9 +326,9 @@
144
 
145
   errno=0;
146
   if(tret1<0 || tret2<0){
147
-    d->private->last_milliseconds=-1;
148
+    d->private_data->last_milliseconds=-1;
149
   }else{
150
-    d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000 + (tv2.tv_nsec-tv1.tv_nsec)/1000000;
151
+    d->private_data->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000 + (tv2.tv_nsec-tv1.tv_nsec)/1000000;
152
   }
153
   return(0);
154
 }
155
@@ -347,7 +347,7 @@
156
 
157
   memset(&hdr,0,sizeof(hdr));
158
   memset(sense,0,sizeof(sense));
159
-  memcpy(d->private->sg_buffer,cmd+cmd_len,in_size);
160
+  memcpy(d->private_data->sg_buffer,cmd+cmd_len,in_size);
161
 
162
   hdr.cmdp = cmd;
163
   hdr.cmd_len = cmd_len;
164
@@ -355,7 +355,7 @@
165
   hdr.mx_sb_len = SG_MAX_SENSE;
166
   hdr.timeout = 50000;
167
   hdr.interface_id = 'S';
168
-  hdr.dxferp =  d->private->sg_buffer;
169
+  hdr.dxferp =  d->private_data->sg_buffer;
170
   hdr.flags = SG_FLAG_DIRECT_IO;  /* direct IO if we can get it */
171
 
172
   /* scary buffer fill hack */
173
@@ -400,7 +400,7 @@
174
   if(bytecheck && in_size<out_size){
175
     long i,flag=0;
176
     for(i=in_size;i<out_size;i++)
177
-      if(d->private->sg_buffer[i]!=bytefill){
178
+      if(d->private_data->sg_buffer[i]!=bytefill){
179
 	flag=1;
180
 	break;
181
       }
182
@@ -412,7 +412,7 @@
183
   }
184
 
185
   /* Can't rely on .duration because we can't be certain kernel has HZ set to something useful */
186
-  /* d->private->last_milliseconds = hdr.duration; */
187
+  /* d->private_data->last_milliseconds = hdr.duration; */
188
 
189
   errno = 0;
190
   return 0;
191
@@ -445,9 +445,9 @@
192
 
193
   handle_scsi_cmd(d, cmd, 6, 0, 56, 0,0, sense);
194
 
195
-  key = d->private->sg_buffer[2] & 0xf;
196
-  ASC = d->private->sg_buffer[12];
197
-  ASCQ = d->private->sg_buffer[13];
198
+  key = d->private_data->sg_buffer[2] & 0xf;
199
+  ASC = d->private_data->sg_buffer[12];
200
+  ASCQ = d->private_data->sg_buffer[13];
201
   
202
   if(key == 2 && ASC == 4 && ASCQ == 1) return 0;
203
   return 1;
204
@@ -492,7 +492,7 @@
205
   if (handle_scsi_cmd (d, cmd, 10, 0, size+4,'\377',1,sense)) return(1);
206
 
207
   {
208
-    unsigned char *b=d->private->sg_buffer;
209
+    unsigned char *b=d->private_data->sg_buffer;
210
     if(b[0])return(1); /* Handles only up to 256 bytes */
211
     if(b[6])return(1); /* Handles only up to 256 bytes */
212
 
213
@@ -604,8 +604,8 @@
214
 static unsigned int get_orig_sectorsize(cdrom_drive *d){
215
   if(mode_sense(d,12,0x01))return(-1);
216
 
217
-  d->orgdens = d->private->sg_buffer[4];
218
-  return(d->orgsize = ((int)(d->private->sg_buffer[10])<<8)+d->private->sg_buffer[11]);
219
+  d->orgdens = d->private_data->sg_buffer[4];
220
+  return(d->orgsize = ((int)(d->private_data->sg_buffer[10])<<8)+d->private_data->sg_buffer[11]);
221
 }
222
 
223
 /* switch CDROM scsi drives to given sector size  */
224
@@ -664,8 +664,8 @@
225
     return(-4);
226
   }
227
 
228
-  first=d->private->sg_buffer[2];
229
-  last=d->private->sg_buffer[3];
230
+  first=d->private_data->sg_buffer[2];
231
+  last=d->private_data->sg_buffer[3];
232
   tracks=last-first+1;
233
 
234
   if (last > MAXTRK || first > MAXTRK || last<0 || first<0) {
235
@@ -683,7 +683,7 @@
236
       return(-5);
237
     }
238
     {
239
-      scsi_TOC *toc=(scsi_TOC *)(d->private->sg_buffer+4);
240
+      scsi_TOC *toc=(scsi_TOC *)(d->private_data->sg_buffer+4);
241
 
242
       d->disc_toc[i-first].bFlags=toc->bFlags;
243
       d->disc_toc[i-first].bTrack=i;
244
@@ -704,7 +704,7 @@
245
     return(-2);
246
   }
247
   {
248
-    scsi_TOC *toc=(scsi_TOC *)(d->private->sg_buffer+4);
249
+    scsi_TOC *toc=(scsi_TOC *)(d->private_data->sg_buffer+4);
250
     
251
     d->disc_toc[i-first].bFlags=toc->bFlags;
252
     d->disc_toc[i-first].bTrack=0xAA;
253
@@ -738,7 +738,7 @@
254
   }
255
 
256
   /* copy to our structure and convert start sector */
257
-  tracks = d->private->sg_buffer[1];
258
+  tracks = d->private_data->sg_buffer[1];
259
   if (tracks > MAXTRK) {
260
     cderror(d,"003: CDROM reporting illegal number of tracks\n");
261
     return(-3);
262
@@ -754,33 +754,33 @@
263
       return(-5);
264
     }
265
     
266
-    d->disc_toc[i].bFlags = d->private->sg_buffer[10];
267
+    d->disc_toc[i].bFlags = d->private_data->sg_buffer[10];
268
     d->disc_toc[i].bTrack = i + 1;
269
 
270
     d->disc_toc[i].dwStartSector= d->adjust_ssize * 
271
-	(((signed char)(d->private->sg_buffer[2])<<24) | 
272
-	 (d->private->sg_buffer[3]<<16)|
273
-	 (d->private->sg_buffer[4]<<8)|
274
-	 (d->private->sg_buffer[5]));
275
+	(((signed char)(d->private_data->sg_buffer[2])<<24) | 
276
+	 (d->private_data->sg_buffer[3]<<16)|
277
+	 (d->private_data->sg_buffer[4]<<8)|
278
+	 (d->private_data->sg_buffer[5]));
279
   }
280
 
281
   d->disc_toc[i].bFlags = 0;
282
   d->disc_toc[i].bTrack = i + 1;
283
-  memcpy (&foo, d->private->sg_buffer+2, 4);
284
-  memcpy (&bar, d->private->sg_buffer+6, 4);
285
+  memcpy (&foo, d->private_data->sg_buffer+2, 4);
286
+  memcpy (&bar, d->private_data->sg_buffer+6, 4);
287
   d->disc_toc[i].dwStartSector = d->adjust_ssize * (be32_to_cpu(foo) +
288
 						    be32_to_cpu(bar));
289
 
290
   d->disc_toc[i].dwStartSector= d->adjust_ssize * 
291
-    ((((signed char)(d->private->sg_buffer[2])<<24) | 
292
-      (d->private->sg_buffer[3]<<16)|
293
-      (d->private->sg_buffer[4]<<8)|
294
-      (d->private->sg_buffer[5]))+
295
+    ((((signed char)(d->private_data->sg_buffer[2])<<24) | 
296
+      (d->private_data->sg_buffer[3]<<16)|
297
+      (d->private_data->sg_buffer[4]<<8)|
298
+      (d->private_data->sg_buffer[5]))+
299
      
300
-     ((((signed char)(d->private->sg_buffer[6])<<24) | 
301
-       (d->private->sg_buffer[7]<<16)|
302
-       (d->private->sg_buffer[8]<<8)|
303
-       (d->private->sg_buffer[9]))));
304
+     ((((signed char)(d->private_data->sg_buffer[6])<<24) | 
305
+       (d->private_data->sg_buffer[7]<<16)|
306
+       (d->private_data->sg_buffer[8]<<8)|
307
+       (d->private_data->sg_buffer[9]))));
308
 
309
 
310
   d->cd_extra = FixupTOC(d,tracks+1);
311
@@ -817,7 +817,7 @@
312
   cmd[8] = sectors;
313
   if((ret=handle_scsi_cmd(d,cmd,10,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
314
     return(ret);
315
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
316
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
317
   return(0);
318
 }
319
 
320
@@ -836,7 +836,7 @@
321
   cmd[9] = sectors;
322
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
323
     return(ret);
324
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
325
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
326
   return(0);
327
 }
328
 
329
@@ -854,7 +854,7 @@
330
   cmd[8] = sectors;
331
   if((ret=handle_scsi_cmd(d,cmd,10,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
332
     return(ret);
333
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
334
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
335
   return(0);
336
 }
337
 
338
@@ -872,7 +872,7 @@
339
   cmd[9] = sectors;
340
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
341
     return(ret);
342
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
343
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
344
   return(0);
345
 }
346
 
347
@@ -890,7 +890,7 @@
348
   cmd[8] = sectors;
349
   if((ret=handle_scsi_cmd(d,cmd,10,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
350
     return(ret);
351
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
352
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
353
   return(0);
354
 }
355
 
356
@@ -908,7 +908,7 @@
357
   cmd[9] = sectors;
358
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
359
     return(ret);
360
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
361
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
362
   return(0);
363
 }
364
 
365
@@ -922,7 +922,7 @@
366
   cmd[8] = sectors;
367
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
368
     return(ret);
369
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
370
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
371
   return(0);
372
 }
373
 
374
@@ -936,7 +936,7 @@
375
   cmd[8] = sectors;
376
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
377
     return(ret);
378
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
379
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
380
   return(0);
381
 }
382
 
383
@@ -950,7 +950,7 @@
384
   cmd[8] = sectors;
385
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
386
     return(ret);
387
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
388
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
389
   return(0);
390
 }
391
 
392
@@ -964,7 +964,7 @@
393
   cmd[8] = sectors;
394
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
395
     return(ret);
396
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
397
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
398
   return(0);
399
 }
400
 
401
@@ -978,7 +978,7 @@
402
   cmd[8] = sectors;
403
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
404
     return(ret);
405
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
406
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
407
   return(0);
408
 }
409
 
410
@@ -992,7 +992,7 @@
411
   cmd[8] = sectors;
412
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
413
     return(ret);
414
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
415
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
416
   return(0);
417
 }
418
 
419
@@ -1026,7 +1026,7 @@
420
 
421
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
422
     return(ret);
423
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
424
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
425
   return(0);
426
 }
427
 
428
@@ -1039,7 +1039,7 @@
429
 
430
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
431
     return(ret);
432
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
433
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
434
   return(0);
435
 }
436
 
437
@@ -1052,7 +1052,7 @@
438
   
439
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
440
     return(ret);
441
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
442
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
443
   return(0);
444
 }
445
 
446
@@ -1275,7 +1275,7 @@
447
 static int count_2352_bytes(cdrom_drive *d){
448
   long i;
449
   for(i=2351;i>=0;i--)
450
-    if(d->private->sg_buffer[i]!=(unsigned char)'\177')
451
+    if(d->private_data->sg_buffer[i]!=(unsigned char)'\177')
452
       return(((i+3)>>2)<<2);
453
 
454
   return(0);
455
@@ -1284,7 +1284,7 @@
456
 static int verify_nonzero(cdrom_drive *d){
457
   long i,flag=0;
458
   for(i=0;i<2352;i++)
459
-    if(d->private->sg_buffer[i]!=0){
460
+    if(d->private_data->sg_buffer[i]!=0){
461
       flag=1;
462
       break;
463
     }
464
@@ -1621,7 +1621,7 @@
465
   d->is_mmc=0;
466
   if(mode_sense(d,22,0x2A)==0){
467
   
468
-    b=d->private->sg_buffer;
469
+    b=d->private_data->sg_buffer;
470
     b+=b[3]+4;
471
     
472
     if((b[0]&0x3F)==0x2A){
473
@@ -1669,7 +1669,7 @@
474
     cderror(d,"008: Unable to identify CDROM model\n");
475
     return(NULL);
476
   }
477
-  return (d->private->sg_buffer);
478
+  return (d->private_data->sg_buffer);
479
 }
480
 
481
 int scsi_init_drive(cdrom_drive *d){
482
@@ -1725,8 +1725,8 @@
483
   check_cache(d);
484
 
485
   d->error_retry=1;
486
-  d->private->sg_hd=realloc(d->private->sg_hd,d->nsectors*CD_FRAMESIZE_RAW + SG_OFF + 128);
487
-  d->private->sg_buffer=((unsigned char *)d->private->sg_hd)+SG_OFF;
488
+  d->private_data->sg_hd=realloc(d->private_data->sg_hd,d->nsectors*CD_FRAMESIZE_RAW + SG_OFF + 128);
489
+  d->private_data->sg_buffer=((unsigned char *)d->private_data->sg_hd)+SG_OFF;
490
   d->report_all=1;
491
   return(0);
492
 }
493
Index: interface/cooked_interface.c
494
===================================================================
495
--- interface/cooked_interface.c	(revision 15337)
496
+++ interface/cooked_interface.c	(revision 15338)
497
@@ -13,13 +13,13 @@
498
 static int timed_ioctl(cdrom_drive *d, int fd, int command, void *arg){
499
   struct timespec tv1;
500
   struct timespec tv2;
501
-  int ret1=clock_gettime(d->private->clock,&tv1);
502
+  int ret1=clock_gettime(d->private_data->clock,&tv1);
503
   int ret2=ioctl(fd, command,arg);
504
-  int ret3=clock_gettime(d->private->clock,&tv2);
505
+  int ret3=clock_gettime(d->private_data->clock,&tv2);
506
   if(ret1<0 || ret3<0){
507
-    d->private->last_milliseconds=-1;
508
+    d->private_data->last_milliseconds=-1;
509
   }else{
510
-    d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
511
+    d->private_data->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
512
   }
513
   return ret2;
514
 }
515
Index: interface/scan_devices.c
516
===================================================================
517
--- interface/scan_devices.c	(revision 15337)
518
+++ interface/scan_devices.c	(revision 15338)
519
@@ -264,11 +264,11 @@
520
   d->interface=COOKED_IOCTL;
521
   d->bigendianp=-1; /* We don't know yet... */
522
   d->nsectors=-1;
523
-  d->private=calloc(1,sizeof(*d->private));
524
+  d->private_data=calloc(1,sizeof(*d->private_data));
525
   {
526
     /* goddamnit */
527
     struct timespec tv;
528
-    d->private->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC);
529
+    d->private_data->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC);
530
   }
531
   idmessage(messagedest,messages,"\t\tCDROM sensed: %s\n",description);
532
   return(d);
533
@@ -674,15 +674,15 @@
534
   d->bigendianp=-1; /* We don't know yet... */
535
   d->nsectors=-1;
536
   d->messagedest = messagedest;
537
-  d->private=calloc(1,sizeof(*d->private));
538
+  d->private_data=calloc(1,sizeof(*d->private_data));
539
   {
540
     /* goddamnit */
541
     struct timespec tv;
542
-    d->private->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC);
543
+    d->private_data->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC);
544
   }
545
   if(use_sgio){
546
     d->interface=SGIO_SCSI;
547
-    d->private->sg_buffer=(unsigned char *)(d->private->sg_hd=malloc(MAX_BIG_BUFF_SIZE));
548
+    d->private_data->sg_buffer=(unsigned char *)(d->private_data->sg_hd=malloc(MAX_BIG_BUFF_SIZE));
549
     g_fd=d->cdda_fd=dup(d->ioctl_fd);
550
   }else{
551
     version=verify_SG_version(d,messagedest,messages);
552
@@ -696,8 +696,8 @@
553
     }
554
 
555
     /* malloc our big buffer for scsi commands */
556
-    d->private->sg_hd=malloc(MAX_BIG_BUFF_SIZE);
557
-    d->private->sg_buffer=((unsigned char *)d->private->sg_hd)+SG_OFF;
558
+    d->private_data->sg_hd=malloc(MAX_BIG_BUFF_SIZE);
559
+    d->private_data->sg_buffer=((unsigned char *)d->private_data->sg_hd)+SG_OFF;
560
   }
561
 
562
   {
563
@@ -772,9 +772,9 @@
564
   if(i_fd!=-1)close(i_fd);
565
   if(g_fd!=-1)close(g_fd);
566
   if(d){
567
-    if(d->private){
568
-      if(d->private->sg_hd)free(d->private->sg_hd);
569
-      free(d->private);
570
+    if(d->private_data){
571
+      if(d->private_data->sg_hd)free(d->private_data->sg_hd);
572
+      free(d->private_data);
573
     }
574
     free(d);
575
   }
576
@@ -821,7 +821,7 @@
577
   d->interface=TEST_INTERFACE;
578
   d->bigendianp=-1; /* We don't know yet... */
579
   d->nsectors=-1;
580
-  d->private=calloc(1,sizeof(*d->private));
581
+  d->private_data=calloc(1,sizeof(*d->private_data));
582
   d->drive_model=copystring("File based test interface");
583
   idmessage(messagedest,messages,"\t\tCDROM sensed: %s\n",d->drive_model);
584
   
(-)b/audio/cdparanoia/files/patch-Makefile.in (-8 / +8 lines)
Lines 1-4 Link Here
1
--- Makefile.in.orig	2001-03-27 22:46:58 UTC
1
--- Makefile.in.orig	2019-07-25 21:55:03 UTC
2
+++ Makefile.in
2
+++ Makefile.in
3
@@ -8,7 +8,7 @@ VPATH=@srcdir@
3
@@ -8,7 +8,7 @@ VPATH=@srcdir@
4
 srcdir=@srcdir@
4
 srcdir=@srcdir@
Lines 7-29 Link Here
7
-FLAGS=@TYPESIZES@ @CFLAGS@
7
-FLAGS=@TYPESIZES@ @CFLAGS@
8
+FLAGS=@TYPESIZES@ @CPPFLAGS@ @CFLAGS@ -I./interface
8
+FLAGS=@TYPESIZES@ @CPPFLAGS@ @CFLAGS@ -I./interface
9
 OPT=@OPT@ $(FLAGS)
9
 OPT=@OPT@ $(FLAGS)
10
 DEBUG=@DEBUG@ $(FLAGS)
10
 DEBUG=@DEBUG@
11
 CC=@CC@
11
 CC=@CC@
12
@@ -32,7 +32,7 @@ export VERSION
12
@@ -32,7 +32,7 @@ export VERSION
13
 
13
 
14
 ifeq ($(STATIC),TRUE)
14
 ifeq ($(STATIC),TRUE)
15
 	LIBS = interface/libcdda_interface.a paranoia/libcdda_paranoia.a \
15
 	LIBS = interface/libcdda_interface.a paranoia/libcdda_paranoia.a \
16
-		-static -lm
16
-		-static -lm -lrt
17
+		-lm -lcam
17
+		-lm -lrt -lcam
18
 	LIBDEP = interface/libcdda_interface.a paranoia/libcdda_paranoia.a
18
 	LIBDEP = interface/libcdda_interface.a paranoia/libcdda_paranoia.a
19
 else
19
 else
20
 	LIBS = -lcdda_interface -lcdda_paranoia -lm
20
 	LIBS = -lcdda_interface -lcdda_paranoia -lm -lrt
21
@@ -64,28 +64,27 @@ slib:
21
@@ -63,28 +63,27 @@ slib:
22
 	cd paranoia && $(MAKE) slib
22
 	cd paranoia && $(MAKE) slib
23
 
23
 
24
 install:
24
 install:
25
-	$(INSTALL) -d -m 0755 $(BINDIR)
25
-	$(INSTALL) -d -m 0755 $(BINDIR)
26
-	$(INSTALL) -m 0755 $(srcdir)/cdparanoia $(BINDIR)
26
-	$(INSTALL) -m 755 $(srcdir)/cdparanoia $(BINDIR)
27
-	$(INSTALL) -d -m 0755 $(MANDIR)
27
-	$(INSTALL) -d -m 0755 $(MANDIR)
28
-	$(INSTALL) -d -m 0755 $(MANDIR)/man1
28
-	$(INSTALL) -d -m 0755 $(MANDIR)/man1
29
-	$(INSTALL) -m 0644 $(srcdir)/cdparanoia.1 $(MANDIR)/man1
29
-	$(INSTALL) -m 0644 $(srcdir)/cdparanoia.1 $(MANDIR)/man1
Lines 37-43 Link Here
37
-	$(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.a $(LIBDIR)
37
-	$(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.a $(LIBDIR)
38
-	$(INSTALL) -m 0644 $(srcdir)/utils.h $(INCLUDEDIR)
38
-	$(INSTALL) -m 0644 $(srcdir)/utils.h $(INCLUDEDIR)
39
+	$(INSTALL) -d -m 0755 $(DESTDIR)$(BINDIR)
39
+	$(INSTALL) -d -m 0755 $(DESTDIR)$(BINDIR)
40
+	$(INSTALL) -m 0755 $(srcdir)/cdparanoia $(DESTDIR)$(BINDIR)
40
+	$(INSTALL) -m 755 $(srcdir)/cdparanoia $(DESTDIR)$(BINDIR)
41
+	$(INSTALL) -d -m 0755 $(DESTDIR)$(MANDIR)
41
+	$(INSTALL) -d -m 0755 $(DESTDIR)$(MANDIR)
42
+	$(INSTALL) -d -m 0755 $(DESTDIR)$(MANDIR)/man1
42
+	$(INSTALL) -d -m 0755 $(DESTDIR)$(MANDIR)/man1
43
+	$(INSTALL) -m 0644 $(srcdir)/cdparanoia.1 $(DESTDIR)$(MANDIR)/man1
43
+	$(INSTALL) -m 0644 $(srcdir)/cdparanoia.1 $(DESTDIR)$(MANDIR)/man1
(-)a/audio/cdparanoia/files/patch-configure (-15 lines)
Removed Link Here
1
Index: configure
2
===================================================================
3
RCS file: /home/cvs/cdparanoia/configure,v
4
retrieving revision 1.1.1.1
5
retrieving revision 1.2
6
--- configure.orig	2000-04-15 15:13:01 UTC
7
+++ configure
8
@@ -1084,7 +1084,6 @@ EOF
9
 fi
10
 
11
 
12
-CFLAGS=""
13
 
14
 TYPESIZES="" 
15
 
(-)b/audio/cdparanoia/files/patch-interface_Makefile.in (-17 / +7 lines)
Lines 3-27 Index: interface/Makefile.in Link Here
3
RCS file: /home/cvs/cdparanoia/interface/Makefile.in,v
3
RCS file: /home/cvs/cdparanoia/interface/Makefile.in,v
4
retrieving revision 1.1.1.1
4
retrieving revision 1.1.1.1
5
retrieving revision 1.3
5
retrieving revision 1.3
6
--- interface/Makefile.in.orig	1999-12-14 04:27:59 UTC
6
--- interface/Makefile.in.orig	2008-08-21 16:08:54 UTC
7
+++ interface/Makefile.in
7
+++ interface/Makefile.in
8
@@ -9,13 +9,13 @@ srcdir=@srcdir@
8
@@ -9,13 +9,13 @@ srcdir=@srcdir@
9
 @SET_MAKE@
9
 @SET_MAKE@
10
 FLAGS=@SBPCD_H@ @UCDROM_H@ @TYPESIZES@ @CFLAGS@
10
 FLAGS=@SBPCD_H@ @UCDROM_H@ @TYPESIZES@ @CFLAGS@
11
 OPT=@OPT@ $(FLAGS)
11
 OPT=@OPT@ $(FLAGS)
12
-DEBUG=@DEBUG@ $(FLAGS) -DCDDA_TEST
12
-DEBUG=@DEBUG@ -DCDDA_TEST
13
+DEBUG=@DEBUG@ $(FLAGS)
13
+DEBUG=@DEBUG@ $(FLAGS)
14
 CC=@CC@
14
 CC=@CC@
15
 LD=@CC@
15
 LD=@CC@
16
 LDFLAGS=@LDFLAGS@ $(FLAGS)
16
 LDFLAGS=@LDFLAGS@ $(FLAGS)
17
 AR=@AR@
17
 AR=@AR@
18
 RANLIB=@RANLIB@
18
 RANLIB=@RANLIB@
19
-LIBS = -lm
19
-LIBS = -lm -lrt
20
+LIBS = -lm -lcam
20
+LIBS = -lm -lrt -lcam
21
 CPPFLAGS+=-D_REENTRANT
21
 CPPFLAGS+=-D_REENTRANT
22
 
22
 
23
 OFILES = scan_devices.o	common_interface.o cooked_interface.o interface.o\
23
 OFILES = scan_devices.o	common_interface.o cooked_interface.o interface.o\
24
@@ -23,19 +23,15 @@ OFILES = scan_devices.o	common_interface
24
@@ -23,18 +23,14 @@ OFILES = scan_devices.o	common_interface.o cooked_inte
25
 
25
 
26
 export VERSION
26
 export VERSION
27
 
27
 
Lines 38-56 retrieving revision 1.3 Link Here
38
 	$(MAKE) lessmessy
38
 	$(MAKE) lessmessy
39
 	$(MAKE) libcdda_interface.so CFLAGS="$(OPT) -fpic" 
39
 	$(MAKE) libcdda_interface.so CFLAGS="$(OPT) -fpic" 
40
 	[ -e libcdda_interface.so.0 ] || ln -s libcdda_interface.so libcdda_interface.so.0
40
 	[ -e libcdda_interface.so.0 ] || ln -s libcdda_interface.so libcdda_interface.so.0
41
 
41
+
42
+debug:
42
+debug:
43
+	$(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)"
43
+	$(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)"
44
+
44
 
45
 test:	
45
 test:	
46
 	$(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)"
46
 	$(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)"
47
 	$(CC) $(DEBUG) -c test.c
48
@@ -46,7 +42,7 @@ libcdda_interface.a: 	$(OFILES)	
49
 	$(RANLIB) libcdda_interface.a
50
 
51
 libcdda_interface.so: 	$(OFILES)	
52
-	$(CC) -fpic -shared -o libcdda_interface.so.0.$(VERSION) -Wl,-soname -Wl,libcdda_interface.so.0 $(OFILES)
53
+	$(CC) -fpic -shared -o libcdda_interface.so.0.$(VERSION) -Wl,-soname -Wl,libcdda_interface.so.0 $(OFILES) ${LIBS}
54
 	[ -e libcdda_interface.so.0 ] || ln -s libcdda_interface.so.0.$(VERSION) libcdda_interface.so.0
55
 	[ -e libcdda_interface.so ] || ln -s libcdda_interface.so.0.$(VERSION) libcdda_interface.so
56
 
(-)b/audio/cdparanoia/files/patch-interface_cdda__interface.h (-17 / +5 lines)
Lines 1-18 Link Here
1
--- interface/cdda_interface.h.orig	2001-03-24 01:15:46 UTC
1
--- interface/cdda_interface.h.orig	2008-09-11 10:43:52 UTC
2
+++ interface/cdda_interface.h
2
+++ interface/cdda_interface.h
3
@@ -21,6 +21,11 @@
3
@@ -21,6 +21,13 @@
4
 #include <sys/types.h>
4
 #include <sys/types.h>
5
 #include <signal.h>
5
 #include <signal.h>
6
 
6
 
7
+#ifdef __FreeBSD__
7
+#ifdef __FreeBSD__
8
+#include <stdio.h>
8
+#include <stdio.h>
9
+#include <camlib.h>
9
+#include <camlib.h>
10
+
11
+#define ENOMEDIUM 12345
10
+#endif
12
+#endif
11
+
13
+
12
 #define MAXTRK 100
14
 #define MAXTRK 100
13
 
15
 
14
 typedef struct TOC {	/* structure of table of contents */
16
 typedef struct TOC {	/* structure of table of contents */
15
@@ -47,13 +52,19 @@ typedef struct cdrom_drive{
17
@@ -49,13 +56,19 @@ typedef struct cdrom_drive{
16
   int opened; /* This struct may just represent a candidate for opening */
18
   int opened; /* This struct may just represent a candidate for opening */
17
 
19
 
18
   char *cdda_device_name;
20
   char *cdda_device_name;
Lines 34-50 Link Here
34
   int interface;
36
   int interface;
35
   int bigendianp;
37
   int bigendianp;
36
   int nsectors;
38
   int nsectors;
37
@@ -83,9 +94,13 @@ typedef struct cdrom_drive{
38
   int is_mmc;
39
 
40
   /* SCSI command buffer and offset pointers */
41
+#ifdef Linux
42
   unsigned char *sg;
43
   unsigned char *sg_buffer;
44
   unsigned char inqbytes[4];
45
+#elif defined(__FreeBSD__)
46
+  unsigned char *sg_buffer;
47
+#endif
48
 
49
   /* Scsi parameters and state */
50
   unsigned char density;
(-)b/audio/cdparanoia/files/patch-interface_common__interface.c (-10 / +25 lines)
Lines 3-31 Index: interface/common_interface.c Link Here
3
RCS file: /home/cvs/cdparanoia/interface/common_interface.c,v
3
RCS file: /home/cvs/cdparanoia/interface/common_interface.c,v
4
retrieving revision 1.1.1.1
4
retrieving revision 1.1.1.1
5
retrieving revision 1.5
5
retrieving revision 1.5
6
--- interface/common_interface.c.orig	2000-04-19 22:41:04 UTC
6
--- interface/common_interface.c.orig	2008-08-21 16:08:54 UTC
7
+++ interface/common_interface.c
7
+++ interface/common_interface.c
8
@@ -13,12 +13,19 @@
8
@@ -13,15 +13,25 @@
9
 #include "utils.h"
9
 #include "utils.h"
10
 #include "smallft.h"
10
 #include "smallft.h"
11
 
11
 
12
+#ifdef Linux
12
+#ifdef Linux
13
 #include <linux/hdreg.h>
13
 #include <linux/hdreg.h>
14
+#elif defined(__FreeBSD__)
15
+#include <sys/cdio.h>
14
+#endif
16
+#endif
15
 
17
 
16
 /* Test for presence of a cdrom by pinging with the 'CDROMVOLREAD' ioctl() */
18
 /* Test for presence of a cdrom by pinging with the 'CDROMVOLREAD' ioctl() */
19
 /* Also test using CDROM_GET_CAPABILITY (if available) as some newer DVDROMs will
20
    reject CDROMVOLREAD ioctl for god-knows-what reason */
17
 int ioctl_ping_cdrom(int fd){
21
 int ioctl_ping_cdrom(int fd){
18
+#ifdef Linux
22
+#ifdef Linux
19
   struct cdrom_volctrl volctl;
23
   struct cdrom_volctrl volctl;
20
   if (ioctl(fd, CDROMVOLREAD, &volctl)) 
24
   if (ioctl(fd, CDROMVOLREAD, &volctl) &&
25
       ioctl(fd, CDROM_GET_CAPABILITY, NULL)<0)
21
+#elif defined(__FreeBSD__)
26
+#elif defined(__FreeBSD__)
22
+  struct ioc_vol volctl;
27
+  struct ioc_vol volctl;
23
+  if (ioctl(fd, CDIOCGETVOL, &volctl))
28
+  if (ioctl(fd, CDIOCGETVOL, &volctl) &&
29
+     (ioctl(fd, CDIOCCAPABILITY, NULL)<0))
24
+#endif
30
+#endif
25
     return(1); /* failure */
31
     return(1); /* failure */
26
 
32
 
27
   return(0);
33
   return(0);
28
@@ -26,6 +33,7 @@ int ioctl_ping_cdrom(int fd){
34
@@ -29,6 +39,7 @@ int ioctl_ping_cdrom(int fd){
29
 }
35
 }
30
 
36
 
31
 
37
 
Lines 33-39 retrieving revision 1.5 Link Here
33
 /* Use the ioctl thingy above ping the cdrom; this will get model info */
39
 /* Use the ioctl thingy above ping the cdrom; this will get model info */
34
 char *atapi_drive_info(int fd){
40
 char *atapi_drive_info(int fd){
35
   /* Work around the fact that the struct grew without warning in
41
   /* Work around the fact that the struct grew without warning in
36
@@ -46,6 +54,7 @@ char *atapi_drive_info(int fd){
42
@@ -49,6 +60,7 @@ char *atapi_drive_info(int fd){
37
   free(id);
43
   free(id);
38
   return(ret);
44
   return(ret);
39
 }
45
 }
Lines 41-48 retrieving revision 1.5 Link Here
41
 
47
 
42
 int data_bigendianp(cdrom_drive *d){
48
 int data_bigendianp(cdrom_drive *d){
43
   float lsb_votes=0;
49
   float lsb_votes=0;
44
@@ -171,7 +180,9 @@ int data_bigendianp(cdrom_drive *d){
50
@@ -174,7 +186,9 @@ int data_bigendianp(cdrom_drive *d){
45
    knows the leasoud/leadin size. */
51
    knows the leadout/leadin size. */
46
 
52
 
47
 int FixupTOC(cdrom_drive *d,int tracks){
53
 int FixupTOC(cdrom_drive *d,int tracks){
48
+#ifdef Linux
54
+#ifdef Linux
Lines 51-57 retrieving revision 1.5 Link Here
51
   int j;
57
   int j;
52
   
58
   
53
   /* First off, make sure the 'starting sector' is >=0 */
59
   /* First off, make sure the 'starting sector' is >=0 */
54
@@ -208,6 +219,8 @@ int FixupTOC(cdrom_drive *d,int tracks){
60
@@ -211,6 +225,8 @@ int FixupTOC(cdrom_drive *d,int tracks){
55
   /* For a scsi device, the ioctl must go to the specialized SCSI
61
   /* For a scsi device, the ioctl must go to the specialized SCSI
56
      CDROM device, not the generic device. */
62
      CDROM device, not the generic device. */
57
 
63
 
Lines 60-69 retrieving revision 1.5 Link Here
60
   if (d->ioctl_fd != -1) {
66
   if (d->ioctl_fd != -1) {
61
     int result;
67
     int result;
62
 
68
 
63
@@ -231,6 +244,7 @@ int FixupTOC(cdrom_drive *d,int tracks){
69
@@ -235,6 +251,16 @@ int FixupTOC(cdrom_drive *d,int tracks){
64
       return 1;
70
       return 1;
65
     }
71
     }
66
   }
72
   }
73
+#elif defined(__FreeBSD__)
74
+    for (j = tracks-1; j >= 0; j--) {
75
+      if (j > 0 && !IS_AUDIO(d,j) && IS_AUDIO(d,j-1)) {
76
+        if ((d->disc_toc[j].dwStartSector > d->disc_toc[j].dwStartSector - 11400) &&
77
+            (d->disc_toc[j].dwStartSector - 11400 > d->disc_toc[j-1].dwStartSector))
78
+          d->disc_toc[j].dwStartSector = d->disc_toc[j].dwStartSector - 11400;
79
+        break;
80
+      }
81
+    }
67
+#endif
82
+#endif
68
   return 0;
83
   return 0;
69
 }
84
 }
(-)b/audio/cdparanoia/files/patch-interface_cooked__interface.c (-10 / +10 lines)
Lines 1-24 Link Here
1
--- interface/cooked_interface.c.orig	2000-04-19 22:41:04 UTC
1
--- interface/cooked_interface.c.orig	2008-08-26 09:55:22 UTC
2
+++ interface/cooked_interface.c
2
+++ interface/cooked_interface.c
3
@@ -1,6 +1,8 @@
3
@@ -1,6 +1,8 @@
4
 /******************************************************************
4
 /******************************************************************
5
  * CopyPolicy: GNU Public License 2 applies
5
  * CopyPolicy: GNU Lesser General Public License 2.1 applies
6
  * Copyright (C) Monty xiphmont@mit.edu
6
  * Copyright (C) Monty xiphmont@mit.edu
7
+ * FreeBSD porting (c) 2003
7
+ * FreeBSD porting (c) 2003
8
+ * 	Simon 'corecode' Schubert <corecode@corecode.ath.cx>
8
+ * 	Simon 'corecode' Schubert <corecode@corecode.ath.cx>
9
  *
9
  *
10
  * CDROM code specific to the cooked ioctl interface
10
  * CDROM code specific to the cooked ioctl interface
11
  *
11
  *
12
@@ -10,6 +12,7 @@
12
@@ -24,6 +26,7 @@ static int timed_ioctl(cdrom_drive *d, int fd, int com
13
 #include "common_interface.h"
13
   return ret2;
14
 #include "utils.h"
14
 }
15
 
15
 
16
+#ifdef Linux
16
+#ifdef Linux
17
 static int cooked_readtoc (cdrom_drive *d){
17
 static int cooked_readtoc (cdrom_drive *d){
18
   int i;
18
   int i;
19
   int tracks;
19
   int tracks;
20
@@ -129,6 +132,142 @@ static long cooked_read (cdrom_drive *d,
20
@@ -157,6 +160,142 @@ static long cooked_read (cdrom_drive *d, void *p, long
21
   return(sectors);
21
   return ret;
22
 }
22
 }
23
 
23
 
24
+#elif defined(__FreeBSD__)
24
+#elif defined(__FreeBSD__)
Lines 160-166 Link Here
160
 /* hook */
160
 /* hook */
161
 static int Dummy (cdrom_drive *d,int Switch){
161
 static int Dummy (cdrom_drive *d,int Switch){
162
   return(0);
162
   return(0);
163
@@ -193,6 +332,7 @@ static void check_exceptions(cdrom_drive
163
@@ -221,6 +360,7 @@ static void check_exceptions(cdrom_drive *d,exception 
164
 int cooked_init_drive (cdrom_drive *d){
164
 int cooked_init_drive (cdrom_drive *d){
165
   int ret;
165
   int ret;
166
 
166
 
Lines 168-174 Link Here
168
   switch(d->drive_type){
168
   switch(d->drive_type){
169
   case MATSUSHITA_CDROM_MAJOR:	/* sbpcd 1 */
169
   case MATSUSHITA_CDROM_MAJOR:	/* sbpcd 1 */
170
   case MATSUSHITA_CDROM2_MAJOR:	/* sbpcd 2 */
170
   case MATSUSHITA_CDROM2_MAJOR:	/* sbpcd 2 */
171
@@ -243,6 +383,9 @@ int cooked_init_drive (cdrom_drive *d){
171
@@ -271,6 +411,9 @@ int cooked_init_drive (cdrom_drive *d){
172
   default:
172
   default:
173
     d->nsectors=40; 
173
     d->nsectors=40; 
174
   }
174
   }
Lines 177-180 Link Here
177
+#endif
177
+#endif
178
   d->enable_cdda = Dummy;
178
   d->enable_cdda = Dummy;
179
   d->read_audio = cooked_read;
179
   d->read_audio = cooked_read;
180
   d->set_speed = cooked_setspeed;
180
   d->read_toc = cooked_readtoc;
(-)b/audio/cdparanoia/files/patch-interface_interface.c (-15 / +22 lines)
Lines 1-6 Link Here
1
--- interface/interface.c.orig	2000-04-19 22:41:04 UTC
1
--- interface/interface.c.orig	2008-09-11 10:43:52 UTC
2
+++ interface/interface.c
2
+++ interface/interface.c
3
@@ -30,11 +30,24 @@ int cdda_close(cdrom_drive *d){
3
@@ -35,10 +35,17 @@ int cdda_close(cdrom_drive *d){
4
 
4
 
5
     _clean_messages(d);
5
     _clean_messages(d);
6
     if(d->cdda_device_name)free(d->cdda_device_name);
6
     if(d->cdda_device_name)free(d->cdda_device_name);
Lines 9-27 Link Here
9
     if(d->drive_model)free(d->drive_model);
9
     if(d->drive_model)free(d->drive_model);
10
     if(d->cdda_fd!=-1)close(d->cdda_fd);
10
     if(d->cdda_fd!=-1)close(d->cdda_fd);
11
     if(d->ioctl_fd!=-1 && d->ioctl_fd!=d->cdda_fd)close(d->ioctl_fd);
11
     if(d->ioctl_fd!=-1 && d->ioctl_fd!=d->cdda_fd)close(d->ioctl_fd);
12
     if(d->sg)free(d->sg);
13
+#elif defined(__FreeBSD__)
12
+#elif defined(__FreeBSD__)
14
+    if (d->drive_model)
13
+    if(d->drive_model)free(d->drive_model);
15
+	    free(d->drive_model);
14
+    if(d->ccb)cam_freeccb(d->ccb);
16
+    if (d->ccb)
15
+    if(d->dev)cam_close_device(d->dev);
17
+	    cam_freeccb(d->ccb);
16
+    if(d->ioctl_fd != -1)close(d->ioctl_fd);
18
+    if (d->dev)
19
+	    cam_close_device(d->dev);
20
+    if (d->sg_buffer)
21
+	    free(d->sg_buffer);
22
+    if (d->ioctl_fd != -1)
23
+	    close(d->ioctl_fd);
24
+#endif
17
+#endif
25
     
18
     if(d->private_data){
26
     free(d);
19
       if(d->private_data->sg_hd)free(d->private_data->sg_hd);
20
       free(d->private_data);
21
@@ -127,7 +134,13 @@ long cdda_read_timed(cdrom_drive *d, void *buffer, lon
22
 	}
23
       }	
24
     }
25
+#ifdef Linux
26
     if(ms)*ms=d->private_data->last_milliseconds;
27
+#elif defined(__FreeBSD__)
28
+    if(ms) {
29
+      *ms = (d->private_data == NULL) ? 0 : d->private_data->last_milliseconds;
30
+    }
31
+#endif
32
     return(sectors);
27
   }
33
   }
34
   
(-)b/audio/cdparanoia/files/patch-interface_low__interface.h (-8 / +6 lines)
Lines 3-11 Index: interface/low_interface.h Link Here
3
RCS file: /home/cvs/cdparanoia/interface/low_interface.h,v
3
RCS file: /home/cvs/cdparanoia/interface/low_interface.h,v
4
retrieving revision 1.1.1.1
4
retrieving revision 1.1.1.1
5
retrieving revision 1.3
5
retrieving revision 1.3
6
--- interface/low_interface.h.orig	2001-03-26 06:12:11 UTC
6
--- interface/low_interface.h.orig	2008-09-11 10:43:52 UTC
7
+++ interface/low_interface.h
7
+++ interface/low_interface.h
8
@@ -25,6 +25,8 @@
8
@@ -26,6 +26,8 @@
9
 #include <sys/time.h>
9
 #include <sys/time.h>
10
 #include <sys/types.h>
10
 #include <sys/types.h>
11
 
11
 
Lines 14-20 retrieving revision 1.3 Link Here
14
 #include <linux/major.h>
14
 #include <linux/major.h>
15
 #include <linux/version.h>
15
 #include <linux/version.h>
16
 
16
 
17
@@ -48,12 +50,27 @@
17
@@ -54,6 +56,17 @@
18
 #include <linux/cdrom.h>
18
 #include <linux/cdrom.h>
19
 #include <linux/major.h>
19
 #include <linux/major.h>
20
 
20
 
Lines 24-35 retrieving revision 1.3 Link Here
24
+#include <sys/cdrio.h>
24
+#include <sys/cdrio.h>
25
+
25
+
26
+#include <cam/scsi/scsi_message.h>
26
+#include <cam/scsi/scsi_message.h>
27
+#include <cam/scsi/scsi_sg.h>
27
+#include <camlib.h>
28
+#include <camlib.h>
28
+
29
+
29
+#endif
30
+#endif
30
+
31
+
31
 #include "cdda_interface.h"
32
 #include "cdda_interface.h"
32
 
33
 
34
 #ifndef SG_EMULATED_HOST
35
@@ -107,10 +120,17 @@ struct cdda_private_data {
33
 #define MAX_RETRIES 8
36
 #define MAX_RETRIES 8
34
 #define MAX_BIG_BUFF_SIZE 65536
37
 #define MAX_BIG_BUFF_SIZE 65536
35
 #define MIN_BIG_BUFF_SIZE 4096
38
 #define MIN_BIG_BUFF_SIZE 4096
Lines 40-50 retrieving revision 1.3 Link Here
40
+#define SG_OFF (0)
43
+#define SG_OFF (0)
41
+#endif
44
+#endif
42
 
45
 
43
 #ifndef SG_EMULATED_HOST
44
 /* old kernel version; the check for the ioctl is still runtime, this
45
@@ -64,7 +81,9 @@
46
 #endif
47
 
48
 extern int  cooked_init_drive (cdrom_drive *d);
46
 extern int  cooked_init_drive (cdrom_drive *d);
49
+#ifdef Linux
47
+#ifdef Linux
50
 extern unsigned char *scsi_inquiry (cdrom_drive *d);
48
 extern unsigned char *scsi_inquiry (cdrom_drive *d);
(-)b/audio/cdparanoia/files/patch-interface_scan__devices.c (-26 / +46 lines)
Lines 1-15 Link Here
1
--- interface/scan_devices.c.orig	2001-03-26 05:44:01 UTC
1
--- interface/scan_devices.c.orig	2008-08-26 09:55:22 UTC
2
+++ interface/scan_devices.c
2
+++ interface/scan_devices.c
3
@@ -1,6 +1,8 @@
3
@@ -1,6 +1,8 @@
4
 /******************************************************************
4
 /******************************************************************
5
  * CopyPolicy: GNU Public License 2 applies
5
  * CopyPolicy: GNU Lesser General Public License 2.1 applies
6
  * Copyright (C) 1998 Monty xiphmont@mit.edu
6
  * Copyright (C) 1998-2008 Monty xiphmont@mit.edu
7
+ * FreeBSD porting (c) 2003
7
+ * FreeBSD porting (c) 2003
8
+ * 	Simon 'corecode' Schubert <corecode@corecode.ath.cx>
8
+ * 	Simon 'corecode' Schubert <corecode@corecode.ath.cx>
9
  * 
9
  * 
10
  * Autoscan for or verify presence of a cdrom device
10
  * Autoscan for or verify presence of a cdrom device
11
  * 
11
  * 
12
@@ -21,6 +23,8 @@
12
@@ -24,6 +26,8 @@
13
 
13
 
14
 #define MAX_DEV_LEN 20 /* Safe because strings only come from below */
14
 #define MAX_DEV_LEN 20 /* Safe because strings only come from below */
15
 /* must be absolute paths! */
15
 /* must be absolute paths! */
Lines 18-24 Link Here
18
 static char *scsi_cdrom_prefixes[]={
18
 static char *scsi_cdrom_prefixes[]={
19
   "/dev/scd",
19
   "/dev/scd",
20
   "/dev/sr",
20
   "/dev/sr",
21
@@ -49,6 +53,17 @@ static char *cdrom_devices[]={
21
@@ -52,6 +56,17 @@ static char *cdrom_devices[]={
22
   "/dev/cm206cd",
22
   "/dev/cm206cd",
23
   "/dev/gscd",
23
   "/dev/gscd",
24
   "/dev/optcd",NULL};
24
   "/dev/optcd",NULL};
Lines 36-42 Link Here
36
 
36
 
37
 /* Functions here look for a cdrom drive; full init of a drive type
37
 /* Functions here look for a cdrom drive; full init of a drive type
38
    happens in interface.c */
38
    happens in interface.c */
39
@@ -75,10 +90,12 @@ cdrom_drive *cdda_find_a_cdrom(int messa
39
@@ -61,6 +76,9 @@ cdrom_drive *cdda_find_a_cdrom(int messagedest,char **
40
   
41
   int i=0;
42
   cdrom_drive *d;
43
+#if defined(__FreeBSD__)
44
+  struct passwd *pwent;
45
+#endif
46
 
47
   while(cdrom_devices[i]!=NULL){
48
 
49
@@ -78,10 +96,12 @@ cdrom_drive *cdda_find_a_cdrom(int messagedest,char **
40
 	if((d=cdda_identify(buffer,messagedest,messages)))
50
 	if((d=cdda_identify(buffer,messagedest,messages)))
41
 	  return(d);
51
 	  return(d);
42
 	idmessage(messagedest,messages,"",NULL);
52
 	idmessage(messagedest,messages,"",NULL);
Lines 49-70 Link Here
49
       }
59
       }
50
     }else{
60
     }else{
51
       /* Name.  Go for it. */
61
       /* Name.  Go for it. */
52
@@ -117,8 +134,14 @@ cdrom_drive *cdda_identify(const char *d
62
@@ -92,9 +112,23 @@ cdrom_drive *cdda_find_a_cdrom(int messagedest,char **
63
     }
64
     i++;
53
   }
65
   }
54
 #endif
66
+
55
 
67
+#if Linux
56
+#ifdef Linux	/* is order of checks important? */
68
   idmessage(messagedest,messages,
57
   d=cdda_identify_cooked(device,messagedest,messages);
69
 	    "\n\nNo cdrom drives accessible to %s found.\n",
58
   if(!d)d=cdda_identify_scsi(device,NULL,messagedest,messages);
70
 	    cuserid(NULL));
59
+#elif defined(__FreeBSD__)
71
+#elif defined(__FreeBSD__)
60
+  d = cdda_identify_scsi(device, NULL, messagedest, messages);
72
+  pwent = getpwuid((uid_t)geteuid());
61
+  if (d == NULL)
73
+  if (pwent == NULL) {
62
+	  d = cdda_identify_cooked(device, messagedest, messages);
74
+    idmessage(messagedest,messages,
75
+	      "\n\nNo accessible cdrom drives found.\n", NULL);
76
+    return(NULL);
77
+  }
78
+
79
+  idmessage(messagedest,messages,
80
+	    "\n\nNo cdrom drives accessible to %s found.\n",
81
+	    pwent->pw_name);
63
+#endif
82
+#endif
83
   return(NULL);
84
 }
64
 
85
 
65
 #ifdef CDDA_TEST
86
@@ -145,6 +179,7 @@ char *test_resolve_symlink(const char *file,int messag
66
   if(!d)d=cdda_identify_test(device,messagedest,messages);
67
@@ -143,6 +166,7 @@ char *test_resolve_symlink(const char *f
68
 
87
 
69
 }
88
 }
70
 
89
 
Lines 72-78 Link Here
72
 cdrom_drive *cdda_identify_cooked(const char *dev, int messagedest,
91
 cdrom_drive *cdda_identify_cooked(const char *dev, int messagedest,
73
 				  char **messages){
92
 				  char **messages){
74
 
93
 
75
@@ -275,6 +299,61 @@ cdrom_drive *cdda_identify_cooked(const 
94
@@ -274,6 +309,61 @@ cdrom_drive *cdda_identify_cooked(const char *dev, int
76
   return(d);
95
   return(d);
77
 }
96
 }
78
 
97
 
Lines 134-140 Link Here
134
 struct  sg_id {
153
 struct  sg_id {
135
   long    l1; /* target | lun << 8 | channel << 16 | low_ino << 24 */
154
   long    l1; /* target | lun << 8 | channel << 16 | low_ino << 24 */
136
   long    l2; /* Unique id */
155
   long    l2; /* Unique id */
137
@@ -390,6 +469,7 @@ matchfail:
156
@@ -400,6 +490,7 @@ matchfail:
138
   if(dev!=-1)close(dev);
157
   if(dev!=-1)close(dev);
139
   return(NULL);
158
   return(NULL);
140
 }
159
 }
Lines 142-148 Link Here
142
 
161
 
143
 void strscat(char *a,char *b,int n){
162
 void strscat(char *a,char *b,int n){
144
   int i;
163
   int i;
145
@@ -401,6 +481,7 @@ void strscat(char *a,char *b,int n){
164
@@ -411,6 +502,7 @@ void strscat(char *a,char *b,int n){
146
   strcat(a," ");
165
   strcat(a," ");
147
 }
166
 }
148
 
167
 
Lines 150-163 Link Here
150
 /* At this point, we're going to punt compatability before SG2, and
169
 /* At this point, we're going to punt compatability before SG2, and
151
    allow only SG2 and SG3 */
170
    allow only SG2 and SG3 */
152
 static int verify_SG_version(cdrom_drive *d,int messagedest,
171
 static int verify_SG_version(cdrom_drive *d,int messagedest,
153
@@ -653,6 +734,89 @@ cdda_identify_scsi_fail:
172
@@ -780,6 +872,90 @@ cdda_identify_scsi_fail:
154
   if(g_fd!=-1)close(g_fd);
173
   }
155
   return(NULL);
174
   return(NULL);
156
 }
175
 }
157
+#elif defined(__FreeBSD__)
176
+#elif defined(__FreeBSD__)
158
+
177
+
159
+cdrom_drive *cdda_identify_scsi(const char *device,
178
+cdrom_drive *cdda_identify_scsi(const char *dummy,
160
+    const char *dummy,
179
+    const char *device,
161
+    int messagedest,
180
+    int messagedest,
162
+    char **messages)
181
+    char **messages)
163
+{
182
+{
Lines 209-215 Link Here
209
+	d->lun = d->dev->target_lun;
228
+	d->lun = d->dev->target_lun;
210
+	d->interface = GENERIC_SCSI;
229
+	d->interface = GENERIC_SCSI;
211
+
230
+
212
+	if ((d->sg_buffer = malloc(MAX_BIG_BUFF_SIZE)) == NULL) {
231
+	d->private_data=calloc(1,sizeof(*d->private_data));
232
+	if ((d->private_data->sg_buffer=(unsigned char *)(d->private_data->sg_hd=malloc(MAX_BIG_BUFF_SIZE))) == NULL) {
213
+		idperror(messagedest, messages, "Could not allocate buffer memory", NULL);
233
+		idperror(messagedest, messages, "Could not allocate buffer memory", NULL);
214
+		goto cdda_identify_scsi_fail;
234
+		goto cdda_identify_scsi_fail;
215
+	}
235
+	}
(-)b/audio/cdparanoia/files/patch-interface_scsi__interface.c (-100 / +143 lines)
Lines 1-117 Link Here
1
--- interface/scsi_interface.c.orig	2001-03-24 01:15:46 UTC
1
--- interface/scsi_interface.c.orig	2019-07-25 21:55:03 UTC
2
+++ interface/scsi_interface.c
2
+++ interface/scsi_interface.c
3
@@ -3,6 +3,8 @@
3
@@ -3,6 +3,8 @@
4
  * Original interface.c Copyright (C) 1994-1997 
4
  * Original interface.c Copyright (C) 1994-1997 
5
  *            Eissfeldt heiko@colossus.escape.de
5
  *            Eissfeldt heiko@colossus.escape.de
6
  * Current blenderization Copyright (C) 1998-1999 Monty xiphmont@mit.edu
6
  * Current incarnation Copyright (C) 1998-2008 Monty xiphmont@mit.edu
7
+ * FreeBSD porting (c) 2003
7
+ * FreeBSD porting (c) 2003
8
+ * 	Simon 'corecode' Schubert <corecode@corecode.ath.cx>
8
+ * 	Simon 'corecode' Schubert <corecode@corecode.ath.cx>
9
  * 
9
  * 
10
  * Generic SCSI interface specific code.
10
  * Generic SCSI interface specific code.
11
  *
11
  *
12
@@ -23,6 +25,7 @@ static void tweak_SG_buffer(cdrom_drive 
12
@@ -36,6 +38,7 @@ static void tweak_SG_buffer(cdrom_drive *d) {
13
   int table,reserved;
13
   int table, reserved, cur, err;
14
   char buffer[256];
14
   char buffer[256];
15
 
15
 
16
+#ifdef Linux
16
+#ifdef Linux
17
   /* maximum transfer size? */
17
   /* SG_SET_RESERVED_SIZE doesn't actually allocate or reserve anything.
18
   if(ioctl(d->cdda_fd,SG_GET_RESERVED_SIZE,&reserved)){
18
    * what it _does_ do is give you an error if you ask for a value
19
     /* Up, guess not. */
19
    * larger than q->max_sectors (the length of the device's bio request
20
@@ -59,8 +62,17 @@ static void tweak_SG_buffer(cdrom_drive 
20
@@ -54,6 +57,10 @@ static void tweak_SG_buffer(cdrom_drive *d) {
21
     cdmessage(d,"\tCouldn't disable command queue!  Continuing anyway...\n");
21
      implement working sg lists with SG_IO devices, so who knows... */
22
   }
22
   if (ioctl(d->cdda_fd, SG_GET_SG_TABLESIZE, &table) < 0)
23
 
23
     table=1;
24
+#elif defined(__FreeBSD__)
24
+#else
25
+  d->nsectors = 26;		/* FreeBSD only supports 64K I/O transfer size */
25
+  reserved = 26 * CD_FRAMESIZE_RAW;	/* FreeBSD only supports 64K I/O transfer size */
26
+  d->bigbuff = d->nsectors * CD_FRAMESIZE_RAW;
26
+  table = 1;
27
+  
28
+  sprintf(buffer,"\tSetting default read size to %d sectors (%d bytes).\n\n",
29
+      d->nsectors,d->nsectors*CD_FRAMESIZE_RAW);
30
+  cdmessage(d,buffer);
31
+#endif
27
+#endif
32
 }
33
 
28
 
34
+#ifdef Linux
29
   sprintf(buffer,"\tDMA scatter/gather table entries: %d\n\t"
35
 static void reset_scsi(cdrom_drive *d){
30
 	  "table entry size: %d bytes\n\t"
36
   int arg;
31
@@ -93,6 +100,7 @@ static void tweak_SG_buffer(cdrom_drive *d) {
37
   d->enable_cdda(d,0);
32
   cdmessage(d,buffer);
38
@@ -74,6 +86,30 @@ static void reset_scsi(cdrom_drive *d){
39
   d->enable_cdda(d,1);
40
 }
33
 }
41
 
34
 
42
+#elif defined(__FreeBSD__)
43
+static void reset_scsi(cdrom_drive *d) {
44
+	d->enable_cdda(d,0);
45
+
46
+	d->ccb->ccb_h.func_code = XPT_RESET_DEV;
47
+	d->ccb->ccb_h.timeout = 5000;
48
+
49
+	cdmessage(d, "sending SCSI reset... ");
50
+	if (cam_send_ccb(d->dev, d->ccb)) {
51
+		cdmessage(d, "error sending XPT_RESET_DEV CCB");
52
+	} else {
53
+	
54
+		if (((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) ||
55
+		    ((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_BDR_SENT))
56
+			cdmessage(d,"OK\n");
57
+		else
58
+			cdmessage(d,"FAILED\n");
59
+	}
60
+
61
+	d->enable_cdda(d,1);
62
+}
63
+#endif
64
+
65
+#ifdef Linux
35
+#ifdef Linux
66
 static void clear_garbage(cdrom_drive *d){
36
 static void clear_garbage(cdrom_drive *d){
67
   fd_set fdset;
37
   fd_set fdset;
68
   struct timeval tv;
38
   struct timeval tv;
69
@@ -104,8 +140,10 @@ static void clear_garbage(cdrom_drive *d
39
@@ -123,6 +131,7 @@ static void clear_garbage(cdrom_drive *d){
70
     flag=1;
40
     flag=1;
71
   }
41
   }
72
 }
42
 }
73
+#endif
43
+#endif
74
 
44
 
45
 static int check_sbp_error(const unsigned char status,
46
 			   const unsigned char *sbp) {
47
@@ -172,6 +181,7 @@ static int check_sbp_error(const unsigned char status,
48
   return 0;
49
 }
50
 
51
+#ifdef Linux
75
 /* process a complete scsi command. */
52
 /* process a complete scsi command. */
53
 static int sg2_handle_scsi_cmd(cdrom_drive *d,
54
 			       unsigned char *cmd,
55
@@ -332,7 +342,9 @@ static int sg2_handle_scsi_cmd(cdrom_drive *d,
56
   }
57
   return(0);
58
 }
59
+#endif
60
 
61
+#ifdef Linux
62
 static int sgio_handle_scsi_cmd(cdrom_drive *d,
63
 				unsigned char *cmd,
64
 				unsigned int cmd_len, 
65
@@ -417,7 +429,9 @@ static int sgio_handle_scsi_cmd(cdrom_drive *d,
66
   errno = 0;
67
   return 0;
68
 }
69
+#endif
70
 
76
+#ifdef Linux
71
+#ifdef Linux
77
 static int handle_scsi_cmd(cdrom_drive *d,
72
 static int handle_scsi_cmd(cdrom_drive *d,
73
 			   unsigned char *cmd,
78
 			   unsigned int cmd_len, 
74
 			   unsigned int cmd_len, 
79
 			   unsigned int in_size, 
75
@@ -433,6 +447,120 @@ static int handle_scsi_cmd(cdrom_drive *d,
80
@@ -284,6 +322,95 @@ static int handle_scsi_cmd(cdrom_drive *
76
 
81
   return(0);
82
 }
77
 }
83
 
78
 
84
+#elif defined(__FreeBSD__)
79
+#elif defined(__FreeBSD__)
85
+static int handle_scsi_cmd(cdrom_drive *d,
80
+static int handle_scsi_cmd(cdrom_drive *d,
86
+			   unsigned int cmd_len, 
81
+			   unsigned char *cmd,
87
+			   unsigned int out_size, 
82
+			   unsigned int cmd_len,
88
+			   unsigned int in_size,
83
+			   unsigned int in_size,
84
+			   unsigned int out_size,
89
+			   unsigned char bytefill,
85
+			   unsigned char bytefill,
90
+			   int bytecheck) {
86
+			   int bytecheck,
87
+			   unsigned char *sense){
91
+	int result;
88
+	int result;
92
+	int error_code, sense_key, asc, ascq;
89
+	int error_code, sense_key, asc, ascq;
93
+	
90
+	
94
+	bzero(&d->ccb->csio, sizeof(d->ccb->csio));
91
+	bzero(&d->ccb->csio, sizeof(d->ccb->csio));
95
+
92
+
96
+	memcpy(d->ccb->csio.cdb_io.cdb_bytes, d->sg_buffer, cmd_len);
93
+	memcpy(d->ccb->csio.cdb_io.cdb_bytes, cmd, cmd_len);
97
+
94
+
98
+	if (bytecheck && out_size == 0)
95
+	if (bytecheck && in_size == 0)
99
+		memset(d->sg_buffer, bytefill, in_size);
96
+		memset(d->private_data->sg_buffer, bytefill, out_size);
100
+
97
+
101
+	cam_fill_csio(&d->ccb->csio,
98
+	cam_fill_csio(&d->ccb->csio,
102
+	    /* retries */ 0,
99
+	    /* retries */ 0,
103
+	    /* cbfcnp */ NULL,
100
+	    /* cbfcnp */ NULL,
104
+	    /* flags */ CAM_DEV_QFRZDIS | (out_size ? CAM_DIR_OUT : CAM_DIR_IN),
101
+	    /* flags */ CAM_DEV_QFRZDIS | (in_size ? CAM_DIR_OUT : CAM_DIR_IN),
105
+	    /* tag_action */ MSG_SIMPLE_Q_TAG,
102
+	    /* tag_action */ MSG_SIMPLE_Q_TAG,
106
+	    /* data_ptr */ out_size ? d->sg_buffer + cmd_len : d->sg_buffer,
103
+	    /* data_ptr */ in_size ? cmd + cmd_len : d->private_data->sg_buffer,
107
+	    /* dxfer_len */ out_size ? out_size : in_size,
104
+	    /* dxfer_len */ out_size ? out_size : in_size,
108
+	    /* sense_len */ SSD_FULL_SIZE,
105
+	    /* sense_len */ SSD_FULL_SIZE,
109
+	    /* cdb_len */ cmd_len,
106
+	    /* cdb_len */ cmd_len,
110
+	    /* timeout */ 60000);	/* XXX */
107
+	    /* timeout */ 60000);	/* XXX */
111
+
108
+
109
+	struct timespec tv1;
110
+	struct timespec tv2;
111
+	int tret1=clock_gettime(d->private_data->clock,&tv1);
112
+	if ((result = cam_send_ccb(d->dev, d->ccb)) < 0 ||
112
+	if ((result = cam_send_ccb(d->dev, d->ccb)) < 0 ||
113
+	    (d->ccb->ccb_h.status & CAM_STATUS_MASK) == 0 /* hack? */)
113
+	    (d->ccb->ccb_h.status & CAM_STATUS_MASK) == 0 /* hack? */)
114
+		return TR_EREAD;
114
+		return TR_EREAD;
115
+	int tret2=clock_gettime(d->private_data->clock,&tv2);
115
+
116
+
116
+	if ((d->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP &&
117
+	if ((d->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP &&
117
+	    (d->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_SCSI_STATUS_ERROR) {
118
+	    (d->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_SCSI_STATUS_ERROR) {
Lines 121-127 Link Here
121
+		return TR_UNKNOWN;
122
+		return TR_UNKNOWN;
122
+	}
123
+	}
123
+
124
+
124
+	if (d->ccb->csio.dxfer_len != in_size) {
125
+	if (d->ccb->csio.dxfer_len != out_size) {
125
+		errno = EIO;
126
+		errno = EIO;
126
+		return TR_EREAD;
127
+		return TR_EREAD;
127
+	}
128
+	}
Lines 165-185 Link Here
165
+		break;
166
+		break;
166
+	}
167
+	}
167
+
168
+
169
+	if(bytecheck && out_size){
170
+		long i,flag=0;
171
+		for(i=in_size;i<out_size;i++)
172
+			if(d->private_data->sg_buffer[i]!=bytefill){
173
+				flag=1;
174
+				break;
175
+			}
176
+
177
+		if(!flag){
178
+			errno=EINVAL;
179
+			return(TR_ILLEGAL);
180
+		}
181
+	}
182
+
183
+	if(tret1<0 || tret2<0){
184
+		d->private_data->last_milliseconds=-1;
185
+	}else{
186
+		d->private_data->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
187
+	}
188
+
168
+	return 0;
189
+	return 0;
169
+}
190
+}
170
+#endif
191
+#endif
171
+
192
+
172
+
193
 static int test_unit_ready(cdrom_drive *d){
173
 /* Group 1 (10b) command */
194
   unsigned char sense[SG_MAX_SENSE];
195
   unsigned char key, ASC, ASCQ;
196
@@ -453,6 +581,7 @@ static int test_unit_ready(cdrom_drive *d){
197
   return 1;
198
 }
174
 
199
 
175
 static int mode_sense_atapi(cdrom_drive *d,int size,int page){ 
176
@@ -833,30 +960,37 @@ static long scsi_read_map (cdrom_drive *
177
   while(1) {
178
     if((err=map(d,(p?buffer:NULL),begin,sectors))){
179
       if(d->report_all){
180
+#ifdef Linux
200
+#ifdef Linux
181
 	struct sg_header *sg_hd=(struct sg_header *)d->sg;
201
 static void reset_scsi(cdrom_drive *d){
202
   int arg,tries=0;
203
   d->enable_cdda(d,0);
204
@@ -472,6 +601,29 @@ static void reset_scsi(cdrom_drive *d){
205
   d->enable_cdda(d,1);
206
 }
207
 
182
+#elif defined(__FreeBSD__)
208
+#elif defined(__FreeBSD__)
209
+static void reset_scsi(cdrom_drive *d) {
210
+	d->enable_cdda(d,0);
211
+
212
+	d->ccb->ccb_h.func_code = XPT_RESET_DEV;
213
+	d->ccb->ccb_h.timeout = 5000;
214
+
215
+	cdmessage(d, "sending SCSI reset... ");
216
+	if (cam_send_ccb(d->dev, d->ccb)) {
217
+		cdmessage(d, "error sending XPT_RESET_DEV CCB");
218
+	} else {
219
+	
220
+		if (((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) ||
221
+		    ((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_BDR_SENT))
222
+			cdmessage(d,"OK\n");
223
+		else
224
+			cdmessage(d,"FAILED\n");
225
+	}
226
+
227
+	d->enable_cdda(d,1);
228
+}
229
+#endif
230
+
231
 static int mode_sense_atapi(cdrom_drive *d,int size,int page){ 
232
   unsigned char sense[SG_MAX_SENSE];
233
   unsigned char cmd[10]= {0x5A,   /* MODE_SENSE */
234
@@ -1074,29 +1226,35 @@ static long scsi_read_map (cdrom_drive *d, void *p, lo
235
 
236
     if((err=map(d,(p?buffer:NULL),begin,sectors,sense))){
237
       if(d->report_all){
238
+#ifdef __FreeBSD__
183
+	int error_code, sense_key, asc, ascq;
239
+	int error_code, sense_key, asc, ascq;
184
+#endif
240
+#endif
185
 	char b[256];
241
 	char b[256];
Lines 194-202 Link Here
194
+#endif
250
+#endif
195
 	sprintf(b,"                 Sense key: %x ASC: %x ASCQ: %x\n",
251
 	sprintf(b,"                 Sense key: %x ASC: %x ASCQ: %x\n",
196
+#ifdef Linux
252
+#ifdef Linux
197
 		(int)(sg_hd->sense_buffer[2]&0xf),
253
 		(int)(sense[2]&0xf),
198
 		(int)(sg_hd->sense_buffer[12]),
254
 		(int)(sense[12]),
199
 		(int)(sg_hd->sense_buffer[13]));
255
 		(int)(sense[13]));
200
+#elif defined(__FreeBSD__)
256
+#elif defined(__FreeBSD__)
201
+		sense_key, asc, ascq);
257
+		sense_key, asc, ascq);
202
+#endif
258
+#endif
Lines 212-234 Link Here
212
-	fprintf(stderr,"scsi_read error: sector=%ld length=%ld retry=%d\n",
268
-	fprintf(stderr,"scsi_read error: sector=%ld length=%ld retry=%d\n",
213
-		begin,sectors,retry_count);
269
-		begin,sectors,retry_count);
214
-	fprintf(stderr,"                 Sense key: %x ASC: %x ASCQ: %x\n",
270
-	fprintf(stderr,"                 Sense key: %x ASC: %x ASCQ: %x\n",
215
-		(int)(sg_hd->sense_buffer[2]&0xf),
271
-		(int)(sense[2]&0xf),
216
-		(int)(sg_hd->sense_buffer[12]),
272
-		(int)(sense[12]),
217
-		(int)(sg_hd->sense_buffer[13]));
273
-		(int)(sense[13]));
218
-	fprintf(stderr,"                 Transport error: %s\n",strerror_tr[err]);
274
-	fprintf(stderr,"                 Transport error: %s\n",strerror_tr[err]);
219
-	fprintf(stderr,"                 System error: %s\n",strerror(errno));
275
-	fprintf(stderr,"                 System error: %s\n",strerror(errno));
220
       }
276
       }
221
 
277
       
222
       if(!d->error_retry)return(-7);
278
       switch(errno){
223
@@ -1307,6 +1441,7 @@ static void check_fua_bit(cdrom_drive *d
279
@@ -1583,6 +1741,7 @@ static void check_cache(cdrom_drive *d){
224
   return;
280
   }
225
 }
281
 }
226
 
282
 
227
+#ifdef Linux
283
+#ifdef Linux
228
 static int check_atapi(cdrom_drive *d){
284
 static int check_atapi(cdrom_drive *d){
229
   int atapiret=-1;
285
   int atapiret=-1;
230
   int fd = d->cdda_fd; /* this is the correct fd (not ioctl_fd), as the 
286
   int fd = d->cdda_fd; /* check the device we'll actually be using to read */
231
@@ -1333,6 +1468,53 @@ static int check_atapi(cdrom_drive *d){
287
@@ -1614,6 +1773,53 @@ static int check_atapi(cdrom_drive *d){
232
   }
288
   }
233
 }  
289
 }  
234
 
290
 
Lines 280-313 Link Here
280
+#endif
336
+#endif
281
+
337
+
282
 static int check_mmc(cdrom_drive *d){
338
 static int check_mmc(cdrom_drive *d){
283
   char *b;
339
   unsigned char *b;
284
   cdmessage(d,"\nChecking for MMC style command set...\n");
340
   cdmessage(d,"\nChecking for MMC style command set...\n");
285
@@ -1379,6 +1561,7 @@ static void check_exceptions(cdrom_drive
341
@@ -1660,6 +1866,7 @@ static void check_exceptions(cdrom_drive *d,exception 
286
   }
342
   }
287
 }
343
 }
288
 
344
 
289
+#ifdef Linux
345
+#ifdef Linux
290
 /* request vendor brand and model */
346
 /* request vendor brand and model */
291
 unsigned char *scsi_inquiry(cdrom_drive *d){
347
 unsigned char *scsi_inquiry(cdrom_drive *d){
292
   memcpy(d->sg_buffer,(char[]){ 0x12,0,0,0,56,0},6);
348
   unsigned char sense[SG_MAX_SENSE];
293
@@ -1389,6 +1572,7 @@ unsigned char *scsi_inquiry(cdrom_drive 
349
@@ -1671,6 +1878,7 @@ unsigned char *scsi_inquiry(cdrom_drive *d){
294
   }
350
   }
295
   return (d->sg_buffer);
351
   return (d->private_data->sg_buffer);
296
 }
352
 }
297
+#endif
353
+#endif
298
 
354
 
299
 
300
 int scsi_init_drive(cdrom_drive *d){
355
 int scsi_init_drive(cdrom_drive *d){
301
@@ -1458,8 +1642,12 @@ int scsi_init_drive(cdrom_drive *d){
356
   int ret;
302
   check_fua_bit(d);
303
 
304
   d->error_retry=1;
305
+#ifdef Linux
306
   d->sg=realloc(d->sg,d->nsectors*CD_FRAMESIZE_RAW + SG_OFF + 128);
307
   d->sg_buffer=d->sg+SG_OFF;
308
+#elif defined(__FreeBSD__)
309
+  d->sg_buffer = realloc(d->sg_buffer, d->nsectors * CD_FRAMESIZE_RAW);
310
+#endif
311
   d->report_all=1;
312
   return(0);
313
 }
(-)b/audio/cdparanoia/files/patch-interface_utils.h (-1 / +37 lines)
Lines 3-9 Index: interface/utils.h Link Here
3
RCS file: /home/cvs/cdparanoia/interface/utils.h,v
3
RCS file: /home/cvs/cdparanoia/interface/utils.h,v
4
retrieving revision 1.1.1.1
4
retrieving revision 1.1.1.1
5
retrieving revision 1.3
5
retrieving revision 1.3
6
--- interface/utils.h.orig	2000-04-19 22:41:04 UTC
6
--- interface/utils.h.orig	2008-08-14 13:56:20 UTC
7
+++ interface/utils.h
7
+++ interface/utils.h
8
@@ -1,4 +1,9 @@
8
@@ -1,4 +1,9 @@
9
+#ifdef LINUX
9
+#ifdef LINUX
Lines 15-17 retrieving revision 1.3 Link Here
15
 #include <stdio.h>
15
 #include <stdio.h>
16
 #include <errno.h>
16
 #include <errno.h>
17
 #include <string.h>
17
 #include <string.h>
18
@@ -111,7 +116,7 @@ static void cderror(cdrom_drive *d,const char *s){
19
       d->errorbuf=catstring(d->errorbuf,s);
20
       break;
21
     case CDDA_MESSAGE_FORGETIT:
22
-    default:
23
+    default:break;break;break;
24
       break;
25
     }
26
   }
27
@@ -127,7 +132,7 @@ static void cdmessage(cdrom_drive *d,const char *s){
28
       d->messagebuf=catstring(d->messagebuf,s);
29
       break;
30
     case CDDA_MESSAGE_FORGETIT:
31
-    default:
32
+    default:break;break;break;
33
       break;
34
     }
35
   }
36
@@ -170,7 +175,7 @@ static void idperror(int messagedest,char **messages,c
37
       }
38
       break;
39
     case CDDA_MESSAGE_FORGETIT:
40
-    default:
41
+    default:break;break;break;
42
       break;
43
     }
44
   }
45
@@ -207,7 +212,7 @@ static void idmessage(int messagedest,char **messages,
46
 	}
47
       break;
48
     case CDDA_MESSAGE_FORGETIT:
49
-    default:
50
+    default:break;break;break;
51
       break;
52
     }
53
   }
(-)b/audio/cdparanoia/files/patch-main.c (+15 lines)
Added Link Here
1
--- main.c.orig	2019-07-23 18:12:13 UTC
2
+++ main.c
3
@@ -588,10 +588,10 @@ static void callback(long inpos, int function){
4
 	    buffer[aheadposition+19]='>';
5
 	}
6
    
7
-	fprintf(stderr,buffer);
8
+	fprintf(stderr,"%s",buffer);
9
        
10
 	if (logfile != NULL && function==-1) {
11
-	  fprintf(logfile,buffer+1);
12
+	  fprintf(logfile,"%s",buffer+1);
13
 	  fprintf(logfile,"\n\n");
14
 	  fflush(logfile);
15
 	}
(-)b/audio/cdparanoia/files/patch-paranoia_Makefile.in (-5 / +4 lines)
Lines 1-6 Link Here
1
--- paranoia/Makefile.in.orig	1999-12-14 04:28:04 UTC
1
--- paranoia/Makefile.in.orig	2008-09-04 19:02:47 UTC
2
+++ paranoia/Makefile.in
2
+++ paranoia/Makefile.in
3
@@ -24,18 +24,14 @@ OFILES = paranoia.o p_block.o overlap.o 
3
@@ -24,17 +24,13 @@ OFILES = paranoia.o p_block.o overlap.o gap.o isort.o 
4
 LIBS = ../interface/libcdda_interface.a -lm
4
 LIBS = ../interface/libcdda_interface.a -lm
5
 export VERSION
5
 export VERSION
6
 
6
 
Lines 16-25 Link Here
16
-slib:	
16
-slib:	
17
 	$(MAKE) lessmessy
17
 	$(MAKE) lessmessy
18
 	$(MAKE) libcdda_paranoia.so CFLAGS="$(OPT) -fpic" 
18
 	$(MAKE) libcdda_paranoia.so CFLAGS="$(OPT) -fpic" 
19
 
19
+
20
+debug:
20
+debug:
21
+	$(MAKE) libcdda_paranoia.a CFLAGS="$(DEBUG)"
21
+	$(MAKE) libcdda_paranoia.a CFLAGS="$(DEBUG)"
22
+
22
 
23
 #test:	$(TFILES)
23
 #test:	$(TFILES)
24
 #
24
 #
25
 
(-)b/audio/cdparanoia/files/patch-paranoia_cdda__paranoia.h (-2 / +2 lines)
Lines 3-11 Index: paranoia/cdda_paranoia.h Link Here
3
RCS file: /home/cvs/cdparanoia/paranoia/cdda_paranoia.h,v
3
RCS file: /home/cvs/cdparanoia/paranoia/cdda_paranoia.h,v
4
retrieving revision 1.1.1.1
4
retrieving revision 1.1.1.1
5
retrieving revision 1.2
5
retrieving revision 1.2
6
--- paranoia/cdda_paranoia.h.orig	2001-03-24 01:15:47 UTC
6
--- paranoia/cdda_paranoia.h.orig	2008-09-11 20:09:40 UTC
7
+++ paranoia/cdda_paranoia.h
7
+++ paranoia/cdda_paranoia.h
8
@@ -34,6 +34,8 @@
8
@@ -35,6 +35,8 @@
9
 #define PARANOIA_MODE_NEVERSKIP   32
9
 #define PARANOIA_MODE_NEVERSKIP   32
10
 
10
 
11
 #ifndef CDP_COMPILE
11
 #ifndef CDP_COMPILE
(-)b/audio/cdparanoia/files/patch-paranoia_overlap.c (+20 lines)
Added Link Here
1
--- paranoia/overlap.c.orig	2019-07-23 18:06:02 UTC
2
+++ paranoia/overlap.c
3
@@ -107,7 +107,7 @@ void offset_adjust_settings(cdrom_paranoia *p, void(*c
4
        sector, frob it.  We just want a little hysteresis [sp?]*/
5
     long av=(p->stage2.offpoints?p->stage2.offaccum/p->stage2.offpoints:0);
6
     
7
-    if(abs(av)>p->dynoverlap/4){
8
+    if(labs(av)>p->dynoverlap/4){
9
       av=(av/MIN_SECTOR_EPSILON)*MIN_SECTOR_EPSILON;
10
       
11
       if(callback)(*callback)(ce(p->root.vector),PARANOIA_CB_DRIFT);
12
@@ -207,7 +207,7 @@ void offset_add_value(cdrom_paranoia *p,offsets *o,lon
13
   if(o->offpoints!=-1){
14
 
15
     /* Track the average magnitude of jitter (in either direction) */
16
-    o->offdiff+=abs(value);
17
+    o->offdiff+=labs(value);
18
     o->offpoints++;
19
     o->newpoints++;
20
 
(-)a/audio/cdparanoia/files/patch-version.h (-17 lines)
Removed Link Here
1
Index: version.h
2
===================================================================
3
RCS file: /home/cvs/cdparanoia/version.h,v
4
retrieving revision 1.1.1.1
5
retrieving revision 1.2
6
--- version.h.orig	2001-03-24 01:15:45 UTC
7
+++ version.h
8
@@ -8,6 +8,8 @@
9
 
10
 
11
 #define VERSION "cdparanoia III release 9.8 (March 23, 2001)\n"\
12
-                "(C) 2001 Monty <monty@xiph.org> and Xiphophorus\n\n"\
13
+                "(C) 2001 Monty <monty@xiph.org> and Xiphophorus\n"\
14
+		"FreeBSD porting (c) 2003\n"\
15
+		"\tSimon 'corecode' Schubert <corecode@corecode.ath.cx>\n\n"\
16
 		"Report bugs to paranoia@xiph.org\n"\
17
 		"http://www.xiph.org/paranoia/\n"
(-)b/audio/cdparanoia/pkg-plist (-2 / +2 lines)
Lines 4-12 include/cdda_paranoia.h Link Here
4
lib/libcdda_interface.a
4
lib/libcdda_interface.a
5
lib/libcdda_interface.so
5
lib/libcdda_interface.so
6
lib/libcdda_interface.so.0
6
lib/libcdda_interface.so.0
7
lib/libcdda_interface.so.0.9.8
7
lib/libcdda_interface.so.0.10.2
8
lib/libcdda_paranoia.a
8
lib/libcdda_paranoia.a
9
lib/libcdda_paranoia.so
9
lib/libcdda_paranoia.so
10
lib/libcdda_paranoia.so.0
10
lib/libcdda_paranoia.so.0
11
lib/libcdda_paranoia.so.0.9.8
11
lib/libcdda_paranoia.so.0.10.2
12
man/man1/cdparanoia.1.gz
12
man/man1/cdparanoia.1.gz
(-)b/extra-patch-upstream-patch-r15314 (+312 lines)
Added Link Here
1
Fix the cdda_enable bug that would cause the -A tests to fail on
2
drives that require a density set
3
4
Correct a bug that would cause a failed density set to abort out of
5
verify_read_command
6
7
Improve autosense order; non-density-set modes should be chacked
8
before even NULL-density modes because there's not necessarily any
9
going back (eg, Plextor lets you *set* the mode descriptor density,
10
but does not let you read it; it always reports '0')
11
12
Index: interface/interface.c
13
===================================================================
14
--- interface/interface.c	(revision 15313)
15
+++ interface/interface.c	(revision 15314)
16
@@ -90,11 +90,11 @@
17
       }
18
   }
19
 
20
+  if(d->bigendianp==-1)d->bigendianp=data_bigendianp(d);
21
+
22
   if((ret=d->enable_cdda(d,1)))
23
     return(ret);
24
     
25
-  /*  d->select_speed(d,d->maxspeed); most drives are full speed by default */
26
-  if(d->bigendianp==-1)d->bigendianp=data_bigendianp(d);
27
   return(0);
28
 }
29
 
30
Index: interface/scsi_interface.c
31
===================================================================
32
--- interface/scsi_interface.c	(revision 15313)
33
+++ interface/scsi_interface.c	(revision 15314)
34
@@ -1298,7 +1298,7 @@
35
 
36
 static int verify_read_command(cdrom_drive *d){
37
   int i,j,k;
38
-  int audioflag=0;
39
+  int audioflag=1;
40
 
41
   int  (*enablecommand)  (struct cdrom_drive *d, int speed);
42
   long (*readcommand)   (struct cdrom_drive *d, void *p, long begin, 
43
@@ -1313,7 +1313,7 @@
44
      for data */
45
 
46
   if(d->enable_cdda(d,1)==0){
47
-    
48
+    audioflag=0;
49
     for(i=1;i<=d->tracks;i++){
50
       if(cdda_track_audiop(d,i)==1){
51
 	long firstsector=cdda_track_firstsector(d,i);
52
@@ -1358,115 +1358,111 @@
53
     /* NEC test must come before sony; the nec drive expects d8 to be
54
        10 bytes, and a 12 byte verson (Sony) crashes the drive */
55
 
56
-    for(j=0;j<15;j++){
57
-      int densitypossible=1;
58
-
59
-      switch(j){
60
+    for(i=0;i<5;i++){
61
+      switch(i){
62
       case 0:
63
-	d->read_audio=scsi_read_28;
64
-	rs="28 0x,00";
65
+	d->density=0;
66
+	d->enable_cdda=Dummy;
67
+	es="none    ";
68
 	break;
69
       case 1:
70
-	d->read_audio=scsi_read_A8;
71
-	rs="a8 0x,00";
72
+	d->density=0;
73
+	d->enable_cdda=scsi_enable_cdda;
74
+	es="yes/0x00";
75
 	break;
76
-
77
       case 2:
78
-	d->read_audio=scsi_read_mmcB;
79
-	rs="be 02,10";
80
-	densitypossible=0;
81
+	d->density=0x04;
82
+	d->enable_cdda=scsi_enable_cdda;
83
+	es="yes/0x04";
84
 	break;
85
       case 3:
86
-	d->read_audio=scsi_read_mmc2B;
87
-	rs="be 02,f8";
88
-	densitypossible=0;
89
+	d->density=0x82;
90
+	d->enable_cdda=scsi_enable_cdda;
91
+	es="yes/0x82";
92
 	break;
93
       case 4:
94
-	d->read_audio=scsi_read_mmc3B;
95
-	rs="be 06,f8";
96
-	densitypossible=0;
97
+	d->density=0x81;
98
+	d->enable_cdda=scsi_enable_cdda;
99
+	es="yes/0x81";
100
 	break;
101
+      }
102
 
103
-      case 5:
104
-	d->read_audio=scsi_read_mmc;
105
-	rs="be 00,10";
106
-	densitypossible=0;
107
-	break;
108
-      case 6:
109
-	d->read_audio=scsi_read_mmc2;
110
-	rs="be 00,f8";
111
-	densitypossible=0;
112
-	break;
113
-      case 7:
114
-	d->read_audio=scsi_read_mmc3;
115
-	rs="be 04,f8";
116
-	densitypossible=0;
117
-	break;
118
-
119
-      case 8:
120
-	d->read_audio=scsi_read_msf;
121
-	rs="b9 00,10";
122
-	densitypossible=0;
123
-	break;
124
-      case 9:
125
-	d->read_audio=scsi_read_msf2;
126
-	rs="b9 00,f8";
127
-	densitypossible=0;
128
-	break;
129
-      case 10:
130
-	d->read_audio=scsi_read_msf3;
131
-	rs="b9 04,f8";
132
-	densitypossible=0;
133
-	break;
134
-
135
-      case 11:
136
-	d->read_audio=scsi_read_D4_10;
137
-	rs="d4(10)0x";
138
-	break;
139
-      case 12:
140
-	d->read_audio=scsi_read_D4_12;
141
-	rs="d4(12)0x";
142
-	break;
143
-      case 13:
144
-	d->read_audio=scsi_read_D5;
145
-	rs="d5 0x,00";
146
-	break;
147
-      case 14:
148
-	d->read_audio=scsi_read_D8;
149
-	rs="d8 0x,00";
150
-	break;
151
-      }
152
-      
153
-      for(i=0;i<5;i++){
154
-	switch(i){
155
+      for(j=0;j<15;j++){
156
+	
157
+	switch(j){
158
 	case 0:
159
-	  d->density=0;
160
-	  d->enable_cdda=Dummy;
161
-	  es="none    ";
162
-	  if(!densitypossible)i=5; /* short circuit MMC style commands */
163
+	  d->read_audio=scsi_read_28;
164
+	  rs="28 0x,00";
165
 	  break;
166
 	case 1:
167
-	  d->density=0;
168
-	  d->enable_cdda=scsi_enable_cdda;
169
-	  es="yes/0x00";
170
+	  d->read_audio=scsi_read_A8;
171
+	  rs="a8 0x,00";
172
 	  break;
173
+	  
174
+	  /* 2 through 10 do not allow/require density */
175
 	case 2:
176
-	  d->density=0x04;
177
-	  d->enable_cdda=scsi_enable_cdda;
178
-	  es="yes/0x04";
179
-	  break;
180
+	  d->read_audio=scsi_read_mmcB;
181
+	  rs="be 02,10";
182
+	  if(i==0)break;
183
 	case 3:
184
-	  d->density=0x82;
185
-	  d->enable_cdda=scsi_enable_cdda;
186
-	  es="yes/0x82";
187
-	  break;
188
+	  j=3;
189
+	  d->read_audio=scsi_read_mmc2B;
190
+	  rs="be 02,f8";
191
+	  if(i==0)break;
192
 	case 4:
193
-	  d->density=0x81;
194
-	  d->enable_cdda=scsi_enable_cdda;
195
-	  es="yes/0x81";
196
+	  j=4;
197
+	  d->read_audio=scsi_read_mmc3B;
198
+	  rs="be 06,f8";
199
+	  if(i==0)break;
200
+	case 5:
201
+	  j=5;
202
+	  d->read_audio=scsi_read_mmc;
203
+	  rs="be 00,10";
204
+	  if(i==0)break;
205
+	case 6:
206
+	  j=6;
207
+	  d->read_audio=scsi_read_mmc2;
208
+	  rs="be 00,f8";
209
+	  if(i==0)break;
210
+	case 7:
211
+	  j=7;
212
+	  d->read_audio=scsi_read_mmc3;
213
+	  rs="be 04,f8";
214
+	  if(i==0)break;
215
+	case 8:
216
+	  j=8;
217
+	  d->read_audio=scsi_read_msf;
218
+	  rs="b9 00,10";
219
+	  if(i==0)break;
220
+	case 9:
221
+	  j=9;
222
+	  d->read_audio=scsi_read_msf2;
223
+	  rs="b9 00,f8";
224
+	  if(i==0)break;
225
+	case 10:
226
+	  j=10;
227
+	  d->read_audio=scsi_read_msf3;
228
+	  rs="b9 04,f8";
229
+	  if(i==0)break;
230
+	
231
+	case 11:
232
+	  d->read_audio=scsi_read_D4_10;
233
+	  rs="d4(10)0x";
234
 	  break;
235
+	case 12:
236
+	  d->read_audio=scsi_read_D4_12;
237
+	  rs="d4(12)0x";
238
+	  break;
239
+	case 13:
240
+	  d->read_audio=scsi_read_D5;
241
+	  rs="d5 0x,00";
242
+	  break;
243
+	case 14:
244
+	  d->read_audio=scsi_read_D8;
245
+	  rs="d8 0x,00";
246
+	  break;
247
 	}
248
-
249
+	
250
 	cdmessage(d,"\ttest -> density: [");
251
 	cdmessage(d,es);
252
 	cdmessage(d,"]  command: [");
253
@@ -1525,21 +1521,21 @@
254
 	  if(zeroflag){
255
 	    char buffer[256];
256
 	    sprintf(buffer,"\t\tDrive returned %d packet(s), but contents\n"
257
-		        "\t\twere entirely zero\n",zeroflag);
258
+		    "\t\twere entirely zero\n",zeroflag);
259
 	    cdmessage(d,buffer);
260
 	  }
261
 	}
262
       }
263
     }
264
-
265
+    
266
     /* D'oh. */
267
     d->density=density;
268
     d->read_audio=readcommand;
269
     d->enable_cdda=enablecommand;
270
-
271
+    
272
     cdmessage(d,"\tUnable to find any suitable command set from probe;\n"
273
 	      "\tdrive probably not CDDA capable.\n");
274
-
275
+    
276
     cderror(d,"006: Could not read any data from drive\n");
277
 
278
   }
279
@@ -1690,33 +1686,20 @@
280
   if(d->is_atapi)d->lun=0; /* it should already be; just to make sure */
281
       
282
   if(d->is_mmc){
283
-
284
     d->read_audio = scsi_read_mmc2B;
285
     d->bigendianp=0;
286
-
287
     check_exceptions(d,mmc_list);
288
-
289
   }else{
290
-    
291
     if(d->is_atapi){
292
       /* Not MMC maybe still uses 0xbe */
293
-
294
       d->read_audio = scsi_read_mmc2B;
295
       d->bigendianp=0;
296
-
297
       check_exceptions(d,atapi_list);
298
-
299
     }else{
300
-
301
       check_exceptions(d,scsi_list);
302
-
303
     }
304
   }
305
 
306
-  if(!d->is_atapi)set_sectorsize(d,2048); /* we really do want the
307
-					     sector size at 2048 to begin.*/
308
-  d->enable_cdda(d,0);
309
-
310
   d->read_toc = (!memcmp(d->drive_model, "IMS", 3) && !d->is_atapi) ? scsi_read_toc2 : 
311
     scsi_read_toc;
312
   d->set_speed = scsi_set_speed;
(-)b/extra-patch-upstream-patch-r15337 (+31 lines)
Added Link Here
1
Commit fix to make debug (no optimization, please)
2
3
Commit fix to -p not actually outputting in host byte order (in fact,
4
it always get s it reversed regardless of endianness)
5
6
Index: Makefile.in
7
===================================================================
8
--- Makefile.in	(revision 15336)
9
+++ Makefile.in	(revision 15337)
10
@@ -10,7 +10,7 @@
11
 @SET_MAKE@
12
 FLAGS=@TYPESIZES@ @CFLAGS@
13
 OPT=@OPT@ $(FLAGS)
14
-DEBUG=@DEBUG@ $(FLAGS)
15
+DEBUG=@DEBUG@
16
 CC=@CC@
17
 LD=@CC@
18
 LDFLAGS=@LDFLAGS@ $(FLAGS)
19
Index: main.c
20
===================================================================
21
--- main.c	(revision 15336)
22
+++ main.c	(revision 15337)
23
@@ -746,7 +746,7 @@
24
       break;
25
     case 'p':
26
       output_type=0;
27
-      output_endian=-1;
28
+      output_endian=bigendianp();
29
       break;
30
     case 'r':
31
       output_type=0;
(-)b/extra-patch-upstream-patch-r15338 (+584 lines)
Added Link Here
1
Commit fix for 'private' becoming a reserved keyword as of GCC 4.3+
2
3
Index: interface/test_interface.c
4
===================================================================
5
--- interface/test_interface.c	(revision 15337)
6
+++ interface/test_interface.c	(revision 15338)
7
@@ -66,9 +66,9 @@
8
   if(!fd)fd=fdopen(d->cdda_fd,"r");
9
 
10
   if(begin<lastread)
11
-    d->private->last_milliseconds=20;
12
+    d->private_data->last_milliseconds=20;
13
   else
14
-    d->private->last_milliseconds=sectors;
15
+    d->private_data->last_milliseconds=sectors;
16
 
17
 #ifdef CDDA_TEST_UNDERRUN
18
   sectors-=1;
19
Index: interface/cdda_interface.h
20
===================================================================
21
--- interface/cdda_interface.h	(revision 15337)
22
+++ interface/cdda_interface.h	(revision 15338)
23
@@ -84,7 +84,7 @@
24
   int is_atapi;
25
   int is_mmc;
26
 
27
-  cdda_private_data_t *private;
28
+  cdda_private_data_t *private_data;
29
   void         *reserved;
30
   unsigned char inqbytes[4];
31
 
32
Index: interface/interface.c
33
===================================================================
34
--- interface/interface.c	(revision 15337)
35
+++ interface/interface.c	(revision 15338)
36
@@ -39,9 +39,9 @@
37
     if(d->drive_model)free(d->drive_model);
38
     if(d->cdda_fd!=-1)close(d->cdda_fd);
39
     if(d->ioctl_fd!=-1 && d->ioctl_fd!=d->cdda_fd)close(d->ioctl_fd);
40
-    if(d->private){
41
-      if(d->private->sg_hd)free(d->private->sg_hd);
42
-      free(d->private);
43
+    if(d->private_data){
44
+      if(d->private_data->sg_hd)free(d->private_data->sg_hd);
45
+      free(d->private_data);
46
     }
47
 
48
     free(d);
49
@@ -127,7 +127,7 @@
50
 	}
51
       }	
52
     }
53
-    if(ms)*ms=d->private->last_milliseconds;
54
+    if(ms)*ms=d->private_data->last_milliseconds;
55
     return(sectors);
56
   }
57
   
58
Index: interface/scsi_interface.c
59
===================================================================
60
--- interface/scsi_interface.c	(revision 15337)
61
+++ interface/scsi_interface.c	(revision 15338)
62
@@ -15,13 +15,13 @@
63
 static int timed_ioctl(cdrom_drive *d, int fd, int command, void *arg){
64
   struct timespec tv1;
65
   struct timespec tv2;
66
-  int ret1=clock_gettime(d->private->clock,&tv1);
67
+  int ret1=clock_gettime(d->private_data->clock,&tv1);
68
   int ret2=ioctl(fd, command,arg);
69
-  int ret3=clock_gettime(d->private->clock,&tv2);
70
+  int ret3=clock_gettime(d->private_data->clock,&tv2);
71
   if(ret1<0 || ret3<0){
72
-    d->private->last_milliseconds=-1;
73
+    d->private_data->last_milliseconds=-1;
74
   }else{
75
-    d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
76
+    d->private_data->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
77
   }
78
   return ret2;
79
 }
80
@@ -96,7 +96,7 @@
81
 static void clear_garbage(cdrom_drive *d){
82
   fd_set fdset;
83
   struct timeval tv;
84
-  struct sg_header *sg_hd=d->private->sg_hd;
85
+  struct sg_header *sg_hd=d->private_data->sg_hd;
86
   int flag=0;
87
 
88
   /* clear out any possibly preexisting garbage */
89
@@ -185,7 +185,7 @@
90
   struct timespec tv2;
91
   int tret1,tret2;
92
   int status = 0;
93
-  struct sg_header *sg_hd=d->private->sg_hd;
94
+  struct sg_header *sg_hd=d->private_data->sg_hd;
95
   long writebytes=SG_OFF+cmd_len+in_size;
96
 
97
   /* generic scsi device services */
98
@@ -195,7 +195,7 @@
99
 
100
   memset(sg_hd,0,sizeof(sg_hd)); 
101
   memset(sense_buffer,0,SG_MAX_SENSE); 
102
-  memcpy(d->private->sg_buffer,cmd,cmd_len+in_size);
103
+  memcpy(d->private_data->sg_buffer,cmd,cmd_len+in_size);
104
   sg_hd->twelve_byte = cmd_len == 12;
105
   sg_hd->result = 0;
106
   sg_hd->reply_len = SG_OFF + out_size;
107
@@ -209,7 +209,7 @@
108
      tell if the command failed.  Scared yet? */
109
 
110
   if(bytecheck && out_size>in_size){
111
-    memset(d->private->sg_buffer+cmd_len+in_size,bytefill,out_size-in_size); 
112
+    memset(d->private_data->sg_buffer+cmd_len+in_size,bytefill,out_size-in_size); 
113
     /* the size does not remove cmd_len due to the way the kernel
114
        driver copies buffers */
115
     writebytes+=(out_size-in_size);
116
@@ -243,7 +243,7 @@
117
   }
118
 
119
   sigprocmask (SIG_BLOCK, &(d->sigset), NULL );
120
-  tret1=clock_gettime(d->private->clock,&tv1);  
121
+  tret1=clock_gettime(d->private_data->clock,&tv1);  
122
   errno=0;
123
   status = write(d->cdda_fd, sg_hd, writebytes );
124
 
125
@@ -289,7 +289,7 @@
126
     }
127
   }
128
 
129
-  tret2=clock_gettime(d->private->clock,&tv2);  
130
+  tret2=clock_gettime(d->private_data->clock,&tv2);  
131
   errno=0;
132
   status = read(d->cdda_fd, sg_hd, SG_OFF + out_size);
133
   sigprocmask ( SIG_UNBLOCK, &(d->sigset), NULL );
134
@@ -313,7 +313,7 @@
135
   if(bytecheck && in_size+cmd_len<out_size){
136
     long i,flag=0;
137
     for(i=in_size;i<out_size;i++)
138
-      if(d->private->sg_buffer[i]!=bytefill){
139
+      if(d->private_data->sg_buffer[i]!=bytefill){
140
 	flag=1;
141
 	break;
142
       }
143
@@ -326,9 +326,9 @@
144
 
145
   errno=0;
146
   if(tret1<0 || tret2<0){
147
-    d->private->last_milliseconds=-1;
148
+    d->private_data->last_milliseconds=-1;
149
   }else{
150
-    d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000 + (tv2.tv_nsec-tv1.tv_nsec)/1000000;
151
+    d->private_data->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000 + (tv2.tv_nsec-tv1.tv_nsec)/1000000;
152
   }
153
   return(0);
154
 }
155
@@ -347,7 +347,7 @@
156
 
157
   memset(&hdr,0,sizeof(hdr));
158
   memset(sense,0,sizeof(sense));
159
-  memcpy(d->private->sg_buffer,cmd+cmd_len,in_size);
160
+  memcpy(d->private_data->sg_buffer,cmd+cmd_len,in_size);
161
 
162
   hdr.cmdp = cmd;
163
   hdr.cmd_len = cmd_len;
164
@@ -355,7 +355,7 @@
165
   hdr.mx_sb_len = SG_MAX_SENSE;
166
   hdr.timeout = 50000;
167
   hdr.interface_id = 'S';
168
-  hdr.dxferp =  d->private->sg_buffer;
169
+  hdr.dxferp =  d->private_data->sg_buffer;
170
   hdr.flags = SG_FLAG_DIRECT_IO;  /* direct IO if we can get it */
171
 
172
   /* scary buffer fill hack */
173
@@ -400,7 +400,7 @@
174
   if(bytecheck && in_size<out_size){
175
     long i,flag=0;
176
     for(i=in_size;i<out_size;i++)
177
-      if(d->private->sg_buffer[i]!=bytefill){
178
+      if(d->private_data->sg_buffer[i]!=bytefill){
179
 	flag=1;
180
 	break;
181
       }
182
@@ -412,7 +412,7 @@
183
   }
184
 
185
   /* Can't rely on .duration because we can't be certain kernel has HZ set to something useful */
186
-  /* d->private->last_milliseconds = hdr.duration; */
187
+  /* d->private_data->last_milliseconds = hdr.duration; */
188
 
189
   errno = 0;
190
   return 0;
191
@@ -445,9 +445,9 @@
192
 
193
   handle_scsi_cmd(d, cmd, 6, 0, 56, 0,0, sense);
194
 
195
-  key = d->private->sg_buffer[2] & 0xf;
196
-  ASC = d->private->sg_buffer[12];
197
-  ASCQ = d->private->sg_buffer[13];
198
+  key = d->private_data->sg_buffer[2] & 0xf;
199
+  ASC = d->private_data->sg_buffer[12];
200
+  ASCQ = d->private_data->sg_buffer[13];
201
   
202
   if(key == 2 && ASC == 4 && ASCQ == 1) return 0;
203
   return 1;
204
@@ -492,7 +492,7 @@
205
   if (handle_scsi_cmd (d, cmd, 10, 0, size+4,'\377',1,sense)) return(1);
206
 
207
   {
208
-    unsigned char *b=d->private->sg_buffer;
209
+    unsigned char *b=d->private_data->sg_buffer;
210
     if(b[0])return(1); /* Handles only up to 256 bytes */
211
     if(b[6])return(1); /* Handles only up to 256 bytes */
212
 
213
@@ -604,8 +604,8 @@
214
 static unsigned int get_orig_sectorsize(cdrom_drive *d){
215
   if(mode_sense(d,12,0x01))return(-1);
216
 
217
-  d->orgdens = d->private->sg_buffer[4];
218
-  return(d->orgsize = ((int)(d->private->sg_buffer[10])<<8)+d->private->sg_buffer[11]);
219
+  d->orgdens = d->private_data->sg_buffer[4];
220
+  return(d->orgsize = ((int)(d->private_data->sg_buffer[10])<<8)+d->private_data->sg_buffer[11]);
221
 }
222
 
223
 /* switch CDROM scsi drives to given sector size  */
224
@@ -664,8 +664,8 @@
225
     return(-4);
226
   }
227
 
228
-  first=d->private->sg_buffer[2];
229
-  last=d->private->sg_buffer[3];
230
+  first=d->private_data->sg_buffer[2];
231
+  last=d->private_data->sg_buffer[3];
232
   tracks=last-first+1;
233
 
234
   if (last > MAXTRK || first > MAXTRK || last<0 || first<0) {
235
@@ -683,7 +683,7 @@
236
       return(-5);
237
     }
238
     {
239
-      scsi_TOC *toc=(scsi_TOC *)(d->private->sg_buffer+4);
240
+      scsi_TOC *toc=(scsi_TOC *)(d->private_data->sg_buffer+4);
241
 
242
       d->disc_toc[i-first].bFlags=toc->bFlags;
243
       d->disc_toc[i-first].bTrack=i;
244
@@ -704,7 +704,7 @@
245
     return(-2);
246
   }
247
   {
248
-    scsi_TOC *toc=(scsi_TOC *)(d->private->sg_buffer+4);
249
+    scsi_TOC *toc=(scsi_TOC *)(d->private_data->sg_buffer+4);
250
     
251
     d->disc_toc[i-first].bFlags=toc->bFlags;
252
     d->disc_toc[i-first].bTrack=0xAA;
253
@@ -738,7 +738,7 @@
254
   }
255
 
256
   /* copy to our structure and convert start sector */
257
-  tracks = d->private->sg_buffer[1];
258
+  tracks = d->private_data->sg_buffer[1];
259
   if (tracks > MAXTRK) {
260
     cderror(d,"003: CDROM reporting illegal number of tracks\n");
261
     return(-3);
262
@@ -754,33 +754,33 @@
263
       return(-5);
264
     }
265
     
266
-    d->disc_toc[i].bFlags = d->private->sg_buffer[10];
267
+    d->disc_toc[i].bFlags = d->private_data->sg_buffer[10];
268
     d->disc_toc[i].bTrack = i + 1;
269
 
270
     d->disc_toc[i].dwStartSector= d->adjust_ssize * 
271
-	(((signed char)(d->private->sg_buffer[2])<<24) | 
272
-	 (d->private->sg_buffer[3]<<16)|
273
-	 (d->private->sg_buffer[4]<<8)|
274
-	 (d->private->sg_buffer[5]));
275
+	(((signed char)(d->private_data->sg_buffer[2])<<24) | 
276
+	 (d->private_data->sg_buffer[3]<<16)|
277
+	 (d->private_data->sg_buffer[4]<<8)|
278
+	 (d->private_data->sg_buffer[5]));
279
   }
280
 
281
   d->disc_toc[i].bFlags = 0;
282
   d->disc_toc[i].bTrack = i + 1;
283
-  memcpy (&foo, d->private->sg_buffer+2, 4);
284
-  memcpy (&bar, d->private->sg_buffer+6, 4);
285
+  memcpy (&foo, d->private_data->sg_buffer+2, 4);
286
+  memcpy (&bar, d->private_data->sg_buffer+6, 4);
287
   d->disc_toc[i].dwStartSector = d->adjust_ssize * (be32_to_cpu(foo) +
288
 						    be32_to_cpu(bar));
289
 
290
   d->disc_toc[i].dwStartSector= d->adjust_ssize * 
291
-    ((((signed char)(d->private->sg_buffer[2])<<24) | 
292
-      (d->private->sg_buffer[3]<<16)|
293
-      (d->private->sg_buffer[4]<<8)|
294
-      (d->private->sg_buffer[5]))+
295
+    ((((signed char)(d->private_data->sg_buffer[2])<<24) | 
296
+      (d->private_data->sg_buffer[3]<<16)|
297
+      (d->private_data->sg_buffer[4]<<8)|
298
+      (d->private_data->sg_buffer[5]))+
299
      
300
-     ((((signed char)(d->private->sg_buffer[6])<<24) | 
301
-       (d->private->sg_buffer[7]<<16)|
302
-       (d->private->sg_buffer[8]<<8)|
303
-       (d->private->sg_buffer[9]))));
304
+     ((((signed char)(d->private_data->sg_buffer[6])<<24) | 
305
+       (d->private_data->sg_buffer[7]<<16)|
306
+       (d->private_data->sg_buffer[8]<<8)|
307
+       (d->private_data->sg_buffer[9]))));
308
 
309
 
310
   d->cd_extra = FixupTOC(d,tracks+1);
311
@@ -817,7 +817,7 @@
312
   cmd[8] = sectors;
313
   if((ret=handle_scsi_cmd(d,cmd,10,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
314
     return(ret);
315
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
316
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
317
   return(0);
318
 }
319
 
320
@@ -836,7 +836,7 @@
321
   cmd[9] = sectors;
322
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
323
     return(ret);
324
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
325
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
326
   return(0);
327
 }
328
 
329
@@ -854,7 +854,7 @@
330
   cmd[8] = sectors;
331
   if((ret=handle_scsi_cmd(d,cmd,10,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
332
     return(ret);
333
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
334
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
335
   return(0);
336
 }
337
 
338
@@ -872,7 +872,7 @@
339
   cmd[9] = sectors;
340
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
341
     return(ret);
342
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
343
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
344
   return(0);
345
 }
346
 
347
@@ -890,7 +890,7 @@
348
   cmd[8] = sectors;
349
   if((ret=handle_scsi_cmd(d,cmd,10,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
350
     return(ret);
351
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
352
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
353
   return(0);
354
 }
355
 
356
@@ -908,7 +908,7 @@
357
   cmd[9] = sectors;
358
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
359
     return(ret);
360
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
361
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
362
   return(0);
363
 }
364
 
365
@@ -922,7 +922,7 @@
366
   cmd[8] = sectors;
367
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
368
     return(ret);
369
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
370
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
371
   return(0);
372
 }
373
 
374
@@ -936,7 +936,7 @@
375
   cmd[8] = sectors;
376
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
377
     return(ret);
378
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
379
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
380
   return(0);
381
 }
382
 
383
@@ -950,7 +950,7 @@
384
   cmd[8] = sectors;
385
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
386
     return(ret);
387
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
388
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
389
   return(0);
390
 }
391
 
392
@@ -964,7 +964,7 @@
393
   cmd[8] = sectors;
394
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
395
     return(ret);
396
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
397
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
398
   return(0);
399
 }
400
 
401
@@ -978,7 +978,7 @@
402
   cmd[8] = sectors;
403
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
404
     return(ret);
405
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
406
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
407
   return(0);
408
 }
409
 
410
@@ -992,7 +992,7 @@
411
   cmd[8] = sectors;
412
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
413
     return(ret);
414
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
415
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
416
   return(0);
417
 }
418
 
419
@@ -1026,7 +1026,7 @@
420
 
421
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
422
     return(ret);
423
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
424
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
425
   return(0);
426
 }
427
 
428
@@ -1039,7 +1039,7 @@
429
 
430
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
431
     return(ret);
432
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
433
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
434
   return(0);
435
 }
436
 
437
@@ -1052,7 +1052,7 @@
438
   
439
   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
440
     return(ret);
441
-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
442
+  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
443
   return(0);
444
 }
445
 
446
@@ -1275,7 +1275,7 @@
447
 static int count_2352_bytes(cdrom_drive *d){
448
   long i;
449
   for(i=2351;i>=0;i--)
450
-    if(d->private->sg_buffer[i]!=(unsigned char)'\177')
451
+    if(d->private_data->sg_buffer[i]!=(unsigned char)'\177')
452
       return(((i+3)>>2)<<2);
453
 
454
   return(0);
455
@@ -1284,7 +1284,7 @@
456
 static int verify_nonzero(cdrom_drive *d){
457
   long i,flag=0;
458
   for(i=0;i<2352;i++)
459
-    if(d->private->sg_buffer[i]!=0){
460
+    if(d->private_data->sg_buffer[i]!=0){
461
       flag=1;
462
       break;
463
     }
464
@@ -1621,7 +1621,7 @@
465
   d->is_mmc=0;
466
   if(mode_sense(d,22,0x2A)==0){
467
   
468
-    b=d->private->sg_buffer;
469
+    b=d->private_data->sg_buffer;
470
     b+=b[3]+4;
471
     
472
     if((b[0]&0x3F)==0x2A){
473
@@ -1669,7 +1669,7 @@
474
     cderror(d,"008: Unable to identify CDROM model\n");
475
     return(NULL);
476
   }
477
-  return (d->private->sg_buffer);
478
+  return (d->private_data->sg_buffer);
479
 }
480
 
481
 int scsi_init_drive(cdrom_drive *d){
482
@@ -1725,8 +1725,8 @@
483
   check_cache(d);
484
 
485
   d->error_retry=1;
486
-  d->private->sg_hd=realloc(d->private->sg_hd,d->nsectors*CD_FRAMESIZE_RAW + SG_OFF + 128);
487
-  d->private->sg_buffer=((unsigned char *)d->private->sg_hd)+SG_OFF;
488
+  d->private_data->sg_hd=realloc(d->private_data->sg_hd,d->nsectors*CD_FRAMESIZE_RAW + SG_OFF + 128);
489
+  d->private_data->sg_buffer=((unsigned char *)d->private_data->sg_hd)+SG_OFF;
490
   d->report_all=1;
491
   return(0);
492
 }
493
Index: interface/cooked_interface.c
494
===================================================================
495
--- interface/cooked_interface.c	(revision 15337)
496
+++ interface/cooked_interface.c	(revision 15338)
497
@@ -13,13 +13,13 @@
498
 static int timed_ioctl(cdrom_drive *d, int fd, int command, void *arg){
499
   struct timespec tv1;
500
   struct timespec tv2;
501
-  int ret1=clock_gettime(d->private->clock,&tv1);
502
+  int ret1=clock_gettime(d->private_data->clock,&tv1);
503
   int ret2=ioctl(fd, command,arg);
504
-  int ret3=clock_gettime(d->private->clock,&tv2);
505
+  int ret3=clock_gettime(d->private_data->clock,&tv2);
506
   if(ret1<0 || ret3<0){
507
-    d->private->last_milliseconds=-1;
508
+    d->private_data->last_milliseconds=-1;
509
   }else{
510
-    d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
511
+    d->private_data->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
512
   }
513
   return ret2;
514
 }
515
Index: interface/scan_devices.c
516
===================================================================
517
--- interface/scan_devices.c	(revision 15337)
518
+++ interface/scan_devices.c	(revision 15338)
519
@@ -264,11 +264,11 @@
520
   d->interface=COOKED_IOCTL;
521
   d->bigendianp=-1; /* We don't know yet... */
522
   d->nsectors=-1;
523
-  d->private=calloc(1,sizeof(*d->private));
524
+  d->private_data=calloc(1,sizeof(*d->private_data));
525
   {
526
     /* goddamnit */
527
     struct timespec tv;
528
-    d->private->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC);
529
+    d->private_data->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC);
530
   }
531
   idmessage(messagedest,messages,"\t\tCDROM sensed: %s\n",description);
532
   return(d);
533
@@ -674,15 +674,15 @@
534
   d->bigendianp=-1; /* We don't know yet... */
535
   d->nsectors=-1;
536
   d->messagedest = messagedest;
537
-  d->private=calloc(1,sizeof(*d->private));
538
+  d->private_data=calloc(1,sizeof(*d->private_data));
539
   {
540
     /* goddamnit */
541
     struct timespec tv;
542
-    d->private->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC);
543
+    d->private_data->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC);
544
   }
545
   if(use_sgio){
546
     d->interface=SGIO_SCSI;
547
-    d->private->sg_buffer=(unsigned char *)(d->private->sg_hd=malloc(MAX_BIG_BUFF_SIZE));
548
+    d->private_data->sg_buffer=(unsigned char *)(d->private_data->sg_hd=malloc(MAX_BIG_BUFF_SIZE));
549
     g_fd=d->cdda_fd=dup(d->ioctl_fd);
550
   }else{
551
     version=verify_SG_version(d,messagedest,messages);
552
@@ -696,8 +696,8 @@
553
     }
554
 
555
     /* malloc our big buffer for scsi commands */
556
-    d->private->sg_hd=malloc(MAX_BIG_BUFF_SIZE);
557
-    d->private->sg_buffer=((unsigned char *)d->private->sg_hd)+SG_OFF;
558
+    d->private_data->sg_hd=malloc(MAX_BIG_BUFF_SIZE);
559
+    d->private_data->sg_buffer=((unsigned char *)d->private_data->sg_hd)+SG_OFF;
560
   }
561
 
562
   {
563
@@ -772,9 +772,9 @@
564
   if(i_fd!=-1)close(i_fd);
565
   if(g_fd!=-1)close(g_fd);
566
   if(d){
567
-    if(d->private){
568
-      if(d->private->sg_hd)free(d->private->sg_hd);
569
-      free(d->private);
570
+    if(d->private_data){
571
+      if(d->private_data->sg_hd)free(d->private_data->sg_hd);
572
+      free(d->private_data);
573
     }
574
     free(d);
575
   }
576
@@ -821,7 +821,7 @@
577
   d->interface=TEST_INTERFACE;
578
   d->bigendianp=-1; /* We don't know yet... */
579
   d->nsectors=-1;
580
-  d->private=calloc(1,sizeof(*d->private));
581
+  d->private_data=calloc(1,sizeof(*d->private_data));
582
   d->drive_model=copystring("File based test interface");
583
   idmessage(messagedest,messages,"\t\tCDROM sensed: %s\n",d->drive_model);
584
   
(-)b/patch-main.c (+15 lines)
Added Link Here
1
--- main.c.orig	2019-07-23 18:12:13 UTC
2
+++ main.c
3
@@ -588,10 +588,10 @@ static void callback(long inpos, int function){
4
 	    buffer[aheadposition+19]='>';
5
 	}
6
    
7
-	fprintf(stderr,buffer);
8
+	fprintf(stderr,"%s",buffer);
9
        
10
 	if (logfile != NULL && function==-1) {
11
-	  fprintf(logfile,buffer+1);
12
+	  fprintf(logfile,"%s",buffer+1);
13
 	  fprintf(logfile,"\n\n");
14
 	  fflush(logfile);
15
 	}
(-)b/patch-paranoia_overlap.c (-1 / +20 lines)
Added Link Here
0
- 
1
--- paranoia/overlap.c.orig	2019-07-23 18:06:02 UTC
2
+++ paranoia/overlap.c
3
@@ -107,7 +107,7 @@ void offset_adjust_settings(cdrom_paranoia *p, void(*c
4
        sector, frob it.  We just want a little hysteresis [sp?]*/
5
     long av=(p->stage2.offpoints?p->stage2.offaccum/p->stage2.offpoints:0);
6
     
7
-    if(abs(av)>p->dynoverlap/4){
8
+    if(labs(av)>p->dynoverlap/4){
9
       av=(av/MIN_SECTOR_EPSILON)*MIN_SECTOR_EPSILON;
10
       
11
       if(callback)(*callback)(ce(p->root.vector),PARANOIA_CB_DRIFT);
12
@@ -207,7 +207,7 @@ void offset_add_value(cdrom_paranoia *p,offsets *o,lon
13
   if(o->offpoints!=-1){
14
 
15
     /* Track the average magnitude of jitter (in either direction) */
16
-    o->offdiff+=abs(value);
17
+    o->offdiff+=labs(value);
18
     o->offpoints++;
19
     o->newpoints++;
20
 

Return to bug 200925