xfs_mru_cache.h (1167B)
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (c) 2006-2007 Silicon Graphics, Inc. 4 * All Rights Reserved. 5 */ 6#ifndef __XFS_MRU_CACHE_H__ 7#define __XFS_MRU_CACHE_H__ 8 9struct xfs_mru_cache; 10 11struct xfs_mru_cache_elem { 12 struct list_head list_node; 13 unsigned long key; 14}; 15 16/* Function pointer type for callback to free a client's data pointer. */ 17typedef void (*xfs_mru_cache_free_func_t)(void *, struct xfs_mru_cache_elem *); 18 19int xfs_mru_cache_init(void); 20void xfs_mru_cache_uninit(void); 21int xfs_mru_cache_create(struct xfs_mru_cache **mrup, void *data, 22 unsigned int lifetime_ms, unsigned int grp_count, 23 xfs_mru_cache_free_func_t free_func); 24void xfs_mru_cache_destroy(struct xfs_mru_cache *mru); 25int xfs_mru_cache_insert(struct xfs_mru_cache *mru, unsigned long key, 26 struct xfs_mru_cache_elem *elem); 27struct xfs_mru_cache_elem * 28xfs_mru_cache_remove(struct xfs_mru_cache *mru, unsigned long key); 29void xfs_mru_cache_delete(struct xfs_mru_cache *mru, unsigned long key); 30struct xfs_mru_cache_elem * 31xfs_mru_cache_lookup(struct xfs_mru_cache *mru, unsigned long key); 32void xfs_mru_cache_done(struct xfs_mru_cache *mru); 33 34#endif /* __XFS_MRU_CACHE_H__ */