uapi: fix linux/nfsd/cld.h userspace compilation errors
Subsystems (2)
PATCH 1/1 uapi: fix linux/nfsd/cld.h userspace compilation errors
Include <linux/types.h> and consistently use types it provides to fix the following linux/nfsd/cld.h userspace compilation errors:
/usr/include/linux/nfsd/cld.h:40:2: error: unknown type name 'uint16_t'
uint16_t cn_len; /* length of cm_id *//usr/include/linux/nfsd/cld.h:46:2: error: unknown type name 'uint8_t'
uint8_t cm_vers; /* upcall version *//usr/include/linux/nfsd/cld.h:47:2: error: unknown type name 'uint8_t'
uint8_t cm_cmd; /* upcall command *//usr/include/linux/nfsd/cld.h:48:2: error: unknown type name 'int16_t'
int16_t cm_status; /* return code *//usr/include/linux/nfsd/cld.h:49:2: error: unknown type name 'uint32_t'
uint32_t cm_xid; /* transaction id *//usr/include/linux/nfsd/cld.h:51:3: error: unknown type name 'int64_t'
int64_t cm_gracetime; /* grace period start time */
--- include/uapi/linux/nfsd/cld.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
include/uapi/linux/nfsd/cld.h +8 -6
@@ -22,6 +22,8 @@#ifndef _NFSD_CLD_H#define _NFSD_CLD_H +#include <linux/types.h> +/* latest upcall version available */ #define CLD_UPCALL_VERSION 1
@@ -37,18 +39,18 @@ enum cld_command {/* representation of long-form NFSv4 client ID */ struct cld_name { -uint16_t cn_len;/* length of cm_id */ +__u16 cn_len;/* length of cm_id */ unsigned char cn_id[NFS4_OPAQUE_LIMIT ];/* client-provided */ } __attribute__((packed));/* message struct for communication with userspace */ struct cld_msg { -uint8_t cm_vers;/* upcall version */ -uint8_t cm_cmd;/* upcall command */ -int16_t cm_status;/* return code */ -uint32_t cm_xid;/* transaction id */ +__u8 cm_vers;/* upcall version */ +__u8 cm_cmd;/* upcall command */ +__s16 cm_status;/* return code */ +__u32 cm_xid;/* transaction id */ union { -int64_t cm_gracetime;/* grace period start time */ +__s64 cm_gracetime;/* grace period start time */ struct cld_name cm_name; } __attribute__((packed)) cm_u; } __attribute__((packed));
Signature · 1 line
ldv
Why aren't the unitX_t types OK here?
Anyway, assuming this is right I'll apply for 4.12. (I'm assuming it's not urgent since this file's always been this way.)
--b.
Quoted 61 lines · Dmitry V. Levin
Include <
linux/types.h> and consistently use types it provides to fix the followinglinux/nfsd/cld.huserspace compilation errors:
/usr/include/linux/nfsd/cld.h:40:2: error: unknown type name 'uint16_t'
uint16_tcn_len; /* length ofcm_id*//usr/include/linux/nfsd/cld.h:46:2: error: unknown type name 'uint8_t'
uint8_tcm_vers; /* upcall version *//usr/include/linux/nfsd/cld.h:47:2: error: unknown type name 'uint8_t'
uint8_tcm_cmd; /* upcall command *//usr/include/linux/nfsd/cld.h:48:2: error: unknown type name 'int16_t'
int16_tcm_status; /* return code *//usr/include/linux/nfsd/cld.h:49:2: error: unknown type name 'uint32_t'
uint32_tcm_xid; /* transaction id *//usr/include/linux/nfsd/cld.h:51:3: error: unknown type name 'int64_t'
int64_tcm_gracetime; /* grace period start time */Signed-off-by Dmitry V. Levin <[email protected]>--- include/uapi/linux/nfsd/cld.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)include/uapi/linux/nfsd/cld.h +8
-6@@ -22,6 +22,8 @@#ifndef _NFSD_CLD_H#define _NFSD_CLD_H +#include <linux/types.h> +/* latest upcall version available */ #define CLD_UPCALL_VERSION 1@@ -37,18 +39,18 @@ enum cld_command {/* representation of long-form NFSv4 client ID */ struct cld_name { -uint16_t cn_len;/* length of cm_id */ +__u16 cn_len;/* length of cm_id */ unsigned char cn_id[NFS4_OPAQUE_LIMIT ];/* client-provided */ } __attribute__((packed));/* message struct for communication with userspace */ struct cld_msg { -uint8_t cm_vers;/* upcall version */ -uint8_t cm_cmd;/* upcall command */ -int16_t cm_status;/* return code */ -uint32_t cm_xid;/* transaction id */ +__u8 cm_vers;/* upcall version */ +__u8 cm_cmd;/* upcall command */ +__s16 cm_status;/* return code */ +__u32 cm_xid;/* transaction id */ union { -int64_t cm_gracetime;/* grace period start time */ +__s64 cm_gracetime;/* grace period start time */ struct cld_name cm_name; } __attribute__((packed)) cm_u; } __attribute__((packed));Signature · 1 line
ldv
Quoted 1 line · J. Bruce Fields
Why aren't the
unitX_ttypes OK here?
unitX_t types are not OK here because no UAPI header defines them, include/uapi/linux/types.h defines only their __uX/__sX analogues.
For this reason most of UAPI headers use types provided by <linux/types.h>, see e.g. include/uapi/linux/nfsd/nfsfh.h
There are few exceptions to this rule when headers are made portable between linux and other operating systems.
Quoted 2 lines
Anyway, assuming this is right I'll apply for 4.12. (I'm assuming it's not urgent since this file's always been this way.)
This should be safe to apply for 4.11 as well, but it's surely not urgent.
Quoted 64 lines
--b.
Quoted 61 lines · Dmitry V. Levin
Include <
linux/types.h> and consistently use types it provides to fix the followinglinux/nfsd/cld.huserspace compilation errors:
/usr/include/linux/nfsd/cld.h:40:2: error: unknown type name 'uint16_t'
uint16_tcn_len; /* length ofcm_id*//usr/include/linux/nfsd/cld.h:46:2: error: unknown type name 'uint8_t'
uint8_tcm_vers; /* upcall version *//usr/include/linux/nfsd/cld.h:47:2: error: unknown type name 'uint8_t'
uint8_tcm_cmd; /* upcall command *//usr/include/linux/nfsd/cld.h:48:2: error: unknown type name 'int16_t'
int16_tcm_status; /* return code *//usr/include/linux/nfsd/cld.h:49:2: error: unknown type name 'uint32_t'
uint32_tcm_xid; /* transaction id *//usr/include/linux/nfsd/cld.h:51:3: error: unknown type name 'int64_t'
int64_tcm_gracetime; /* grace period start time */Signed-off-by Dmitry V. Levin <[email protected]>--- include/uapi/linux/nfsd/cld.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)include/uapi/linux/nfsd/cld.h +8
-6@@ -22,6 +22,8 @@#ifndef _NFSD_CLD_H#define _NFSD_CLD_H +#include <linux/types.h> +/* latest upcall version available */ #define CLD_UPCALL_VERSION 1@@ -37,18 +39,18 @@ enum cld_command {/* representation of long-form NFSv4 client ID */ struct cld_name { -uint16_t cn_len;/* length of cm_id */ +__u16 cn_len;/* length of cm_id */ unsigned char cn_id[NFS4_OPAQUE_LIMIT ];/* client-provided */ } __attribute__((packed));/* message struct for communication with userspace */ struct cld_msg { -uint8_t cm_vers;/* upcall version */ -uint8_t cm_cmd;/* upcall command */ -int16_t cm_status;/* return code */ -uint32_t cm_xid;/* transaction id */ +__u8 cm_vers;/* upcall version */ +__u8 cm_cmd;/* upcall command */ +__s16 cm_status;/* return code */ +__u32 cm_xid;/* transaction id */ union { -int64_t cm_gracetime;/* grace period start time */ +__s64 cm_gracetime;/* grace period start time */ struct cld_name cm_name; } __attribute__((packed)) cm_u; } __attribute__((packed));Signature · 1 line
ldv
Signature · 1 line
ldv
Quoted 9 lines · Dmitry V. Levin
Quoted 1 line · J. Bruce Fields
Why aren't the
unitX_ttypes OK here?
unitX_ttypes are not OK here because no UAPI header defines them,include/uapi/linux/types.hdefines only their __uX/__sX analogues.For this reason most of UAPI headers use types provided by <
linux/types.h>, see e.g.include/uapi/linux/nfsd/nfsfh.h
Quoted 7 lines
There are few exceptions to this rule when headers are made portable between linux and other operating systems.
Quoted 2 lines
Anyway, assuming this is right I'll apply for 4.12. (I'm assuming it's not urgent since this file's always been this way.)
This should be safe to apply for 4.11 as well, but it's surely not urgent.
OK, thanks.--b.
Quoted 68 lines
Quoted 65 lines
--b.
Quoted 61 lines · Dmitry V. Levin
Include <
linux/types.h> and consistently use types it provides to fix the followinglinux/nfsd/cld.huserspace compilation errors:
/usr/include/linux/nfsd/cld.h:40:2: error: unknown type name 'uint16_t'
uint16_tcn_len; /* length ofcm_id*//usr/include/linux/nfsd/cld.h:46:2: error: unknown type name 'uint8_t'
uint8_tcm_vers; /* upcall version *//usr/include/linux/nfsd/cld.h:47:2: error: unknown type name 'uint8_t'
uint8_tcm_cmd; /* upcall command *//usr/include/linux/nfsd/cld.h:48:2: error: unknown type name 'int16_t'
int16_tcm_status; /* return code *//usr/include/linux/nfsd/cld.h:49:2: error: unknown type name 'uint32_t'
uint32_tcm_xid; /* transaction id *//usr/include/linux/nfsd/cld.h:51:3: error: unknown type name 'int64_t'
int64_tcm_gracetime; /* grace period start time */Signed-off-by Dmitry V. Levin <[email protected]>--- include/uapi/linux/nfsd/cld.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)include/uapi/linux/nfsd/cld.h +8
-6@@ -22,6 +22,8 @@#ifndef _NFSD_CLD_H#define _NFSD_CLD_H +#include <linux/types.h> +/* latest upcall version available */ #define CLD_UPCALL_VERSION 1@@ -37,18 +39,18 @@ enum cld_command {/* representation of long-form NFSv4 client ID */ struct cld_name { -uint16_t cn_len;/* length of cm_id */ +__u16 cn_len;/* length of cm_id */ unsigned char cn_id[NFS4_OPAQUE_LIMIT ];/* client-provided */ } __attribute__((packed));/* message struct for communication with userspace */ struct cld_msg { -uint8_t cm_vers;/* upcall version */ -uint8_t cm_cmd;/* upcall command */ -int16_t cm_status;/* return code */ -uint32_t cm_xid;/* transaction id */ +__u8 cm_vers;/* upcall version */ +__u8 cm_cmd;/* upcall command */ +__s16 cm_status;/* return code */ +__u32 cm_xid;/* transaction id */ union { -int64_t cm_gracetime;/* grace period start time */ +__s64 cm_gracetime;/* grace period start time */ struct cld_name cm_name; } __attribute__((packed)) cm_u; } __attribute__((packed));Signature · 1 line
ldvSignature · 1 line
ldv