On 01/30/15 21:21, Johannes Berg wrote:
On Fri, 2015-01-30 at 21:12 +0100, Arend van Spriel wrote:
--- /dev/null
+++ b/backport/compat/backport-3.20.c
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2014 Hauke Mehrtens<hauke@xxxxxxxxxx>
Speaking of copy/paste errors ... :)
Hah! :-D Will fix that and the year.
+ * Backport functionality introduced in Linux 3.19.
And this one.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include<linux/export.h>
+#include<linux/net.h>
+
+struct net *get_net_ns_by_fd(int fd)
+{
+ return ERR_PTR(-EINVAL);
+}
+EXPORT_SYMBOL_GPL(get_net_ns_by_fd);
Interesting approach - you're relying on a previously existing
definition in some existing header file I guess? But does it always
exist?
I think it'd probably be better to have this in
backports-include/net/net_namespace.h, like so:
#define get_net_ns_by_fd LINUX_BACKPORT(get_net_ns_by_fd)
static inline struct net *get_net_ns_by_fd(int fd)
{
return ERR_PTR(-EINVAL);
}
This was indeed the trick that I was looking for.
because that not only saves the huge EXPORT_SYMBOL thing (that's like a
few hundred bytes IIRC!) but also makes sure that the definition is
always really there?
Is that a question? Guess not. I will make a V2.
Regards,
Arend
Anyway as long as this was there on 3.0 already both approaches work, of
course.
--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html