mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-16 07:57:13 -04:00
Doc
This commit is contained in:
parent
cc4b26ca2e
commit
8084d8363d
@ -21,16 +21,83 @@ enum class device_type {
|
|||||||
CHAR_DEVICE
|
CHAR_DEVICE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Block device driver interface
|
||||||
|
*/
|
||||||
struct dev_driver {
|
struct dev_driver {
|
||||||
|
/*!
|
||||||
|
* \brief Read a block of data
|
||||||
|
* \param data The driver data
|
||||||
|
* \param buffer The buffer into which to read
|
||||||
|
* \param count The amount of bytes to read
|
||||||
|
* \param offset The offset at which to start reading
|
||||||
|
* \param read output reference to indicate the number of bytes read
|
||||||
|
* \return 0 on success, an error code otherwise
|
||||||
|
*/
|
||||||
virtual size_t read(void* data, char* buffer, size_t count, size_t offset, size_t& read) = 0;
|
virtual size_t read(void* data, char* buffer, size_t count, size_t offset, size_t& read) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Write a block of data
|
||||||
|
* \param data The driver data
|
||||||
|
* \param buffer The buffer from which to read
|
||||||
|
* \param count The amount of bytes to write
|
||||||
|
* \param offset The offset at which to start writing
|
||||||
|
* \param written output reference to indicate the number of bytes written
|
||||||
|
* \return 0 on success, an error code otherwise
|
||||||
|
*/
|
||||||
virtual size_t write(void* data, const char* buffer, size_t count, size_t offset, size_t& written) = 0;
|
virtual size_t write(void* data, const char* buffer, size_t count, size_t offset, size_t& written) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Clear a portion of a file (write zeroes)
|
||||||
|
* \param data The driver data
|
||||||
|
* \param count The amount of bytes to write
|
||||||
|
* \param offset The offset at which to start writing
|
||||||
|
* \param written output reference to indicate the number of bytes written
|
||||||
|
* \return 0 on success, an error code otherwise
|
||||||
|
*/
|
||||||
virtual size_t clear(void* data, size_t count, size_t offset, size_t& written) = 0;
|
virtual size_t clear(void* data, size_t count, size_t offset, size_t& written) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return the size of the device
|
||||||
|
* \param data The driver data
|
||||||
|
* \return The size of the device
|
||||||
|
*/
|
||||||
virtual size_t size(void* data) = 0;
|
virtual size_t size(void* data) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Character device driver interface
|
||||||
|
*/
|
||||||
struct char_driver {
|
struct char_driver {
|
||||||
|
/*!
|
||||||
|
* \brief Read a block of data
|
||||||
|
* \param data The driver data
|
||||||
|
* \param buffer The buffer into which to read
|
||||||
|
* \param count The amount of bytes to read
|
||||||
|
* \param read output reference to indicate the number of bytes read
|
||||||
|
* \return 0 on success, an error code otherwise
|
||||||
|
*/
|
||||||
virtual size_t read(void* data, char* buffer, size_t count, size_t& read) = 0;
|
virtual size_t read(void* data, char* buffer, size_t count, size_t& read) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Read a block of data only waiting for a given amount of time
|
||||||
|
* \param data The driver data
|
||||||
|
* \param buffer The buffer into which to read
|
||||||
|
* \param count The amount of bytes to read
|
||||||
|
* \param read output reference to indicate the number of bytes read
|
||||||
|
* \param ms The amount of time, in milliseconds, to wait for the read
|
||||||
|
* \return 0 on success, an error code otherwise
|
||||||
|
*/
|
||||||
virtual size_t read(void* data, char* buffer, size_t count, size_t& read, size_t ms) = 0;
|
virtual size_t read(void* data, char* buffer, size_t count, size_t& read, size_t ms) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Write a block of data
|
||||||
|
* \param data The driver data
|
||||||
|
* \param buffer The buffer from which to read
|
||||||
|
* \param count The amount of bytes to write
|
||||||
|
* \param written output reference to indicate the number of bytes written
|
||||||
|
* \return 0 on success, an error code otherwise
|
||||||
|
*/
|
||||||
virtual size_t write(void* data, const char* buffer, size_t count, size_t& written) = 0;
|
virtual size_t write(void* data, const char* buffer, size_t count, size_t& written) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user