blob: a93593f1fa4ea7d38668bf4367bd1bec0ecc1faa [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * include/linux/nfsd/nfsfh.h
3 *
4 * This file describes the layout of the file handles as passed
5 * over the wire.
6 *
7 * Earlier versions of knfsd used to sign file handles using keyed MD5
8 * or SHA. I've removed this code, because it doesn't give you more
9 * security than blocking external access to port 2049 on your firewall.
10 *
11 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
12 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#ifndef _LINUX_NFSD_FH_H
14#define _LINUX_NFSD_FH_H
15
Boaz Harrosh72579ac2009-12-03 20:28:59 +020016# include <linux/sunrpc/svc.h>
David Howells616d1ca2012-10-09 09:49:02 +010017#include <uapi/linux/nfsd/nfsfh.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
19static inline __u32 ino_t_to_u32(ino_t ino)
20{
21 return (__u32) ino;
22}
23
24static inline ino_t u32_to_ino_t(__u32 uino)
25{
26 return (ino_t) uino;
27}
28
29/*
30 * This is the internal representation of an NFS handle used in knfsd.
31 * pre_mtime/post_version will be used to support wcc_attr's in NFSv3.
32 */
33typedef struct svc_fh {
34 struct knfsd_fh fh_handle; /* FH data */
35 struct dentry * fh_dentry; /* validated dentry */
36 struct svc_export * fh_export; /* export pointer */
37 int fh_maxsize; /* max size for fh_handle */
38
39 unsigned char fh_locked; /* inode locked by us */
Jan Kara4a55c102012-06-12 16:20:33 +020040 unsigned char fh_want_write; /* remount protection taken */
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42#ifdef CONFIG_NFSD_V3
43 unsigned char fh_post_saved; /* post-op attrs saved */
44 unsigned char fh_pre_saved; /* pre-op attrs saved */
45
46 /* Pre-op attributes saved during fh_lock */
47 __u64 fh_pre_size; /* size before operation */
48 struct timespec fh_pre_mtime; /* mtime before oper */
49 struct timespec fh_pre_ctime; /* ctime before oper */
J. Bruce Fieldsc654b8a2009-04-16 17:33:25 -040050 /*
51 * pre-op nfsv4 change attr: note must check IS_I_VERSION(inode)
52 * to find out if it is valid.
53 */
54 u64 fh_pre_change;
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
56 /* Post-op attributes saved in fh_unlock */
Peter Staubach40ee5dc2007-08-16 12:10:07 -040057 struct kstat fh_post_attr; /* full attrs after operation */
J. Bruce Fieldsc654b8a2009-04-16 17:33:25 -040058 u64 fh_post_change; /* nfsv4 change; see above */
Linus Torvalds1da177e2005-04-16 15:20:36 -070059#endif /* CONFIG_NFSD_V3 */
60
61} svc_fh;
62
Linus Torvalds1da177e2005-04-16 15:20:36 -070063#endif /* _LINUX_NFSD_FH_H */