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

OCF cache API. More...

#include "ocf_volume.h"
#include "ocf_ctx.h"
#include "ocf_def.h"
#include "ocf_stats.h"

Go to the source code of this file.

Data Structures

struct  ocf_cache_info
 Cache info: configuration, status. More...
 

Functions

ocf_volume_t ocf_cache_get_volume (ocf_cache_t cache)
 Obtain volume from cache. More...
 
const char * ocf_cache_get_name (ocf_cache_t cache)
 Get name of given cache object. More...
 
bool ocf_cache_is_incomplete (ocf_cache_t cache)
 Check is cache in incomplete state. More...
 
bool ocf_cache_is_device_attached (ocf_cache_t cache)
 Check if caching device is attached. More...
 
bool ocf_cache_is_running (ocf_cache_t cache)
 Check if cache object is running. More...
 
ocf_cache_mode_t ocf_cache_get_mode (ocf_cache_t cache)
 Get cache mode of given cache object. More...
 
ocf_cache_line_size_t ocf_cache_get_line_size (ocf_cache_t cache)
 Get cache line size of given cache object. More...
 
uint64_t ocf_cache_bytes_2_lines (ocf_cache_t cache, uint64_t bytes)
 Convert bytes to cache lines. More...
 
uint32_t ocf_cache_get_core_count (ocf_cache_t cache)
 Get core count of given cache object. More...
 
int ocf_cache_get_info (ocf_cache_t cache, struct ocf_cache_info *info)
 Get cache mode of given cache object. More...
 
const struct ocf_volume_uuidocf_cache_get_uuid (ocf_cache_t cache)
 Get UUID of volume associated with cache. More...
 
ocf_ctx_t ocf_cache_get_ctx (ocf_cache_t cache)
 Get OCF context of given cache object. More...
 
uint8_t ocf_cache_get_type_id (ocf_cache_t cache)
 Get volume type id of given cache object. More...
 
void ocf_cache_set_priv (ocf_cache_t cache, void *priv)
 Set cache private data. More...
 
void * ocf_cache_get_priv (ocf_cache_t cache)
 Get cache private data. More...
 

Detailed Description

OCF cache API.

Function Documentation

◆ ocf_cache_bytes_2_lines()

uint64_t ocf_cache_bytes_2_lines ( ocf_cache_t  cache,
uint64_t  bytes 
)

Convert bytes to cache lines.

Parameters
[in]cacheCache object
[in]bytesNumber of bytes
Return values
Cachelines count

◆ ocf_cache_get_core_count()

uint32_t ocf_cache_get_core_count ( ocf_cache_t  cache)

Get core count of given cache object.

Parameters
[in]cacheCache object
Return values
Corecount

◆ ocf_cache_get_ctx()

ocf_ctx_t ocf_cache_get_ctx ( ocf_cache_t  cache)

Get OCF context of given cache object.

Parameters
[in]cacheCache object
Return values
OCFcontext

◆ ocf_cache_get_info()

int ocf_cache_get_info ( ocf_cache_t  cache,
struct ocf_cache_info info 
)

Get cache mode of given cache object.

Parameters
[in]cacheCache object
[out]infoCache info structure
Return values
0Success
Non-zeroFail

◆ ocf_cache_get_line_size()

ocf_cache_line_size_t ocf_cache_get_line_size ( ocf_cache_t  cache)

Get cache line size of given cache object.

Parameters
[in]cacheCache object
Return values
Cacheline size

◆ ocf_cache_get_mode()

ocf_cache_mode_t ocf_cache_get_mode ( ocf_cache_t  cache)

Get cache mode of given cache object.

Parameters
[in]cacheCache object
Return values
Cachemode

◆ ocf_cache_get_name()

const char* ocf_cache_get_name ( ocf_cache_t  cache)

Get name of given cache object.

Parameters
[in]cacheCache object
Return values
Cachename

◆ ocf_cache_get_priv()

void* ocf_cache_get_priv ( ocf_cache_t  cache)

Get cache private data.

Parameters
[in]cacheCache object
Return values
Privatedata

◆ ocf_cache_get_type_id()

uint8_t ocf_cache_get_type_id ( ocf_cache_t  cache)

Get volume type id of given cache object.

Parameters
[in]cacheCache object
Return values
volumetype id, -1 if device detached

◆ ocf_cache_get_uuid()

const struct ocf_volume_uuid* ocf_cache_get_uuid ( ocf_cache_t  cache)

Get UUID of volume associated with cache.

Parameters
[in]cacheCache object
Return values
VolumeUUID, NULL if detached.

◆ ocf_cache_get_volume()

ocf_volume_t ocf_cache_get_volume ( ocf_cache_t  cache)

Obtain volume from cache.

Parameters
[in]cacheCache object
Return values
Volume,NULLif dettached.

◆ ocf_cache_is_device_attached()

bool ocf_cache_is_device_attached ( ocf_cache_t  cache)

Check if caching device is attached.

Parameters
[in]cacheCache object
Return values
1Caching device is attached
0Caching device is detached

◆ ocf_cache_is_incomplete()

bool ocf_cache_is_incomplete ( ocf_cache_t  cache)

Check is cache in incomplete state.

Parameters
[in]cacheCache object
Return values
1Cache is in incomplete state
0Cache is in complete state

◆ ocf_cache_is_running()

bool ocf_cache_is_running ( ocf_cache_t  cache)

Check if cache object is running.

Parameters
[in]cacheCache object
Return values
1Caching device is being stopped
0Caching device is being stopped

◆ ocf_cache_set_priv()

void ocf_cache_set_priv ( ocf_cache_t  cache,
void *  priv 
)

Set cache private data.

Parameters
[in]cacheCache object
[in]privPrivate data