xfs_mru_cache.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 2006-2007 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __XFS_MRU_CACHE_H__
  19. #define __XFS_MRU_CACHE_H__
  20. struct xfs_mru_cache;
  21. struct xfs_mru_cache_elem {
  22. struct list_head list_node;
  23. unsigned long key;
  24. };
  25. /* Function pointer type for callback to free a client's data pointer. */
  26. typedef void (*xfs_mru_cache_free_func_t)(struct xfs_mru_cache_elem *elem);
  27. int xfs_mru_cache_init(void);
  28. void xfs_mru_cache_uninit(void);
  29. int xfs_mru_cache_create(struct xfs_mru_cache **mrup, unsigned int lifetime_ms,
  30. unsigned int grp_count,
  31. xfs_mru_cache_free_func_t free_func);
  32. void xfs_mru_cache_destroy(struct xfs_mru_cache *mru);
  33. int xfs_mru_cache_insert(struct xfs_mru_cache *mru, unsigned long key,
  34. struct xfs_mru_cache_elem *elem);
  35. struct xfs_mru_cache_elem *
  36. xfs_mru_cache_remove(struct xfs_mru_cache *mru, unsigned long key);
  37. void xfs_mru_cache_delete(struct xfs_mru_cache *mru, unsigned long key);
  38. struct xfs_mru_cache_elem *
  39. xfs_mru_cache_lookup(struct xfs_mru_cache *mru, unsigned long key);
  40. void xfs_mru_cache_done(struct xfs_mru_cache *mru);
  41. #endif /* __XFS_MRU_CACHE_H__ */