[tip/core/rcu,05/28] rcu: Move rcu_head definition to types.h

Message ID 1307561407-13809-5-git-send-email-paulmck@linux.vnet.ibm.com
State New
Headers show

Commit Message

Paul E. McKenney June 8, 2011, 7:29 p.m.
Take a first step towards untangling Linux kernel header files by
placing the struct rcu_head definition into include/linux/types.h.
Once this is in place, then header files that need only rcu_head
can include types.h rather than rcupdate.h.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 include/linux/rcupdate.h |   10 +---------
 include/linux/types.h    |   10 ++++++++++
 2 files changed, 11 insertions(+), 9 deletions(-)

Comments

Paul E. McKenney June 9, 2011, 12:02 a.m. | #1
On Wed, Jun 08, 2011 at 07:26:21PM -0400, Mathieu Desnoyers wrote:
> * Paul E. McKenney (paulmck@linux.vnet.ibm.com) wrote:
> > Take a first step towards untangling Linux kernel header files by
> > placing the struct rcu_head definition into include/linux/types.h.
> > Once this is in place, then header files that need only rcu_head
> > can include types.h rather than rcupdate.h.
> > 
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> 
> Yes! I'm suddenly feeling the temperature drop by a few degrees in
> #include hell ;) One detail though: I think rcupdate.h should then
> include types.h.

Glad you like it!

But please see below.

> Thanks,
> 
> Mathieu
> 
> 
> > ---
> >  include/linux/rcupdate.h |   10 +---------
> >  include/linux/types.h    |   10 ++++++++++
> >  2 files changed, 11 insertions(+), 9 deletions(-)
> > 
> > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> > index 8be0433..ad09eb8 100644
> > --- a/include/linux/rcupdate.h
> > +++ b/include/linux/rcupdate.h
> > @@ -64,15 +64,7 @@ static inline void rcutorture_record_progress(unsigned long vernum)
> >  #define ULONG_CMP_GE(a, b)	(ULONG_MAX / 2 >= (a) - (b))
> >  #define ULONG_CMP_LT(a, b)	(ULONG_MAX / 2 < (a) - (b))
> >  
> > -/**
> > - * struct rcu_head - callback structure for use with RCU
> > - * @next: next update requests in a list
> > - * @func: actual update function to call after the grace period.
> > - */
> > -struct rcu_head {
> > -	struct rcu_head *next;
> > -	void (*func)(struct rcu_head *head);
> > -};
> > +#include <linux/types.h>

And here you go!

> >  
> >  /* Exported common interfaces */
> >  extern void call_rcu_sched(struct rcu_head *head,
> > diff --git a/include/linux/types.h b/include/linux/types.h
> > index 176da8c..57a9723 100644
> > --- a/include/linux/types.h
> > +++ b/include/linux/types.h
> > @@ -238,6 +238,16 @@ struct ustat {
> >  	char			f_fpack[6];
> >  };
> >  
> > +/**
> > + * struct rcu_head - callback structure for use with RCU
> > + * @next: next update requests in a list
> > + * @func: actual update function to call after the grace period.
> > + */
> > +struct rcu_head {
> > +	struct rcu_head *next;
> > +	void (*func)(struct rcu_head *head);
> > +};
> > +
> >  #endif	/* __KERNEL__ */
> >  #endif /*  __ASSEMBLY__ */
> >  #endif /* _LINUX_TYPES_H */
> > -- 
> > 1.7.3.2
> > 
> 
> -- 
> Mathieu Desnoyers
> Operating System Efficiency R&D Consultant
> EfficiOS Inc.
> http://www.efficios.com

Patch

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 8be0433..ad09eb8 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -64,15 +64,7 @@  static inline void rcutorture_record_progress(unsigned long vernum)
 #define ULONG_CMP_GE(a, b)	(ULONG_MAX / 2 >= (a) - (b))
 #define ULONG_CMP_LT(a, b)	(ULONG_MAX / 2 < (a) - (b))
 
-/**
- * struct rcu_head - callback structure for use with RCU
- * @next: next update requests in a list
- * @func: actual update function to call after the grace period.
- */
-struct rcu_head {
-	struct rcu_head *next;
-	void (*func)(struct rcu_head *head);
-};
+#include <linux/types.h>
 
 /* Exported common interfaces */
 extern void call_rcu_sched(struct rcu_head *head,
diff --git a/include/linux/types.h b/include/linux/types.h
index 176da8c..57a9723 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -238,6 +238,16 @@  struct ustat {
 	char			f_fpack[6];
 };
 
+/**
+ * struct rcu_head - callback structure for use with RCU
+ * @next: next update requests in a list
+ * @func: actual update function to call after the grace period.
+ */
+struct rcu_head {
+	struct rcu_head *next;
+	void (*func)(struct rcu_head *head);
+};
+
 #endif	/* __KERNEL__ */
 #endif /*  __ASSEMBLY__ */
 #endif /* _LINUX_TYPES_H */