On Thu, 2016-02-11 at 10:47 +0200, Dmitry Kasatkin wrote: > On Thu, Feb 11, 2016 at 4:08 AM, Mimi Zohar <zohar at linux.vnet.ibm.com> wrote: > static int idmap[] = { > [READING_FIRMWARE] = FIRMWARE_CHECK, > [READING_MODULE] = MODULE_CHECK, > ... > }; That works nicely, even with non-sequential ordering or missing entries. The switch case be replaced with a single line: func = read_idmap[read_id] == 0 ? FILE_CHECK : read_idmap[read_id]; Thank you! Mimi