From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755578AbdHYKZd (ORCPT ); Fri, 25 Aug 2017 06:25:33 -0400 Received: from mail.skyhub.de ([5.9.137.197]:55644 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755301AbdHYKYX (ORCPT ); Fri, 25 Aug 2017 06:24:23 -0400 From: Borislav Petkov To: linux-edac Cc: Steven Rostedt , Tony Luck , Yazen Ghannam , X86 ML , LKML Subject: [PATCH 3/7] seq_buf: Add seq_buf_clear_buf() Date: Fri, 25 Aug 2017 12:24:07 +0200 Message-Id: <20170825102411.8682-4-bp@alien8.de> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170825102411.8682-1-bp@alien8.de> References: <20170825102411.8682-1-bp@alien8.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov This is the version which clears the supplied buffer too. Useful when we're done with the buffer and want to clean it up and prepare it for reuse. Signed-off-by: Borislav Petkov Acked-by: Steven Rostedt (VMware) --- include/linux/seq_buf.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h index fb7eb9ccb1cd..8705a482e76c 100644 --- a/include/linux/seq_buf.h +++ b/include/linux/seq_buf.h @@ -28,6 +28,13 @@ static inline void seq_buf_clear(struct seq_buf *s) s->readpos = 0; } +/* Like seq_buf_clear() but zero out the buffer too. */ +static inline void seq_buf_clear_buf(struct seq_buf *s) +{ + seq_buf_clear(s); + memset(s->buffer, 0, s->size); +} + static inline void seq_buf_init(struct seq_buf *s, unsigned char *buf, unsigned int size) { -- 2.13.0