correct states on multiple opens
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Sat, 18 Apr 1987 05:12:10 +0000 (21:12 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Sat, 18 Apr 1987 05:12:10 +0000 (21:12 -0800)
SCCS-vsn: sys/vax/mba/hp.c 7.5

usr/src/sys/vax/mba/hp.c

index d37ca3b..ca6f802 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)hp.c        7.4 (Berkeley) %G%
+ *     @(#)hp.c        7.5 (Berkeley) %G%
  */
 
 #ifdef HPDEBUG
  */
 
 #ifdef HPDEBUG
@@ -290,10 +290,7 @@ hpinit(dev, flags)
        mi = hpinfo[unit];
        hpaddr = (struct hpdevice *)mi->mi_drv;
 
        mi = hpinfo[unit];
        hpaddr = (struct hpdevice *)mi->mi_drv;
 
-       if (flags & O_NDELAY)
-               sc->sc_state = WANTOPENRAW;
-       else
-               sc->sc_state = WANTOPEN;
+       sc->sc_state = WANTOPEN;
        /*
         * Use the default sizes until we've read the label,
         * or longer if there isn't one there.
        /*
         * Use the default sizes until we've read the label,
         * or longer if there isn't one there.
@@ -303,6 +300,9 @@ hpinit(dev, flags)
        lp->d_ntracks = 20;
        lp->d_secpercyl = 32*20;
 
        lp->d_ntracks = 20;
        lp->d_secpercyl = 32*20;
 
+       if (flags & O_NDELAY)
+               goto raw;
+
        /*
         * Map all ML11's to the same type.  Also calculate
         * transfer rates based on device characteristics.
        /*
         * Map all ML11's to the same type.  Also calculate
         * transfer rates based on device characteristics.
@@ -322,7 +322,7 @@ hpinit(dev, flags)
                mi->mi_type = MBDT_ML11A;
                lp->d_partitions[0].p_size = sc->sc_mlsize;
                lp->d_secpercyl = sc->sc_mlsize;
                mi->mi_type = MBDT_ML11A;
                lp->d_partitions[0].p_size = sc->sc_mlsize;
                lp->d_secpercyl = sc->sc_mlsize;
-               sc->sc_state = WANTOPENRAW;
+               goto raw;
        }
 
        /*
        }
 
        /*
@@ -330,8 +330,6 @@ hpinit(dev, flags)
         * during first read operation.
         */
        if (msg = readdisklabel(dev, hpstrategy, lp)) {
         * during first read operation.
         */
        if (msg = readdisklabel(dev, hpstrategy, lp)) {
-               if (sc->sc_state == OPENRAW)
-                       goto done;
                if (cold)
                        printf(": %s", msg);
                else
                if (cold)
                        printf(": %s", msg);
                else
@@ -339,8 +337,7 @@ hpinit(dev, flags)
 #ifdef COMPAT_42
                mi->mi_type = hpmaptype(mi, lp);
 #else
 #ifdef COMPAT_42
                mi->mi_type = hpmaptype(mi, lp);
 #else
-               sc->sc_state = OPENRAW;
-               goto done;
+               goto raw;
 #endif
        }
 
 #endif
        }
 
@@ -383,6 +380,11 @@ hpinit(dev, flags)
 done:
        wakeup((caddr_t)sc);
        return (error);
 done:
        wakeup((caddr_t)sc);
        return (error);
+
+raw:
+       sc->sc_state = OPENRAW;
+       wakeup((caddr_t)sc);
+       return (error);
 }
 
 hpstrategy(bp)
 }
 
 hpstrategy(bp)