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/mscp Pull up revisions 1.26-1.27 (requested by ...



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

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

diffstat:

 sys/dev/mscp/mscp_disk.c |  49 ++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 45 insertions(+), 4 deletions(-)

diffs (95 lines):

diff -r faa6c51e978a -r 3ec1789968ef sys/dev/mscp/mscp_disk.c
--- a/sys/dev/mscp/mscp_disk.c  Tue May 01 12:27:18 2001 +0000
+++ b/sys/dev/mscp/mscp_disk.c  Tue May 01 12:27:22 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mscp_disk.c,v 1.25 2000/05/27 04:52:35 thorpej Exp $   */
+/*     $NetBSD: mscp_disk.c,v 1.25.4.1 2001/05/01 12:27:22 he Exp $    */
 /*
  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
  * Copyright (c) 1988 Regents of the University of California.
@@ -360,6 +360,9 @@
        struct disklabel *lp, *tp;
        struct ra_softc *ra = ra_cd.cd_devs[unit];
        int error = 0;
+#ifdef __HAVE_OLD_DISKLABEL
+       struct disklabel newlabel;
+#endif
 
        lp = ra->ra_disk.dk_label;
 
@@ -368,6 +371,14 @@
        case DIOCGDINFO:
                bcopy(lp, data, sizeof (struct disklabel));
                break;
+#ifdef __HAVE_OLD_DISKLABEL
+       case ODIOCGDINFO:
+               bcopy(lp, &newlabel, sizeof disklabel);
+               if (newlabel.d_npartitions > OLDMAXPARTITIONS)
+                       return ENOTTY;
+               bcopy(&newlabel, data, sizeof (struct olddisklabel));
+               break;
+#endif
 
        case DIOCGPART:
                ((struct partinfo *)data)->disklab = lp;
@@ -377,11 +388,27 @@
 
        case DIOCWDINFO:
        case DIOCSDINFO:
+#ifdef __HAVE_OLD_DISKLABEL
+       case ODIOCWDINFO:
+       case ODIOCSDINFO:
+               if (cmd == ODIOCSDINFO || xfer == ODIOCWDINFO) {
+                       memset(&newlabel, 0, sizeof newlabel);
+                       memcpy(&newlabel, data, sizeof (struct olddisklabel));
+                       tp = &newlabel;
+               } else
+#endif
+               tp = (struct disklabel *)data;
+
                if ((flag & FWRITE) == 0)
                        error = EBADF;
                else {
-                       error = setdisklabel(lp, (struct disklabel *)data,0,0);
-                       if ((error == 0) && (cmd == DIOCWDINFO)) {
+                       error = setdisklabel(lp, tp, 0, 0);
+                       if ((error == 0) && (cmd == DIOCWDINFO
+#ifdef __HAVE_OLD_DISKLABEL
+                           || cmd == ODIOCWDINFO
+#else
+                           )) {
+#endif
                                ra->ra_wlabel = 1;
                                error = writedisklabel(dev, rastrategy, lp,0);
                                ra->ra_wlabel = 0;
@@ -397,8 +424,15 @@
                break;
 
        case DIOCGDEFLABEL:
+#ifdef __HAVE_OLD_DISKLABEL
+       case ODIOCGDEFLABEL:
+               if (cmd == ODIOCGDEFLABEL)
+                       tp = &newlabel;
+               else
+#else
                tp = (struct disklabel *)data;
-               bzero(data, sizeof(struct disklabel));
+#endif
+               bzero(tp, sizeof(struct disklabel));
                tp->d_secsize = lp->d_secsize;
                tp->d_nsectors = lp->d_nsectors;
                tp->d_ntracks = lp->d_ntracks;
@@ -408,6 +442,13 @@
                tp->d_type = DTYPE_MSCP;
                tp->d_rpm = 3600;
                rrmakelabel(tp, ra->ra_mediaid);
+#ifdef __HAVE_OLD_DISKLABEL
+               if (cmd == ODIOCGDEFLABEL) {
+                       if (tp->d_npartitions > OLDMAXPARTITIONS)
+                               return ENOTTY;
+                       memcpy(data, tp, sizeof (struct olddisklabel));
+               }
+#endif
                break;
 
        default:



Home | Main Index | Thread Index | Old Index