hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/uapi/linux/nfsd/cld.h
....@@ -26,22 +26,39 @@
2626 #include <linux/types.h>
2727
2828 /* latest upcall version available */
29
-#define CLD_UPCALL_VERSION 1
29
+#define CLD_UPCALL_VERSION 2
3030
3131 /* defined by RFC3530 */
3232 #define NFS4_OPAQUE_LIMIT 1024
33
+
34
+#ifndef SHA256_DIGEST_SIZE
35
+#define SHA256_DIGEST_SIZE 32
36
+#endif
3337
3438 enum cld_command {
3539 Cld_Create, /* create a record for this cm_id */
3640 Cld_Remove, /* remove record of this cm_id */
3741 Cld_Check, /* is this cm_id allowed? */
3842 Cld_GraceDone, /* grace period is complete */
43
+ Cld_GraceStart, /* grace start (upload client records) */
44
+ Cld_GetVersion, /* query max supported upcall version */
3945 };
4046
4147 /* representation of long-form NFSv4 client ID */
4248 struct cld_name {
4349 __u16 cn_len; /* length of cm_id */
4450 unsigned char cn_id[NFS4_OPAQUE_LIMIT]; /* client-provided */
51
+} __attribute__((packed));
52
+
53
+/* sha256 hash of the kerberos principal */
54
+struct cld_princhash {
55
+ __u8 cp_len; /* length of cp_data */
56
+ unsigned char cp_data[SHA256_DIGEST_SIZE]; /* hash of principal */
57
+} __attribute__((packed));
58
+
59
+struct cld_clntinfo {
60
+ struct cld_name cc_name;
61
+ struct cld_princhash cc_princhash;
4562 } __attribute__((packed));
4663
4764 /* message struct for communication with userspace */
....@@ -53,7 +70,28 @@
5370 union {
5471 __s64 cm_gracetime; /* grace period start time */
5572 struct cld_name cm_name;
73
+ __u8 cm_version; /* for getting max version */
5674 } __attribute__((packed)) cm_u;
5775 } __attribute__((packed));
5876
77
+/* version 2 message can include hash of kerberos principal */
78
+struct cld_msg_v2 {
79
+ __u8 cm_vers; /* upcall version */
80
+ __u8 cm_cmd; /* upcall command */
81
+ __s16 cm_status; /* return code */
82
+ __u32 cm_xid; /* transaction id */
83
+ union {
84
+ struct cld_name cm_name;
85
+ __u8 cm_version; /* for getting max version */
86
+ struct cld_clntinfo cm_clntinfo; /* name & princ hash */
87
+ } __attribute__((packed)) cm_u;
88
+} __attribute__((packed));
89
+
90
+struct cld_msg_hdr {
91
+ __u8 cm_vers; /* upcall version */
92
+ __u8 cm_cmd; /* upcall command */
93
+ __s16 cm_status; /* return code */
94
+ __u32 cm_xid; /* transaction id */
95
+} __attribute__((packed));
96
+
5997 #endif /* !_NFSD_CLD_H */