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

OCF core API. More...

#include "ocf_volume.h"
#include "ocf_io.h"
#include "ocf_mngt.h"

Go to the source code of this file.

Data Structures

struct  ocf_core_info
 

Typedefs

typedef int(* ocf_core_visitor_t) (ocf_core_t core, void *cntx)
 Core visitor function type which is called back when iterating over cores. More...
 

Functions

int ocf_core_get_by_name (ocf_cache_t cache, const char *name, size_t name_len, ocf_core_t *core)
 Get OCF core by name. More...
 
ocf_cache_t ocf_core_get_cache (ocf_core_t core)
 Obtain cache object from core. More...
 
ocf_volume_t ocf_core_get_volume (ocf_core_t core)
 Obtain volume associated with core. More...
 
ocf_volume_t ocf_core_get_front_volume (ocf_core_t core)
 Obtain volume of the core. More...
 
uint32_t ocf_core_get_seq_cutoff_threshold (ocf_core_t core)
 Get sequential cutoff threshold of given core object. More...
 
ocf_seq_cutoff_policy ocf_core_get_seq_cutoff_policy (ocf_core_t core)
 Get sequential cutoff policy of given core object. More...
 
const char * ocf_core_get_name (ocf_core_t core)
 Get name of given core object. More...
 
ocf_core_state_t ocf_core_get_state (ocf_core_t core)
 Get core state. More...
 
int ocf_core_submit_io_fast (struct ocf_io *io)
 Fast path for submitting IO. If possible, request is processed immediately without adding to internal request queue. More...
 
int ocf_core_visit (ocf_cache_t cache, ocf_core_visitor_t visitor, void *cntx, bool only_opened)
 Run visitor function for each core of given cache. More...
 
int ocf_core_get_info (ocf_core_t core, struct ocf_core_info *info)
 Get info of given core object. More...
 
void ocf_core_set_priv (ocf_core_t core, void *priv)
 Set core private data. More...
 
void * ocf_core_get_priv (ocf_core_t core)
 Get core private data. More...
 

Detailed Description

OCF core API.

Typedef Documentation

◆ ocf_core_visitor_t

typedef int(* ocf_core_visitor_t) (ocf_core_t core, void *cntx)

Core visitor function type which is called back when iterating over cores.

Parameters
[in]coreCore which is currently iterated (visited)
[in]cntxVisitor context
Return values
0continue visiting cores
Non-zerostop iterating and return result

Function Documentation

◆ ocf_core_get_by_name()

int ocf_core_get_by_name ( ocf_cache_t  cache,
const char *  name,
size_t  name_len,
ocf_core_t core 
)

Get OCF core by name.

Parameters
[in]cacheOCF cache
[in]nameCore name
[in]name_lenCore name length
[out]coreOCF core handle
Return values
0Get cache successfully
-OCF_ERR_CORE_NOT_EXISTCore with given name doesn't exist

◆ ocf_core_get_cache()

ocf_cache_t ocf_core_get_cache ( ocf_core_t  core)

Obtain cache object from core.

Parameters
[in]coreCore object
Return values
Cacheobject

◆ ocf_core_get_front_volume()

ocf_volume_t ocf_core_get_front_volume ( ocf_core_t  core)

Obtain volume of the core.

Parameters
[in]coreCore object
Return values
Frontvolume

◆ ocf_core_get_info()

int ocf_core_get_info ( ocf_core_t  core,
struct ocf_core_info info 
)

Get info of given core object.

Parameters
[in]coreCore object
[out]infoCore info structure
Return values
0Success
Non-zeroFail

◆ ocf_core_get_name()

const char* ocf_core_get_name ( ocf_core_t  core)

Get name of given core object.

Parameters
[in]coreCore object
Return values
Corename

◆ ocf_core_get_priv()

void* ocf_core_get_priv ( ocf_core_t  core)

Get core private data.

Parameters
[in]coreCore object
Return values
Privatedata

◆ ocf_core_get_seq_cutoff_policy()

ocf_seq_cutoff_policy ocf_core_get_seq_cutoff_policy ( ocf_core_t  core)

Get sequential cutoff policy of given core object.

Parameters
[in]coreCore object
Return values
Sequentialcutoff policy

◆ ocf_core_get_seq_cutoff_threshold()

uint32_t ocf_core_get_seq_cutoff_threshold ( ocf_core_t  core)

Get sequential cutoff threshold of given core object.

Parameters
[in]coreCore object
Return values
Sequentialcutoff threshold [B]

◆ ocf_core_get_state()

ocf_core_state_t ocf_core_get_state ( ocf_core_t  core)

Get core state.

Parameters
[in]coreCore object
Return values
Corestate

◆ ocf_core_get_volume()

ocf_volume_t ocf_core_get_volume ( ocf_core_t  core)

Obtain volume associated with core.

Parameters
[in]coreCore object
Return values
Volume

◆ ocf_core_set_priv()

void ocf_core_set_priv ( ocf_core_t  core,
void *  priv 
)

Set core private data.

Parameters
[in]coreCore object
[in]privPrivate data

◆ ocf_core_submit_io_fast()

int ocf_core_submit_io_fast ( struct ocf_io io)

Fast path for submitting IO. If possible, request is processed immediately without adding to internal request queue.

Parameters
[in]ioIO to be submitted
Return values
0IO has been submitted successfully
Non-zeroFast submit failed. Try to submit IO with ocf_core_submit_io()

◆ ocf_core_visit()

int ocf_core_visit ( ocf_cache_t  cache,
ocf_core_visitor_t  visitor,
void *  cntx,
bool  only_opened 
)

Run visitor function for each core of given cache.

Parameters
[in]cacheOCF cache instance
[in]visitorVisitor function
[in]cntxVisitor context
[in]only_openedVisit only opened cores
Return values
0Success
Non-zeroFail