Skip to contentSkip to conversation

backport: small copy&paste error fixed

PATCH In review Arend van Spriel 3 participants 6 messages Jan 30, 2015 – Feb 22, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 backport: small copy&paste error fixed

Changed the version number in the file header comment.

---
 backport/compat/backport-3.19.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
backport/compat/backport-3.19.c +1 -1
index c633f38..0b59bef 100644
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2014  Hauke Mehrtens <[email protected]>
  *
- * Backport functionality introduced in Linux 3.18.
+ * Backport functionality introduced in Linux 3.19.
  *
  * 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
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/2 backport: add backport file for the next kernel release

In mac80211-next a call to get_net_ns_by_fd() has been added in cfg80211 which resides in networking core. This function has been backported such that it will always fail, ie. as it would when CONFIG_NET_NS is not defined. The call was added by:

commit 4b681c82d2f9bef121c912ffcaac89a004af3f2c
Author: Vadim Kochan <[email protected]>
Date: Mon Jan 12 16:34:05 2015 +0200

nl80211: Allow set network namespace by fd

---
 backport/compat/Makefile        |  1 +
 backport/compat/backport-3.20.c | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 backport/compat/backport-3.20.c
backport/compat/Makefile +1 -0
index 3d905ed..b6f1d12 100644
@@ -25,6 +25,7 @@ compat-$(CPTCFG_KERNEL_3_15) += backport-3.15.o
 compat-$(CPTCFG_KERNEL_3_17) += backport-3.17.o
 compat-$(CPTCFG_KERNEL_3_18) += backport-3.18.o
 compat-$(CPTCFG_KERNEL_3_19) += backport-3.19.o
+compat-$(CPTCFG_KERNEL_3_20) += backport-3.20.o
 
 compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
 compat-$(CPTCFG_BPAUTO_BUILD_DMA_SHARED_HELPERS) += dma-shared-helpers.o
backport/compat/backport-3.20.c new file +17 -0
new file mode 100644
index 0000000..ce119fd
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2014  Hauke Mehrtens <[email protected]>
+ *
+ * Backport functionality introduced in Linux 3.19.
+ *
+ * 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);
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 2/2] backport: add backport file for the next kernel release

backport/compat/backport-3.20.c line 2

Quoted 5 lines · Arend van Spriel
backport/compat/backport-3.20.c new file +2 -0
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2014  Hauke Mehrtens <[email protected]>

Speaking of copy/paste errors ... :)

Quoted 4 lines
backport/compat/backport-3.20.c new file +4 -0
+ * Backport functionality introduced in Linux 3.19.
+ *
+ * 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

backport/compat/backport-3.20.c line 17

Quoted 10 lines
backport/compat/backport-3.20.c new file +10 -0
+ * 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);
}

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?

Anyway as long as this was there on 3.0 already both approaches work, of course.

johannes

#3 lore raw

Re: [PATCH 2/2] backport: add backport file for the next kernel release

Quoted 9 lines · Johannes Berg

backport/compat/backport-3.20.c line 2

Quoted 5 lines · Arend van Spriel
backport/compat/backport-3.20.c new file +2 -0
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2014  Hauke Mehrtens<[email protected]>

Speaking of copy/paste errors ... :)

Hah! :-D Will fix that and the year.

Quoted 1 line

backport/compat/backport-3.20.c line 4

Quoted 1 line
backport/compat/backport-3.20.c new file +1 -0
+ * Backport functionality introduced in Linux 3.19.

And this one.

Quoted 18 lines

backport/compat/backport-3.20.c line 17

Quoted 13 lines
backport/compat/backport-3.20.c new file +13 -0
+ *
+ * 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?

Quoted 8 lines

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.

Quoted 3 lines

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

Quoted 2 lines

Anyway as long as this was there on 3.0 already both approaches work, of course.

#4 lore raw
In reply to Arend van Spriel
Quoted 13 lines · Arend van Spriel

Changed the version number in the file header comment.

---
 backport/compat/backport-3.19.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
backport/compat/backport-3.19.c +0 -0
index c633f38..0b59bef 100644

backport/compat/backport-3.19.c line 7

Quoted 8 lines
backport/compat/backport-3.19.c +1 -1
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2014  Hauke Mehrtens <[email protected]>
  *
- * Backport functionality introduced in Linux 3.18.
+ * Backport functionality introduced in Linux 3.19.
  *
  * 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

Thank you for the patch, it was applied to backports, somehow I missed the second one I will take care of it later.

Hauke

#5 lore raw
Quoted 17 lines · Hauke Mehrtens
Quoted 16 lines · Arend van Spriel

Changed the version number in the file header comment.

---
  backport/compat/backport-3.19.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
backport/compat/backport-3.19.c +0 -1
index c633f38..0b59bef 100644
@@ -1,7 +1,7 @@
  /*
   * Copyright (c) 2014  Hauke Mehrtens<[email protected]>
   *
- * Backport functionality introduced in Linux 3.18.
Quoted 8 lines

backport/compat/backport-3.19.c line 7

Quoted 5 lines
backport/compat/backport-3.19.c +1 -0
+ * Backport functionality introduced in Linux 3.19.
   *
   * 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

Thank you for the patch, it was applied to backports, somehow I missed the second one I will take care of it later.

I think I cause confusion renaming the patch subject to "backport: add backport for get_net_ns_by_fd()" [1].

Regards,
Arend

[1] http://mid.gmane.org/[email protected]