Re: [PATCH v3 4/9] pstore: allow storing different type id's in rambackend

From: Anton Vorontsov
Date: Sat Nov 17 2012 - 21:08:06 EST


On Thu, Oct 18, 2012 at 02:06:02PM +0300, dragos.tatulea@xxxxxxxxx wrote:
> From: Dragos Tatulea <dragos.tatulea@xxxxxxxxx>
>
> Added pstore_type_id in message header when storing to ram.
> On write, take into account the contents of this header and
> set the type accordingly.
>
> Signed-off-by: Dragos Tatulea <dragos.tatulea@xxxxxxxxx>
> ---
[...]
> -static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz)
> +static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz,
> + enum pstore_type_id type)
> {
> char *hdr;
> struct timeval timestamp;
> size_t len;
>
> do_gettimeofday(&timestamp);
> - hdr = kasprintf(GFP_ATOMIC, RAMOOPS_KERNMSG_HDR "%lu.%lu\n",
> - (long)timestamp.tv_sec, (long)timestamp.tv_usec);
> + hdr = kasprintf(GFP_ATOMIC, "%u" RAMOOPS_KERNMSG_HDR "%lu.%lu\n",
> + type, (long)timestamp.tv_sec, (long)timestamp.tv_usec);

This will probably break scripts (and the main purpose for the header is
to make it somewhat scripts-parsable). It's safer to change it to

RAMOOPS_KERNMSG_HDR "%lu.%lu %u"

Thanks,
Anton.
--
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/