Thread View: comp.os.os2.programmer
2 messages
2 total messages
Started by scott e garfinkle
Mon, 01 Oct 1990 21:20
(P)Dsk functions
Author: scott e garfinkle
Date: Mon, 01 Oct 1990 21:20
Date: Mon, 01 Oct 1990 21:20
22 lines
1417 bytes
1417 bytes
Can anybody help me with the functions that directly access disk sectors? None of the books I have gives a very good description of how to use them. I need to be able to read and write arbitrary disk sectors. The OS/2 Programmer's Reference refers to the TRACKLAYOUT structure; but it's still not clear to me how to use it. So, the specific questions are: 1. How do I set things up so that I read/write a specific sector, say the disk's boot sector? 2. What are the starting points for the numbering systems? (I am guessing that Heads, Cylinder, and FirstSector start at zero and SectorNumber starts at 1). 3. Is it necessary to do a LOCK[PHYS]DRIVE before any read/writes (it would seem so)? 4. Is it necessary to fill in the TrackTable array for an entire track's worth of sectors? How much of this array *really* has to be filled in? If there is a reference that explains this that I ought to have, please feel free to suggest. -Scott E. Garfinkle Ingres Corp.
Re: (P)Dsk functions
Author: Jari Artes
Date: Tue, 02 Oct 1990 07:57
Date: Tue, 02 Oct 1990 07:57
39 lines
1813 bytes
1813 bytes
seg@ingres.com (scott e garfinkle) writes: > 1. How do I set things up so that I read/write a specific > sector, say the disk's boot sector? TRACKLAYOUT is set up as follows: Command db 0 ; in this case this could be 1 Head dw 0 ; zero based head number Cylinder dw 0 ; zero based cylinder number FirstSec dw 0 ; this is zero based INDEX to track table Sectors dw 1 ; number of sectors on which to perform the operation ; this is the track table ; first (and last) entry: SecNum dw 1 ; one based physical sector number SecSize dw 512 ; sector size > 2. What are the starting points for the numbering systems? > (I am guessing that Heads, Cylinder, and FirstSector start at > zero and SectorNumber starts at 1). Your assumptions are correct. > 3. Is it necessary to do a LOCK[PHYS]DRIVE before any > read/writes (it would seem so)? Not necessarily in case you just read partition tables, boot records or other data that is not subject to change during your program's lifetime. It is a good practice to lock the drive(s) you're operating on, but make sure your program doesn't crash before the lock is released. > 4. Is it necessary to fill in the TrackTable array for an > entire track's worth of sectors? How much of this array > *really* has to be filled in? There must be cSectors elements in the array. -- Jari Artes jaria@tuura.yj.data.nokia.fi
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads