1

What does this line mean:

[0 ... 255] = &&default_label 

in the definition:

static const void *jumptable[256] = {
    [0 ... 255] = &&default_label,
    /* Now overwrite non-defaults ... */
    /* 32 bit ALU operations */
    [BPF_ALU | BPF_ADD | BPF_X] = &&ALU_ADD_X,
    …
};

http://lxr.devzen.net/source/xref/linux-4.8.15/kernel/bpf/core.c#473

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

1 Answers1

1

The [0 ... 255] notation is a GCC extension to the designated initializer syntax (that is desperately needed in standard C). It sets elements 0 through 255 of the array (of void * values) to the address of the label default_label (another GCC syntax extension, but this is one that is not desperately needed in standard C).

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278