xref: /openbmc/linux/fs/nfs/fscache.h (revision 08734048)
18ec442aeSDavid Howells /* NFS filesystem cache interface definitions
28ec442aeSDavid Howells  *
38ec442aeSDavid Howells  * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
48ec442aeSDavid Howells  * Written by David Howells (dhowells@redhat.com)
58ec442aeSDavid Howells  *
68ec442aeSDavid Howells  * This program is free software; you can redistribute it and/or
78ec442aeSDavid Howells  * modify it under the terms of the GNU General Public Licence
88ec442aeSDavid Howells  * as published by the Free Software Foundation; either version
98ec442aeSDavid Howells  * 2 of the Licence, or (at your option) any later version.
108ec442aeSDavid Howells  */
118ec442aeSDavid Howells 
128ec442aeSDavid Howells #ifndef _NFS_FSCACHE_H
138ec442aeSDavid Howells #define _NFS_FSCACHE_H
148ec442aeSDavid Howells 
158ec442aeSDavid Howells #include <linux/nfs_fs.h>
168ec442aeSDavid Howells #include <linux/nfs_mount.h>
178ec442aeSDavid Howells #include <linux/nfs4_mount.h>
188ec442aeSDavid Howells #include <linux/fscache.h>
198ec442aeSDavid Howells 
208ec442aeSDavid Howells #ifdef CONFIG_NFS_FSCACHE
218ec442aeSDavid Howells 
228ec442aeSDavid Howells /*
2308734048SDavid Howells  * set of NFS FS-Cache objects that form a superblock key
2408734048SDavid Howells  */
2508734048SDavid Howells struct nfs_fscache_key {
2608734048SDavid Howells 	struct rb_node		node;
2708734048SDavid Howells 	struct nfs_client	*nfs_client;	/* the server */
2808734048SDavid Howells 
2908734048SDavid Howells 	/* the elements of the unique key - as used by nfs_compare_super() and
3008734048SDavid Howells 	 * nfs_compare_mount_options() to distinguish superblocks */
3108734048SDavid Howells 	struct {
3208734048SDavid Howells 		struct {
3308734048SDavid Howells 			unsigned long	s_flags;	/* various flags
3408734048SDavid Howells 							 * (& NFS_MS_MASK) */
3508734048SDavid Howells 		} super;
3608734048SDavid Howells 
3708734048SDavid Howells 		struct {
3808734048SDavid Howells 			struct nfs_fsid fsid;
3908734048SDavid Howells 			int		flags;
4008734048SDavid Howells 			unsigned int	rsize;		/* read size */
4108734048SDavid Howells 			unsigned int	wsize;		/* write size */
4208734048SDavid Howells 			unsigned int	acregmin;	/* attr cache timeouts */
4308734048SDavid Howells 			unsigned int	acregmax;
4408734048SDavid Howells 			unsigned int	acdirmin;
4508734048SDavid Howells 			unsigned int	acdirmax;
4608734048SDavid Howells 		} nfs_server;
4708734048SDavid Howells 
4808734048SDavid Howells 		struct {
4908734048SDavid Howells 			rpc_authflavor_t au_flavor;
5008734048SDavid Howells 		} rpc_auth;
5108734048SDavid Howells 
5208734048SDavid Howells 		/* uniquifier - can be used if nfs_server.flags includes
5308734048SDavid Howells 		 * NFS_MOUNT_UNSHARED  */
5408734048SDavid Howells 		u8 uniq_len;
5508734048SDavid Howells 		char uniquifier[0];
5608734048SDavid Howells 	} key;
5708734048SDavid Howells };
5808734048SDavid Howells 
5908734048SDavid Howells /*
608ec442aeSDavid Howells  * fscache-index.c
618ec442aeSDavid Howells  */
628ec442aeSDavid Howells extern struct fscache_netfs nfs_fscache_netfs;
6314727281SDavid Howells extern const struct fscache_cookie_def nfs_fscache_server_index_def;
6408734048SDavid Howells extern const struct fscache_cookie_def nfs_fscache_super_index_def;
658ec442aeSDavid Howells 
668ec442aeSDavid Howells extern int nfs_fscache_register(void);
678ec442aeSDavid Howells extern void nfs_fscache_unregister(void);
688ec442aeSDavid Howells 
6914727281SDavid Howells /*
7014727281SDavid Howells  * fscache.c
7114727281SDavid Howells  */
7214727281SDavid Howells extern void nfs_fscache_get_client_cookie(struct nfs_client *);
7314727281SDavid Howells extern void nfs_fscache_release_client_cookie(struct nfs_client *);
7414727281SDavid Howells 
7508734048SDavid Howells extern void nfs_fscache_get_super_cookie(struct super_block *,
7608734048SDavid Howells 					 struct nfs_parsed_mount_data *);
7708734048SDavid Howells extern void nfs_fscache_release_super_cookie(struct super_block *);
7808734048SDavid Howells 
798ec442aeSDavid Howells #else /* CONFIG_NFS_FSCACHE */
808ec442aeSDavid Howells static inline int nfs_fscache_register(void) { return 0; }
818ec442aeSDavid Howells static inline void nfs_fscache_unregister(void) {}
828ec442aeSDavid Howells 
8314727281SDavid Howells static inline void nfs_fscache_get_client_cookie(struct nfs_client *clp) {}
8414727281SDavid Howells static inline void nfs_fscache_release_client_cookie(struct nfs_client *clp) {}
8514727281SDavid Howells 
8608734048SDavid Howells static inline void nfs_fscache_get_super_cookie(
8708734048SDavid Howells 	struct super_block *sb,
8808734048SDavid Howells 	struct nfs_parsed_mount_data *data)
8908734048SDavid Howells {
9008734048SDavid Howells }
9108734048SDavid Howells static inline void nfs_fscache_release_super_cookie(struct super_block *sb) {}
9208734048SDavid Howells 
938ec442aeSDavid Howells #endif /* CONFIG_NFS_FSCACHE */
948ec442aeSDavid Howells #endif /* _NFS_FSCACHE_H */
95