2018-06-06 02:42:14 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2007-07-11 01:09:12 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2007 Silicon Graphics, Inc.
|
|
|
|
* All Rights Reserved.
|
|
|
|
*/
|
|
|
|
#ifndef __XFS_MRU_CACHE_H__
|
|
|
|
#define __XFS_MRU_CACHE_H__
|
|
|
|
|
2014-04-22 21:11:51 +00:00
|
|
|
struct xfs_mru_cache;
|
2007-07-11 01:09:12 +00:00
|
|
|
|
2014-04-22 21:11:51 +00:00
|
|
|
struct xfs_mru_cache_elem {
|
|
|
|
struct list_head list_node;
|
|
|
|
unsigned long key;
|
|
|
|
};
|
2007-07-11 01:09:12 +00:00
|
|
|
|
2014-04-22 21:11:51 +00:00
|
|
|
/* Function pointer type for callback to free a client's data pointer. */
|
2018-04-09 17:23:39 +00:00
|
|
|
typedef void (*xfs_mru_cache_free_func_t)(void *, struct xfs_mru_cache_elem *);
|
2007-07-11 01:09:12 +00:00
|
|
|
|
|
|
|
int xfs_mru_cache_init(void);
|
|
|
|
void xfs_mru_cache_uninit(void);
|
2018-04-09 17:23:39 +00:00
|
|
|
int xfs_mru_cache_create(struct xfs_mru_cache **mrup, void *data,
|
|
|
|
unsigned int lifetime_ms, unsigned int grp_count,
|
|
|
|
xfs_mru_cache_free_func_t free_func);
|
2007-07-11 01:09:12 +00:00
|
|
|
void xfs_mru_cache_destroy(struct xfs_mru_cache *mru);
|
|
|
|
int xfs_mru_cache_insert(struct xfs_mru_cache *mru, unsigned long key,
|
2014-04-22 21:11:51 +00:00
|
|
|
struct xfs_mru_cache_elem *elem);
|
|
|
|
struct xfs_mru_cache_elem *
|
|
|
|
xfs_mru_cache_remove(struct xfs_mru_cache *mru, unsigned long key);
|
2007-07-11 01:09:12 +00:00
|
|
|
void xfs_mru_cache_delete(struct xfs_mru_cache *mru, unsigned long key);
|
2014-04-22 21:11:51 +00:00
|
|
|
struct xfs_mru_cache_elem *
|
|
|
|
xfs_mru_cache_lookup(struct xfs_mru_cache *mru, unsigned long key);
|
2007-07-11 01:09:12 +00:00
|
|
|
void xfs_mru_cache_done(struct xfs_mru_cache *mru);
|
|
|
|
|
|
|
|
#endif /* __XFS_MRU_CACHE_H__ */
|