Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/sys/dev/ofw Pull up revisions 1.14-1.15 (requested by f...



details:   https://anonhg.NetBSD.org/src/rev/0bc7848228ac
branches:  netbsd-1-5
changeset: 491531:0bc7848228ac
user:      he <he%NetBSD.org@localhost>
date:      Tue May 01 12:27:26 2001 +0000

description:
Pull up revisions 1.14-1.15 (requested by fvdl):
  Increase the number of BSD disklabel partitions on i386 to 16.

diffstat:

 sys/dev/ofw/ofdisk.c |  46 +++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 43 insertions(+), 3 deletions(-)

diffs (86 lines):

diff -r 3ec1789968ef -r 0bc7848228ac sys/dev/ofw/ofdisk.c
--- a/sys/dev/ofw/ofdisk.c      Tue May 01 12:27:22 2001 +0000
+++ b/sys/dev/ofw/ofdisk.c      Tue May 01 12:27:26 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofdisk.c,v 1.13 2000/05/16 05:45:52 thorpej Exp $      */
+/*     $NetBSD: ofdisk.c,v 1.13.4.1 2001/05/01 12:27:26 he Exp $       */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -314,11 +314,22 @@
 {
        struct ofdisk_softc *of = ofdisk_cd.cd_devs[DISKUNIT(dev)];
        int error;
+#ifdef __HAVE_OLD_DISKLABEL
+       struct disklabel newlabel;
+#endif
        
        switch (cmd) {
        case DIOCGDINFO:
                *(struct disklabel *)data = *of->sc_dk.dk_label;
                return 0;
+#ifdef __HAVE_OLD_DISKLABEL
+       case ODIOCGDINFO:
+               newlabel = *of->sc_dk.dk_label;
+               if (newlabel.d_npartitions > OLDMAXPARTITIONS)
+                       return ENOTTY;
+               memcpy(data, &newlabel, sizeof (struct olddisklabel));
+               return 0;
+#endif
                
        case DIOCGPART:
                ((struct partinfo *)data)->disklab = of->sc_dk.dk_label;
@@ -328,22 +339,51 @@
                
        case DIOCWDINFO:
        case DIOCSDINFO:
+#ifdef __HAVE_OLD_DISKLABEL
+       case ODIOCWDINFO:
+       case ODIOCSDINFO:
+#endif
+       {
+               struct disklabel *lp;
+
+#ifdef __HAVE_OLD_DISKLABEL
+               if (cmd == ODIOCSDINFO || cmd == ODIOCWDINFO) {
+                       memset(&newlabel, 0, sizeof newlabel);
+                       memcpy(&newlabel, data, sizeof (struct olddisklabel));
+                       lp = &newlabel;
+               } else
+#endif
+               lp = (struct disklabel *)data;
+
                if ((flag & FWRITE) == 0)
                        return EBADF;
                
                error = setdisklabel(of->sc_dk.dk_label,
-                   (struct disklabel *)data, /*of->sc_dk.dk_openmask */0,
+                   lp, /*of->sc_dk.dk_openmask */0,
                    of->sc_dk.dk_cpulabel);
-               if (error == 0 && cmd == DIOCWDINFO)
+               if (error == 0 && cmd == DIOCWDINFO
+#ifdef __HAVE_OLD_DISKLABEL
+                   || xfer == ODIOCWDINFO
+#endif
+                   )
                        error = writedisklabel(MAKEDISKDEV(major(dev),
                            DISKUNIT(dev), RAW_PART), ofdisk_strategy,
                            of->sc_dk.dk_label, of->sc_dk.dk_cpulabel);
 
                return error;
+       }
 
        case DIOCGDEFLABEL:
                ofdisk_getdefaultlabel(of, (struct disklabel *)data);
                return 0;
+#ifdef __HAVE_OLD_DISKLABEL
+       case DIOCGDEFLABEL:
+               ofdisk_getdefaultlabel(of, &newlabel);
+               if (newlabel.d_npartitions > OLDMAXPARTITIONS)
+                       return ENOTTY;
+               memcpy(data, &newlabel, sizeof (struct olddisklabel));
+               return 0;
+#endif
 
        default:
                return ENOTTY;



Home | Main Index | Thread Index | Old Index