]>
Commit | Line | Data |
---|---|---|
14dbe5f1 | 1 | --- cdrtools-2.01/mkisofs/Makefile.orig Sat Mar 1 23:44:58 2003 |
2 | +++ cdrtools-2.01/mkisofs/Makefile Mon Mar 10 20:59:39 2003 | |
3 | @@ -41,7 +41,7 @@ | |
016fe5d8 | 4 | getopt.c getopt1.c \ |
5 | scsi.c \ | |
6 | scsi_cdr.c cd_misc.c \ | |
7 | - modes.c \ | |
8 | + modes.c silo.c \ | |
14dbe5f1 | 9 | apple.c volume.c desktop.c mac_label.c stream.c \ |
10 | ifo_read.c dvd_file.c dvd_reader.c | |
016fe5d8 | 11 | HFILES= apple.h bootinfo.h config.h defaults.h diskmbr.h exclude.h \ |
016fe5d8 | 12 | --- cdrtools-1.10/mkisofs/defaults.h |
13 | +++ cdrtools-1.10/mkisofs/defaults.h | |
14 | @@ -22,6 +22,10 @@ | |
15 | #define VOLUME_ID_DEFAULT "CDROM" | |
16 | #define BOOT_CATALOG_DEFAULT "boot.catalog" | |
17 | #define BOOT_IMAGE_DEFAULT NULL | |
18 | +#define SILO_BOOT_IMAGE_DEFAULT "boot/second.b" | |
19 | +#define SILO_BOOTBLOCK_DEFAULT "boot/cd.b" | |
20 | +#define SILO_CONF_FILE_DEFAULT "/etc/silo.conf" | |
21 | + | |
22 | #ifdef APPLE_HYB | |
23 | #define APPLE_TYPE_DEFAULT "TEXT" | |
24 | #define APPLE_CREATOR_DEFAULT "unix" | |
25 | --- cdrtools-1.10/mkisofs/mkisofs.8 | |
26 | +++ cdrtools-1.10/mkisofs/mkisofs.8 | |
016fe5d8 | 27 | @@ -1272,6 +1280,25 @@ |
28 | .B \&.m\&kisofsrc | |
29 | with SYSI=system_id. | |
30 | If specified in both places, the command line version is used. | |
31 | +.TP | |
32 | +.BI \-s " silo_conf_file | |
33 | +Specifies the path and filename of the SILO configuration file to be | |
34 | +used when making a "SILO" bootable CD. The pathname must be relative to the | |
35 | +source path specified to | |
36 | +.B mkisofs | |
37 | +and start with a slash. | |
38 | +The default is | |
39 | +.I /etc/silo.conf | |
40 | +See SILO documentation for the syntax of this file. | |
41 | +.TP | |
42 | +.BI \-S " silo_bootblock | |
43 | +Specifies the path and filename of the SILO first stage boot image to be | |
44 | +used when making a "SILO" bootable CD. The pathname must be relative to the | |
45 | +source path specified to | |
46 | +.B mkisofs. | |
47 | +The default is | |
48 | +.I boot/cd.b | |
49 | +The boot image must come from SILO 0.8.7 and higher. | |
50 | .TP | |
51 | .B \-T | |
52 | Generate a file TRANS.TBL in each directory on the CDROM, which can be used | |
14dbe5f1 | 53 | --- cdrtools-2.01/mkisofs/mkisofs.c.orig Sun Mar 2 17:28:33 2003 |
54 | +++ cdrtools-2.01/mkisofs/mkisofs.c Mon Mar 10 21:21:18 2003 | |
55 | @@ -98,6 +98,7 @@ | |
016fe5d8 | 56 | int verbose = 1; |
14dbe5f1 | 57 | int debug = 0; |
016fe5d8 | 58 | int gui = 0; |
14dbe5f1 | 59 | +int use_silo = 0; |
016fe5d8 | 60 | int all_files = 1; /* New default is to include all files */ |
14dbe5f1 | 61 | int follow_links = 0; |
62 | #ifdef IS_CYGWIN | |
63 | @@ -133,6 +134,10 @@ | |
016fe5d8 | 64 | char *boot_catalog = BOOT_CATALOG_DEFAULT; |
65 | char *boot_image = BOOT_IMAGE_DEFAULT; | |
66 | char *genboot_image = BOOT_IMAGE_DEFAULT; | |
67 | +char *silo_boot_image = SILO_BOOT_IMAGE_DEFAULT; | |
68 | +char *silo_bootblock = SILO_BOOTBLOCK_DEFAULT; | |
69 | +char *silo_conf_file = SILO_CONF_FILE_DEFAULT; | |
70 | + | |
71 | int ucs_level = 3; /* We now have Unicode tables so use level 3 */ | |
72 | int volume_set_size = 1; | |
73 | int volume_sequence_number = 1; | |
14dbe5f1 | 74 | @@ -408,6 +413,8 @@ |
016fe5d8 | 75 | |
76 | #endif /* APPLE_HYB */ | |
77 | ||
78 | +#define OPTION_SILO_BOOT 2200 | |
79 | + | |
80 | static int save_pname = 0; | |
81 | ||
82 | static const struct ld_option ld_options[] = | |
14dbe5f1 | 83 | @@ -440,6 +447,8 @@ |
016fe5d8 | 84 | '\0', NULL, "Start specifying alternative El Torito boot parameters", ONE_DASH}, |
85 | {{"sparc-boot", required_argument, NULL, 'B'}, | |
86 | 'B', "FILES", "Set sparc boot image names", ONE_DASH}, | |
87 | + {{"silo-boot", required_argument, NULL, OPTION_SILO_BOOT}, | |
88 | + '\0', "FILE", "Set SILO second stage boot image name" , ONE_DASH }, | |
89 | {{"generic-boot", required_argument, NULL, 'G'}, | |
90 | 'G', "FILE", "Set generic boot image name", ONE_DASH}, | |
91 | {{"sparc-label", required_argument, NULL, OPTION_SPARCLABEL}, | |
14dbe5f1 | 92 | @@ -548,7 +557,10 @@ |
016fe5d8 | 93 | { {"sort", required_argument, NULL, OPTION_SORT}, |
94 | '\0', "FILE", "Sort file content locations according to rules in FILE" , ONE_DASH }, | |
95 | #endif /* SORTING */ | |
96 | - | |
97 | + { {"silo-conf-file", required_argument, NULL, 's'}, | |
98 | + 's', "FILE", "Set name of SILO configuration file on the CD", ONE_DASH }, | |
99 | + { {"silo-bootblock", required_argument, NULL, 'S'}, | |
100 | + 'S', "FILE", "Set SILO first stage bootblock image name", ONE_DASH }, | |
101 | {{"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT}, | |
102 | '\0', NULL, "Split output into files of approx. 1GB size", ONE_DASH}, | |
14dbe5f1 | 103 | {{"stream-file-name", required_argument, NULL, OPTION_STREAM_FILE_NAME}, |
104 | @@ -1362,6 +1374,34 @@ | |
016fe5d8 | 105 | #endif |
106 | } | |
107 | break; | |
108 | + case OPTION_SILO_BOOT: | |
109 | + use_silo++; | |
110 | + silo_boot_image = optarg; /* pathname of the boot image on cd */ | |
111 | + if (silo_boot_image == NULL) { | |
112 | + fprintf(stderr,"Required boot image pathname missing\n"); | |
113 | + exit(1); | |
114 | + } | |
115 | + break; | |
116 | + case 'S': | |
117 | + use_silo++; | |
118 | + silo_bootblock = optarg; /* pathname of the boot image on cd */ | |
119 | + if (silo_bootblock == NULL) { | |
120 | + fprintf(stderr,"Required bootblock pathname missing\n"); | |
121 | + exit(1); | |
122 | + } | |
123 | + break; | |
124 | + case 's': | |
125 | + use_silo++; | |
126 | + silo_conf_file = optarg; /* pathname of the boot image on cd */ | |
127 | + if (silo_conf_file == NULL) { | |
128 | + fprintf(stderr,"Required SILO config file pathname missing\n"); | |
129 | + exit(1); | |
130 | + } | |
131 | + if (*silo_conf_file != '/') { | |
132 | + fprintf(stderr,"SILO config file pathname must start with /\n"); | |
133 | + exit(1); | |
134 | + } | |
135 | + break; | |
136 | case OPTION_ABSTRACT: | |
137 | abstract = optarg; | |
138 | if (strlen(abstract) > 37) { | |
14dbe5f1 | 139 | @@ -3004,7 +3044,10 @@ |
016fe5d8 | 140 | outputlist_insert(&sunlabel_desc); |
141 | if (use_genboot) | |
142 | outputlist_insert(&genboot_desc); | |
14dbe5f1 | 143 | - outputlist_insert(&startpad_desc); |
016fe5d8 | 144 | + if (use_silo) |
14dbe5f1 | 145 | + outputlist_insert(&silo_desc); |
016fe5d8 | 146 | + else |
14dbe5f1 | 147 | + outputlist_insert(&padblock_desc); |
016fe5d8 | 148 | |
149 | /* PVD for disc. */ | |
150 | outputlist_insert(&voldesc_desc); | |
14dbe5f1 | 151 | --- cdrtools-2.01/mkisofs/mkisofs.h.orig Fri Feb 28 01:30:36 2003 |
152 | +++ cdrtools-2.01/mkisofs/mkisofs.h Mon Mar 10 21:22:48 2003 | |
153 | @@ -167,6 +167,7 @@ | |
016fe5d8 | 154 | extern struct output_fragment *out_tail; |
155 | ||
14dbe5f1 | 156 | extern struct output_fragment startpad_desc; |
016fe5d8 | 157 | +extern struct output_fragment silo_desc; |
158 | extern struct output_fragment voldesc_desc; | |
14dbe5f1 | 159 | extern struct output_fragment xvoldesc_desc; |
016fe5d8 | 160 | extern struct output_fragment joliet_desc; |
14dbe5f1 | 161 | @@ -268,8 +269,15 @@ |
016fe5d8 | 162 | struct directory_entry *s_entry; |
163 | unsigned int pad; | |
164 | off_t off; | |
165 | +#ifdef __STDC__ | |
166 | + int (*filter)(char *, int, int); | |
167 | +#else | |
168 | + int (*filter)(); | |
169 | +#endif | |
170 | }; | |
171 | ||
172 | +extern struct deferred_write * dw_head, * dw_tail; | |
173 | + | |
174 | struct eltorito_boot_entry_info { | |
175 | struct eltorito_boot_entry_info *next; | |
176 | char *boot_image; | |
14dbe5f1 | 177 | @@ -616,6 +624,9 @@ |
016fe5d8 | 178 | extern char *boot_catalog; |
179 | extern char *boot_image; | |
180 | extern char *genboot_image; | |
181 | +extern char *silo_boot_image; | |
182 | +extern char *silo_bootblock; | |
183 | +extern char *silo_conf_file; | |
184 | extern int ucs_level; | |
185 | extern int volume_set_size; | |
186 | extern int volume_sequence_number; | |
187 | --- cdrtools-1.10/mkisofs/silo.c | |
188 | +++ cdrtools-1.10/mkisofs/silo.c | |
189 | @@ -0,0 +1,255 @@ | |
190 | +/* | |
191 | + * Program silo.c - Handle SILO bootable iso9660 CD-ROMs. | |
192 | + * | |
193 | + | |
194 | + Copyright (C) 1999 Jakub Jelinek <jakub@redhat.com>. | |
195 | + | |
196 | + This program is free software; you can redistribute it and/or modify | |
197 | + it under the terms of the GNU General Public License as published by | |
198 | + the Free Software Foundation; either version 2, or (at your option) | |
199 | + any later version. | |
200 | + | |
201 | + This program is distributed in the hope that it will be useful, | |
202 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
203 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
204 | + GNU General Public License for more details. | |
205 | + | |
206 | + You should have received a copy of the GNU General Public License | |
207 | + along with this program; if not, write to the Free Software | |
208 | + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
209 | + | |
210 | + | |
211 | +static char rcsid[] ="$Id$"; | |
212 | + | |
213 | +#include <mconfig.h> | |
214 | +#include <stdio.h> | |
215 | +#include <sys/types.h> | |
216 | +#include <sys/stat.h> | |
217 | +#include <unistd.h> | |
218 | +#include <fcntl.h> | |
219 | +#include <stdlib.h> | |
220 | + | |
221 | +#include "mkisofs.h" | |
222 | +#include "iso9660.h" | |
223 | +#include <schily.h> | |
224 | + | |
225 | +/* used by Win32 for opening binary file - not used by Unix */ | |
226 | +#ifndef O_BINARY | |
227 | +#define O_BINARY 0 | |
228 | +#endif /* O_BINARY */ | |
229 | + | |
230 | +struct sun_disklabel { | |
231 | + char info[128]; /* Informative text string */ | |
232 | + char spare0[14]; | |
233 | + struct sun_info { | |
234 | + char spare1; | |
235 | + char id; | |
236 | + char spare2; | |
237 | + char flags; | |
238 | + } infos[8]; | |
239 | + char spare1[246]; /* Boot information etc. */ | |
240 | + char rspeed[2]; /* 722 - Disk rotational speed */ | |
241 | + char pcylcount[2]; /* 722 - Physical cylinder count */ | |
242 | + char sparecyl[2]; /* 722 - extra sects per cylinder */ | |
243 | + char spare2[4]; /* More magic... */ | |
244 | + char ilfact[2]; /* 722 - Interleave factor */ | |
245 | + char ncyl[2]; /* 722 - Data cylinder count */ | |
246 | + char nacyl[2]; /* 722 - Alt. cylinder count */ | |
247 | + char ntrks[2]; /* 722 - Tracks per cylinder */ | |
248 | + char nsect[2]; /* 722 - Sectors per track */ | |
249 | + char spare3[4]; /* Even more magic... */ | |
250 | + struct sun_partition { | |
251 | + char start_cylinder[4]; /* 732 */ | |
252 | + char num_sectors[4]; /* 732 */ | |
253 | + } partitions[8]; | |
254 | + char magic[2]; /* 722 - Magic number */ | |
255 | + char csum[2]; /* 722 - Label xor'd checksum */ | |
256 | + struct bootblock_header { | |
257 | + char magic[4]; /* 732 */ | |
258 | + char aout[20]; | |
259 | + char siloid[8]; | |
260 | + char insn[16]; | |
261 | + char extent[4]; /* 732 */ | |
262 | + char size[4]; /* 732 */ | |
263 | + char text[2048-512-56]; | |
264 | + } bootblock; | |
265 | +}; | |
266 | + | |
267 | +static struct { | |
268 | + char id; | |
269 | + char conf_part; | |
270 | + char part; | |
271 | + char pad; | |
272 | + char conf_file[256]; | |
273 | +} silo_info; | |
274 | + | |
275 | +static int silo_size(int starting_extent) | |
276 | +{ | |
277 | + last_extent += 16; | |
278 | + return 0; | |
279 | +} | |
280 | + | |
281 | +static int silo_filter(char * buffer, int size, int offset) | |
282 | +{ | |
283 | + if (offset < 0x808 + sizeof(silo_info) | |
284 | + && offset + size > 0x808) | |
285 | + { | |
286 | + int i; | |
287 | + if (offset < 0x808) | |
288 | + { | |
289 | + offset = 0x808 - offset; | |
290 | + size -= offset; | |
291 | + buffer += offset; | |
292 | + offset = 0; | |
293 | + } | |
294 | + else | |
295 | + offset -= 0x808; | |
296 | + i = sizeof(silo_info) - offset; | |
297 | + if (i > size) i = size; | |
298 | + memcpy (buffer, ((char *)&silo_info) + offset, i); | |
299 | + } | |
300 | + return 0; | |
301 | +} | |
302 | + | |
303 | +static int silo_write(FILE * outfile) | |
304 | +{ | |
305 | + struct directory_entry * de; | |
306 | + struct directory_entry * de2; | |
307 | + struct deferred_write * dwpnt; | |
308 | + int bootblock, i, should_write; | |
309 | + struct sun_disklabel silo_bb; | |
310 | + | |
311 | + memset (&silo_bb, 0, sizeof (silo_bb)); | |
312 | + | |
313 | + if (*silo_bootblock == '/') silo_bootblock++; | |
314 | + if (*silo_boot_image == '/') silo_boot_image++; | |
315 | + | |
316 | + /* | |
317 | + * search from root of iso fs to find boot catalog | |
318 | + */ | |
319 | + de2 = search_tree_file(root, silo_bootblock); | |
320 | + if (!de2) | |
321 | + { | |
322 | + fprintf(stderr,"Uh oh, I cant find the SILO bootblock!\n"); | |
323 | + exit(1); | |
324 | + } | |
325 | + | |
326 | + /* | |
327 | + * now read it from disk | |
328 | + */ | |
329 | + bootblock = open(de2->whole_name, O_RDWR | O_BINARY); | |
330 | + if (bootblock == -1) | |
331 | + { | |
332 | + fprintf(stderr,"Error opening SILO bootblock for reading.\n"); | |
333 | + perror(""); | |
334 | + exit(1); | |
335 | + } | |
336 | + | |
337 | + if (read (bootblock, (char *)&silo_bb.bootblock, 1024) != 1024) | |
338 | + { | |
339 | + fprintf(stderr,"Error reading SILO bootblock.\n"); | |
340 | + perror(""); | |
341 | + exit(1); | |
342 | + } | |
343 | + | |
344 | + close (bootblock); | |
345 | + | |
346 | + if (get_732 (silo_bb.bootblock.magic) != 0x01030107 | |
347 | + || strncmp (silo_bb.bootblock.siloid, "SILO", 4) | |
348 | + || silo_bb.bootblock.siloid[5] != '.' | |
349 | + || silo_bb.bootblock.siloid[4] < '0' | |
350 | + || silo_bb.bootblock.siloid[4] > '9' | |
351 | + || silo_bb.bootblock.siloid[6] < '0' | |
352 | + || silo_bb.bootblock.siloid[6] > '9' | |
353 | + || silo_bb.bootblock.siloid[7] < '0' | |
354 | + || silo_bb.bootblock.siloid[7] > '9') | |
355 | + { | |
356 | + fprintf(stderr,"Error: the file %s is not a valid SILO bootblock.\n", silo_bootblock); | |
357 | + perror(""); | |
358 | + exit(1); | |
359 | + } | |
360 | + | |
361 | + /* Check version number. Only SILO 0.87 and up is valid. */ | |
362 | + if (silo_bb.bootblock.siloid[4] == '0' | |
363 | + && (silo_bb.bootblock.siloid[6] < '8' | |
364 | + || (silo_bb.bootblock.siloid[6] == '8' | |
365 | + && silo_bb.bootblock.siloid[7] <= '6'))) | |
366 | + { | |
367 | + fprintf(stderr,"Error: SILO bootblock is too old. Must be at least 0.8.7.\n"); | |
368 | + perror(""); | |
369 | + exit(1); | |
370 | + } | |
371 | + | |
372 | + /* | |
373 | + * search from root of iso fs to find boot catalog | |
374 | + */ | |
375 | + de = search_tree_file(root, silo_boot_image); | |
376 | + if (!de) | |
377 | + { | |
378 | + fprintf(stderr,"Uh oh, I cant find the SILO boot image!\n"); | |
379 | + exit(1); | |
380 | + } | |
381 | + | |
382 | + /* | |
383 | + * need to filter second.b, so that we can seed | |
384 | + * silo.conf location and other stuff. | |
385 | + * We could write it into the de->whole_name file, | |
386 | + * but I prefer filtering it like this because | |
387 | + * then the tree can be e.g. read only NFS mounted. | |
388 | + */ | |
389 | + for (dwpnt = dw_head; dwpnt; dwpnt = dwpnt->next) | |
390 | + { | |
391 | + if (!dwpnt->name) continue; | |
392 | + if (!strcmp (dwpnt->name, de->whole_name)) | |
393 | + dwpnt->filter = silo_filter; | |
394 | + } | |
395 | + | |
396 | + set_732 (silo_bb.bootblock.extent, de->starting_block); | |
397 | + set_732 (silo_bb.bootblock.size, de->size); | |
398 | + | |
399 | + strcpy (silo_bb.info, "SPARC bootable CD-ROM: "); | |
400 | + strcat (silo_bb.info, volume_id); | |
401 | + | |
402 | + should_write = (last_extent - session_start) << 2; | |
403 | + | |
404 | + /* Now some magic */ | |
405 | + silo_bb.spare0[3] = 1; | |
406 | + silo_bb.spare0[13] = 8; | |
407 | + for (i = 0; i < 8; i++) { | |
408 | + silo_bb.infos[i].id = 0x83; | |
409 | + silo_bb.infos[i].flags = 0x18; | |
410 | + } | |
411 | + set_732 (silo_bb.spare1 + 14, 0x600ddeee); | |
412 | + set_722 (silo_bb.rspeed, 0x15e); | |
413 | + set_722 (silo_bb.pcylcount, (should_write + 639) / 640); | |
414 | + set_722 (silo_bb.ilfact, 1); | |
415 | + set_722 (silo_bb.ncyl, (should_write + 639) / 640); | |
416 | + set_722 (silo_bb.ntrks, 1); | |
417 | + set_722 (silo_bb.nsect, 640); | |
418 | + set_732 (silo_bb.partitions[0].num_sectors, should_write); | |
419 | + set_722 (silo_bb.magic, 0xdabe); | |
420 | + for (i = 0; i < 510; i+=2) { | |
421 | + silo_bb.csum[0] ^= silo_bb.info[i]; | |
422 | + silo_bb.csum[1] ^= silo_bb.info[i+1]; | |
423 | + } | |
424 | + | |
425 | + xfwrite(&silo_bb, 1, sizeof(silo_bb), outfile); | |
426 | + memset (&silo_bb, 0, sizeof(silo_bb)); | |
427 | + | |
428 | + for(i=1; i<16; i++) | |
429 | + { | |
430 | + xfwrite(&silo_bb, 1, sizeof(silo_bb), outfile); | |
431 | + } | |
432 | + | |
433 | + memset (&silo_info, 0, sizeof(silo_info)); | |
434 | + silo_info.id = 'L'; | |
435 | + silo_info.conf_part = 1; | |
436 | + strncpy (silo_info.conf_file, silo_conf_file, 256); | |
437 | + silo_info.conf_file[259] = '\0'; | |
438 | + | |
439 | + last_extent_written += 16; | |
440 | + | |
441 | + return 0; | |
442 | +} | |
443 | + | |
444 | +struct output_fragment silo_desc = {NULL, silo_size, NULL, silo_write}; | |
445 | --- cdrtools-1.10/mkisofs/vms.c | |
446 | +++ cdrtools-1.10/mkisofs/vms.c | |
447 | @@ -288,7 +288,7 @@ | |
448 | extern unsigned int last_extent_written; | |
449 | ||
450 | int | |
451 | -vms_write_one_file(char *filename, int size, FILE * outfile) | |
452 | +vms_write_one_file(struct deferred_write * dwpnt, FILE * outfile) | |
453 | { | |
454 | int status, | |
455 | i; | |
456 | @@ -296,10 +296,12 @@ | |
457 | int count; | |
458 | int use; | |
459 | int remain; | |
460 | + int offset = 0; | |
461 | ||
462 | - open_file(filename); | |
463 | ||
464 | - remain = size; | |
465 | + open_file(dwpnt->name); | |
466 | + | |
467 | + remain = dwpnt->size; | |
468 | ||
469 | while (remain > 0) { | |
470 | use = (remain > SECTOR_SIZE * NSECT - 1 ? NSECT * SECTOR_SIZE : remain); | |
471 | @@ -308,11 +310,14 @@ | |
472 | rab->rab$l_ubf = buffer; | |
473 | rab->rab$w_usz = sizeof(buffer); | |
474 | status = sys$read(rab); | |
475 | + if (dwpnt->filter) | |
476 | + (* dwpnt->filter)(buffer, use, offset); | |
477 | fwrite(buffer, 1, use, outfile); | |
478 | last_extent_written += use / SECTOR_SIZE; | |
479 | if ((last_extent_written % 1000) < use / SECTOR_SIZE) | |
480 | fprintf(stderr, "%d..", last_extent_written); | |
481 | remain -= use; | |
482 | + offset += use; | |
483 | }; | |
484 | ||
485 | close_file(rab); | |
14dbe5f1 | 486 | --- cdrtools-2.01/mkisofs/write.c.orig Fri Feb 28 01:32:13 2003 |
487 | +++ cdrtools-2.01/mkisofs/write.c Mon Mar 10 21:27:06 2003 | |
488 | @@ -77,10 +77,10 @@ | |
016fe5d8 | 489 | FILE *file)); |
490 | static int assign_directory_addresses __PR((struct directory *node)); | |
491 | #ifdef APPLE_HYB | |
492 | -static void write_one_file __PR((char *filename, unsigned int size, | |
493 | +static void write_one_file __PR((struct deferred_write *dwpnt, | |
494 | FILE *outfile, off_t off)); | |
495 | #else | |
496 | -static void write_one_file __PR((char *filename, unsigned int size, | |
497 | +static void write_one_file __PR((struct deferred_write *dwpnt, | |
498 | FILE *outfile)); | |
499 | #endif | |
500 | static void write_files __PR((FILE *outfile)); | |
14dbe5f1 | 501 | @@ -297,7 +297,7 @@ |
016fe5d8 | 502 | static struct deferred_write mac_boot; |
503 | ||
504 | #endif /* APPLE_HYB */ | |
505 | -static struct deferred_write *dw_head = NULL, | |
506 | +struct deferred_write *dw_head = NULL, | |
507 | *dw_tail = NULL; | |
508 | ||
509 | unsigned int last_extent_written = 0; | |
14dbe5f1 | 510 | @@ -354,16 +354,14 @@ |
016fe5d8 | 511 | |
512 | #ifdef APPLE_HYB | |
513 | static void | |
514 | -write_one_file(filename, size, outfile, off) | |
515 | - char *filename; | |
516 | - unsigned int size; | |
517 | +write_one_file(dwpnt, outfile, off) | |
518 | + struct deferred_write *dwpnt; | |
519 | FILE *outfile; | |
520 | off_t off; | |
521 | #else | |
522 | static void | |
523 | -write_one_file(filename, size, outfile) | |
524 | - char *filename; | |
525 | - unsigned int size; | |
526 | +write_one_file(dwpnt, outfile) | |
527 | + struct deferred_write *dwpnt; | |
528 | FILE *outfile; | |
529 | #endif /* APPLE_HYB */ | |
530 | { | |
14dbe5f1 | 531 | @@ -379,18 +377,18 @@ |
016fe5d8 | 532 | FILE *infile; |
533 | int remain; | |
534 | int use; | |
14dbe5f1 | 535 | + int offset; |
016fe5d8 | 536 | |
14dbe5f1 | 537 | - |
016fe5d8 | 538 | - if ((infile = fopen(filename, "rb")) == NULL) { |
539 | + if ((infile = fopen(dwpnt->name, "rb")) == NULL) { | |
540 | #ifdef USE_LIBSCHILY | |
541 | - comerr("cannot open '%s'\n", filename); | |
542 | + comerr("cannot open '%s'\n", dwpnt->name); | |
543 | #else | |
14dbe5f1 | 544 | #ifndef HAVE_STRERROR |
545 | fprintf(stderr, "cannot open '%s': (%d)\n", | |
016fe5d8 | 546 | - filename, errno); |
547 | + dwpnt->name, errno); | |
548 | #else | |
14dbe5f1 | 549 | fprintf(stderr, "cannot open '%s': %s\n", |
016fe5d8 | 550 | - filename, strerror(errno)); |
551 | + dwpnt->name, strerror(errno)); | |
552 | #endif | |
553 | exit(1); | |
554 | #endif | |
14dbe5f1 | 555 | @@ -398,8 +396,8 @@ |
016fe5d8 | 556 | #ifdef APPLE_HYB |
557 | fseek(infile, off, SEEK_SET); | |
558 | #endif /* APPLE_HYB */ | |
559 | - remain = size; | |
560 | - | |
561 | + remain = dwpnt->size; | |
562 | + offset = 0; | |
563 | while (remain > 0) { | |
564 | use = (remain > SECTOR_SIZE * NSECT - 1 ? | |
565 | NSECT * SECTOR_SIZE : remain); | |
14dbe5f1 | 566 | @@ -408,13 +406,16 @@ |
016fe5d8 | 567 | memset(buffer, 0, use); |
568 | if (fread(buffer, 1, use, infile) == 0) { | |
569 | #ifdef USE_LIBSCHILY | |
14dbe5f1 | 570 | - comerr("cannot read from '%s'\n", filename); |
571 | + comerr("cannot read from '%s'\n", dwpnt->name); | |
016fe5d8 | 572 | #else |
14dbe5f1 | 573 | - fprintf(stderr, "cannot read from '%s'\n", filename); |
574 | + fprintf(stderr, "cannot read from '%s'\n", dwpnt->name); | |
016fe5d8 | 575 | exit(1); |
576 | #endif | |
577 | } | |
14dbe5f1 | 578 | + if (dwpnt->filter) |
579 | + (* dwpnt->filter)(buffer, use, offset); | |
016fe5d8 | 580 | xfwrite(buffer, 1, use, outfile); |
581 | + offset += use; | |
582 | last_extent_written += use / SECTOR_SIZE; | |
583 | #if 0 | |
584 | if ((last_extent_written % 1000) < use / SECTOR_SIZE) { | |
14dbe5f1 | 585 | @@ -474,13 +475,12 @@ |
016fe5d8 | 586 | } else { |
587 | ||
588 | #ifdef VMS | |
589 | - vms_write_one_file(dwpnt->name, dwpnt->size, outfile); | |
590 | + vms_write_one_file(dwpnt, outfile); | |
591 | #else | |
592 | #ifdef APPLE_HYB | |
593 | - write_one_file(dwpnt->name, dwpnt->size, outfile, | |
594 | - dwpnt->off); | |
595 | + write_one_file(dwpnt, outfile,dwpnt->off); | |
596 | #else | |
597 | - write_one_file(dwpnt->name, dwpnt->size, outfile); | |
598 | + write_one_file(dwpnt, outfile); | |
599 | #endif /* APPLE_HYB */ | |
600 | #endif | |
601 | free(dwpnt->name); | |
14dbe5f1 | 602 | @@ -1145,6 +1145,7 @@ |
016fe5d8 | 603 | dwpnt->next = NULL; |
604 | dwpnt->size = s_entry->size; | |
605 | dwpnt->extent = last_extent; | |
606 | + dwpnt->filter = NULL; | |
607 | set_733((char *) s_entry->isorec.extent, | |
608 | last_extent); | |
609 | s_entry->starting_block = last_extent; | |
14dbe5f1 | 610 | @@ -1716,8 +1717,7 @@ |
016fe5d8 | 611 | |
612 | /* write out HFS boot block */ | |
613 | if (mac_boot.name) | |
614 | - write_one_file(mac_boot.name, mac_boot.size, outfile, | |
615 | - mac_boot.off); | |
616 | + write_one_file(&mac_boot, outfile, mac_boot.off); | |
617 | } | |
618 | #endif /* APPLE_HYB */ | |
619 |