Re: [PATCH] printk: Export struct log size and member offsets through vmcoreinfo

From: Kay Sievers
Date: Wed Jul 18 2012 - 13:27:27 EST


On Wed, Jul 18, 2012 at 7:18 PM, Vivek Goyal <vgoyal@xxxxxxxxxx> wrote:

> Currently I am not exporting log "level" info as that is a bitfield and
> offsetof() bitfields can't be calculated.

We could make the level the lower 3 bits of the byte, export the byte,
and define that only 3 bits of the byte are valid? Would that help?

> kernel/printk.c | 9 +++++++++
> 1 file changed, 9 insertions(+)

> + /*
> + * Export struct log size and field offsets. User space tools can
> + * parse it and detect any changes to structure down the line.
> + */
> + VMCOREINFO_STRUCT_SIZE(log);
> + VMCOREINFO_OFFSET(log, ts_nsec);
> + VMCOREINFO_OFFSET(log, len);
> + VMCOREINFO_OFFSET(log, text_len);
> + VMCOREINFO_OFFSET(log, dict_len);

Ah, nice, that's how you handle exporting structures, it was still on
my list, to find out how all that should look like.

Cc:ing Greg, to pick it up.

Thanks a lot for taking care of it,
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/