1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*
3  * Upcall description for nfsdcld communication
4  *
5  * Copyright (c) 2012 Red Hat, Inc.
6  * Author(s): Jeff Layton <jlayton@redhat.com>
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22 
23 #ifndef _NFSD_CLD_H
24 #define _NFSD_CLD_H
25 
26 #include <linux/types.h>
27 
28 /* latest upcall version available */
29 #define CLD_UPCALL_VERSION 1
30 
31 /* defined by RFC3530 */
32 #define NFS4_OPAQUE_LIMIT 1024
33 
34 enum cld_command {
35 	Cld_Create,		/* create a record for this cm_id */
36 	Cld_Remove,		/* remove record of this cm_id */
37 	Cld_Check,		/* is this cm_id allowed? */
38 	Cld_GraceDone,		/* grace period is complete */
39 };
40 
41 /* representation of long-form NFSv4 client ID */
42 struct cld_name {
43 	__u16		cn_len;				/* length of cm_id */
44 	unsigned char	cn_id[NFS4_OPAQUE_LIMIT];	/* client-provided */
45 } __attribute__((packed));
46 
47 /* message struct for communication with userspace */
48 struct cld_msg {
49 	__u8		cm_vers;		/* upcall version */
50 	__u8		cm_cmd;			/* upcall command */
51 	__s16		cm_status;		/* return code */
52 	__u32		cm_xid;			/* transaction id */
53 	union {
54 		__s64		cm_gracetime;	/* grace period start time */
55 		struct cld_name	cm_name;
56 	} __attribute__((packed)) cm_u;
57 } __attribute__((packed));
58 
59 #endif /* !_NFSD_CLD_H */
60