Re: [ 052/153] idr: idr_for_each_entry() macro
On Mon, 2013-03-04 at 22:05 +0100, Philipp Reisner wrote: > Sure, here it is: > -- > > From: Philipp Reisner > > commit 9749f30f1a387070e6e8351f35aeb829eacc3ab6 upstream. > > Inspired by the list_for_each_entry() macro > > Signed-off-by: Ben Hutchings > Signed-off-by: Philipp Reisner Thanks. Ben. > --- > include/linux/idr.h | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/include/linux/idr.h b/include/linux/idr.h > index 255491c..52a9da2 100644 > --- a/include/linux/idr.h > +++ b/include/linux/idr.h > @@ -152,4 +152,15 @@ void ida_simple_remove(struct ida *ida, unsigned int id); > > void __init idr_init_cache(void); > > +/** > + * idr_for_each_entry - iterate over an idr's elements of a given type > + * @idp: idr handle > + * @entry: the type * to use as cursor > + * @id: id entry's key > + */ > +#define idr_for_each_entry(idp, entry, id) \ > + for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \ > +entry != NULL; \ > +++id, entry = (typeof(entry))idr_get_next((idp), &(id))) > + > #endif /* __IDR_H__ */ > > -- Ben Hutchings Always try to do things in chronological order; it's less confusing that way. signature.asc Description: This is a digitally signed message part
Re: [ 052/153] idr: idr_for_each_entry() macro
Sure, here it is: -- From: Philipp Reisner commit 9749f30f1a387070e6e8351f35aeb829eacc3ab6 upstream. Inspired by the list_for_each_entry() macro Signed-off-by: Ben Hutchings Signed-off-by: Philipp Reisner --- include/linux/idr.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/include/linux/idr.h b/include/linux/idr.h index 255491c..52a9da2 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h @@ -152,4 +152,15 @@ void ida_simple_remove(struct ida *ida, unsigned int id); void __init idr_init_cache(void); +/** + * idr_for_each_entry - iterate over an idr's elements of a given type + * @idp: idr handle + * @entry: the type * to use as cursor + * @id: id entry's key + */ +#define idr_for_each_entry(idp, entry, id) \ + for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \ +entry != NULL; \ +++id, entry = (typeof(entry))idr_get_next((idp), &(id))) + #endif /* __IDR_H__ */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [ 052/153] idr: idr_for_each_entry() macro
Sure, here it is: -- From: Philipp Reisner philipp.reis...@linbit.com commit 9749f30f1a387070e6e8351f35aeb829eacc3ab6 upstream. Inspired by the list_for_each_entry() macro Signed-off-by: Ben Hutchings b...@decadent.org.uk Signed-off-by: Philipp Reisner philipp.reis...@linbit.com --- include/linux/idr.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/include/linux/idr.h b/include/linux/idr.h index 255491c..52a9da2 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h @@ -152,4 +152,15 @@ void ida_simple_remove(struct ida *ida, unsigned int id); void __init idr_init_cache(void); +/** + * idr_for_each_entry - iterate over an idr's elements of a given type + * @idp: idr handle + * @entry: the type * to use as cursor + * @id: id entry's key + */ +#define idr_for_each_entry(idp, entry, id) \ + for (id = 0, entry = (typeof(entry))idr_get_next((idp), (id)); \ +entry != NULL; \ +++id, entry = (typeof(entry))idr_get_next((idp), (id))) + #endif /* __IDR_H__ */ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [ 052/153] idr: idr_for_each_entry() macro
On Mon, 2013-03-04 at 22:05 +0100, Philipp Reisner wrote: Sure, here it is: -- From: Philipp Reisner philipp.reis...@linbit.com commit 9749f30f1a387070e6e8351f35aeb829eacc3ab6 upstream. Inspired by the list_for_each_entry() macro Signed-off-by: Ben Hutchings b...@decadent.org.uk Signed-off-by: Philipp Reisner philipp.reis...@linbit.com Thanks. Ben. --- include/linux/idr.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/include/linux/idr.h b/include/linux/idr.h index 255491c..52a9da2 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h @@ -152,4 +152,15 @@ void ida_simple_remove(struct ida *ida, unsigned int id); void __init idr_init_cache(void); +/** + * idr_for_each_entry - iterate over an idr's elements of a given type + * @idp: idr handle + * @entry: the type * to use as cursor + * @id: id entry's key + */ +#define idr_for_each_entry(idp, entry, id) \ + for (id = 0, entry = (typeof(entry))idr_get_next((idp), (id)); \ +entry != NULL; \ +++id, entry = (typeof(entry))idr_get_next((idp), (id))) + #endif /* __IDR_H__ */ -- Ben Hutchings Always try to do things in chronological order; it's less confusing that way. signature.asc Description: This is a digitally signed message part
Re: [ 052/153] idr: idr_for_each_entry() macro
On Mon, 2013-03-04 at 03:37 +, Ben Hutchings wrote: > 3.2-stable review patch. If anyone has any objections, please let me know. > > -- > > From: Philipp Reisner > > commit 9749f30f1a387070e6e8351f35aeb829eacc3ab6 upstream. > > Inspired by the list_for_each_entry() macro > > Signed-off-by: Ben Hutchings Philipp, please can I have an explicit Signed-off-by from you? It was missing in mainline though this change appeared in a long series of drbd changes with proper Signed-off-by lines. Ben. > --- > include/linux/idr.h | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/include/linux/idr.h b/include/linux/idr.h > index 255491c..52a9da2 100644 > --- a/include/linux/idr.h > +++ b/include/linux/idr.h > @@ -152,4 +152,15 @@ void ida_simple_remove(struct ida *ida, unsigned int id); > > void __init idr_init_cache(void); > > +/** > + * idr_for_each_entry - iterate over an idr's elements of a given type > + * @idp: idr handle > + * @entry: the type * to use as cursor > + * @id: id entry's key > + */ > +#define idr_for_each_entry(idp, entry, id) \ > + for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \ > + entry != NULL; \ > + ++id, entry = (typeof(entry))idr_get_next((idp), &(id))) > + > #endif /* __IDR_H__ */ > > > -- > To unsubscribe from this list: send the line "unsubscribe stable" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- Ben Hutchings Always try to do things in chronological order; it's less confusing that way. signature.asc Description: This is a digitally signed message part
[ 052/153] idr: idr_for_each_entry() macro
3.2-stable review patch. If anyone has any objections, please let me know. -- From: Philipp Reisner commit 9749f30f1a387070e6e8351f35aeb829eacc3ab6 upstream. Inspired by the list_for_each_entry() macro Signed-off-by: Ben Hutchings --- include/linux/idr.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/include/linux/idr.h b/include/linux/idr.h index 255491c..52a9da2 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h @@ -152,4 +152,15 @@ void ida_simple_remove(struct ida *ida, unsigned int id); void __init idr_init_cache(void); +/** + * idr_for_each_entry - iterate over an idr's elements of a given type + * @idp: idr handle + * @entry: the type * to use as cursor + * @id: id entry's key + */ +#define idr_for_each_entry(idp, entry, id) \ + for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \ +entry != NULL; \ +++id, entry = (typeof(entry))idr_get_next((idp), &(id))) + #endif /* __IDR_H__ */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[ 052/153] idr: idr_for_each_entry() macro
3.2-stable review patch. If anyone has any objections, please let me know. -- From: Philipp Reisner philipp.reis...@linbit.com commit 9749f30f1a387070e6e8351f35aeb829eacc3ab6 upstream. Inspired by the list_for_each_entry() macro Signed-off-by: Ben Hutchings b...@decadent.org.uk --- include/linux/idr.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/include/linux/idr.h b/include/linux/idr.h index 255491c..52a9da2 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h @@ -152,4 +152,15 @@ void ida_simple_remove(struct ida *ida, unsigned int id); void __init idr_init_cache(void); +/** + * idr_for_each_entry - iterate over an idr's elements of a given type + * @idp: idr handle + * @entry: the type * to use as cursor + * @id: id entry's key + */ +#define idr_for_each_entry(idp, entry, id) \ + for (id = 0, entry = (typeof(entry))idr_get_next((idp), (id)); \ +entry != NULL; \ +++id, entry = (typeof(entry))idr_get_next((idp), (id))) + #endif /* __IDR_H__ */ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [ 052/153] idr: idr_for_each_entry() macro
On Mon, 2013-03-04 at 03:37 +, Ben Hutchings wrote: 3.2-stable review patch. If anyone has any objections, please let me know. -- From: Philipp Reisner philipp.reis...@linbit.com commit 9749f30f1a387070e6e8351f35aeb829eacc3ab6 upstream. Inspired by the list_for_each_entry() macro Signed-off-by: Ben Hutchings b...@decadent.org.uk Philipp, please can I have an explicit Signed-off-by from you? It was missing in mainline though this change appeared in a long series of drbd changes with proper Signed-off-by lines. Ben. --- include/linux/idr.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/include/linux/idr.h b/include/linux/idr.h index 255491c..52a9da2 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h @@ -152,4 +152,15 @@ void ida_simple_remove(struct ida *ida, unsigned int id); void __init idr_init_cache(void); +/** + * idr_for_each_entry - iterate over an idr's elements of a given type + * @idp: idr handle + * @entry: the type * to use as cursor + * @id: id entry's key + */ +#define idr_for_each_entry(idp, entry, id) \ + for (id = 0, entry = (typeof(entry))idr_get_next((idp), (id)); \ + entry != NULL; \ + ++id, entry = (typeof(entry))idr_get_next((idp), (id))) + #endif /* __IDR_H__ */ -- To unsubscribe from this list: send the line unsubscribe stable in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- Ben Hutchings Always try to do things in chronological order; it's less confusing that way. signature.asc Description: This is a digitally signed message part