Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Block_device Class Reference

This is an abstract block device, implemented by things like disk drivers. More...

#include <blockdev.h>

List of all members.

Public Methods

void init ()
void deinit ()
bool read_page (unsigned int block, void *data)
bool write_page (unsigned int block, void *data)
bool read_block (unsigned int block, void *data)
bool write_block (unsigned int block, void *data)

Public Attributes

void * device
unsigned int block_size
unsigned int total_blocks
unsigned int blocks_per_page
void(* init_func )(void *)
void(* deinit_func )(void *)
bool(* read_block_func )(void *, unsigned int block, void *data)
bool(* write_block_func )(void *, unsigned int block, void *data)


Detailed Description

This is an abstract block device, implemented by things like disk drivers.

In any normal program, this would be an abstract base class with pure virtual functions, and polymorphism would decide which implementation function is used. However, I cannot for the life of me get virtual functions to work with gcc and ld and the specific compile and link options necessary for this kernel. Thus, I've done a sort of ugly hack to simulate virtual functions. Enjoy.


Member Function Documentation

void Block_device::deinit   [inline]
 

Deinitialize the device, free data structures, etc.

void Block_device::init   [inline]
 

Initialize the device, allocate any necessary data structures, etc.

bool Block_device::read_block unsigned int    block,
void *    data
[inline]
 

Read a block of data from disk into the provided buffer.

bool Block_device::read_page unsigned int    block,
void *    data
[inline]
 

Read a page of data from disk into the provided buffer, starting at the given block.

bool Block_device::write_block unsigned int    block,
void *    data
[inline]
 

Write a block of data to disk from the provided buffer.

bool Block_device::write_page unsigned int    block,
void *    data
[inline]
 

Write a page of data to disk from the provided buffer, starting at the given block.


Member Data Documentation

unsigned int Block_device::block_size
 

block size in bytes.

unsigned int Block_device::blocks_per_page
 

blocks per page of memory.

void(* Block_device::deinit_func)(void*)
 

void* Block_device::device
 

specific implementation device.

void(* Block_device::init_func)(void*)
 

bool(* Block_device::read_block_func)(void*, unsigned int block, void* data)
 

unsigned int Block_device::total_blocks
 

total blocks on this device.

bool(* Block_device::write_block_func)(void*, unsigned int block, void* data)
 


The documentation for this class was generated from the following file:

Torsion Operating System, Copyright (C) 2000-2002 Dan Helfman