Revision 0d413fc6
b/snf-image-helper/disklabel.py | ||
---|---|---|
94 | 94 |
"""Packs a CHS tuple to an address string.""" |
95 | 95 |
|
96 | 96 |
assert 1 <= sector <= 63 |
97 |
assert 0 <= cylinder <= 1023 |
|
98 | 97 |
assert 0 <= head <= 255 |
98 |
assert 0 <= cylinder |
|
99 |
|
|
100 |
# If the cylinders overflow then put the value (1023, 254, 63) to |
|
101 |
# the tuple. At least this is what OpenBSD does. |
|
102 |
if cylinder > 1023: |
|
103 |
cylinder = 1023 |
|
104 |
head = 254 |
|
105 |
sector = 63 |
|
99 | 106 |
|
100 | 107 |
byte0 = head |
101 | 108 |
byte1 = (cylinder >> 2) & 0xC0 | sector |
Also available in: Unified diff