Delete the bogus d_boot[01] fields from struct disklabel.

This shrinks the size 4 bytes on alpha, down to the same 276 bytes
as all other platforms.

Construct a hack to make old ioctls work on new kernels.

Once world is recompiled only the new and correct sysctls will be
used.

This hack will become annoying around 1st of may to make people
rebuild their worlds and it will be gone before 5.0.
This commit is contained in:
Poul-Henning Kamp 2002-04-04 20:34:48 +00:00
parent 4805ff9a48
commit f67ad03a25
4 changed files with 71 additions and 54 deletions

View File

@ -62,6 +62,9 @@
#include <sys/bio.h>
#include <sys/buf.h>
#include <sys/condvar.h>
#ifdef __alpha__
#include <sys/disklabel.h>
#endif
#ifdef KTRACE
#include <sys/ktrace.h>
#endif
@ -648,6 +651,17 @@ ioctl(td, uap)
*(caddr_t *)data = uap->data;
}
#ifdef __alpha__
if (com == DIOCGDINFO_ALPHAHACK)
com = DIOCGDINFO;
if (com == DIOCSDINFO_ALPHAHACK)
com = DIOCSDINFO;
if (com == DIOCWDINFO_ALPHAHACK)
com = DIOCWDINFO;
if (com == DIOCGDVIRGIN_ALPHAHACK)
com = DIOCGDVIRGIN;
#endif
switch (com) {
case FIONBIO:

View File

@ -98,24 +98,7 @@ struct disklabel {
u_int16_t d_subtype; /* controller/d_type specific */
char d_typename[16]; /* type name, e.g. "eagle" */
/*
* d_packname contains the pack identifier and is returned when
* the disklabel is read off the disk or in-core copy.
* d_boot0 and d_boot1 are the (optional) names of the
* primary (block 0) and secondary (block 1-15) bootstraps
* as found in /boot. These are returned when using
* getdiskbyname(3) to retrieve the values from /etc/disktab.
*/
union {
char un_d_packname[16]; /* pack identifier */
struct {
char *un_d_boot0; /* primary bootstrap name */
char *un_d_boot1; /* secondary bootstrap name */
} un_b;
} d_un;
#define d_packname d_un.un_d_packname
#define d_boot0 d_un.un_b.un_d_boot0
#define d_boot1 d_un.un_b.un_d_boot1
char d_packname[16]; /* pack identifier */
/* disk geometry: */
u_int32_t d_secsize; /* # of bytes per sector */
@ -184,6 +167,10 @@ struct disklabel {
} d_partitions[MAXPARTITIONS]; /* actually may be more */
};
#ifdef CTASSERT
CTASSERT(sizeof(struct disklabel) == 276);
#endif
static __inline u_int16_t dkcksum(struct disklabel *lp);
static __inline u_int16_t
dkcksum(lp)
@ -374,6 +361,20 @@ CTASSERT(sizeof (struct dos_partition) == 16);
#define DIOCGFWCYLINDERS _IOR('d', 132, u_int) /* Get firmware cyl'scount */
#define DIOCGKERNELDUMP _IOW('d', 133, u_int) /* Set/Clear kernel dumps */
#ifdef __alpha__
struct disklabel_alphahack {
struct disklabel dl;
char pad[4];
};
#define DIOCGDINFO_ALPHAHACK _IOR('d', 101, struct disklabel_alphahack)/* get */
#define DIOCSDINFO_ALPHAHACK _IOW('d', 102, struct disklabel_alphahack)/* set */
#define DIOCWDINFO_ALPHAHACK _IOW('d', 103, struct disklabel_alphahack)/* set, update disk */
#define DIOCGDVIRGIN_ALPHAHACK _IOR('d', 105, struct disklabel_alphahack)/* get virgin label */
#ifdef CTASSERT
CTASSERT(sizeof(struct disklabel_alphahack) == 280);
#endif
#endif
#ifdef _KERNEL
/*

View File

@ -98,24 +98,7 @@ struct disklabel {
u_int16_t d_subtype; /* controller/d_type specific */
char d_typename[16]; /* type name, e.g. "eagle" */
/*
* d_packname contains the pack identifier and is returned when
* the disklabel is read off the disk or in-core copy.
* d_boot0 and d_boot1 are the (optional) names of the
* primary (block 0) and secondary (block 1-15) bootstraps
* as found in /boot. These are returned when using
* getdiskbyname(3) to retrieve the values from /etc/disktab.
*/
union {
char un_d_packname[16]; /* pack identifier */
struct {
char *un_d_boot0; /* primary bootstrap name */
char *un_d_boot1; /* secondary bootstrap name */
} un_b;
} d_un;
#define d_packname d_un.un_d_packname
#define d_boot0 d_un.un_b.un_d_boot0
#define d_boot1 d_un.un_b.un_d_boot1
char d_packname[16]; /* pack identifier */
/* disk geometry: */
u_int32_t d_secsize; /* # of bytes per sector */
@ -184,6 +167,10 @@ struct disklabel {
} d_partitions[MAXPARTITIONS]; /* actually may be more */
};
#ifdef CTASSERT
CTASSERT(sizeof(struct disklabel) == 276);
#endif
static __inline u_int16_t dkcksum(struct disklabel *lp);
static __inline u_int16_t
dkcksum(lp)
@ -374,6 +361,20 @@ CTASSERT(sizeof (struct dos_partition) == 16);
#define DIOCGFWCYLINDERS _IOR('d', 132, u_int) /* Get firmware cyl'scount */
#define DIOCGKERNELDUMP _IOW('d', 133, u_int) /* Set/Clear kernel dumps */
#ifdef __alpha__
struct disklabel_alphahack {
struct disklabel dl;
char pad[4];
};
#define DIOCGDINFO_ALPHAHACK _IOR('d', 101, struct disklabel_alphahack)/* get */
#define DIOCSDINFO_ALPHAHACK _IOW('d', 102, struct disklabel_alphahack)/* set */
#define DIOCWDINFO_ALPHAHACK _IOW('d', 103, struct disklabel_alphahack)/* set, update disk */
#define DIOCGDVIRGIN_ALPHAHACK _IOR('d', 105, struct disklabel_alphahack)/* get virgin label */
#ifdef CTASSERT
CTASSERT(sizeof(struct disklabel_alphahack) == 280);
#endif
#endif
#ifdef _KERNEL
/*

View File

@ -98,24 +98,7 @@ struct disklabel {
u_int16_t d_subtype; /* controller/d_type specific */
char d_typename[16]; /* type name, e.g. "eagle" */
/*
* d_packname contains the pack identifier and is returned when
* the disklabel is read off the disk or in-core copy.
* d_boot0 and d_boot1 are the (optional) names of the
* primary (block 0) and secondary (block 1-15) bootstraps
* as found in /boot. These are returned when using
* getdiskbyname(3) to retrieve the values from /etc/disktab.
*/
union {
char un_d_packname[16]; /* pack identifier */
struct {
char *un_d_boot0; /* primary bootstrap name */
char *un_d_boot1; /* secondary bootstrap name */
} un_b;
} d_un;
#define d_packname d_un.un_d_packname
#define d_boot0 d_un.un_b.un_d_boot0
#define d_boot1 d_un.un_b.un_d_boot1
char d_packname[16]; /* pack identifier */
/* disk geometry: */
u_int32_t d_secsize; /* # of bytes per sector */
@ -184,6 +167,10 @@ struct disklabel {
} d_partitions[MAXPARTITIONS]; /* actually may be more */
};
#ifdef CTASSERT
CTASSERT(sizeof(struct disklabel) == 276);
#endif
static __inline u_int16_t dkcksum(struct disklabel *lp);
static __inline u_int16_t
dkcksum(lp)
@ -374,6 +361,20 @@ CTASSERT(sizeof (struct dos_partition) == 16);
#define DIOCGFWCYLINDERS _IOR('d', 132, u_int) /* Get firmware cyl'scount */
#define DIOCGKERNELDUMP _IOW('d', 133, u_int) /* Set/Clear kernel dumps */
#ifdef __alpha__
struct disklabel_alphahack {
struct disklabel dl;
char pad[4];
};
#define DIOCGDINFO_ALPHAHACK _IOR('d', 101, struct disklabel_alphahack)/* get */
#define DIOCSDINFO_ALPHAHACK _IOW('d', 102, struct disklabel_alphahack)/* set */
#define DIOCWDINFO_ALPHAHACK _IOW('d', 103, struct disklabel_alphahack)/* set, update disk */
#define DIOCGDVIRGIN_ALPHAHACK _IOR('d', 105, struct disklabel_alphahack)/* get virgin label */
#ifdef CTASSERT
CTASSERT(sizeof(struct disklabel_alphahack) == 280);
#endif
#endif
#ifdef _KERNEL
/*