summaryrefslogtreecommitdiff
path: root/fdisk/fdisksunlabel.h
blob: 647a2cec1f9e675b2f35119f9cea67495e10113e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <linux/types.h>   /* for __u16, __u32 */

typedef struct {
	unsigned char info[128];   /* Informative text string */
	unsigned char spare0[14];
	struct sun_info {
		unsigned char spare1;
		unsigned char id;
		unsigned char spare2;
		unsigned char flags;
	} infos[8];
	unsigned char spare1[246]; /* Boot information etc. */
	unsigned short rspeed;     /* Disk rotational speed */
	unsigned short pcylcount;  /* Physical cylinder count */
	unsigned short sparecyl;   /* extra sects per cylinder */
	unsigned char spare2[4];   /* More magic... */
	unsigned short ilfact;     /* Interleave factor */
	unsigned short ncyl;       /* Data cylinder count */
	unsigned short nacyl;      /* Alt. cylinder count */
	unsigned short ntrks;      /* Tracks per cylinder */
	unsigned short nsect;      /* Sectors per track */
	unsigned char spare3[4];   /* Even more magic... */
	struct sun_partition {
		__u32 start_cylinder;
		__u32 num_sectors;
	} partitions[8];
	unsigned short magic;      /* Magic number */
	unsigned short csum;       /* Label xor'd checksum */
} sun_partition;

#define SUN_LABEL_MAGIC          0xDABE
#define SUN_LABEL_MAGIC_SWAPPED  0xBEDA
#define sunlabel ((sun_partition *)MBRbuffer)
#define SSWAP16(x) (other_endian ? __swap16(x) \
				 : (__u16)(x))
#define SSWAP32(x) (other_endian ? __swap32(x) \
				 : (__u32)(x))
				 
/* fdisk.c */
extern char MBRbuffer[MAX_SECTOR_SIZE];
extern uint heads, sectors, cylinders;
extern int show_begin;
extern int sun_label;
extern char *partition_type(unsigned char type);
extern void update_units(void);
extern char read_chars(char *mesg);
extern void set_all_unchanged(void);
extern void set_changed(int);

/* fdisksunlabel.c */
#define SUNOS_SWAP 3
#define WHOLE_DISK 5

extern struct systypes sun_sys_types[];
extern int get_num_sectors(struct sun_partition p);
extern void guess_device_type(int fd);
extern int check_sun_label(void);
extern void sun_nolabel(void);
extern void create_sunlabel(void);
extern void sun_delete_partition(int i);
extern void sun_change_sysid(int i, int sys);
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);
extern void toggle_sunflags(int i, unsigned char mask);