[Ocfs2-commits] zab commits r1758 - in trunk: . cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed Jan 12 13:23:14 CST 2005


Author: zab
Date: 2005-01-12 13:23:12 -0600 (Wed, 12 Jan 2005)
New Revision: 1758

Modified:
   trunk/Config.make.in
   trunk/cluster/Makefile
   trunk/cluster/dlm_compat.h
   trunk/cluster/tcp.c
   trunk/configure.in
Log:
o late 2.6 doesn't export sock_create.  switch the code to sock_create_lite and
  provide a compat inline based on sock_alloc() if it isn't available.


Modified: trunk/Config.make.in
===================================================================
--- trunk/Config.make.in	2005-01-12 18:44:13 UTC (rev 1757)
+++ trunk/Config.make.in	2005-01-12 19:23:12 UTC (rev 1758)
@@ -55,6 +55,7 @@
 endif
 
 HAVE_NPTL = @HAVE_NPTL@
+HAVE_SOCK_CREATE_LITE = @HAVE_SOCK_CREATE_LITE@
 
 COMPAT_SAFE_WRITE = @COMPAT_SAFE_WRITE@
 

Modified: trunk/cluster/Makefile
===================================================================
--- trunk/cluster/Makefile	2005-01-12 18:44:13 UTC (rev 1757)
+++ trunk/cluster/Makefile	2005-01-12 19:23:12 UTC (rev 1758)
@@ -33,6 +33,10 @@
 GLOBAL_DEFINES += -DHAVE_NPTL
 endif
 
+ifdef HAVE_SOCK_CREATE_LITE
+GLOBAL_DEFINES += -DHAVE_SOCK_CREATE_LITE
+endif
+
 CFILES = \
 	compat_libfs.c	\
 	dlmmaster.c	\

Modified: trunk/cluster/dlm_compat.h
===================================================================
--- trunk/cluster/dlm_compat.h	2005-01-12 18:44:13 UTC (rev 1757)
+++ trunk/cluster/dlm_compat.h	2005-01-12 19:23:12 UTC (rev 1758)
@@ -168,5 +168,22 @@
 
 #endif  /* LINUX_VERSION_CODE */
 
+#ifndef HAVE_SOCK_CREATE_LITE
+static inline int sock_create_lite(int family, int type, int protocol,
+				   struct socket **res)
+{
+	struct socket *sock = sock_alloc();
+	int ret = 0;
+
+	if (sock == NULL)
+		ret = -ENOMEM;
+
+	*res = sock;
+
+	return ret;
+}
+#endif /* HAVE_SOCK_CREATE_LITE */
+
+
 #endif  /* CLUSTER_DLM_COMPAT_H */
 

Modified: trunk/cluster/tcp.c
===================================================================
--- trunk/cluster/tcp.c	2005-01-12 18:44:13 UTC (rev 1757)
+++ trunk/cluster/tcp.c	2005-01-12 19:23:12 UTC (rev 1758)
@@ -98,6 +98,9 @@
 #define sk_state		state
 #define sk_receive_queue	receive_queue
 #define sk_reuse		reuse
+#define sk_family		family
+#define sk_type			type
+#define sk_protocol		protocol
 #endif
 
 struct socket *recv_sock = NULL;
@@ -1380,8 +1383,11 @@
 	}
 	error = 0;
 	while (error >= 0) {
-		sock = sock_alloc();
-		if (!sock)
+		error = sock_create_lite(recv_sock->sk->sk_family,
+					 recv_sock->sk->sk_type,
+					 recv_sock->sk->sk_protocol,
+					 &sock);
+		if (error)
 			break;
 
 		sock->type = recv_sock->type;

Modified: trunk/configure.in
===================================================================
--- trunk/configure.in	2005-01-12 18:44:13 UTC (rev 1757)
+++ trunk/configure.in	2005-01-12 19:23:12 UTC (rev 1758)
@@ -312,6 +312,15 @@
 CPPFLAGS="$saved_CPPFLAGS"
 CFLAGS="$saved_CFLAGS"
 
+AC_MSG_CHECKING([for sock_create_lite])
+if grep -q "\<sock_create_lite(" "$KERNELINC/linux/net.h" ; then
+  HAVE_SOCK_CREATE_LITE=yes
+  AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+fi
+AC_SUBST(HAVE_SOCK_CREATE_LITE)
+
 AC_MSG_CHECKING(for directory for kernel modules)
 AC_ARG_WITH(moddir, [  --with-moddir=/path     Path to where modules should be installed [[/lib/modules/<KVER>/fs]]], moddir="$withval", moddir="/lib/modules/$kversion/kernel/fs")
 AC_MSG_RESULT($moddir)



More information about the Ocfs2-commits mailing list