Erik van Konijnenburg
2005-May-22 07:52 UTC
[klibc] [patch 11/12] Unpleasantness in linux/nfs_mount.h
There is a conflict in glibc between <linux/in.h> and <netinet/in.h>: one defines protocols with an enum, the other does the same, but adds a self-define for every enumerated value. #define IPPROTO_IP IPPROTO_IP This means the two cannot be mixed, and since loads of include files refer to <netinet/in.h>, effectively <linux/in.h> cannot be used with glibc. Since <linux/nfs_mount.h> uses <linux/in.h>, that also is off-limits for anything that wants to be compatible with glibc. This uses the same workaround used by util-linux: just copy the relevant declarations. Ugly, but it's not like people are going to change the NFS mount interface from under us without warning. Signed-off-by: Erik van Konijnenburg <ekonijn@xs4all.nl> Index: exec/nfsmount/main.c ==================================================================--- exec.orig/nfsmount/main.c 2005-05-21 13:10:26.000000000 +0200 +++ exec/nfsmount/main.c 2005-05-21 14:32:12.000000000 +0200 @@ -14,8 +14,6 @@ #include <sys/wait.h> #include <unistd.h> -#include <linux/nfs_mount.h> - #include "nfsmount.h" #include "sunrpc.h" #include "dummypmap.h" Index: exec/nfsmount/nfsmount.h ==================================================================--- exec.orig/nfsmount/nfsmount.h 2005-05-21 14:37:18.000000000 +0200 +++ exec/nfsmount/nfsmount.h 2005-05-21 14:38:15.000000000 +0200 @@ -1,8 +1,64 @@ /* * nfsmount/nfsmount.h + * + * We inline the contents of linux/nfs_mount.h, minus + * the include of linux/in.h, because of style conflicts + * between netinet/in.h and linux/in.h. + * Inlined stuff is Copyright (C) 1992 Rick Sladkey + */ + +#include <sys/types.h> +#include <linux/types.h> +#include <linux/nfs.h> +#include <linux/nfs2.h> +#include <linux/nfs3.h> + +/* + * WARNING! Do not delete or change the order of these fields. If + * a new field is required then add it to the end. The version field + * tracks which fields are present. This will ensure some measure of + * mount-to-kernel version compatibility. Some of these aren't used yet + * but here they are anyway. */ +#define NFS_MOUNT_VERSION 5 + +struct nfs_mount_data { + int version; /* 1 */ + int fd; /* 1 */ + struct nfs2_fh old_root; /* 1 */ + int flags; /* 1 */ + int rsize; /* 1 */ + int wsize; /* 1 */ + int timeo; /* 1 */ + int retrans; /* 1 */ + int acregmin; /* 1 */ + int acregmax; /* 1 */ + int acdirmin; /* 1 */ + int acdirmax; /* 1 */ + struct sockaddr_in addr; /* 1 */ + char hostname[256]; /* 1 */ + int namlen; /* 2 */ + unsigned int bsize; /* 3 */ + struct nfs3_fh root; /* 4 */ + int pseudoflavor; /* 5 */ +}; + +/* bits in the flags field */ -#include <linux/nfs_mount.h> +#define NFS_MOUNT_SOFT 0x0001 /* 1 */ +#define NFS_MOUNT_INTR 0x0002 /* 1 */ +#define NFS_MOUNT_SECURE 0x0004 /* 1 */ +#define NFS_MOUNT_POSIX 0x0008 /* 1 */ +#define NFS_MOUNT_NOCTO 0x0010 /* 1 */ +#define NFS_MOUNT_NOAC 0x0020 /* 1 */ +#define NFS_MOUNT_TCP 0x0040 /* 2 */ +#define NFS_MOUNT_VER3 0x0080 /* 3 */ +#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ +#define NFS_MOUNT_NONLM 0x0200 /* 3 */ +#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ +#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ +#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ +#define NFS_MOUNT_FLAGMASK 0xFFFF extern __u32 nfs_port; --
H. Peter Anvin
2005-May-24 22:46 UTC
[klibc] [patch 11/12] Unpleasantness in linux/nfs_mount.h
Erik van Konijnenburg wrote:> There is a conflict in glibc between <linux/in.h> and <netinet/in.h>: > one defines protocols with an enum, the other does the same, > but adds a self-define for every enumerated value. > #define IPPROTO_IP IPPROTO_IP > > This means the two cannot be mixed, and since loads of include files > refer to <netinet/in.h>, effectively <linux/in.h> cannot be used > with glibc. > > Since <linux/nfs_mount.h> uses <linux/in.h>, that also is off-limits > for anything that wants to be compatible with glibc. > > This uses the same workaround used by util-linux: just copy > the relevant declarations. Ugly, but it's not like people > are going to change the NFS mount interface from under us > without warning. > > > /* > * nfsmount/nfsmount.h > + * > + * We inline the contents of linux/nfs_mount.h, minus > + * the include of linux/in.h, because of style conflicts > + * between netinet/in.h and linux/in.h. > + * Inlined stuff is Copyright (C) 1992 Rick Sladkey > + */ > +What are the copyright terms for this file? -hpa
Reasonably Related Threads
- [patch 00/12] ipconfig and nfsmount compatibility with glibc
- [PATCH 1/3] nfsmount.h: Add missing definitions.
- [PATCH 2/3] nfsmount: s/PF_INET/AF_INET/
- [klibc:master] nfsmount: Fix wrong NFS umount path
- RESEND [PATCH][BUGFIX] Fix termination of the spoofing portmapper