Skip to content

Commit 396093b

Browse files
author
Jan Jaeger
committed
Merge 2.13 changes back in
git-svn-id: file:///home/jj/hercules.svn/trunk@120 956126f8-22a0-4046-8f4a-272fa8102e63
1 parent ea1cb0b commit 396093b

31 files changed

+1252
-521
lines changed

CHANGES

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
07 May 2001 CMPSC fix - Bernard van der Helm
2+
07 May 2001 Correct false data exception in CVDG - Jan Jaegerr
3+
06 May 2001 Fix to Lock Page - Jan Jaeger
4+
06 May 2001 Complete Storage Key Assist - Jan Jaeger
5+
06 May 2001 Complete Move Page Facility 2 - Jan Jaeger
6+
04 May 2001 Correct fbadasd.c syntax error - Greg Smith
7+
04 May 2001 Correct RRB/RRBE rcpkey - Paul Leisy
8+
03 May 2001 Try to open FBA emulated device readonly if open for
9+
readwrite failed. Allows Linux/390 to be installed
10+
from cdrom - Greg Smith
11+
03 May 2001 Allow `readonly' to be specified for shadowed ckd or cckd
12+
devices. Base file will be opened O_RDONLY. - Greg Smith
13+
03 May 2001 Enablement of ISKE/RRBE/SSKE in S/370 mode - Valery Pogonchenko
14+
03 May 2001 Correction to oldpsw during ifetch - Jan Jaeger
15+
30 Apr 2001 Correct SIE guest interrupt subclass enablement - Jan Jaeger
16+
28 Apr 2001 Temporarily intercept move page (SIE) - Jan Jaeger
17+
28 Apr 2001 Add move page to z/Arch - Jan Jaeger
18+
28 Apr 2001 Fix RRBE RCP index error - Paul Leisy
19+
27 Apr 2001 Fix STCM(G) with zero mask - Paul Leisy
20+
26 Apr 2001 Change unsupported config statements erros to warnings - Jan Jaeger
21+
26 Apr 2001 Correct old psw during ifetch exception - Paul Leisy
22+
26 Apr 2001 Correct setting of fetch bit in SSKE under SIE - Paul Leisy
23+
24 Apr 2001 Fixed ckd2cckd bug for multi-file ckd disks - Greg Smith
24+
24 Apr 2001 Added error detection code to ckd2cckd and cckd2ckd - Greg Smith
25+
24 Apr 2001 Fixed potential errors in cckd backwards merge (sf-) - Greg Smith
26+
24 Apr 2001 Reduced CCKD_MAX_DFWQ_DEPTH to 8 for WIN32 otherwise 32 - Greg Smith
127
22 Apr 2001 cckd2ckd not stopping if -cyl specified - Greg Smith
228
22 Apr 2001 add ISKE, RRBE and SSKE to 370 mode - Valery Pogonchenko
329
22 Apr 2001 ckd fix Read Count setting index marker - Valery Pogonchenko

_build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
#!/bin/bash
21
make -f makefile.w32 HOST_ARCH=`uname -m` DEST=/bin install

cckd2ckd.c

Lines changed: 80 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,18 @@ int limited=0; /* 1=Limit cyls copied */
158158

159159
/* read the CKD device header */
160160
rc = read (ifd, &devhdr, CKDDASD_DEVHDR_SIZE);
161+
if (rc != CKDDASD_DEVHDR_SIZE)
162+
{
163+
fprintf (stderr, "cckd2ckd: %s read error: %s\n",
164+
ifile, strerror(errno));
165+
exit (2);
166+
}
161167
if (memcmp(devhdr.devid, "CKD_C370", 8) != 0)
162168
{
163169
fprintf (stderr,
164170
"cckd2ckd: input file %s is not a compressed ckd file\n",
165171
ifile);
166-
exit (2);
172+
exit (3);
167173
}
168174
memcpy (devhdr.devid, "CKD_P370", 8);
169175

@@ -179,6 +185,12 @@ int limited=0; /* 1=Limit cyls copied */
179185

180186
/* read the compressed CKD device header */
181187
rc = read (ifd, &cdevhdr, CCKDDASD_DEVHDR_SIZE);
188+
if (rc != CCKDDASD_DEVHDR_SIZE)
189+
{
190+
fprintf (stderr, "cckd2ckd: %s read error: %s\n",
191+
ifile, strerror(errno));
192+
exit (4);
193+
}
182194

183195
/* check the byte order of the file vs the machine */
184196
if (((cdevhdr.options & CCKD_BIGENDIAN) != 0 && chk_endian() == 0) ||
@@ -188,7 +200,19 @@ int limited=0; /* 1=Limit cyls copied */
188200
/* get area for primary lookup table and read it in */
189201
if (swapend) swapend4 ((unsigned char *)&cdevhdr.numl1tab);
190202
l1 = malloc (cdevhdr.numl1tab * CCKD_L1ENT_SIZE);
203+
if (l1 == NULL)
204+
{
205+
fprintf (stderr, "lookup table malloc error: %s\n",
206+
strerror(errno));
207+
exit (5);
208+
}
191209
rc = read (ifd, l1, cdevhdr.numl1tab * CCKD_L1ENT_SIZE);
210+
if (rc != cdevhdr.numl1tab * CCKD_L1ENT_SIZE)
211+
{
212+
fprintf (stderr, "cckd2ckd: %s read error: %s\n",
213+
ifile, strerror(errno));
214+
exit (6);
215+
}
192216
if (swapend)
193217
for (i = 0; i < cdevhdr.numl1tab; i++)
194218
swapend4 ((unsigned char *)&l1[i]);
@@ -214,7 +238,19 @@ int limited=0; /* 1=Limit cyls copied */
214238
else
215239
{
216240
rc = lseek (ifd, l1[i], SEEK_SET);
241+
if (rc == -1)
242+
{
243+
fprintf (stderr, "cckd2ckd: %s lseek error: %s\n",
244+
ifile, strerror(errno));
245+
exit (7);
246+
}
217247
rc = read (ifd, &l2, CCKD_L2TAB_SIZE);
248+
if (rc != CCKD_L2TAB_SIZE)
249+
{
250+
fprintf (stderr, "cckd2ckd: %s read error: %s\n",
251+
ifile, strerror(errno));
252+
exit (8);
253+
}
218254
}
219255
/* find the last used entry in the level 2 table */
220256
for (j = 255; j > 0; j--)
@@ -256,6 +292,12 @@ int limited=0; /* 1=Limit cyls copied */
256292
/* get buffers */
257293
buf = malloc (trksz);
258294
buf2 = malloc (trksz);
295+
if (buf == NULL || buf2 == NULL)
296+
{
297+
fprintf (stderr, "cckd2ckd: buffer malloc error: %s\n",
298+
strerror(errno));
299+
exit (9);
300+
}
259301

260302
/* process each entry in the primary lookup table */
261303
for (i = 0; i * 256 < trks || l1[i] != 0; i++)
@@ -267,7 +309,19 @@ int limited=0; /* 1=Limit cyls copied */
267309
else
268310
{
269311
rc = lseek (ifd, l1[i], SEEK_SET);
312+
if (rc == -1)
313+
{
314+
fprintf (stderr, "cckd2ckd: %s lseek error: %s\n",
315+
ifile, strerror(errno));
316+
exit (10);
317+
}
270318
rc = read (ifd, &l2, CCKD_L2TAB_SIZE);
319+
if (rc != CCKD_L2TAB_SIZE)
320+
{
321+
fprintf (stderr, "cckd2ckd: %s read error: %s\n",
322+
ifile, strerror(errno));
323+
exit (11);
324+
}
271325
if (swapend) /* fix byte order if necessary */
272326
for (j = 0; j< 256; j++)
273327
{
@@ -279,9 +333,7 @@ int limited=0; /* 1=Limit cyls copied */
279333

280334
/* process each entry in the secondary lookup table */
281335
for (j = 0;
282-
283336
j < 256 && (i * 256 + j < trks || (l1[i] != 0 && l2[j].pos != 0));
284-
285337
j++)
286338

287339
{
@@ -300,7 +352,7 @@ int limited=0; /* 1=Limit cyls copied */
300352
fprintf (stderr,
301353
"cckd2ckd: %s close error: %s\n",
302354
ofile, strerror(errno));
303-
exit(3);
355+
exit(12);
304356
}
305357
*sfxptr = '0' + fileseq;
306358
}
@@ -326,16 +378,17 @@ int limited=0; /* 1=Limit cyls copied */
326378
fprintf (stderr,
327379
"cckd2ckd: %s open error: %s\n",
328380
ofile, strerror(errno));
329-
exit (4);
381+
exit (13);
330382
}
383+
331384
/* write the devhdr */
332385
rc = write (ofd, &devhdr, CKDDASD_DEVHDR_SIZE);
333386
if (rc != CKDDASD_DEVHDR_SIZE)
334387
{
335388
fprintf (stderr,
336389
"cckd2ckd: %s write error: %s\n",
337390
ofile, strerror(errno));
338-
exit (5);
391+
exit (14);
339392
}
340393
}
341394

@@ -348,7 +401,21 @@ int limited=0; /* 1=Limit cyls copied */
348401
else
349402
{
350403
rc = lseek (ifd, l2[j].pos, SEEK_SET);
404+
if (rc == -1)
405+
{
406+
fprintf (stderr, "cckd2ckd: %s lseek error: %s\n",
407+
ifile, strerror(errno));
408+
exit (15);
409+
}
410+
351411
rc = read (ifd, buf, l2[j].len);
412+
if (rc != l2[j].len)
413+
{
414+
fprintf (stderr, "cckd2ckd: %s read error: %s\n",
415+
ifile, strerror(errno));
416+
exit (16);
417+
}
418+
352419
/* uncompress the track image */
353420
compress = buf[0];
354421
buf[0] = 0;
@@ -444,7 +511,7 @@ int limited=0; /* 1=Limit cyls copied */
444511
fprintf (stderr,
445512
"cckd2ckd: %s write error: %s\n",
446513
ofile, strerror(errno));
447-
exit (6);
514+
exit (17);
448515
}
449516

450517
/* update status information */
@@ -455,7 +522,7 @@ int limited=0; /* 1=Limit cyls copied */
455522
{
456523
fprintf (stderr,
457524
"cckd2ckd: Terminated due to errors\n");
458-
exit (7);
525+
exit (18);
459526
}
460527
}
461528
}
@@ -472,15 +539,15 @@ int limited=0; /* 1=Limit cyls copied */
472539
fprintf (stderr,
473540
"cckd2ckd: %s close error: %s\n",
474541
ofile, strerror(errno));
475-
exit(8);
542+
exit(19);
476543
}
477544
rc = close (ifd);
478545
if (rc < 0)
479546
{
480547
fprintf (stderr,
481548
"cckd2ckd: %s close error: %s\n",
482549
ifile, strerror(errno));
483-
exit(9);
550+
exit(20);
484551
}
485552

486553
if (quiet == 0 || errs > 0)
@@ -509,7 +576,7 @@ void syntax ()
509576
" -quiet quiet mode, don't display status\n"
510577
" -validate validate track images [default]\n"
511578
" -novalidate don't validate track images\n");
512-
exit (9);
579+
exit (21);
513580
} /* end function syntax */
514581

515582
int abbrev (char *tst, char *cmp)
@@ -615,10 +682,11 @@ int kl,dl; /* Key/Data lengths */
615682
{
616683
kl = buf[sz+5];
617684
dl = buf[sz+6] * 256 + buf[sz+7];
685+
618686
/* fix for track overflow bit */
619687
memcpy (cchh2, &buf[sz], 4); cchh2[0] &= 0x7f;
620-
/* fix for funny formatted vm disks */
621688

689+
/* fix for funny formatted vm disks */
622690
if (r == 1) memcpy (cchh, cchh2, 4);
623691

624692
if (memcmp (cchh, cchh2, 4) != 0 || buf[sz+4] == 0 ||

cckdcdsk.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,9 +698,9 @@ char *compression[] = {"none", "zlib", "bzip2"};
698698

699699
/* consistency check on level 2 table entry */
700700
if (trk >= trks || l2[j].pos < lopos ||
701-
l2[j].pos + l2[j].size > hipos ||
701+
l2[j].pos + l2[j].len > hipos ||
702702
l2[j].len <= CKDDASD_TRKHDR_SIZE ||
703-
l2[j].len > l2[j].size || l2[j].size > trksz)
703+
l2[j].len > trksz)
704704
{
705705
sprintf(msg, "l2tab inconsistency track %d", trk);
706706
bad_trk:
@@ -722,8 +722,8 @@ char *compression[] = {"none", "zlib", "bzip2"};
722722
goto validate_l2;
723723
}
724724
cdskmsg (m, "%s\n"
725-
" l2[%d,%d] offset 0x%x len %d size %d\n",
726-
msg, i, j, l2[j].pos, l2[j].len, l2[j].size);
725+
" l2[%d,%d] offset 0x%x len %d\n",
726+
msg, i, j, l2[j].pos, l2[j].len);
727727
trkerrs++;
728728
invalid_trks++;
729729
if (fdflags & O_RDWR)

cckddasd.c

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2528,14 +2528,43 @@ long len; /* Uncompressed trk length */
25282528
/* make the previous file active */
25292529
cckd->sfn--;
25302530

2531+
/* Verify the integrity of the new active file by calling the
2532+
chkdsk function. This is especially important if the
2533+
preceding file was created by cckddump program and made
2534+
writable for the merge */
2535+
rc = cckd_chkdsk (cckd->fd[sfx-1], sysblk.msgpipew, 1);
2536+
if (rc < 0)
2537+
{
2538+
logmsg ("cckddasd: cannot remove shadow file [%d], "
2539+
"file [%d] failed chkdsk\n",
2540+
sfx, sfx-1);
2541+
cckd->sfn++;
2542+
release_lock (&cckd->filelock);
2543+
return;
2544+
}
2545+
2546+
/* Re-read the compressed device header, in case chkdsk
2547+
rebuilt the free space */
2548+
rc = cckd_read_chdr (dev);
2549+
if (rc < 0)
2550+
{
2551+
logmsg ("cckddasd: cannot remove shadow file [%d], "
2552+
"file [%d] read cckd devhdr failed\n",
2553+
sfx, sfx-1);
2554+
cckd->sfn++;
2555+
release_lock (&cckd->filelock);
2556+
return;
2557+
}
2558+
25312559
/* perform backwards merge to a compressed file */
25322560
if (merge && cckd->cdevhdr[sfx-1].size)
25332561
{
2562+
DEVTRACE ("cckddasd: sfrem merging to compressed file [%d] %s\n",
2563+
sfx-1, sfn);
2564+
cckd->cdevhdr[cckd->sfn].options |= CCKD_OPENED;
25342565
buf = malloc (dev->ckdtrksz);
25352566
for (i = 0; i < cckd->cdevhdr[sfx].numl1tab; i++)
25362567
{
2537-
DEVTRACE ("cckddasd: sfrem merging to compressed file [%d] %s\n", sfx-1, sfn);
2538-
25392568
/* get the level 2 tables */
25402569
rc = cckd_read_l2 (dev, sfx, i);
25412570
memcpy (&l2, cckd->l2, CCKD_L2TAB_SIZE);

0 commit comments

Comments
 (0)