blob: 240b6676d2a5237606d58a8e3927a31280fcdbcb (
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
|
#
# adapted from /sys/include/disk.h on Plan 9: subject to the Lucent Public License 1.02
#
Disks: module
{
PATH: con "/dis/lib/disks.dis";
# disk partition interface
Disk: adt {
prefix: string;
part: string;
fd: ref Sys->FD;
wfd: ref Sys->FD;
ctlfd: ref Sys->FD;
rdonly: int;
dtype: string; # "file", "sd" or "floppy"
secs: big;
secsize: int;
size: big;
offset: big; # within larger disk, perhaps
width: int; # of disk size in bytes as decimal string
c: int; # geometry: cyl, head, sectors
h: int;
s: int;
chssrc: string; # "part", "disk" or "guess"
open: fn(f: string, mode: int, noctl: int): ref Disk;
readn: fn(d: self ref Disk, buf: array of byte, n: int): int;
};
init: fn();
# PC partition grot
PCpart: adt {
active: int; # Active or 0
ptype: int;
base: big; # base block address: 0 or first extended partition in chain
offset: big; # block offset from base to partition
size: big; # in sectors
extract: fn(a: array of byte, d: ref Disk): PCpart;
bytes: fn(p: self PCpart, d: ref Disk): array of byte;
};
Toffset: con 446; # offset of partition table in sector
TentrySize: con 2+2*3+4+4; # partition table entry size
NTentry: con 4; # number of table entries
Magic0: con 16r55;
Magic1: con 16rAA;
Active: con 16r80; # partition is active
Type9: con 16r39; # partition type used by Plan 9 and Inferno
chstext: fn(p: array of byte): string;
};
|