fscache.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* NFS filesystem cache interface definitions
  2. *
  3. * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #ifndef _NFS_FSCACHE_H
  12. #define _NFS_FSCACHE_H
  13. #include <linux/nfs_fs.h>
  14. #include <linux/nfs_mount.h>
  15. #include <linux/nfs4_mount.h>
  16. #include <linux/fscache.h>
  17. #ifdef CONFIG_NFS_FSCACHE
  18. /*
  19. * set of NFS FS-Cache objects that form a superblock key
  20. */
  21. struct nfs_fscache_key {
  22. struct rb_node node;
  23. struct nfs_client *nfs_client; /* the server */
  24. /* the elements of the unique key - as used by nfs_compare_super() and
  25. * nfs_compare_mount_options() to distinguish superblocks */
  26. struct {
  27. struct {
  28. unsigned long s_flags; /* various flags
  29. * (& NFS_MS_MASK) */
  30. } super;
  31. struct {
  32. struct nfs_fsid fsid;
  33. int flags;
  34. unsigned int rsize; /* read size */
  35. unsigned int wsize; /* write size */
  36. unsigned int acregmin; /* attr cache timeouts */
  37. unsigned int acregmax;
  38. unsigned int acdirmin;
  39. unsigned int acdirmax;
  40. } nfs_server;
  41. struct {
  42. rpc_authflavor_t au_flavor;
  43. } rpc_auth;
  44. /* uniquifier - can be used if nfs_server.flags includes
  45. * NFS_MOUNT_UNSHARED */
  46. u8 uniq_len;
  47. char uniquifier[0];
  48. } key;
  49. };
  50. /*
  51. * fscache-index.c
  52. */
  53. extern struct fscache_netfs nfs_fscache_netfs;
  54. extern const struct fscache_cookie_def nfs_fscache_server_index_def;
  55. extern const struct fscache_cookie_def nfs_fscache_super_index_def;
  56. extern int nfs_fscache_register(void);
  57. extern void nfs_fscache_unregister(void);
  58. /*
  59. * fscache.c
  60. */
  61. extern void nfs_fscache_get_client_cookie(struct nfs_client *);
  62. extern void nfs_fscache_release_client_cookie(struct nfs_client *);
  63. extern void nfs_fscache_get_super_cookie(struct super_block *,
  64. struct nfs_parsed_mount_data *);
  65. extern void nfs_fscache_release_super_cookie(struct super_block *);
  66. #else /* CONFIG_NFS_FSCACHE */
  67. static inline int nfs_fscache_register(void) { return 0; }
  68. static inline void nfs_fscache_unregister(void) {}
  69. static inline void nfs_fscache_get_client_cookie(struct nfs_client *clp) {}
  70. static inline void nfs_fscache_release_client_cookie(struct nfs_client *clp) {}
  71. static inline void nfs_fscache_get_super_cookie(
  72. struct super_block *sb,
  73. struct nfs_parsed_mount_data *data)
  74. {
  75. }
  76. static inline void nfs_fscache_release_super_cookie(struct super_block *sb) {}
  77. #endif /* CONFIG_NFS_FSCACHE */
  78. #endif /* _NFS_FSCACHE_H */