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/ata Pull up revisions 1.211-1.212 (requested by...



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

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

diffstat:

 sys/dev/ata/wd.c |  48 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 44 insertions(+), 4 deletions(-)

diffs (101 lines):

diff -r ef2ff61e9245 -r 97c3816ae2cf sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Tue May 01 12:27:03 2001 +0000
+++ b/sys/dev/ata/wd.c  Tue May 01 12:27:11 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.205 2000/05/27 16:11:16 bouyer Exp $ */
+/*     $NetBSD: wd.c,v 1.205.2.1 2001/05/01 12:27:11 he Exp $ */
 
 /*
  * Copyright (c) 1998 Manuel Bouyer.  All rights reserved.
@@ -929,6 +929,9 @@
 {
        struct wd_softc *wd = wd_cd.cd_devs[WDUNIT(dev)];
        int error;
+#ifdef __HAVE_OLD_DISKLABEL
+       struct disklabel newlabel;
+#endif
 
        WDCDEBUG_PRINT(("wdioctl\n"), DEBUG_FUNCS);
 
@@ -949,7 +952,15 @@
        case DIOCGDINFO:
                *(struct disklabel *)addr = *(wd->sc_dk.dk_label);
                return 0;
-       
+#ifdef __HAVE_OLD_DISKLABEL
+       case ODIOCGDINFO:
+               newlabel = *(wd->sc_dk.dk_label);
+               if (newlabel.d_npartitions > OLDMAXPARTITIONS)
+                       return ENOTTY;
+               memcpy(addr, &newlabel, sizeof (struct olddisklabel));
+               return 0;
+#endif
+
        case DIOCGPART:
                ((struct partinfo *)addr)->disklab = wd->sc_dk.dk_label;
                ((struct partinfo *)addr)->part =
@@ -958,6 +969,22 @@
        
        case DIOCWDINFO:
        case DIOCSDINFO:
+#ifdef __HAVE_OLD_DISKLABEL
+       case ODIOCWDINFO:
+       case ODIOCSDINFO:
+#endif
+       {
+               struct disklabel *lp;
+
+#ifdef __HAVE_OLD_DISKLABEL
+               if (xfer == ODIOCSDINFO || xfer == ODIOCWDINFO) {
+                       memset(&newlabel, 0, sizeof newlabel);
+                       memcpy(&newlabel, addr, sizeof (struct olddisklabel));
+                       lp = &newlabel;
+               } else
+#endif
+               lp = (struct disklabel *)addr;
+
                if ((flag & FWRITE) == 0)
                        return EBADF;
 
@@ -966,12 +993,16 @@
                wd->sc_flags |= WDF_LABELLING;
 
                error = setdisklabel(wd->sc_dk.dk_label,
-                   (struct disklabel *)addr, /*wd->sc_dk.dk_openmask : */0,
+                   lp, /*wd->sc_dk.dk_openmask : */0,
                    wd->sc_dk.dk_cpulabel);
                if (error == 0) {
                        if (wd->drvp->state > RECAL)
                                wd->drvp->drive_flags |= DRIVE_RESET;
-                       if (xfer == DIOCWDINFO)
+                       if (xfer == DIOCWDINFO
+#ifdef __HAVE_OLD_DISKLABEL
+                           || xfer == ODIOCWDINFO
+#endif
+                           )
                                error = writedisklabel(WDLABELDEV(dev),
                                    wdstrategy, wd->sc_dk.dk_label,
                                    wd->sc_dk.dk_cpulabel);
@@ -980,6 +1011,7 @@
                wd->sc_flags &= ~WDF_LABELLING;
                wdunlock(wd);
                return error;
+       }
 
        case DIOCKLABEL:
                if (*(int *)addr)
@@ -1000,6 +1032,14 @@
        case DIOCGDEFLABEL:
                wdgetdefaultlabel(wd, (struct disklabel *)addr);
                return 0;
+#ifdef __HAVE_OLD_DISKLABEL
+       case ODIOCGDEFLABEL:
+               wdgetdefaultlabel(wd, &newlabel);
+               if (newlabel.d_npartitions > OLDMAXPARTITIONS)
+                       return ENOTTY;
+               memcpy(addr, &newlabel, sizeof (struct olddisklabel));
+               return 0;
+#endif
 
 #ifdef notyet
        case DIOCWFORMAT:



Home | Main Index | Thread Index | Old Index