diff options
author | Michael Brown <mcb30@ipxe.org> | 2010-09-04 23:29:00 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2010-09-05 02:49:06 +0100 |
commit | c04b6ccd75cc87b55b74bcc6a9798ad038b3e744 (patch) | |
tree | b69fbd1907b73be976086f3aa97326ecfa46574f /src/include/ipxe/tables.h | |
parent | a3021ad0e42275f0c0e6c5205746c69ab63b8dfd (diff) | |
download | ipxe-c04b6ccd75cc87b55b74bcc6a9798ad038b3e744.tar.gz |
[tables] Add for_each_table_entry_continue() and _continue_reverse()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/tables.h')
-rw-r--r-- | src/include/ipxe/tables.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/include/ipxe/tables.h b/src/include/ipxe/tables.h index 74d437537..583ba51b8 100644 --- a/src/include/ipxe/tables.h +++ b/src/include/ipxe/tables.h @@ -360,6 +360,35 @@ FILE_LICENCE ( GPL2_OR_LATER ); pointer++ ) /** + * Iterate through all remaining entries within a linker table + * + * @v pointer Entry pointer, preset to most recent entry + * @v table Linker table + * + * Example usage: + * + * @code + * + * #define FROBNICATORS __table ( struct frobnicator, "frobnicators" ) + * #define __frobnicator __table_entry ( FROBNICATORS, 01 ) + * + * struct frob my_frobnicator __frobnicator; + * struct frobnicator *frob; + * + * frob = &my_frobnicator; + * for_each_table_entry_continue ( frob, FROBNICATORS ) { + * ... + * } + * + * @endcode + * + */ +#define for_each_table_entry_continue( pointer, table ) \ + for ( pointer++ ; \ + pointer < table_end ( table ) ; \ + pointer++ ) + +/** * Iterate through all entries within a linker table in reverse order * * @v pointer Entry pointer @@ -385,6 +414,35 @@ FILE_LICENCE ( GPL2_OR_LATER ); pointer >= table_start ( table ) ; \ pointer-- ) +/** + * Iterate through all remaining entries within a linker table in reverse order + * + * @v pointer Entry pointer, preset to most recent entry + * @v table Linker table + * + * Example usage: + * + * @code + * + * #define FROBNICATORS __table ( struct frobnicator, "frobnicators" ) + * #define __frobnicator __table_entry ( FROBNICATORS, 01 ) + * + * struct frob my_frobnicator __frobnicator; + * struct frobnicator *frob; + * + * frob = &my_frobnicator; + * for_each_table_entry_continue_reverse ( frob, FROBNICATORS ) { + * ... + * } + * + * @endcode + * + */ +#define for_each_table_entry_continue_reverse( pointer, table ) \ + for ( pointer-- ; \ + pointer >= table_start ( table ) ; \ + pointer-- ) + /****************************************************************************** * * Intel's C compiler chokes on several of the constructs used in this |