2007-06-27 23:36:08 +02:00
|
|
|
#ifndef FDISK_SUN_LABEL_H
|
|
|
|
#define FDISK_SUN_LABEL_H
|
|
|
|
|
2007-10-27 18:27:31 +01:00
|
|
|
#include <stdint.h>
|
2006-12-07 00:25:35 +01:00
|
|
|
|
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-06-29 15:50:21 -07:00
|
|
|
struct sun_partition {
|
2007-10-27 18:27:31 +01:00
|
|
|
uint32_t start_cylinder;
|
|
|
|
uint32_t num_sectors;
|
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-06-29 15:50:21 -07:00
|
|
|
};
|
2006-12-07 00:25:35 +01:00
|
|
|
|
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-06-29 15:50:21 -07:00
|
|
|
struct sun_tag_flag {
|
2007-10-27 18:27:31 +01:00
|
|
|
uint16_t tag;
|
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-06-29 15:50:21 -07:00
|
|
|
#define SUN_TAG_UNASSIGNED 0x00 /* Unassigned partition */
|
|
|
|
#define SUN_TAG_BOOT 0x01 /* Boot partition */
|
|
|
|
#define SUN_TAG_ROOT 0x02 /* Root filesystem */
|
|
|
|
#define SUN_TAG_SWAP 0x03 /* Swap partition */
|
|
|
|
#define SUN_TAG_USR 0x04 /* /usr filesystem */
|
|
|
|
#define SUN_TAG_BACKUP 0x05 /* Full-disk slice */
|
|
|
|
#define SUN_TAG_STAND 0x06 /* Stand partition */
|
|
|
|
#define SUN_TAG_VAR 0x07 /* /var filesystem */
|
|
|
|
#define SUN_TAG_HOME 0x08 /* /home filesystem */
|
|
|
|
#define SUN_TAG_ALTSCTR 0x09 /* Alt sector partition */
|
|
|
|
#define SUN_TAG_CACHE 0x0a /* Cachefs partition */
|
|
|
|
#define SUN_TAG_RESERVED 0x0b /* SMI reserved data */
|
|
|
|
#define SUN_TAG_LINUX_SWAP 0x82 /* Linux SWAP */
|
|
|
|
#define SUN_TAG_LINUX_NATIVE 0x83 /* Linux filesystem */
|
|
|
|
#define SUN_TAG_LINUX_LVM 0x8e /* Linux LVM */
|
|
|
|
#define SUN_TAG_LINUX_RAID 0xfd /* LInux RAID */
|
|
|
|
|
2007-10-27 18:27:31 +01:00
|
|
|
uint16_t flag;
|
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-06-29 15:50:21 -07:00
|
|
|
#define SUN_FLAG_UNMNT 0x01 /* Unmountable partition*/
|
|
|
|
#define SUN_FLAG_RONLY 0x10 /* Read only */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define SUN_LABEL_SIZE 512
|
|
|
|
|
|
|
|
#define SUN_LABEL_ID_SIZE 128
|
|
|
|
#define SUN_VOLUME_ID_SIZE 8
|
2006-12-07 00:25:35 +01:00
|
|
|
|
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-06-29 15:50:21 -07:00
|
|
|
#define SUN_LABEL_VERSION 0x00000001
|
|
|
|
#define SUN_LABEL_SANE 0x600ddeee
|
|
|
|
#define SUN_NUM_PARTITIONS 8
|
|
|
|
|
|
|
|
struct sun_disk_label {
|
|
|
|
char label_id[SUN_LABEL_ID_SIZE];
|
2007-10-27 18:27:31 +01:00
|
|
|
uint32_t version;
|
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-06-29 15:50:21 -07:00
|
|
|
char volume_id[SUN_VOLUME_ID_SIZE];
|
2007-10-27 18:27:31 +01:00
|
|
|
uint16_t num_partitions;
|
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-06-29 15:50:21 -07:00
|
|
|
struct sun_tag_flag part_tags[SUN_NUM_PARTITIONS];
|
2007-10-27 18:27:31 +01:00
|
|
|
uint32_t bootinfo[3];
|
|
|
|
uint32_t sanity;
|
|
|
|
uint32_t resv[10];
|
|
|
|
uint32_t part_timestamps[SUN_NUM_PARTITIONS];
|
|
|
|
uint32_t write_reinstruct;
|
|
|
|
uint32_t read_reinstruct;
|
|
|
|
uint8_t pad[148];
|
|
|
|
uint16_t rpm;
|
|
|
|
uint16_t pcyl;
|
|
|
|
uint16_t apc;
|
|
|
|
uint16_t resv1;
|
|
|
|
uint16_t resv2;
|
|
|
|
uint16_t intrlv;
|
|
|
|
uint16_t ncyl;
|
|
|
|
uint16_t acyl;
|
|
|
|
uint16_t nhead;
|
|
|
|
uint16_t nsect;
|
|
|
|
uint16_t resv3;
|
|
|
|
uint16_t resv4;
|
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-06-29 15:50:21 -07:00
|
|
|
struct sun_partition partitions[SUN_NUM_PARTITIONS];
|
2007-10-27 18:27:31 +01:00
|
|
|
uint16_t magic;
|
|
|
|
uint16_t cksum;
|
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-06-29 15:50:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define SUN_LABEL_MAGIC 0xDABE
|
|
|
|
#define SUN_LABEL_MAGIC_SWAPPED 0xBEDA
|
|
|
|
#define sunlabel ((struct sun_disk_label *)MBRbuffer)
|
|
|
|
|
|
|
|
/* fdisksunlabel.c */
|
2006-12-07 00:25:35 +01:00
|
|
|
extern struct systypes sun_sys_types[];
|
|
|
|
extern int check_sun_label(void);
|
2006-12-07 00:25:37 +01:00
|
|
|
extern void sun_nolabel(void);
|
2006-12-07 00:25:35 +01:00
|
|
|
extern void create_sunlabel(void);
|
|
|
|
extern void sun_delete_partition(int i);
|
2007-10-27 18:27:31 +01:00
|
|
|
extern int sun_change_sysid(int i, uint16_t sys);
|
2006-12-07 00:25:35 +01:00
|
|
|
extern void sun_list_table(int xtra);
|
|
|
|
extern void verify_sun(void);
|
|
|
|
extern void add_sun_partition(int n, int sys);
|
|
|
|
extern void sun_write_table(void);
|
|
|
|
extern void sun_set_alt_cyl(void);
|
|
|
|
extern void sun_set_ncyl(int cyl);
|
|
|
|
extern void sun_set_xcyl(void);
|
|
|
|
extern void sun_set_ilfact(void);
|
|
|
|
extern void sun_set_rspeed(void);
|
|
|
|
extern void sun_set_pcylcount(void);
|
2007-10-27 18:27:31 +01:00
|
|
|
extern void toggle_sunflags(int i, uint16_t mask);
|
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-06-29 15:50:21 -07:00
|
|
|
extern int sun_get_sysid(int i);
|
2006-12-07 00:25:35 +01:00
|
|
|
|
2007-06-27 23:36:08 +02:00
|
|
|
#endif /* FDISK_SUN_LABEL_H */
|