[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 04/14] tables.h: add linker table support
On Wed, 2016-12-21 at 18:38 -0800, Luis R. Rodriguez wrote: > A linker table is a data structure that is stitched together from > items > in multiple object files. Linux has historically implicitly used > linker > tables for ages, however they were all built in an adhoc manner which > requires linker script modifications, per architecture. This adds a > general linker table solution so that a new linker table can be > implemented by changing C code only. The Linux linker table was > inspired by Michael Brown's iPXE's linker table solution, it has been > been completely re-written and adapted for integration and use on > Linux. > +/** > + * LINKTABLE_FOR_EACH - iterate through all entries within a linker > table > + * > + * @pointer: entry pointer > + * @tbl: linker table > + * > + * Example usage:: > + * > + * struct frobnicator *frob; > + * > + * LINKTABLE_FOR_EACH(frob, frobnicator_fns) { > + * ... > + * } > + */ > + > +#define LINKTABLE_FOR_EACH(pointer, tbl) > \ Hmm... SOMEONE LIKES CAPITAL LETTERS FOR everything, right? :-) I would expect more standard linktable_for_each() macro Same to the rest of similar macros. > +/** > + * LINKTABLE_RUN_ERR - run each linker table entry func and return > error if any > + * > + * @tbl: linker table > + * @func: structure name for the function name we want to call. > + * @args...: arguments to pass to func > + * > + * Example usage:: > + * > + * unsigned int err = LINKTABLE_RUN_ERR(frobnicator_fns, > some_run,); > + */ > +#define LINKTABLE_RUN_ERR(tbl, func, args...) > \ > +({ > \ > + size_t i; > \ > + int err = 0; > \ > + for (i = 0; !err && i < LINKTABLE_SIZE(tbl); i++) > \ > + err = (LINKTABLE_START(tbl)[i]).func (args); > \ > + err; Indentation here a bit confusing. > \ > +}) -- Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Intel Finland Oy _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |