2

In Linux kernel source, there are structures initialized as,

struct remap_trace *trace = kmalloc(sizeof(*trace), GFP_KERNEL);

*trace = (struct remap_trace) {
        .probe = {
            .addr = (unsigned long)addr,
            .len = size,
            .pre_handler = pre,
            .post_handler = post,
            .private = trace
        },
        .phys = offset,
        .id = atomic_inc_return(&next_id)
    }
  • What is this sort of initialization called?
  • Is it specific to gcc or is it there in C standard?
  • Does it create a structure on stack, initialize its members and copy over the whole thing to *trace, i.e. heap in this case)?
sherlock
  • 2,397
  • 3
  • 27
  • 44

0 Answers0