1 | /*
|
---|
2 | * ps2_hdd.h
|
---|
3 | * $Id: ps2_hdd.h,v 1.5 2005/07/10 21:06:48 bobi Exp $
|
---|
4 | *
|
---|
5 | * borrowed from ps2fdisk
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef _PS2_HDD_H_
|
---|
9 | #define _PS2_HDD_H_
|
---|
10 |
|
---|
11 | typedef unsigned char u_char;
|
---|
12 | typedef unsigned int u_int;
|
---|
13 | typedef unsigned short u_short;
|
---|
14 | typedef unsigned long u_long;
|
---|
15 |
|
---|
16 | /* Various PS2 partition constants */
|
---|
17 | #define PS2_PARTITION_MAGIC "APA" /* "APA\0" */
|
---|
18 | #define PS2_PART_IDMAX 32
|
---|
19 | #define PS2_PART_NAMEMAX 128
|
---|
20 | #define PS2_PART_MAXSUB 64 /* Maximum # of sub-partitions */
|
---|
21 | #define PS2_PART_FLAG_SUB 0x0001 /* Is partition a sub-partition? */
|
---|
22 | #define PS2_MBR_VERSION 2 /* Current MBR version */
|
---|
23 |
|
---|
24 | /* Partition types */
|
---|
25 | #define PS2_MBR_PARTITION 0x0001
|
---|
26 | #define PS2_SWAP_PARTITION 0x0082
|
---|
27 | #define PS2_LINUX_PARTITION 0x0083
|
---|
28 | #define PS2_GAME_PARTITION 0x0100
|
---|
29 |
|
---|
30 | /* Date/time descriptor used in on-disk partition header */
|
---|
31 | typedef struct ps2fs_datetime_type
|
---|
32 | {
|
---|
33 | u_char unused;
|
---|
34 | u_char sec;
|
---|
35 | u_char min;
|
---|
36 | u_char hour;
|
---|
37 | u_char day;
|
---|
38 | u_char month;
|
---|
39 | u_short year;
|
---|
40 | } ps2fs_datetime_t;
|
---|
41 |
|
---|
42 | /* On-disk partition header for a partition */
|
---|
43 | typedef struct ps2_partition_header_type
|
---|
44 | {
|
---|
45 | u_long checksum; /* Sum of all 256 words, assuming checksum==0 */
|
---|
46 | u_char magic [4]; /* PS2_PARTITION_MAGIC */
|
---|
47 | u_long next; /* Sector address of next partition */
|
---|
48 | u_long prev; /* Sector address of previous partition */
|
---|
49 | char id [PS2_PART_IDMAX];
|
---|
50 | char unknown1 [16];
|
---|
51 | u_long start; /* Sector address of this partition */
|
---|
52 | u_long length; /* Sector count */
|
---|
53 | u_short type;
|
---|
54 | u_short flags; /* PS2_PART_FLAG_* */
|
---|
55 | u_long nsub; /* No. of sub-partitions (stored in main partition) */
|
---|
56 | ps2fs_datetime_t created;
|
---|
57 | u_long main; /* For sub-partitions, main partition sector address */
|
---|
58 | u_long number; /* For sub-partitions, sub-partition number */
|
---|
59 | u_short unknown2;
|
---|
60 | char unknown3 [30];
|
---|
61 | char name [PS2_PART_NAMEMAX];
|
---|
62 | struct
|
---|
63 | {
|
---|
64 | char magic [32]; /* Copyright message in MBR */
|
---|
65 | char unknown_0x02;
|
---|
66 | char unknown1 [7];
|
---|
67 | ps2fs_datetime_t created; /* Same as for the partition, it seems*/
|
---|
68 | u_long data_start; /* Some sort of MBR data; position in sectors*/
|
---|
69 | u_long data_len; /* Length also in sectors */
|
---|
70 | char unknown2 [200];
|
---|
71 | } mbr;
|
---|
72 | struct
|
---|
73 | { /* Sub-partition data */
|
---|
74 | u_long start;/* Sector address */
|
---|
75 | u_long length;/* Sector count */
|
---|
76 | } subs [PS2_PART_MAXSUB];
|
---|
77 | } ps2_partition_header_t;
|
---|
78 |
|
---|
79 | #endif /* _PS2_HDD_H_ */
|
---|