fsync takes a waitfor flag; replace rdwri with vn_rdwr;
[unix-history] / usr / src / sys / ufs / ffs / ufs_disksubr.c
index 7486d8a..902d513 100644 (file)
@@ -1,9 +1,20 @@
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * All rights reserved.
  *
  *
- *     @(#)ufs_disksubr.c      7.10 (Berkeley) %G%
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ *     @(#)ufs_disksubr.c      7.12 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -11,8 +22,6 @@
 #include "buf.h"
 #include "disklabel.h"
 #include "syslog.h"
 #include "buf.h"
 #include "disklabel.h"
 #include "syslog.h"
-
-#include "dir.h"
 #include "user.h"
 
 /*
 #include "user.h"
 
 /*
@@ -149,9 +158,7 @@ readdisklabel(dev, strat, lp)
        bp->b_flags = B_BUSY | B_READ;
        bp->b_cylin = LABELSECTOR / lp->d_secpercyl;
        (*strat)(bp);
        bp->b_flags = B_BUSY | B_READ;
        bp->b_cylin = LABELSECTOR / lp->d_secpercyl;
        (*strat)(bp);
-       biowait(bp);
-       if (bp->b_flags & B_ERROR) {
-               u.u_error = 0;          /* XXX */
+       if (biowait(bp)) {
                msg = "I/O error";
        } else for (dlp = (struct disklabel *)bp->b_un.b_addr;
            dlp <= (struct disklabel *)(bp->b_un.b_addr+DEV_BSIZE-sizeof(*dlp));
                msg = "I/O error";
        } else for (dlp = (struct disklabel *)bp->b_un.b_addr;
            dlp <= (struct disklabel *)(bp->b_un.b_addr+DEV_BSIZE-sizeof(*dlp));
@@ -244,12 +251,8 @@ writedisklabel(dev, strat, lp)
        bp->b_bcount = lp->d_secsize;
        bp->b_flags = B_READ;
        (*strat)(bp);
        bp->b_bcount = lp->d_secsize;
        bp->b_flags = B_READ;
        (*strat)(bp);
-       biowait(bp);
-       if (bp->b_flags & B_ERROR) {
-               error = u.u_error;              /* XXX */
-               u.u_error = 0;
+       if (error = biowait(bp))
                goto done;
                goto done;
-       }
        for (dlp = (struct disklabel *)bp->b_un.b_addr;
            dlp <= (struct disklabel *)
              (bp->b_un.b_addr + lp->d_secsize - sizeof(*dlp));
        for (dlp = (struct disklabel *)bp->b_un.b_addr;
            dlp <= (struct disklabel *)
              (bp->b_un.b_addr + lp->d_secsize - sizeof(*dlp));
@@ -259,11 +262,7 @@ writedisklabel(dev, strat, lp)
                        *dlp = *lp;
                        bp->b_flags = B_WRITE;
                        (*strat)(bp);
                        *dlp = *lp;
                        bp->b_flags = B_WRITE;
                        (*strat)(bp);
-                       biowait(bp);
-                       if (bp->b_flags & B_ERROR) {
-                               error = u.u_error;              /* XXX */
-                               u.u_error = 0;
-                       }
+                       error = biowait(bp);
                        goto done;
                }
        }
                        goto done;
                }
        }
@@ -340,6 +339,6 @@ diskerr(bp, dname, what, pri, blkdone, lp)
                (*pr)(" (%s%d bn %d; cn %d", dname, unit, sn,
                    sn / lp->d_secpercyl);
                sn %= lp->d_secpercyl;
                (*pr)(" (%s%d bn %d; cn %d", dname, unit, sn,
                    sn / lp->d_secpercyl);
                sn %= lp->d_secpercyl;
-               (*pr)(" tn %d sn %d)", sn / lp->d_ntracks, sn % lp->d_ntracks);
+               (*pr)(" tn %d sn %d)", sn / lp->d_nsectors, sn % lp->d_nsectors);
        }
 }
        }
 }