162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2006-2007 Silicon Graphics, Inc.
462306a36Sopenharmony_ci * All Rights Reserved.
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci#ifndef __XFS_MRU_CACHE_H__
762306a36Sopenharmony_ci#define __XFS_MRU_CACHE_H__
862306a36Sopenharmony_ci
962306a36Sopenharmony_cistruct xfs_mru_cache;
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_cistruct xfs_mru_cache_elem {
1262306a36Sopenharmony_ci	struct list_head list_node;
1362306a36Sopenharmony_ci	unsigned long	key;
1462306a36Sopenharmony_ci};
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/* Function pointer type for callback to free a client's data pointer. */
1762306a36Sopenharmony_citypedef void (*xfs_mru_cache_free_func_t)(void *, struct xfs_mru_cache_elem *);
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ciint xfs_mru_cache_init(void);
2062306a36Sopenharmony_civoid xfs_mru_cache_uninit(void);
2162306a36Sopenharmony_ciint xfs_mru_cache_create(struct xfs_mru_cache **mrup, void *data,
2262306a36Sopenharmony_ci		unsigned int lifetime_ms, unsigned int grp_count,
2362306a36Sopenharmony_ci		xfs_mru_cache_free_func_t free_func);
2462306a36Sopenharmony_civoid xfs_mru_cache_destroy(struct xfs_mru_cache *mru);
2562306a36Sopenharmony_ciint xfs_mru_cache_insert(struct xfs_mru_cache *mru, unsigned long key,
2662306a36Sopenharmony_ci		struct xfs_mru_cache_elem *elem);
2762306a36Sopenharmony_cistruct xfs_mru_cache_elem *
2862306a36Sopenharmony_cixfs_mru_cache_remove(struct xfs_mru_cache *mru, unsigned long key);
2962306a36Sopenharmony_civoid xfs_mru_cache_delete(struct xfs_mru_cache *mru, unsigned long key);
3062306a36Sopenharmony_cistruct xfs_mru_cache_elem *
3162306a36Sopenharmony_cixfs_mru_cache_lookup(struct xfs_mru_cache *mru, unsigned long key);
3262306a36Sopenharmony_civoid xfs_mru_cache_done(struct xfs_mru_cache *mru);
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#endif /* __XFS_MRU_CACHE_H__ */
35