- regc = c; /* put c someplace safe; it gets clobbered */
- n = read(fi, ba, c);
- if(n != c || regc != c){
- msg("(This should not happen)bread from %s [block %d]: c=0x%x, regc=0x%x, &c=0x%x, n=0x%x\n",
- disk, da, c, regc, &c, n);
-#ifdef ERNIE
- msg("Notify Robert Henry of this error.\n");
-#endif
- if (++breaderrors > BREADEMAX){
- msg("More than %d block read errors from %d\n",
- BREADEMAX, disk);
- broadcast("DUMP IS AILING!\n");
- msg("This is an unrecoverable error.\n");
- if (!query("Do you want to attempt to continue?")){
- dumpabort();
- /*NOTREACHED*/
- } else
- breaderrors = 0;
- }
+ msg("read error from %s [block %d]: count=%d, got=%d, errno=%d (%s)\n",
+ disk, blkno, size, cnt, errno, strerror(errno));
+ if (++breaderrors > BREADEMAX) {
+ msg("More than %d block read errors from %d\n",
+ BREADEMAX, disk);
+ broadcast("DUMP IS AILING!\n");
+ msg("This is an unrecoverable error.\n");
+ if (!query("Do you want to attempt to continue?")){
+ dumpabort();
+ /*NOTREACHED*/
+ } else
+ breaderrors = 0;
+ }
+ /*
+ * Zero buffer, then try to read each sector of buffer separately.
+ */
+ bzero(buf, size);
+ for (i = 0; i < size; i += dev_bsize, buf += dev_bsize, blkno++) {
+ if (lseek(diskfd, (long)(blkno << dev_bshift), 0) < 0)
+ msg("bread: lseek2 fails!\n");
+ if ((cnt = read(diskfd, buf, dev_bsize)) != dev_bsize)
+ msg(" read error from %s [sector %d, errno %d]\n",
+ disk, blkno, errno);