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

OCF library context API. More...

#include "ocf_volume.h"
#include "ocf_logger.h"

Go to the source code of this file.

Data Structures

struct  ocf_data_ops
 Context data representation ops. More...
 
struct  ocf_cleaner_ops
 Cleaner operations. More...
 
struct  ocf_metadata_updater_ops
 Metadata updater operations. More...
 
struct  ocf_ctx_ops
 OCF context specific operation. More...
 
struct  ocf_ctx_config
 

Enumerations

enum  ctx_data_seek_t { ctx_data_seek_begin, ctx_data_seek_current }
 Seeking start position in environment data buffer. More...
 

Functions

int ocf_ctx_register_volume_type (ocf_ctx_t ctx, uint8_t type_id, const struct ocf_volume_properties *properties)
 Register volume interface. More...
 
void ocf_ctx_unregister_volume_type (ocf_ctx_t ctx, uint8_t type_id)
 Unregister volume interface. More...
 
ocf_volume_type_t ocf_ctx_get_volume_type (ocf_ctx_t ctx, uint8_t type_id)
 Get volume type operations by type id. More...
 
int ocf_ctx_get_volume_type_id (ocf_ctx_t ctx, ocf_volume_type_t type)
 Get volume type id by type. More...
 
int ocf_ctx_volume_create (ocf_ctx_t ctx, ocf_volume_t *volume, struct ocf_volume_uuid *uuid, uint8_t type_id)
 Create volume of given type. More...
 
int ocf_ctx_create (ocf_ctx_t *ctx, const struct ocf_ctx_config *cfg)
 Create and initialize OCF context. More...
 
void ocf_ctx_get (ocf_ctx_t ctx)
 Increase reference counter of ctx. More...
 
void ocf_ctx_put (ocf_ctx_t ctx)
 Decrease reference counter of ctx. More...
 

Detailed Description

OCF library context API.

Enumeration Type Documentation

◆ ctx_data_seek_t

Seeking start position in environment data buffer.

Enumerator
ctx_data_seek_begin 

Seeking from the beginning of environment data buffer

ctx_data_seek_current 

Seeking from current position in environment data buffer

Function Documentation

◆ ocf_ctx_create()

int ocf_ctx_create ( ocf_ctx_t ctx,
const struct ocf_ctx_config cfg 
)

Create and initialize OCF context.

Parameters
[out]ctxOCF context
[in]opsOCF context operations
Returns
Zero when success, otherwise an error

◆ ocf_ctx_get()

void ocf_ctx_get ( ocf_ctx_t  ctx)

Increase reference counter of ctx.

Parameters
[in]ctxOCF context

◆ ocf_ctx_get_volume_type()

ocf_volume_type_t ocf_ctx_get_volume_type ( ocf_ctx_t  ctx,
uint8_t  type_id 
)

Get volume type operations by type id.

Parameters
[in]ctxOCF context
[in]type_idType id of volume operations which were registered
Returns
Volume type
Return values
NULLWhen volume operations were not registered for requested type

◆ ocf_ctx_get_volume_type_id()

int ocf_ctx_get_volume_type_id ( ocf_ctx_t  ctx,
ocf_volume_type_t  type 
)

Get volume type id by type.

Parameters
[in]ctxOCF context
[in]typeType of volume operations which were registered
Returns
Volume type id
Return values
-1When volume operations were not registered for requested type

◆ ocf_ctx_put()

void ocf_ctx_put ( ocf_ctx_t  ctx)

Decrease reference counter of ctx.

Parameters
[in]ctxOCF context

◆ ocf_ctx_register_volume_type()

int ocf_ctx_register_volume_type ( ocf_ctx_t  ctx,
uint8_t  type_id,
const struct ocf_volume_properties properties 
)

Register volume interface.

Note
Type of volume operations is unique and cannot be repeated.
Parameters
[in]ctxOCF context
[in]propertiesReference to volume properties
[in]type_idType id of volume operations
Return values
0Volume operations registered successfully
Non-zeroVolume registration failure

◆ ocf_ctx_unregister_volume_type()

void ocf_ctx_unregister_volume_type ( ocf_ctx_t  ctx,
uint8_t  type_id 
)

Unregister volume interface.

Parameters
[in]ctxOCF context
[in]type_idType id of volume operations

◆ ocf_ctx_volume_create()

int ocf_ctx_volume_create ( ocf_ctx_t  ctx,
ocf_volume_t volume,
struct ocf_volume_uuid uuid,
uint8_t  type_id 
)

Create volume of given type.

Parameters
[in]ctxhandle to object designating ocf context
[out]volumevolume handle
[in]uuidOCF volume UUID
[in]type_idcache/core volume type id
Returns
Zero when success, othewise en error