KolibriOS kernel
DISKFUNC Struct Reference

============================================================================= More...

Public Attributes

dd strucsize
 
dd close
 
dd closemedia
 
dd querymedia
 
dd read
 
dd write
 
dd flush
 
dd adjust_cache_size
 
dd LoadTray
 

Detailed Description

=============================================================================

================================ Structures =================================

This structure defines all callback functions for working with the physical device. They are implemented by a driver. Objects with this structure reside in a driver.

Source
blkdev/disk.inc:36

Member Data Documentation

◆ adjust_cache_size

dd DISKFUNC::adjust_cache_size

The pointer to the function which flushes the internal device cache. Optional, may be NULL. int flush(void* userdata); Return value: one of DISK_STATUS_* Note that read/write are called by the cache manager, so a driver should not create a software cache. This function is implemented for flushing a hardware cache, if it exists.

◆ close

dd DISKFUNC::close

Size of the structure. This field is intended for possible extensions of this structure. If a new function is added to this structure and a driver implements an old version, the caller can detect this by checking .strucsize, so the driver remains compatible.

◆ closemedia

dd DISKFUNC::closemedia

The pointer to the function which frees all driver-specific resources for the disk. Optional, may be NULL. void close(void* userdata);

◆ flush

dd DISKFUNC::flush

The pointer to the function which writes data to the device. Optional, may be NULL. int write(void* userdata, void* buffer, __int64 startsector, int* numsectors); input: numsectors = number of sectors to write output: *numsectors = number of sectors which were successfully written Return value: one of DISK_STATUS_

◆ LoadTray

dd DISKFUNC::LoadTray

The pointer to the function which returns the cache size for this device. Optional, may be NULL. unsigned int adjust_cache_size(void* userdata, unsigned int suggested_size); Return value: 0 = disable cache, otherwise = used cache size in bytes.

◆ querymedia

dd DISKFUNC::querymedia

The pointer to the function which informs the driver that the kernel has finished all processing with the current media. If media is removed, the driver should decline all requests to that media with DISK_STATUS_NO_MEDIA, even if new media is inserted, until this function is called. If media is removed, a new call to 'disk_media_changed' is not allowed until this function is called. Optional, may be NULL (if media is not removable). void closemedia(void* userdata);

◆ read

dd DISKFUNC::read

The pointer to the function which determines capabilities of the media. int querymedia(void* userdata, DISKMEDIAINFO* info); Return value: one of DISK_STATUS_*

◆ strucsize

dd DISKFUNC::strucsize

◆ write

dd DISKFUNC::write

The pointer to the function which reads data from the device. int read(void* userdata, void* buffer, __int64 startsector, int* numsectors); input: numsectors = number of sectors to read output: *numsectors = number of sectors which were successfully read Return value: one of DISK_STATUS_


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