Renamed the "blkman" module to "block_io".
Also renamed some defines and structures, although the structure and some other names are still odd. This module should probably be moved into the kernel anyway, as it provides basic and crucial services. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12646 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
/*
|
||||
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef __BLOCK_IO_H__
|
||||
#define __BLOCK_IO_H__
|
||||
|
||||
/*
|
||||
Part of Open block device manager
|
||||
@@ -13,19 +15,17 @@
|
||||
by using a buffer (performance will suffer, though).
|
||||
*/
|
||||
|
||||
#ifndef __BLKMAN_H__
|
||||
#define __BLKMAN_H__
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <device_manager.h>
|
||||
|
||||
// cookies issued by blkman
|
||||
typedef struct blkman_device_info *blkman_device;
|
||||
typedef struct blkman_handle_info *blkman_handle;
|
||||
// cookies issued by block_io
|
||||
typedef struct block_io_device_info *block_io_device;
|
||||
typedef struct block_io_handle_info *block_io_handle;
|
||||
|
||||
// cookies issued by device driver
|
||||
typedef struct blkdev_device_cookie *blkdev_device_cookie;
|
||||
typedef struct blkdev_handle_cookie *blkdev_handle_cookie;
|
||||
typedef struct block_device_device_cookie *block_device_device_cookie;
|
||||
typedef struct block_device_handle_cookie *block_device_handle_cookie;
|
||||
|
||||
|
||||
// two reason why to use array of size 1:
|
||||
@@ -46,57 +46,55 @@ typedef struct phys_vecs {
|
||||
|
||||
// attributes:
|
||||
|
||||
// type code for block devices
|
||||
#define BLKDEV_TYPE_NAME "blkdev"
|
||||
// if true, this device may be a BIOS drive (uint8, optional, default: false)
|
||||
#define BLKDEV_IS_BIOS_DRIVE "blkdev/is_bios_drive"
|
||||
#define B_BLOCK_DEVICE_IS_BIOS_DRIVE "block_device/is_bios_drive"
|
||||
// address bits that must be 0 - must be 2^i-1 for some i (uint32, optional, default: 0)
|
||||
#define BLKDEV_DMA_ALIGNMENT "blkdev/dma_alignment"
|
||||
#define B_BLOCK_DEVICE_DMA_ALIGNMENT "block_device/dma_alignment"
|
||||
// maximum number of blocks per transfer (uint32, optional, default: unlimited)
|
||||
#define BLKDEV_MAX_BLOCKS_ITEM "blkdev/max_blocks"
|
||||
#define B_BLOCK_DEVICE_MAX_BLOCKS_ITEM "block_device/max_blocks"
|
||||
// mask of bits that can change in one sg block (uint32, optional, default: ~0)
|
||||
#define BLKDEV_DMA_BOUNDARY "blkdev/dma_boundary"
|
||||
#define B_BLOCK_DEVICE_DMA_BOUNDARY "block_device/dma_boundary"
|
||||
// maximum size of one block in scatter/gather list (uint32, optional, default: ~0)
|
||||
#define BLKDEV_MAX_SG_BLOCK_SIZE "blkdev/max_sg_block_size"
|
||||
#define B_BLOCK_DEVICE_MAX_SG_BLOCK_SIZE "block_device/max_sg_block_size"
|
||||
// maximum number of scatter/gather blocks (uint32, optional, default: unlimited)
|
||||
#define BLKDEV_MAX_SG_BLOCKS "blkdev/max_sg_blocks"
|
||||
#define B_BLOCK_DEVICE_MAX_SG_BLOCKS "block_device/max_sg_blocks"
|
||||
|
||||
|
||||
// interface to be provided by device driver
|
||||
typedef struct blkdev_interface {
|
||||
driver_module_info dinfo;
|
||||
typedef struct block_device_interface {
|
||||
driver_module_info info;
|
||||
|
||||
// iovecs are physical address here
|
||||
// pos and num_blocks are in blocks; bytes_transferred in bytes
|
||||
// vecs are guaranteed to describe enough data for given block count
|
||||
status_t (*open)(blkdev_device_cookie device, blkdev_handle_cookie *handle);
|
||||
status_t (*close)(blkdev_handle_cookie handle);
|
||||
status_t (*free)(blkdev_handle_cookie handle);
|
||||
status_t (*open)(block_device_device_cookie device, block_device_handle_cookie *handle);
|
||||
status_t (*close)(block_device_handle_cookie handle);
|
||||
status_t (*free)(block_device_handle_cookie handle);
|
||||
|
||||
status_t (*read)(blkdev_handle_cookie handle, const phys_vecs *vecs, off_t pos,
|
||||
status_t (*read)(block_device_handle_cookie handle, const phys_vecs *vecs, off_t pos,
|
||||
size_t num_blocks, uint32 block_size, size_t *bytes_transferred);
|
||||
status_t (*write)(blkdev_handle_cookie handle, const phys_vecs *vecs, off_t pos,
|
||||
status_t (*write)(block_device_handle_cookie handle, const phys_vecs *vecs, off_t pos,
|
||||
size_t num_blocks, uint32 block_size, size_t *bytes_transferred);
|
||||
|
||||
status_t (*ioctl)(blkdev_handle_cookie handle, int op, void *buf, size_t len);
|
||||
} blkdev_interface;
|
||||
status_t (*ioctl)(block_device_handle_cookie handle, int op, void *buf, size_t len);
|
||||
} block_device_interface;
|
||||
|
||||
#define BLKMAN_MODULE_NAME "generic/blkman/v1"
|
||||
#define B_BLOCK_IO_MODULE_NAME "generic/block_io/v1"
|
||||
|
||||
|
||||
// Interface for Drivers
|
||||
|
||||
// blkman interface used for callbacks done by driver
|
||||
typedef struct blkman_for_driver_interface {
|
||||
module_info minfo;
|
||||
typedef struct block_io_for_driver_interface {
|
||||
module_info info;
|
||||
|
||||
// block_size - block size in bytes
|
||||
// ld_block_size - log2( block_size) (set to zero if block_size is not power of two)
|
||||
// capacity - capacity in blocks
|
||||
void (*set_media_params)(blkman_device device, uint32 block_size, uint32 ld_block_size,
|
||||
void (*set_media_params)(block_io_device device, uint32 block_size, uint32 ld_block_size,
|
||||
uint64 capacity);
|
||||
} blkman_for_driver_interface;
|
||||
} block_io_for_driver_interface;
|
||||
|
||||
#define BLKMAN_FOR_DRIVER_MODULE_NAME "generic/blkman/driver/v1"
|
||||
#define B_BLOCK_IO_FOR_DRIVER_MODULE_NAME "generic/block_io/driver/v1"
|
||||
|
||||
#endif
|
||||
#endif /* __BLOCK_IO_H__ */
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Part of Open SCSI Peripheral Driver
|
||||
@@ -19,7 +19,7 @@
|
||||
#define __SCSI_PERIPH_H__
|
||||
|
||||
#include <bus/SCSI.h>
|
||||
#include <blkman.h>
|
||||
#include <block_io.h>
|
||||
#include <bus/scsi/scsi_cmds.h>
|
||||
#include <Drivers.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user