OK, I just finished the low-level ATA driver for my OS (read, write, lseek)...
Now I have to change all the ReadSector calls in my FAT32 driver to lseek/read pairs, and I've noticed how clean my code is now! It's incredible!
Low-Level IO - I love it!
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Seriously, read/write/ioctl/lseek/open/close - all reasonably simple to implement but really quite helpful. My device management system means I can do:
To open the first hard drive for read/write access, and read in the data at sector 1024. I'm really happy it works now
Code: Select all
int d = open( "dr0", READWRITE );
char buff[512];
lseek( d, 1024, SEEK_SET );
read( d, buff, 1 );
close( d );
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Look at your documentation:
(That's MSDN)
The int is nothing more than an index in a linked list of descriptors stored elsewhere.
Edit: this is it in action, when inside my fread() function:
Code: Select all
int _open( const char *filename, int oflag [, int pmode] );
The int is nothing more than an index in a linked list of descriptors stored elsewhere.
Edit: this is it in action, when inside my fread() function:
Code: Select all
Welcome to Mattise!
Version 1.1, ALPHA
Hello world, this is a test of the fread function, which is based on the read fu
nction, which is shiny and new and hopefully works well in my OS.