[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1003161354380.18642@pobox.suse.cz>
Date: Tue, 16 Mar 2010 13:58:15 +0100 (CET)
From: Jiri Kosina <jkosina@...e.cz>
To: Bruno Prémont <bonbons@...ux-vserver.org>
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hid: avoid '\0' in hid debugfs events file
On Mon, 15 Mar 2010, Bruno Prémont wrote:
> When dumping /sys/kernel/debug/hid/$device/events '\0' characters show up
> (invisible if cat to console but shown by less or while looking at a dump
> file).
> These are due to hid_debug_event() adding strlen()+1 bytes to the ring
> buffer (e.g. including the trailing '\0').
> Any roll-over causes a '\0' as well as hid_debug_event() handles the ring
> buffers with HID_DEBUG_BUFSIZE-1 size while hid_debug_events_read() handles
> it with full HID_DEBUG_BUFSIZE size.
Applied, thanks.
> Signed-off-by: Bruno Prémont <bonbons@...ux-vserver.org>
> ---
> Note:
> The ring buffer overflow case (when tail crosses head) seems to be
> suboptimal at best.
> Would there be a good way to mark those cases so reader can know where
> data got lost. (though this might not be easy keeping the lockless
> design)
I agree that there might be better implementation. The circular buffer is
merely the same to what we use in other userspace interfaces already (see
original hiddev, for example). Plus this is only debugging interface, and
with SIZE being 512, it's very unlikely that events will get lost.
But I don't think the lockless design is that important here, so if you
are motivated to rewrite it to something better, I wouldn't object.
Thanks,
--
Jiri Kosina
SUSE Labs, Novell Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists