[klibc] [PATCH] avoid name clash on nfs_fh in nfsmount

Erik van Konijnenburg ekonijn at xs4all.nl
Sun Jun 5 05:10:57 PDT 2005


Avoid a name clash in nfsmount on Fedora glibc.

The name nfs_fh is used in both kernel and in nfsmount
application, but one uses it to mean the argument to mount(2),
the other means the data as captured from the wire.

The package glibc-kernelheaders in Fedora makes the kernel
structure visible to user space, so conflict results
in compilation errors.  With klibc, the homonym is harmless
because its hidden by ifdef __KERNEL__.

Signed-off-by: Erik van Konijnenburg <ekonijn at xs4all.nl>

Index: klibc-1.0.14/nfsmount/mount.c
===================================================================
--- klibc-1.0.14.orig/nfsmount/mount.c	2005-06-04 15:15:10.000000000 +0200
+++ klibc-1.0.14/nfsmount/mount.c	2005-06-04 15:18:19.000000000 +0200
@@ -20,19 +20,30 @@
 	char path[0];
 };
 
-#define NFS_MAXFHSIZE 64
 
-struct nfs_fh
+/*
+ * The following structure is the NFS v3 on-the-wire file handle,
+ * as defined in rfc1813.
+ * This differs from the structure used by the kernel,
+ * defined in <linux/nfh3.h>: rfc has a long in network order,
+ * kernel has a short in native order.
+ * Both kernel and rfc use the name nfs_fh; kernel name is
+ * visible to user apps in some versions of libc.
+ * Use different name to avoid clashes.
+ */
+#define NFS_MAXFHSIZE_WIRE 64
+struct nfs_fh_wire
 {
 	__u32 size;
-	char data[NFS_MAXFHSIZE];
+	char data[NFS_MAXFHSIZE_WIRE];
 } __attribute__((packed));
 
+
 struct mount_reply
 {
 	struct rpc_reply reply;
 	__u32 status;
-	struct nfs_fh fh;
+	struct nfs_fh_wire fh;
 } __attribute__((packed));
 
 #define MNT_REPLY_MINSIZE (sizeof(struct rpc_reply) + sizeof(__u32))



More information about the klibc mailing list