Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright (c) 2006-2007 Silicon Graphics, Inc.
0004  * All Rights Reserved.
0005  */
0006 #ifndef __XFS_MRU_CACHE_H__
0007 #define __XFS_MRU_CACHE_H__
0008 
0009 struct xfs_mru_cache;
0010 
0011 struct xfs_mru_cache_elem {
0012     struct list_head list_node;
0013     unsigned long   key;
0014 };
0015 
0016 /* Function pointer type for callback to free a client's data pointer. */
0017 typedef void (*xfs_mru_cache_free_func_t)(void *, struct xfs_mru_cache_elem *);
0018 
0019 int xfs_mru_cache_init(void);
0020 void xfs_mru_cache_uninit(void);
0021 int xfs_mru_cache_create(struct xfs_mru_cache **mrup, void *data,
0022         unsigned int lifetime_ms, unsigned int grp_count,
0023         xfs_mru_cache_free_func_t free_func);
0024 void xfs_mru_cache_destroy(struct xfs_mru_cache *mru);
0025 int xfs_mru_cache_insert(struct xfs_mru_cache *mru, unsigned long key,
0026         struct xfs_mru_cache_elem *elem);
0027 struct xfs_mru_cache_elem *
0028 xfs_mru_cache_remove(struct xfs_mru_cache *mru, unsigned long key);
0029 void xfs_mru_cache_delete(struct xfs_mru_cache *mru, unsigned long key);
0030 struct xfs_mru_cache_elem *
0031 xfs_mru_cache_lookup(struct xfs_mru_cache *mru, unsigned long key);
0032 void xfs_mru_cache_done(struct xfs_mru_cache *mru);
0033 
0034 #endif /* __XFS_MRU_CACHE_H__ */