Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions inc/ocf_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,17 @@ const struct ocf_volume_uuid *ocf_cache_get_uuid(ocf_cache_t cache);
*/
ocf_ctx_t ocf_cache_get_ctx(ocf_cache_t cache);

/**
* @brief Get OCF cleaner of given cache object
*
* @param[in] cache Cache object
*
* @retval OCF cleaner, NULL if cache is in standby mode,
* cache device is not attached (cleaner not initialized)
* or cleaner is disabled
*/
ocf_cleaner_t ocf_cache_get_cleaner(ocf_cache_t cache);

/**
* @brief Get volume type id of given cache object
*
Expand Down
16 changes: 16 additions & 0 deletions src/ocf_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,22 @@ ocf_ctx_t ocf_cache_get_ctx(ocf_cache_t cache)
return cache->owner;
}

ocf_cleaner_t ocf_cache_get_cleaner(ocf_cache_t cache)
{
OCF_CHECK_NULL(cache);

if (ocf_cache_is_standby(cache))
return NULL;

if (!ocf_cache_is_device_attached(cache))
return NULL;

if (cache->conf_meta->cleaner_disabled)
return NULL;
Comment on lines +298 to +302

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this (and doc update):

if (ocf_cache_is_standby(cache))
	return NULL;

BTW this function this is the first place where we introduce ocf_cleaner_t nullability, but I think API-wise it is ok.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any other doc for this change then the one in header?


return &cache->cleaner;
}

void ocf_cache_set_priv(ocf_cache_t cache, void *priv)
{
OCF_CHECK_NULL(cache);
Expand Down
Loading