* [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Don't include bat_sysfs.h in compat.h
@ 2011-05-07 19:48 Sven Eckelmann
2011-05-07 19:48 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Remove unused variable r in bat_printk Sven Eckelmann
2011-05-08 12:36 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Don't include bat_sysfs.h in compat.h Marek Lindner
0 siblings, 2 replies; 4+ messages in thread
From: Sven Eckelmann @ 2011-05-07 19:48 UTC (permalink / raw)
To: b.a.t.m.a.n
bat_sysfs.h is included in compat.h to provide bat_attribute which is
used in bat_wrapper_show and bat_wrapper_store. This could create a
include loop which prevents that functions or datastructures defined
elsewhere cannot be found in bat_sysfs.h when batman-adv gets compiled
as external module, but are available when it is used as in-kernel
module.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
compat.c | 29 +++++++++++++++++++++++++++++
compat.h | 26 ++++----------------------
2 files changed, 33 insertions(+), 22 deletions(-)
diff --git a/compat.c b/compat.c
index f4561c3..34b27a1 100644
--- a/compat.c
+++ b/compat.c
@@ -1,4 +1,33 @@
#include <linux/version.h>
+#include "main.h"
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
+
+#include "bat_sysfs.h" /* struct bat_attribute */
+
+ssize_t bat_wrapper_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
+{
+ struct bat_attribute *bat_attr = to_battr(attr);
+
+ if (bat_attr->show)
+ return bat_attr->show(kobj, attr, buf);
+
+ return -EIO;
+}
+
+ssize_t bat_wrapper_store(struct kobject *kobj, struct attribute *attr,
+ const char *buf, size_t count)
+{
+ struct bat_attribute *bat_attr = to_battr(attr);
+
+ if (bat_attr->store)
+ return bat_attr->store(kobj, attr, (char *)buf, count);
+
+ return -EIO;
+}
+
+#endif /* < KERNEL_VERSION(2, 6, 25) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
diff --git a/compat.h b/compat.h
index c3fd2cd..fb49f9d 100644
--- a/compat.h
+++ b/compat.h
@@ -26,7 +26,6 @@
#define _NET_BATMAN_ADV_COMPAT_H_
#include <linux/version.h> /* LINUX_VERSION_CODE */
-#include "bat_sysfs.h" /* struct bat_attribute */
#ifndef IPPROTO_UDP
#define IPPROTO_UDP 17
@@ -107,28 +106,11 @@ static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom)
#define to_battr(a) container_of(a, struct bat_attribute, attr)
-static inline ssize_t bat_wrapper_show(struct kobject *kobj,
- struct attribute *attr, char *buf)
-{
- struct bat_attribute *bat_attr = to_battr(attr);
+ssize_t bat_wrapper_show(struct kobject *kobj, struct attribute *attr,
+ char *buf);
- if (bat_attr->show)
- return bat_attr->show(kobj, attr, buf);
-
- return -EIO;
-}
-
-static inline ssize_t bat_wrapper_store(struct kobject *kobj,
- struct attribute *attr,
- const char *buf, size_t count)
-{
- struct bat_attribute *bat_attr = to_battr(attr);
-
- if (bat_attr->store)
- return bat_attr->store(kobj, attr, (char *)buf, count);
-
- return -EIO;
-}
+ssize_t bat_wrapper_store(struct kobject *kobj, struct attribute *attr,
+ const char *buf, size_t count);
static struct sysfs_ops bat_wrapper_ops = {
.show = bat_wrapper_show,
--
1.7.5.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Remove unused variable r in bat_printk
2011-05-07 19:48 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Don't include bat_sysfs.h in compat.h Sven Eckelmann
@ 2011-05-07 19:48 ` Sven Eckelmann
2011-05-08 12:37 ` Marek Lindner
2011-05-08 12:36 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Don't include bat_sysfs.h in compat.h Marek Lindner
1 sibling, 1 reply; 4+ messages in thread
From: Sven Eckelmann @ 2011-05-07 19:48 UTC (permalink / raw)
To: b.a.t.m.a.n
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
compat.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/compat.c b/compat.c
index 34b27a1..70de376 100644
--- a/compat.c
+++ b/compat.c
@@ -909,11 +909,10 @@ int bat_vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
asmlinkage int bat_printk(const char *fmt, ...)
{
va_list args;
- int r;
char buf[256];
va_start(args, fmt);
- r = bat_vsnprintf(buf, sizeof(buf), fmt, args);
+ bat_vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
return printk("%s", buf);
--
1.7.5.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Don't include bat_sysfs.h in compat.h
2011-05-07 19:48 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Don't include bat_sysfs.h in compat.h Sven Eckelmann
2011-05-07 19:48 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Remove unused variable r in bat_printk Sven Eckelmann
@ 2011-05-08 12:36 ` Marek Lindner
1 sibling, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2011-05-08 12:36 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Saturday 07 May 2011 21:48:03 Sven Eckelmann wrote:
> bat_sysfs.h is included in compat.h to provide bat_attribute which is
> used in bat_wrapper_show and bat_wrapper_store. This could create a
> include loop which prevents that functions or datastructures defined
> elsewhere cannot be found in bat_sysfs.h when batman-adv gets compiled
> as external module, but are available when it is used as in-kernel
> module.
Applied in revision 741fb5d.
Thanks,
Marek
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Remove unused variable r in bat_printk
2011-05-07 19:48 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Remove unused variable r in bat_printk Sven Eckelmann
@ 2011-05-08 12:37 ` Marek Lindner
0 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2011-05-08 12:37 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Saturday 07 May 2011 21:48:04 Sven Eckelmann wrote:
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Applied in revision 7b1ce30.
Thanks,
Marek
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-05-08 12:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-07 19:48 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Don't include bat_sysfs.h in compat.h Sven Eckelmann
2011-05-07 19:48 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Remove unused variable r in bat_printk Sven Eckelmann
2011-05-08 12:37 ` Marek Lindner
2011-05-08 12:36 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Don't include bat_sysfs.h in compat.h Marek Lindner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.