From 48ed74e6e3b687bbcd078cf48b8f64f7d6357fb2 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 30 Jul 2009 00:30:09 +0000 Subject: [PATCH] b=19856 add configure check for single param to nlmsg_new (sles10) --- libcfs/libcfs/linux/linux-kernelcomm.c | 5 +++++ lustre/autoconf/lustre-core.m4 | 30 ++++++++++++++++++++++++++++++ lustre/tests/copytool.c | 8 ++++---- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/libcfs/libcfs/linux/linux-kernelcomm.c b/libcfs/libcfs/linux/linux-kernelcomm.c index b7e1d49..cb5457f 100644 --- a/libcfs/libcfs/linux/linux-kernelcomm.c +++ b/libcfs/libcfs/linux/linux-kernelcomm.c @@ -144,7 +144,12 @@ static struct sk_buff *netlink_make_msg(int pid, int seq, void *payload, int len = NLMSG_SPACE(size); void *data; +#ifdef HAVE_NETLINK_NL2 skb = nlmsg_new(len, GFP_KERNEL); +#else /* old */ + skb = nlmsg_new(len); +#endif + if (!skb) return NULL; diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 7f634ec..583c6c5 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1636,6 +1636,7 @@ AC_DEFUN([LC_PROG_LINUX], LC_PERCPU_COUNTER LC_QUOTA64 LC_4ARGS_VFS_SYMLINK + LC_NETLINK # does the kernel have VFS intent patches? LC_VFS_INTENT_PATCHES @@ -2013,6 +2014,35 @@ LB_LINUX_TRY_COMPILE([ ]) # +# LC_NETLINK +# +# If we have netlink.h, and nlmsg_new takes 2 args +# +AC_DEFUN([LC_NETLINK], +[AC_MSG_CHECKING([if netlink.h can be compiled]) +LB_LINUX_TRY_COMPILE([ + #include +],[],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_NETLINK, 1, [net/netlink.h found]) + + AC_MSG_CHECKING([if nlmsg_new takes a 2nd argument]) + LB_LINUX_TRY_COMPILE([ + #include + ],[ + nlmsg_new(100, GFP_KERNEL); + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_NETLINK_NL2, 1, [nlmsg_new takes 2 args]) + ],[ + AC_MSG_RESULT([no]) + ]) +],[ + AC_MSG_RESULT([no]) +]) +]) + +# # LC_CONFIGURE # # other configure checks diff --git a/lustre/tests/copytool.c b/lustre/tests/copytool.c index c862426..a6d72d3 100644 --- a/lustre/tests/copytool.c +++ b/lustre/tests/copytool.c @@ -71,7 +71,7 @@ int main(int argc, char **argv) { default: fprintf(stderr, "error: %s: option '%s' unrecognized\n", argv[0], argv[optind - 1]); - return -EINVAL; + return EINVAL; } } @@ -80,11 +80,11 @@ int main(int argc, char **argv) { if (rc < 0) { fprintf(stderr, "Can't start copytool interface: %s\n", strerror(-rc)); - return rc; + return -rc; } if (test) - return llapi_copytool_fini(&ctdata); + return -llapi_copytool_fini(&ctdata); printf("Waiting for message from kernel (pid=%d)\n", getpid()); @@ -123,7 +123,7 @@ int main(int argc, char **argv) { llapi_copytool_fini(&ctdata); - return 0; + return -rc; } -- 1.8.3.1