Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Return error in the case of using ODIOCGDINFO or ODI...
details: https://anonhg.NetBSD.org/src/rev/247c46f8d679
branches: trunk
changeset: 501818:247c46f8d679
user: fvdl <fvdl%NetBSD.org@localhost>
date: Mon Jan 08 02:03:45 2001 +0000
description:
Return error in the case of using ODIOCGDINFO or ODIOCGDEFLABEL when
the number of partitions is > OLDMAXPARTITIONS. This is better
than silently truncating the label (don't want to silently throw
away partitions when using an old disklabel binary on a label with
> 8 partitions). From Enami Tsugutomo.
diffstat:
sys/dev/ata/wd.c | 6 +++---
sys/dev/ccd.c | 6 +++---
sys/dev/isa/fd.c | 4 ++--
sys/dev/isa/mcd.c | 6 +++---
sys/dev/ld.c | 6 +++---
sys/dev/mscp/mscp_disk.c | 6 +++---
sys/dev/ofw/ofdisk.c | 6 +++---
sys/dev/qbus/rl.c | 4 ++--
sys/dev/raidframe/rf_netbsdkintf.c | 6 +++---
sys/dev/scsipi/cd.c | 6 +++---
sys/dev/scsipi/sd.c | 6 +++---
sys/dev/vme/xd.c | 4 ++--
sys/dev/vme/xy.c | 4 ++--
sys/dev/vnd.c | 6 +++---
14 files changed, 38 insertions(+), 38 deletions(-)
diffs (truncated from 342 to 300 lines):
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/ata/wd.c Mon Jan 08 02:03:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wd.c,v 1.211 2001/01/07 18:09:01 fvdl Exp $ */
+/* $NetBSD: wd.c,v 1.212 2001/01/08 02:03:45 fvdl Exp $ */
/*
* Copyright (c) 1998 Manuel Bouyer. All rights reserved.
@@ -950,7 +950,7 @@
case ODIOCGDINFO:
newlabel = *(wd->sc_dk.dk_label);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(addr, &newlabel, sizeof (struct olddisklabel));
return 0;
#endif
@@ -1030,7 +1030,7 @@
case ODIOCGDEFLABEL:
wdgetdefaultlabel(wd, &newlabel);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(addr, &newlabel, sizeof (struct olddisklabel));
return 0;
#endif
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/ccd.c
--- a/sys/dev/ccd.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/ccd.c Mon Jan 08 02:03:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ccd.c,v 1.70 2001/01/07 18:09:01 fvdl Exp $ */
+/* $NetBSD: ccd.c,v 1.71 2001/01/08 02:03:46 fvdl Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -1151,7 +1151,7 @@
case ODIOCGDINFO:
newlabel = *(cs->sc_dkdev.dk_label);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(data, &newlabel, sizeof (struct olddisklabel));
break;
#endif
@@ -1213,7 +1213,7 @@
case ODIOCGDEFLABEL:
ccdgetdefaultlabel(cs, &newlabel);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(data, &newlabel, sizeof (struct olddisklabel));
break;
#endif
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/isa/fd.c
--- a/sys/dev/isa/fd.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/isa/fd.c Mon Jan 08 02:03:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.11 2001/01/07 18:09:02 fvdl Exp $ */
+/* $NetBSD: fd.c,v 1.12 2001/01/08 02:03:47 fvdl Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -1321,7 +1321,7 @@
#ifdef __HAVE_OLD_DISKLABEL
if (cmd == ODIOCGDINFO) {
if (buffer.d_npartitions > OLDMAXPARTITIONS)
- buffer.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(addr, &buffer, sizeof (struct olddisklabel));
} else
#endif
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/isa/mcd.c
--- a/sys/dev/isa/mcd.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/isa/mcd.c Mon Jan 08 02:03:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mcd.c,v 1.68 2001/01/07 18:09:01 fvdl Exp $ */
+/* $NetBSD: mcd.c,v 1.69 2001/01/08 02:03:47 fvdl Exp $ */
/*
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
@@ -618,7 +618,7 @@
case ODIOCGDINFO:
newlabel = *(sc->sc_dk.dk_label);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(addr, &newlabel, sizeof (struct olddisklabel));
return 0;
#endif
@@ -676,7 +676,7 @@
case ODIOCGDEFLABEL:
mcdgetdefaultlabel(sc, &newlabel);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(addr, &newlabel, sizeof (struct olddisklabel));
return 0;
#endif
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/ld.c
--- a/sys/dev/ld.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/ld.c Mon Jan 08 02:03:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ld.c,v 1.4 2001/01/07 18:09:01 fvdl Exp $ */
+/* $NetBSD: ld.c,v 1.5 2001/01/08 02:03:46 fvdl Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -299,7 +299,7 @@
case ODIOCGDINFO:
newlabel = *(sc->sc_dk.dk_label);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(addr, &newlabel, sizeof(struct olddisklabel));
return (0);
#endif
@@ -365,7 +365,7 @@
case ODIOCGDEFLABEL:
ldgetdefaultlabel(sc, &newlabel);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(addr, &newlabel, sizeof (struct olddisklabel));
break;
#endif
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/mscp/mscp_disk.c
--- a/sys/dev/mscp/mscp_disk.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/mscp/mscp_disk.c Mon Jan 08 02:03:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mscp_disk.c,v 1.26 2001/01/07 18:09:02 fvdl Exp $ */
+/* $NetBSD: mscp_disk.c,v 1.27 2001/01/08 02:03:47 fvdl Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* Copyright (c) 1988 Regents of the University of California.
@@ -375,7 +375,7 @@
case ODIOCGDINFO:
bcopy(lp, &newlabel, sizeof disklabel);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
bcopy(&newlabel, data, sizeof (struct olddisklabel));
break;
#endif
@@ -445,7 +445,7 @@
#ifdef __HAVE_OLD_DISKLABEL
if (cmd == ODIOCGDEFLABEL) {
if (tp->d_npartitions > OLDMAXPARTITIONS)
- tp->d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(data, tp, sizeof (struct olddisklabel));
}
#endif
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/ofw/ofdisk.c
--- a/sys/dev/ofw/ofdisk.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/ofw/ofdisk.c Mon Jan 08 02:03:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ofdisk.c,v 1.14 2001/01/07 18:09:02 fvdl Exp $ */
+/* $NetBSD: ofdisk.c,v 1.15 2001/01/08 02:03:47 fvdl Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -326,7 +326,7 @@
case ODIOCGDINFO:
newlabel = *of->sc_dk.dk_label;
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(data, &newlabel, sizeof (struct olddisklabel));
return 0;
#endif
@@ -380,7 +380,7 @@
case DIOCGDEFLABEL:
ofdisk_getdefaultlabel(of, &newlabel);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(data, &newlabel, sizeof (struct olddisklabel));
return 0;
#endif
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/qbus/rl.c
--- a/sys/dev/qbus/rl.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/qbus/rl.c Mon Jan 08 02:03:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rl.c,v 1.6 2001/01/07 18:09:02 fvdl Exp $ */
+/* $NetBSD: rl.c,v 1.7 2001/01/08 02:03:47 fvdl Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -392,7 +392,7 @@
case ODIOCGDINFO:
newlabel = *lp;
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
bcopy(&newlabel, addr, sizeof (struct olddisklabel));
break;
#endif
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c Mon Jan 08 02:03:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.102 2001/01/07 18:09:02 fvdl Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.103 2001/01/08 02:03:47 fvdl Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -1459,7 +1459,7 @@
case ODIOCGDINFO:
newlabel = *(rs->sc_dkdev.dk_label);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(data, &newlabel, sizeof (struct olddisklabel));
break;
#endif
@@ -1528,7 +1528,7 @@
case ODIOCGDEFLABEL:
raidgetdefaultlabel(raidPtr, rs, &newlabel);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(data, &newlabel, sizeof (struct olddisklabel));
break;
#endif
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/scsipi/cd.c
--- a/sys/dev/scsipi/cd.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/scsipi/cd.c Mon Jan 08 02:03:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cd.c,v 1.142 2001/01/07 18:09:03 fvdl Exp $ */
+/* $NetBSD: cd.c,v 1.143 2001/01/08 02:03:48 fvdl Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -871,7 +871,7 @@
case ODIOCGDINFO:
newlabel = *(cd->sc_dk.dk_label);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(addr, &newlabel, sizeof (struct olddisklabel));
return (0);
#endif
@@ -930,7 +930,7 @@
case ODIOCGDEFLABEL:
cdgetdefaultlabel(cd, &newlabel);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(addr, &newlabel, sizeof (struct olddisklabel));
return (0);
#endif
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/scsipi/sd.c Mon Jan 08 02:03:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sd.c,v 1.168 2001/01/07 18:09:03 fvdl Exp $ */
+/* $NetBSD: sd.c,v 1.169 2001/01/08 02:03:48 fvdl Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -913,7 +913,7 @@
case ODIOCGDINFO:
newlabel = *(sd->sc_dk.dk_label);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(addr, &newlabel, sizeof (struct olddisklabel));
return (0);
#endif
@@ -1020,7 +1020,7 @@
case ODIOCGDEFLABEL:
sdgetdefaultlabel(sd, &newlabel);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(addr, &newlabel, sizeof (struct olddisklabel));
return (0);
#endif
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/vme/xd.c
--- a/sys/dev/vme/xd.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/vme/xd.c Mon Jan 08 02:03:45 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xd.c,v 1.33 2001/01/07 18:09:03 fvdl Exp $ */
+/* $NetBSD: xd.c,v 1.34 2001/01/08 02:03:48 fvdl Exp $ */
/*
*
@@ -1023,7 +1023,7 @@
case ODIOCGDINFO:
newlabel = *(xd->sc_dk.dk_label);
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
- newlabel.d_npartitions = OLDMAXPARTITIONS;
+ return ENOTTY;
memcpy(addr, &newlabel, sizeof (struct olddisklabel));
return 0;
#endif
diff -r bd1a34da2d55 -r 247c46f8d679 sys/dev/vme/xy.c
--- a/sys/dev/vme/xy.c Mon Jan 08 01:35:03 2001 +0000
+++ b/sys/dev/vme/xy.c Mon Jan 08 02:03:45 2001 +0000
Home |
Main Index |
Thread Index |
Old Index