aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/diskpc98.h
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1994-12-11 23:20:50 +0000
committerBruce Evans <bde@FreeBSD.org>1994-12-11 23:20:50 +0000
commit63856251d27c54945e52ae3be0c021b3580619f7 (patch)
tree0dab02c73c05347b371f4563223be23770085847 /sys/sys/diskpc98.h
parent51cd3c966690c4f5665e9f8e1972620968e6afbb (diff)
downloadsrc-63856251d27c54945e52ae3be0c021b3580619f7.tar.gz
src-63856251d27c54945e52ae3be0c021b3580619f7.zip
disklabel.h:
Prepare for disk slices - more macros for handling disk device numbers, version of readdisklabel() without DOS goop. Clean up prototypes. Uniformize idempotency ifdef. diskslice.h: New file. dkbad.h: Define more magic numbers. Declare internalized version of dkbad struct and functions to operate on it. Uniformize idempotency ifdef.
Notes
Notes: svn path=/head/; revision=5052
Diffstat (limited to 'sys/sys/diskpc98.h')
-rw-r--r--sys/sys/diskpc98.h76
1 files changed, 55 insertions, 21 deletions
diff --git a/sys/sys/diskpc98.h b/sys/sys/diskpc98.h
index 859192e7e374..4e4b4aa571b9 100644
--- a/sys/sys/diskpc98.h
+++ b/sys/sys/diskpc98.h
@@ -35,7 +35,7 @@
*/
#ifndef _SYS_DISKLABEL_H_
-#define _SYS_DISKLABEL_H_
+#define _SYS_DISKLABEL_H_
/*
* Disk description table, see disktab(5)
@@ -50,6 +50,12 @@
* to leave room for a bootstrap, etc.
*/
+/*
+ * XXX the following will go away when conversion to the slice version is
+ * complete: OURPART, RAWPART, readMSPtolabel, readMBRtolabel, dkminor,
+ * the DOSified readdisklabel, DOS stuff in this file.
+ */
+
/* XXX these should be defined per controller (or drive) elsewhere, not here! */
#ifdef __i386__
#define LABELSECTOR 1 /* sector containing label */
@@ -88,6 +94,9 @@
#define MAXPARTITIONS 8
#endif
+#define LABEL_PART 2 /* partition containing label */
+#define RAW_PART 2 /* partition containing whole disk */
+#define SWAP_PART 1 /* partition normally containing swap */
#ifndef LOCORE
struct disklabel {
@@ -375,21 +384,55 @@ extern struct dos_partition dos_partitions[NDOSPART];
#define DIOCSBAD _IOW('d', 110, struct dkbad) /* set kernel dkbad */
-#endif /* LOCORE */
+/*
+ * XXX encoding of disk minor numbers, should be elsewhere.
+ *
+ * See <sys/reboot.h> for a possibly better encoding.
+ *
+ * "cpio -H newc" can be used to back up device files with large minor
+ * numbers (but not ones >= 2^31). Old cpio formats and all tar formats
+ * don't have enough bits, and cpio and tar don't notice the lossage.
+ * There are also some sign extension bugs.
+ */
+#define dkmakeminor(unit, slice, part) \
+ (((slice) << 16) | ((unit) << 3) | (part))
+#define dkminor(unit, part) dkmakeminor((unit), 0, (part))
+#define dkmodpart(dev, part) (((dev) & ~(dev_t)7) | (part))
+#define dkmodslice(dev, slice) (((dev) & ~(dev_t)0x1f0000) | ((slice) << 16))
+#define dkpart(dev) (minor(dev) & 7)
+#define dkslice(dev) ((minor(dev) >> 16) & 0x1f)
+#define dktype(dev) ((minor(dev) >> 21) & 0x7ff)
+#define dkunit(dev) ((minor(dev) >> 3) & 0x1f)
#ifdef KERNEL
-struct dkbad;
+/*
+ * We're not ready to use <sys/disk.h>.
+ */
+#include <sys/conf.h>
-u_int dkcksum __P((struct disklabel *));
-int writedisklabel __P((dev_t dev, void (*strat)(), struct disklabel *lp));
-char * readdisklabel __P((dev_t dev, void (*strat)(), struct disklabel *lp, struct dos_partition *dp, struct dkbad *bdp));
-int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp, u_long openmask));
+char *correct_readdisklabel __P((dev_t dev, d_strategy_t *strat,
+ struct disklabel *lp));
+void diskerr __P((struct buf *bp, char *dname, char *what, int pri,
+ int blkdone, struct disklabel *lp));
void disksort __P((struct buf *ap, struct buf *bp));
-void diskerr __P((struct buf *, char *, char *, int, int, struct disklabel *));
-#ifdef __i386
-char * readMBRtolabel __P(( dev_t dev , void (*strat)(), register struct disklabel *lp, struct dos_partition *dp, int *cyl));
-#endif
+u_int dkcksum __P((struct disklabel *lp));
+struct dkbad;
+char *readdisklabel __P((dev_t dev, d_strategy_t *strat,
+ struct disklabel *lp,
+ struct dos_partition *dp, struct dkbad *bdp));
+#ifdef __i386__
+char *readMBRtolabel __P((dev_t dev, d_strategy_t *strat,
+ struct disklabel *lp, struct dos_partition *dp,
+ int *cyl));
#endif
+int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp,
+ u_long openmask));
+int writedisklabel __P((dev_t dev, d_strategy_t *strat,
+ struct disklabel *lp));
+
+#endif /* KERNEL */
+
+#endif /* LOCORE */
#if !defined(KERNEL) && !defined(LOCORE)
@@ -401,13 +444,4 @@ __END_DECLS
#endif
-#ifdef __i386
-/* encoding of disk minor numbers, should be elsewhere... */
-#define dkunit(dev) (minor(dev) >> 3)
-#define dkpart(dev) (minor(dev) & 07)
-#define dkminor(unit, part) (((unit) << 3) | (part))
-#endif
-
-#endif
-
-
+#endif /* !_SYS_DISKLABEL_H_ */