summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-09-01 11:17:58 +0000
committerphk <phk@FreeBSD.org>1999-09-01 11:17:58 +0000
commitc7fbcea1dac85de61b1f9338b235b9d2b49387ec (patch)
tree6c99d198601c7def25746c84e92ebf2b216a42db /usr.sbin
parentafc28880fdddae30d2950571e85c673afb083fa0 (diff)
downloadFreeBSD-src-c7fbcea1dac85de61b1f9338b235b9d2b49387ec.zip
FreeBSD-src-c7fbcea1dac85de61b1f9338b235b9d2b49387ec.tar.gz
unifdef -Uvax
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bad144/bad144.c148
1 files changed, 0 insertions, 148 deletions
diff --git a/usr.sbin/bad144/bad144.c b/usr.sbin/bad144/bad144.c
index bd5c53f..9929c09 100644
--- a/usr.sbin/bad144/bad144.c
+++ b/usr.sbin/bad144/bad144.c
@@ -385,11 +385,6 @@ main(argc, argv)
if (badfile != -1)
break;
}
-#ifdef vax
- if (nflag == 0 && fflag)
- for (i = nbad - new; i < nbad; i++)
- format(f, bn[i]);
-#endif
if (nflag == 0 && (dp->d_flags & D_BADSECT) == 0) {
dp->d_flags |= D_BADSECT;
dp->d_checksum = 0;
@@ -615,146 +610,3 @@ badsn(bt)
+ (bt->bt_trksec&0xff));
}
-#ifdef vax
-
-struct rp06hdr {
- short h_cyl;
- short h_trksec;
- short h_key1;
- short h_key2;
- char h_data[512];
-#define RP06_FMT 010000 /* 1 == 16 bit, 0 == 18 bit */
-};
-
-/*
- * Most massbus and unibus drives
- * have headers of this form
- */
-struct hpuphdr {
- u_short hpup_cyl;
- u_char hpup_sect;
- u_char hpup_track;
- char hpup_data[512];
-#define HPUP_OKSECT 0xc000 /* this normally means sector is good */
-#define HPUP_16BIT 0x1000 /* 1 == 16 bit format */
-};
-int rp06format(), hpupformat();
-
-struct formats {
- char *f_name; /* disk name */
- int f_bufsize; /* size of sector + header */
- int f_bic; /* value to bic in hpup_cyl */
- int (*f_routine)(); /* routine for special handling */
-} formats[] = {
- { "rp06", sizeof (struct rp06hdr), RP06_FMT, rp06format },
- { "eagle", sizeof (struct hpuphdr), HPUP_OKSECT, hpupformat },
- { "capricorn", sizeof (struct hpuphdr), HPUP_OKSECT, hpupformat },
- { "rm03", sizeof (struct hpuphdr), HPUP_OKSECT, hpupformat },
- { "rm05", sizeof (struct hpuphdr), HPUP_OKSECT, hpupformat },
- { "9300", sizeof (struct hpuphdr), HPUP_OKSECT, hpupformat },
- { "9766", sizeof (struct hpuphdr), HPUP_OKSECT, hpupformat },
- { 0, 0, 0, 0 }
-};
-
-/*ARGSUSED*/
-hpupformat(fp, dp, blk, buf, count)
- struct formats *fp;
- struct disklabel *dp;
- daddr_t blk;
- char *buf;
- int count;
-{
- struct hpuphdr *hdr = (struct hpuphdr *)buf;
- int sect;
-
- if (count < sizeof(struct hpuphdr)) {
- hdr->hpup_cyl = (HPUP_OKSECT | HPUP_16BIT) |
- (blk / (dp->d_nsectors * dp->d_ntracks));
- sect = blk % (dp->d_nsectors * dp->d_ntracks);
- hdr->hpup_track = (u_char)(sect / dp->d_nsectors);
- hdr->hpup_sect = (u_char)(sect % dp->d_nsectors);
- }
- return (0);
-}
-
-/*ARGSUSED*/
-rp06format(fp, dp, blk, buf, count)
- struct formats *fp;
- struct disklabel *dp;
- daddr_t blk;
- char *buf;
- int count;
-{
-
- if (count < sizeof(struct rp06hdr)) {
- warnx("can't read header on blk %d, can't reformat", blk);
- return (-1);
- }
- return (0);
-}
-
-format(fd, blk)
- int fd;
- daddr_t blk;
-{
- register struct formats *fp;
- static char *buf;
- static char bufsize;
- struct format_op fop;
- int n;
-
- for (fp = formats; fp->f_name; fp++)
- if (strncmp(dp->d_typename, fp->f_name, sizeof(dp->d_typename))
- == 0 && strlen(fp->f_name) <= sizeof(dp->d_typename))
- break;
- if (fp->f_name == 0)
- errx(2, "don't know how to format %.*s disks",
- (int)sizeof(dp->d_typename), dp->d_typename);
- if (buf && bufsize < fp->f_bufsize) {
- free(buf);
- buf = NULL;
- }
- if (buf == NULL)
- buf = malloc((unsigned)fp->f_bufsize);
- if (buf == NULL)
- errx(3, "can't allocate sector buffer");
- bufsize = fp->f_bufsize;
- /*
- * Here we do the actual formatting. All we really
- * do is rewrite the sector header and flag the bad sector
- * according to the format table description. If a special
- * purpose format routine is specified, we allow it to
- * process the sector as well.
- */
- if (verbose)
- printf("format blk %d\n", blk);
- bzero((char *)&fop, sizeof(fop));
- fop.df_buf = buf;
- fop.df_count = fp->f_bufsize;
- fop.df_startblk = blk;
- bzero(buf, fp->f_bufsize);
- if (ioctl(fd, DIOCRFORMAT, &fop) < 0)
- warn("read format");
- if (fp->f_routine &&
- (*fp->f_routine)(fp, dp, blk, buf, fop.df_count) != 0)
- return;
- if (fp->f_bic) {
- struct hpuphdr *xp = (struct hpuphdr *)buf;
-
- xp->hpup_cyl &= ~fp->f_bic;
- }
- if (nflag)
- return;
- bzero((char *)&fop, sizeof(fop));
- fop.df_buf = buf;
- fop.df_count = fp->f_bufsize;
- fop.df_startblk = blk;
- if (ioctl(fd, DIOCWFORMAT, &fop) < 0)
- err(4, "write format");
- if (fop.df_count != fp->f_bufsize) {
- char msg[80];
- (void)sprintf(msg, "write format %d", blk);
- warn("%s", msg);
- }
-}
-#endif
OpenPOWER on IntegriCloud