xref: /openbmc/linux/fs/nfs/callback.h (revision 7146851376861fe55c7a48ac8fc1354a5fff6cd0)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * linux/fs/nfs/callback.h
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * Copyright (C) 2004 Trond Myklebust
51da177e4SLinus Torvalds  *
61da177e4SLinus Torvalds  * NFSv4 callback definitions
71da177e4SLinus Torvalds  */
81da177e4SLinus Torvalds #ifndef __LINUX_FS_NFS_CALLBACK_H
91da177e4SLinus Torvalds #define __LINUX_FS_NFS_CALLBACK_H
101da177e4SLinus Torvalds 
111da177e4SLinus Torvalds #define NFS4_CALLBACK 0x40000000
121da177e4SLinus Torvalds #define NFS4_CALLBACK_XDRSIZE 2048
131da177e4SLinus Torvalds #define NFS4_CALLBACK_BUFSIZE (1024 + NFS4_CALLBACK_XDRSIZE)
141da177e4SLinus Torvalds 
151da177e4SLinus Torvalds enum nfs4_callback_procnum {
161da177e4SLinus Torvalds 	CB_NULL = 0,
171da177e4SLinus Torvalds 	CB_COMPOUND = 1,
181da177e4SLinus Torvalds };
191da177e4SLinus Torvalds 
201da177e4SLinus Torvalds enum nfs4_callback_opnum {
211da177e4SLinus Torvalds 	OP_CB_GETATTR = 3,
221da177e4SLinus Torvalds 	OP_CB_RECALL  = 4,
231da177e4SLinus Torvalds 	OP_CB_ILLEGAL = 10044,
241da177e4SLinus Torvalds };
251da177e4SLinus Torvalds 
261da177e4SLinus Torvalds struct cb_compound_hdr_arg {
272e42c3e2STrond Myklebust 	unsigned int taglen;
281da177e4SLinus Torvalds 	const char *tag;
291da177e4SLinus Torvalds 	unsigned int callback_ident;
301da177e4SLinus Torvalds 	unsigned nops;
311da177e4SLinus Torvalds };
321da177e4SLinus Torvalds 
331da177e4SLinus Torvalds struct cb_compound_hdr_res {
345704fdebSAl Viro 	__be32 *status;
352e42c3e2STrond Myklebust 	unsigned int taglen;
361da177e4SLinus Torvalds 	const char *tag;
375704fdebSAl Viro 	__be32 *nops;
381da177e4SLinus Torvalds };
391da177e4SLinus Torvalds 
401da177e4SLinus Torvalds struct cb_getattrargs {
41671beed7SChuck Lever 	struct sockaddr *addr;
421da177e4SLinus Torvalds 	struct nfs_fh fh;
431da177e4SLinus Torvalds 	uint32_t bitmap[2];
441da177e4SLinus Torvalds };
451da177e4SLinus Torvalds 
461da177e4SLinus Torvalds struct cb_getattrres {
47e6f684f6SAl Viro 	__be32 status;
481da177e4SLinus Torvalds 	uint32_t bitmap[2];
491da177e4SLinus Torvalds 	uint64_t size;
501da177e4SLinus Torvalds 	uint64_t change_attr;
511da177e4SLinus Torvalds 	struct timespec ctime;
521da177e4SLinus Torvalds 	struct timespec mtime;
531da177e4SLinus Torvalds };
541da177e4SLinus Torvalds 
551da177e4SLinus Torvalds struct cb_recallargs {
56c1d35866SChuck Lever 	struct sockaddr *addr;
571da177e4SLinus Torvalds 	struct nfs_fh fh;
581da177e4SLinus Torvalds 	nfs4_stateid stateid;
591da177e4SLinus Torvalds 	uint32_t truncate;
601da177e4SLinus Torvalds };
611da177e4SLinus Torvalds 
62e6f684f6SAl Viro extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res);
63e6f684f6SAl Viro extern __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy);
641da177e4SLinus Torvalds 
655ae1fbceSDavid Howells #ifdef CONFIG_NFS_V4
66*71468513SBenny Halevy extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt);
675ae1fbceSDavid Howells extern void nfs_callback_down(void);
685ae1fbceSDavid Howells #else
695ae1fbceSDavid Howells #define nfs_callback_up()	(0)
705ae1fbceSDavid Howells #define nfs_callback_down()	do {} while(0)
715ae1fbceSDavid Howells #endif
721da177e4SLinus Torvalds 
73a72b4422STrond Myklebust extern unsigned int nfs_callback_set_tcpport;
741da177e4SLinus Torvalds extern unsigned short nfs_callback_tcpport;
75f738f517SChuck Lever extern unsigned short nfs_callback_tcpport6;
761da177e4SLinus Torvalds 
771da177e4SLinus Torvalds #endif /* __LINUX_FS_NFS_CALLBACK_H */
78