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/scsipi Pull up revisions 1.142-1.143 (requested...



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

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

diffstat:

 sys/dev/scsipi/cd.c |  41 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 2 deletions(-)

diffs (90 lines):

diff -r 5c958fd45b83 -r 0a5635716d97 sys/dev/scsipi/cd.c
--- a/sys/dev/scsipi/cd.c       Tue May 01 12:27:33 2001 +0000
+++ b/sys/dev/scsipi/cd.c       Tue May 01 12:27:37 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd.c,v 1.141 2000/06/09 08:54:19 enami Exp $   */
+/*     $NetBSD: cd.c,v 1.141.2.1 2001/05/01 12:27:37 he Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -814,6 +814,9 @@
        struct cd_softc *cd = cd_cd.cd_devs[CDUNIT(dev)];
        int part = CDPART(dev);
        int error;
+#ifdef __HAVE_OLD_DISKLABEL
+       struct disklabel newlabel;
+#endif
 
        SC_DEBUG(cd->sc_link, SDEV_DB2, ("cdioctl 0x%lx ", cmd));
 
@@ -864,6 +867,14 @@
        case DIOCGDINFO:
                *(struct disklabel *)addr = *(cd->sc_dk.dk_label);
                return (0);
+#ifdef __HAVE_OLD_DISKLABEL
+       case ODIOCGDINFO:
+               newlabel = *(cd->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 = cd->sc_dk.dk_label;
@@ -873,6 +884,22 @@
 
        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, addr, sizeof (struct olddisklabel));
+                       lp = &newlabel;
+               } else
+#endif
+               lp = (struct disklabel *)addr;
+
                if ((flag & FWRITE) == 0)
                        return (EBADF);
 
@@ -881,7 +908,7 @@
                cd->flags |= CDF_LABELLING;
 
                error = setdisklabel(cd->sc_dk.dk_label,
-                   (struct disklabel *)addr, /*cd->sc_dk.dk_openmask : */0,
+                   lp, /*cd->sc_dk.dk_openmask : */0,
                    cd->sc_dk.dk_cpulabel);
                if (error == 0) {
                        /* XXX ? */
@@ -890,6 +917,7 @@
                cd->flags &= ~CDF_LABELLING;
                cdunlock(cd);
                return (error);
+       }
 
        case DIOCWLABEL:
                return (EBADF);
@@ -898,6 +926,15 @@
                cdgetdefaultlabel(cd, (struct disklabel *)addr);
                return (0);
 
+#ifdef __HAVE_OLD_DISKLABEL
+       case ODIOCGDEFLABEL:
+               cdgetdefaultlabel(cd, &newlabel);
+               if (newlabel.d_npartitions > OLDMAXPARTITIONS)
+                       return ENOTTY;
+               memcpy(addr, &newlabel, sizeof (struct olddisklabel));
+               return (0);
+#endif
+
        case CDIOCPLAYTRACKS: {
                struct ioc_play_track *args = (struct ioc_play_track *)addr;
 



Home | Main Index | Thread Index | Old Index