cache.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * include/linux/nfsd/cache.h
  3. *
  4. * Request reply cache. This was heavily inspired by the
  5. * implementation in 4.3BSD/4.4BSD.
  6. *
  7. * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
  8. */
  9. #ifndef NFSCACHE_H
  10. #define NFSCACHE_H
  11. #ifdef __KERNEL__
  12. #include <linux/in.h>
  13. #include <linux/uio.h>
  14. /*
  15. * Representation of a reply cache entry. The first two members *must*
  16. * be hash_next and hash_prev.
  17. */
  18. struct svc_cacherep {
  19. struct hlist_node c_hash;
  20. struct list_head c_lru;
  21. unsigned char c_state, /* unused, inprog, done */
  22. c_type, /* status, buffer */
  23. c_secure : 1; /* req came from port < 1024 */
  24. struct sockaddr_in c_addr;
  25. u32 c_xid;
  26. u32 c_prot;
  27. u32 c_proc;
  28. u32 c_vers;
  29. unsigned long c_timestamp;
  30. union {
  31. struct kvec u_vec;
  32. u32 u_status;
  33. } c_u;
  34. };
  35. #define c_replvec c_u.u_vec
  36. #define c_replstat c_u.u_status
  37. /* cache entry states */
  38. enum {
  39. RC_UNUSED,
  40. RC_INPROG,
  41. RC_DONE
  42. };
  43. /* return values */
  44. enum {
  45. RC_DROPIT,
  46. RC_REPLY,
  47. RC_DOIT,
  48. RC_INTR
  49. };
  50. /*
  51. * Cache types.
  52. * We may want to add more types one day, e.g. for diropres and
  53. * attrstat replies. Using cache entries with fixed length instead
  54. * of buffer pointers may be more efficient.
  55. */
  56. enum {
  57. RC_NOCACHE,
  58. RC_REPLSTAT,
  59. RC_REPLBUFF,
  60. };
  61. /*
  62. * If requests are retransmitted within this interval, they're dropped.
  63. */
  64. #define RC_DELAY (HZ/5)
  65. void nfsd_cache_init(void);
  66. void nfsd_cache_shutdown(void);
  67. int nfsd_cache_lookup(struct svc_rqst *, int);
  68. void nfsd_cache_update(struct svc_rqst *, int, u32 *);
  69. #endif /* __KERNEL__ */
  70. #endif /* NFSCACHE_H */