CHS (Cylinder-Head-Sector) Address
CHS addressing is an early method for giving addresses to each physical block of data on a hard disk drive,
identifying individual sectors on a disk by their position in a track, where the track is determined by the head and cylinder numbers.
Install via npm
$ npm install --save chs
Usage
var CHS = require( 'chs' )
var addr = new CHS( 5, 20, 8 )
var c = addr.cylinder
var h = addr.head
var s = addr.sector
var lba = addr.toLBA( headsPerTrack, sectorsPerTrack )
var lba = addr.toLBA( 12, 32 )
addr.setLBA( lba, headsPerTrack, sectorsPerTrack )
addr.setLBA( 3150, 16, 63 )
var buf = addr.buffer
var buf = addr.toBuffer()
addr.buffer = new Buffer([ 0xFE, 0xFF, 0xFF ])
addr.parse( new Buffer([ 0xFE, 0xFF, 0xFF ]) )
API Reference
CHS
Kind: global class
new CHS([cylinder], [head], [sector])
Cylinder-Head-Sector Address
Params
chS.cylinder : Number
Cylinder
Kind: instance property of CHS
chS.head : Number
Head
Kind: instance property of CHS
chS.sector : Number
Sector
Kind: instance property of CHS
chS.buffer : Buffer
Get/set values from/to a Buffer
Kind: instance property of CHS
chS.setLBA(lba, hpt, spt) ⇒ CHS
Set CHS to a Logical Block Address (LBA)
Kind: instance method of CHS
Params
-
lba Number
- Logical Block Address
-
hpt Number
- Heads per Track
-
spt Number
- Sectors per Track
chS.getLBA(hpt, spt) ⇒ Number
Get the Logical Block Address (LBA)
corresponding to the given disk geometry
Kind: instance method of CHS
Returns: Number
- lba
Params
chS.toLBA(hpt, spt) ⇒ Number
Kind: instance method of CHS
Returns: Number
- lba
See: #getLBA()
Params
chS.clone() ⇒ CHS
Clone the CHS Address
Kind: instance method of CHS
chS.copy(target) ⇒ CHS
Copy this address to a target address
Kind: instance method of CHS
Params
chS.parse(buffer) ⇒ CHS
Parse a given Buffer
Kind: instance method of CHS
Params
chS.toBuffer() ⇒ Buffer
Create a Buffer representation of the CHS Address
Kind: instance method of CHS
CHS.fromBuffer(buffer) ⇒ CHS
Create a CHS Address from a given buffer
Kind: static method of CHS
Params
CHS.fromLBA(lba, hpt, spt) ⇒ CHS
Create a CHS Address from a Logical Block Address (LBA)
Kind: static method of CHS
Params
-
lba Number
- Logical Block Address
-
hpt Number
- Heads per Track
-
spt Number
- Sectors per Track