xfs_mru_cache.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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. struct xfs_mru_cache;
  9. struct xfs_mru_cache_elem {
  10. struct list_head list_node;
  11. unsigned long key;
  12. };
  13. /* Function pointer type for callback to free a client's data pointer. */
  14. typedef void (*xfs_mru_cache_free_func_t)(void *, struct xfs_mru_cache_elem *);
  15. int xfs_mru_cache_init(void);
  16. void xfs_mru_cache_uninit(void);
  17. int xfs_mru_cache_create(struct xfs_mru_cache **mrup, void *data,
  18. unsigned int lifetime_ms, unsigned int grp_count,
  19. xfs_mru_cache_free_func_t free_func);
  20. void xfs_mru_cache_destroy(struct xfs_mru_cache *mru);
  21. int xfs_mru_cache_insert(struct xfs_mru_cache *mru, unsigned long key,
  22. struct xfs_mru_cache_elem *elem);
  23. struct xfs_mru_cache_elem *
  24. xfs_mru_cache_remove(struct xfs_mru_cache *mru, unsigned long key);
  25. void xfs_mru_cache_delete(struct xfs_mru_cache *mru, unsigned long key);
  26. struct xfs_mru_cache_elem *
  27. xfs_mru_cache_lookup(struct xfs_mru_cache *mru, unsigned long key);
  28. void xfs_mru_cache_done(struct xfs_mru_cache *mru);
  29. #endif /* __XFS_MRU_CACHE_H__ */