Modifying The System Calls Dispatch Table (Cont.)
Finally, 'versioned_string' used earlier by our code could be implemented as a macro, such as this:
/* BEGINNING OF TRICKY PART */
/* DON'T mess with these - they are required to */
/* allow proper expansion of (possibly) versioned */
/* symbols into strings. */
/* this macro turns its argument into a quoted string */
/* (adding double quotation marks to its front and */
/* back. This is standard C. */
#define do_turn_into_versioned_string(x) #x
/* the reason for using this second macro, is so the C */
/* pre-processor would process the parameter (which is */
/* a kernel symbol name), and turn it into a versioned */
/* string, without quotes. This works since the kernel */
/* defines all its symbols as macros translating into */
/* versioned symbol names. */
#define versioned_string(x) do_turn_into_versioned_string(x)
/* END OF TRICKY PART */