Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Define __HAVE_OLD_DISKLABEL in <machine/types.h> for i38...
details: https://anonhg.NetBSD.org/src/rev/121ef6295bf5
branches: trunk
changeset: 501797:121ef6295bf5
user: fvdl <fvdl%NetBSD.org@localhost>
date: Sun Jan 07 17:55:40 2001 +0000
description:
Define __HAVE_OLD_DISKLABEL in <machine/types.h> for i386 (where the
other __HAVE_* defines are). Conditionalize definition of old
disklabel struct and ODIOC* definitions on it, allowing other ports
to bump the number of partitions in the label if they want to
(see comment in sys/disklabel.h).
diffstat:
sys/arch/i386/include/types.h | 3 +-
sys/sys/disklabel.h | 72 ++++++++++++++++++++++++++++++++++++++++++-
sys/sys/dkio.h | 12 ++++++-
3 files changed, 84 insertions(+), 3 deletions(-)
diffs (138 lines):
diff -r b6ac3c21646c -r 121ef6295bf5 sys/arch/i386/include/types.h
--- a/sys/arch/i386/include/types.h Sun Jan 07 17:53:36 2001 +0000
+++ b/sys/arch/i386/include/types.h Sun Jan 07 17:55:40 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.26 2001/01/03 10:08:59 takemura Exp $ */
+/* $NetBSD: types.h,v 1.27 2001/01/07 17:55:40 fvdl Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -79,5 +79,6 @@
#define __HAVE_CPU_COUNTER
#define __HAVE_SYSCALL_INTERN
#define __HAVE_MINIMAL_EMUL
+#define __HAVE_OLD_DISKLABEL
#endif /* _MACHTYPES_H_ */
diff -r b6ac3c21646c -r 121ef6295bf5 sys/sys/disklabel.h
--- a/sys/sys/disklabel.h Sun Jan 07 17:53:36 2001 +0000
+++ b/sys/sys/disklabel.h Sun Jan 07 17:55:40 2001 +0000
@@ -57,9 +57,25 @@
#endif
/*
+ * Ports can switch their MAXPARTITIONS once, as follows:
+ *
+ * - define OLDMAXPARTITIONS in <machine/disklabel.h> as the old number
+ * - define MAXPARTITIONS as the new number
+ * - define DISKUNIT, DISKPART and DISKMINOR macros in <machine/disklabel.h>
+ * as appropriate for the port (see the i386 one for an example).
+ * - define __HAVE_OLD_DISKLABEL in <machine/types.h>
+ */
+
+#if defined(_KERNEL) && defined(__HAVE_OLD_DISKLABEL) && \
+ (MAXPARTITIONS < OLDMAXPARTITIONS)
+#error "can only grow disklabel size"
+#endif
+
+
+/*
* Translate between device numbers and major/disk unit/disk partition.
*/
-#ifndef __i386__
+#ifndef __HAVE_OLD_DISKLABEL
#define DISKUNIT(dev) (minor(dev) / MAXPARTITIONS)
#define DISKPART(dev) (minor(dev) % MAXPARTITIONS)
#define DISKMINOR(unit, part) \
@@ -167,6 +183,60 @@
#define p_sgs __partition_u1.sgs
} d_partitions[MAXPARTITIONS]; /* actually may be more */
};
+
+#ifdef __HAVE_OLD_DISKLABEL
+/*
+ * Same as above, but with OLDMAXPARTITIONS partitions. For use in
+ * the old DIOC* ioctl calls.
+ */
+struct olddisklabel {
+ u_int32_t d_magic;
+ u_int16_t d_type;
+ u_int16_t d_subtype;
+ char d_typename[16];
+ union {
+ char un_d_packname[16];
+ struct {
+ char *un_d_boot0;
+ char *un_d_boot1;
+ } un_b;
+ } d_un;
+ u_int32_t d_secsize;
+ u_int32_t d_nsectors;
+ u_int32_t d_ntracks;
+ u_int32_t d_ncylinders;
+ u_int32_t d_secpercyl;
+ u_int32_t d_secperunit;
+ u_int16_t d_sparespertrack;
+ u_int16_t d_sparespercyl;
+ u_int32_t d_acylinders;
+ u_int16_t d_rpm;
+ u_int16_t d_interleave;
+ u_int16_t d_trackskew;
+ u_int16_t d_cylskew;
+ u_int32_t d_headswitch;
+ u_int32_t d_trkseek;
+ u_int32_t d_flags;
+ u_int32_t d_drivedata[NDDATA];
+ u_int32_t d_spare[NSPARE];
+ u_int32_t d_magic2;
+ u_int16_t d_checksum;
+ u_int16_t d_npartitions;
+ u_int32_t d_bbsize;
+ u_int32_t d_sbsize;
+ struct opartition {
+ u_int32_t p_size;
+ u_int32_t p_offset;
+ u_int32_t p_fsize;
+ u_int8_t p_fstype;
+ u_int8_t p_frag;
+ union {
+ u_int16_t cpg;
+ u_int16_t sgs;
+ } __partition_u1;
+ } d_partitions[OLDMAXPARTITIONS];
+};
+#endif /* __HAVE_OLD_DISKLABEL */
#else /* _LOCORE */
/*
* offsets for asm boot files.
diff -r b6ac3c21646c -r 121ef6295bf5 sys/sys/dkio.h
--- a/sys/sys/dkio.h Sun Jan 07 17:53:36 2001 +0000
+++ b/sys/sys/dkio.h Sun Jan 07 17:55:40 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dkio.h,v 1.4 1999/12/23 21:23:31 leo Exp $ */
+/* $NetBSD: dkio.h,v 1.5 2001/01/07 17:55:41 fvdl Exp $ */
/*
* Copyright (c) 1987, 1988, 1993
@@ -47,6 +47,12 @@
#define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */
#define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */
+#if defined(__HAVE_OLD_DISKLABEL) && defined(_KERNEL)
+#define ODIOCGDINFO _IOR('d', 101, struct olddisklabel)/* get */
+#define ODIOCSDINFO _IOW('d', 102, struct olddisklabel)/* set */
+#define ODIOCWDINFO _IOW('d', 103, struct olddisklabel)/* set, update dk */
+#endif
+
/* do format operation, read or write */
#define DIOCRFORMAT _IOWR('d', 105, struct format_op)
#define DIOCWFORMAT _IOWR('d', 106, struct format_op)
@@ -65,4 +71,8 @@
#define DIOCGDEFLABEL _IOR('d', 114, struct disklabel)
#define DIOCCLRLABEL _IO('d', 115)
+#if defined(__HAVE_OLD_DISKLABEL) && defined(_KERNEL)
+#define ODIOCGDEFLABEL _IOR('d', 114, struct olddisklabel)
+#endif
+
#endif /* _SYS_DKIO_H_ */
Home |
Main Index |
Thread Index |
Old Index