1# 2# adapted from /sys/include/disk.h on Plan 9: subject to the Lucent Public License 1.02 3# 4Disks: module 5{ 6 PATH: con "/dis/lib/disks.dis"; 7 8 # disk partition interface 9 Disk: adt { 10 prefix: string; 11 part: string; 12 fd: ref Sys->FD; 13 wfd: ref Sys->FD; 14 ctlfd: ref Sys->FD; 15 rdonly: int; 16 dtype: string; # "file", "sd" or "floppy" 17 18 secs: big; 19 secsize: int; 20 size: big; 21 offset: big; # within larger disk, perhaps 22 width: int; # of disk size in bytes as decimal string 23 c: int; # geometry: cyl, head, sectors 24 h: int; 25 s: int; 26 chssrc: string; # "part", "disk" or "guess" 27 28 open: fn(f: string, mode: int, noctl: int): ref Disk; 29 readn: fn(d: self ref Disk, buf: array of byte, n: int): int; 30 }; 31 32 init: fn(); 33 34 # PC partition grot 35 PCpart: adt { 36 active: int; # Active or 0 37 ptype: int; 38 base: big; # base block address: 0 or first extended partition in chain 39 offset: big; # block offset from base to partition 40 size: big; # in sectors 41 42 extract: fn(a: array of byte, d: ref Disk): PCpart; 43 bytes: fn(p: self PCpart, d: ref Disk): array of byte; 44 }; 45 Toffset: con 446; # offset of partition table in sector 46 TentrySize: con 2+2*3+4+4; # partition table entry size 47 NTentry: con 4; # number of table entries 48 Magic0: con 16r55; 49 Magic1: con 16rAA; 50 Active: con 16r80; # partition is active 51 Type9: con 16r39; # partition type used by Plan 9 and Inferno 52 53 chstext: fn(p: array of byte): string; 54}; 55