Open CAS Framework
Open source framework of Cache Acceleration Software
Data Structures | Macros | Functions
ocf_volume.h File Reference

OCF volume API. More...

#include "ocf_types.h"
#include "ocf_env_headers.h"
#include "ocf/ocf_err.h"

Go to the source code of this file.

Data Structures

struct  ocf_volume_uuid
 OCF volume UUID. More...
 
struct  ocf_volume_caps
 This structure describes volume capabilities. More...
 
struct  ocf_volume_ops
 OCF volume interface declaration. More...
 
struct  ocf_volume_properties
 This structure describes volume properties. More...
 

Macros

#define OCF_VOLUME_UUID_MAX_SIZE   (4096UL - sizeof(uint32_t))
 OCF volume UUID maximum allowed size.
 

Functions

int ocf_uuid_set_str (ocf_uuid_t uuid, char *str)
 Initialize UUID from string. More...
 
int ocf_volume_init (ocf_volume_t volume, ocf_volume_type_t type, struct ocf_volume_uuid *uuid, bool uuid_copy)
 Initialize volume. More...
 
void ocf_volume_deinit (ocf_volume_t volume)
 Deinitialize volume. More...
 
int ocf_volume_create (ocf_volume_t *volume, ocf_volume_type_t type, struct ocf_volume_uuid *uuid)
 Allocate and initialize volume. More...
 
void ocf_volume_destroy (ocf_volume_t volume)
 Deinitialize and free volume. More...
 
ocf_volume_type_t ocf_volume_get_type (ocf_volume_t volume)
 Get volume type. More...
 
const struct ocf_volume_uuidocf_volume_get_uuid (ocf_volume_t volume)
 Get volume UUID. More...
 
void * ocf_volume_get_priv (ocf_volume_t volume)
 Get private context of volume. More...
 
ocf_cache_t ocf_volume_get_cache (ocf_volume_t volume)
 Get cache handle for given volume. More...
 
int ocf_volume_is_atomic (ocf_volume_t volume)
 Check if volume supports atomic mode. More...
 
struct ocf_ioocf_volume_new_io (ocf_volume_t volume, ocf_queue_t queue, uint64_t addr, uint32_t bytes, uint32_t dir, uint32_t io_class, uint64_t flags)
 Allocate new io. More...
 
void ocf_volume_submit_io (struct ocf_io *io)
 Submit io to volume. More...
 
void ocf_volume_submit_flush (struct ocf_io *io)
 Submit flush to volume. More...
 
void ocf_volume_submit_discard (struct ocf_io *io)
 Submit discard to volume. More...
 
int ocf_volume_open (ocf_volume_t volume, void *volume_params)
 Open volume. More...
 
void ocf_volume_close (ocf_volume_t volume)
 Get volume max io size. More...
 
unsigned int ocf_volume_get_max_io_size (ocf_volume_t volume)
 Get volume max io size. More...
 
uint64_t ocf_volume_get_length (ocf_volume_t volume)
 Get volume length. More...
 

Detailed Description

OCF volume API.

Function Documentation

◆ ocf_uuid_set_str()

int ocf_uuid_set_str ( ocf_uuid_t  uuid,
char *  str 
)

Initialize UUID from string.

Parameters
[in]uuidUUID to be initialized
[in]strNULL-terminated string
Returns
Zero when success, othewise error

◆ ocf_volume_close()

void ocf_volume_close ( ocf_volume_t  volume)

Get volume max io size.

Parameters
[in]volumeVolume

◆ ocf_volume_create()

int ocf_volume_create ( ocf_volume_t volume,
ocf_volume_type_t  type,
struct ocf_volume_uuid uuid 
)

Allocate and initialize volume.

Parameters
[out]volumepointer to volume handle
[in]typecache/core volume type
[in]uuidOCF volume UUID
Returns
Zero when success, othewise en error

◆ ocf_volume_deinit()

void ocf_volume_deinit ( ocf_volume_t  volume)

Deinitialize volume.

Parameters
[in]volumevolume handle

◆ ocf_volume_destroy()

void ocf_volume_destroy ( ocf_volume_t  volume)

Deinitialize and free volume.

Parameters
[in]volumevolume handle

◆ ocf_volume_get_cache()

ocf_cache_t ocf_volume_get_cache ( ocf_volume_t  volume)

Get cache handle for given volume.

Parameters
volumevolume handle
Returns
Handle to cache for which volume belongs to

◆ ocf_volume_get_length()

uint64_t ocf_volume_get_length ( ocf_volume_t  volume)

Get volume length.

Parameters
[in]volumeVolume
Returns
Length of volume in bytes

◆ ocf_volume_get_max_io_size()

unsigned int ocf_volume_get_max_io_size ( ocf_volume_t  volume)

Get volume max io size.

Parameters
[in]volumeVolume
Returns
Volume max io size in bytes

◆ ocf_volume_get_priv()

void* ocf_volume_get_priv ( ocf_volume_t  volume)

Get private context of volume.

Parameters
[in]volumeVolume
Returns
Volume private context

◆ ocf_volume_get_type()

ocf_volume_type_t ocf_volume_get_type ( ocf_volume_t  volume)

Get volume type.

Parameters
[in]volumeVolume
Returns
Volume type

◆ ocf_volume_get_uuid()

const struct ocf_volume_uuid* ocf_volume_get_uuid ( ocf_volume_t  volume)

Get volume UUID.

Parameters
[in]volumeVolume
Returns
UUID of volume

◆ ocf_volume_init()

int ocf_volume_init ( ocf_volume_t  volume,
ocf_volume_type_t  type,
struct ocf_volume_uuid uuid,
bool  uuid_copy 
)

Initialize volume.

Parameters
[in]volumevolume handle
[in]typecache/core volume type
[in]uuidOCF volume UUID
[in]uuid_copycrate copy of uuid data
Returns
Zero when success, othewise error

◆ ocf_volume_is_atomic()

int ocf_volume_is_atomic ( ocf_volume_t  volume)

Check if volume supports atomic mode.

Parameters
[in]volumeVolume
Returns
Non-zero value if volume is atomic, otherwise zero

◆ ocf_volume_new_io()

struct ocf_io* ocf_volume_new_io ( ocf_volume_t  volume,
ocf_queue_t  queue,
uint64_t  addr,
uint32_t  bytes,
uint32_t  dir,
uint32_t  io_class,
uint64_t  flags 
)

Allocate new io.

Parameters
[in]volumeVolume
[in]queueIO queue handle
[in]addrOCF IO destination address
[in]bytesOCF IO size in bytes
[in]dirOCF IO direction
[in]io_classOCF IO destination class
[in]flagsOCF IO flags
Returns
ocf_io on success atomic, otherwise NULL

◆ ocf_volume_open()

int ocf_volume_open ( ocf_volume_t  volume,
void *  volume_params 
)

Open volume.

Parameters
[in]volumeVolume
[in]volume_paramsOpaque volume params
Returns
Zero when success, othewise en error

◆ ocf_volume_submit_discard()

void ocf_volume_submit_discard ( struct ocf_io io)

Submit discard to volume.

Parameters
[in]ioIO

◆ ocf_volume_submit_flush()

void ocf_volume_submit_flush ( struct ocf_io io)

Submit flush to volume.

Parameters
[in]ioIO

◆ ocf_volume_submit_io()

void ocf_volume_submit_io ( struct ocf_io io)

Submit io to volume.

Parameters
[in]ioIO