annotate libmpdemux/vcd_read_nbsd.h @ 5883:f4a3cb48226a

OpenBSD section translated from Bjorn's patch (beware! doksz-in-the-morning! ;)
author gabucino
date Sun, 28 Apr 2002 05:23:05 +0000
parents 02576893af2a
children 1394aebaa838
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5872
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
1
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
2 #include <sys/types.h>
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
3 #include <sys/inttypes.h>
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
4 #include <sys/cdio.h>
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
5 #include <sys/scsiio.h>
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
6
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
7 #define CDROM_LEADOUT 0xAA
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
8
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
9 static struct ioc_read_toc_entry vcd_entry;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
10 static struct cd_toc_entry vcd_entry_data;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
11 static char vcd_buf[VCD_SECTOR_SIZE];
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
12
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
13 static inline void
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
14 vcd_set_msf(unsigned int sect)
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
15 {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
16 unsigned int s = sect;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
17 vcd_entry_data.addr.msf.frame = sect % 75;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
18 sect = sect / 75;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
19 vcd_entry_data.addr.msf.second = sect % 60;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
20 sect = sect / 60;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
21 vcd_entry_data.addr.msf.minute = sect;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
22 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
23
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
24 static inline unsigned int
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
25 vcd_get_msf()
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
26 {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
27 return vcd_entry_data.addr.msf.frame +
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
28 (vcd_entry_data.addr.msf.second +
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
29 vcd_entry_data.addr.msf.minute * 60) * 75;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
30 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
31
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
32 int
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
33 vcd_seek_to_track(int fd, int track)
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
34 {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
35 vcd_entry.address_format = CD_MSF_FORMAT;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
36 vcd_entry.starting_track = track;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
37 vcd_entry.data_len = sizeof(struct cd_toc_entry);
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
38 vcd_entry.data = &vcd_entry_data;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
39 if (ioctl(fd, CDIOREADTOCENTRIES, &vcd_entry)) {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
40 perror("ioctl dif1");
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
41 return -1;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
42 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
43 return VCD_SECTOR_DATA * vcd_get_msf();
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
44 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
45
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
46 int
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
47 vcd_get_track_end(int fd, int track)
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
48 {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
49 struct ioc_toc_header tochdr;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
50 if (ioctl(fd, CDIOREADTOCHEADER, &tochdr) == -1) {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
51 perror("read CDROM toc header: ");
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
52 return -1;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
53 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
54 vcd_entry.address_format = CD_MSF_FORMAT;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
55 vcd_entry.starting_track = track < tochdr.ending_track ? (track + 1) : CDROM_LEADOUT;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
56 vcd_entry.data_len = sizeof(struct cd_toc_entry);
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
57 vcd_entry.data = &vcd_entry_data;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
58 if (ioctl(fd, CDIOREADTOCENTRYS, &vcd_entry)) {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
59 perror("ioctl dif2");
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
60 return -1;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
61 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
62 return VCD_SECTOR_DATA * vcd_get_msf();
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
63 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
64
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
65 void
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
66 vcd_read_toc(int fd)
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
67 {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
68 struct ioc_toc_header tochdr;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
69 int i;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
70 if (ioctl(fd, CDIOREADTOCHEADER, &tochdr) == -1) {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
71 perror("read CDROM toc header: ");
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
72 return;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
73 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
74 for (i = tochdr.starting_track; i <= tochdr.ending_track; i++) {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
75 struct ioc_read_toc_entry tocentry;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
76 struct cd_toc_entry tocentry_data;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
77
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
78 tocentry.starting_track = i;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
79 tocentry.address_format = CD_MSF_FORMAT;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
80 tocentry.data_len = sizeof(struct cd_toc_entry);
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
81 tocentry.data = &tocentry_data;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
82
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
83 if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
84 perror("read CDROM toc entry: ");
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
85 return;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
86 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
87 printf("track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n",
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
88 (int) tocentry.starting_track,
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
89 (int) tocentry.data->addr_type,
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
90 (int) tocentry.data->control,
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
91 (int) tocentry.address_format,
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
92 (int) tocentry.data->addr.msf.minute,
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
93 (int) tocentry.data->addr.msf.second,
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
94 (int) tocentry.data->addr.msf.frame
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
95 );
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
96 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
97 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
98
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
99 static int
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
100 vcd_read(int fd, char *mem)
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
101 {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
102 struct scsireq sc;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
103 int lba = vcd_get_msf();
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
104 int blocks;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
105 int sector_type;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
106 int sync, header_code, user_data, edc_ecc, error_field;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
107 int sub_channel;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
108 int rc;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
109
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
110 blocks = 1;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
111 sector_type = 5; /* mode2/form2 */
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
112 sync = 0;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
113 header_code = 0;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
114 user_data = 1;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
115 edc_ecc = 0;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
116 error_field = 0;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
117 sub_channel = 0;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
118
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
119 memset(&sc, 0, sizeof(sc));
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
120 sc.cmd[0] = 0xBE;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
121 sc.cmd[1] = (sector_type) << 2;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
122 sc.cmd[2] = (lba >> 24) & 0xff;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
123 sc.cmd[3] = (lba >> 16) & 0xff;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
124 sc.cmd[4] = (lba >> 8) & 0xff;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
125 sc.cmd[5] = lba & 0xff;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
126 sc.cmd[6] = (blocks >> 16) & 0xff;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
127 sc.cmd[7] = (blocks >> 8) & 0xff;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
128 sc.cmd[8] = blocks & 0xff;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
129 sc.cmd[9] = (sync << 7) | (header_code << 5) | (user_data << 4) |
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
130 (edc_ecc << 3) | (error_field << 1);
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
131 sc.cmd[10] = sub_channel;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
132 sc.cmdlen = 12;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
133 sc.databuf = (caddr_t) mem;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
134 sc.datalen = 2328;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
135 sc.senselen = sizeof(sc.sense);
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
136 sc.flags = SCCMD_READ;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
137 sc.timeout = 10000;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
138 rc = ioctl(fd, SCIOCCOMMAND, &sc);
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
139 if (rc == -1) {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
140 perror("SCIOCCOMMAND");
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
141 return -1;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
142 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
143 if (sc.retsts || sc.error) {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
144 fprintf(stderr, "scsi command failed: status %d error %d\n", sc.retsts,
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
145 sc.error);
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
146 return -1;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
147 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
148 return VCD_SECTOR_DATA;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
149 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
150
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
151 #ifdef VCD_CACHE
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
152
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
153 static int vcd_cache_size = 0;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
154 static char *vcd_cache_data = NULL;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
155 static int *vcd_cache_sectors = NULL;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
156 static int vcd_cache_index = 0;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
157 static int vcd_cache_current = -1;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
158
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
159 void
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
160 vcd_cache_init(int s)
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
161 {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
162 vcd_cache_size = s;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
163 vcd_cache_sectors = malloc(s * sizeof(int));
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
164 vcd_cache_data = malloc(s * VCD_SECTOR_SIZE);
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
165 memset(vcd_cache_sectors, 255, s * sizeof(int));
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
166 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
167
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
168 static inline void
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
169 vcd_cache_seek(int sect)
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
170 {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
171 vcd_cache_current = sect;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
172 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
173
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
174 int
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
175 vcd_cache_read(int fd, char *mem)
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
176 {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
177 int i;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
178 char *vcd_buf;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
179 for (i = 0; i < vcd_cache_size; i++)
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
180 if (vcd_cache_sectors[i] == vcd_cache_current) {
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
181 vcd_buf = &vcd_cache_data[i * VCD_SECTOR_SIZE];
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
182 ++vcd_cache_current;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
183 memcpy(mem, &vcd_buf[VCD_SECTOR_OFFS], VCD_SECTOR_DATA);
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
184 return VCD_SECTOR_DATA;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
185 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
186 vcd_buf = &vcd_cache_data[vcd_cache_index * VCD_SECTOR_SIZE];
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
187 vcd_cache_sectors[vcd_cache_index] = vcd_cache_current;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
188 ++vcd_cache_index;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
189 if (vcd_cache_index >= vcd_cache_size)
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
190 vcd_cache_index = 0;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
191 vcd_set_msf(vcd_cache_current);
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
192 memcpy(vcd_buf, &vcd_entry_data.addr.msf, sizeof(vcd_entry_data.addr.msf));
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
193 ++vcd_cache_current;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
194 memcpy(mem, &vcd_buf[VCD_SECTOR_OFFS], VCD_SECTOR_DATA);
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
195 return VCD_SECTOR_DATA;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
196 }
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
197 #endif
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents:
diff changeset
198