From patchwork Thu Jul 17 17:59:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 33805 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5E88820CA0 for ; Thu, 17 Jul 2014 18:01:07 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf17661260pdb.1 for ; Thu, 17 Jul 2014 11:01:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=01Kp9tQqxKpCgyhH/SnKoU6VAqHyoXVFz98dD8q8ryA=; b=erZO4pQQmGMxnV3c3Wrb5aA8l5YQrNSeJvPA6aC1rW2gHpoGIWBY9cfnDX4NnUOpPY 0sHeCQH+sWKlkelwDEujGvEcbm+v5ku4JCFYpLkB43W5u4ZcUMMrY0OVhmU6GzY5SRgU xZNPcnDT95BtoukpNbi8qPuMWpTw5Z3QwLzyRTOCQkwYugOW7lIYKrdkeIi5jx547ZPe 4js/w4gyu07FAkYwwYTnXF75mUp99ZpxM8xXTD4bbjCn5paBShdAJ/aadUOgfo8TCozo 3JJMupxR5dSwK2Y8FkpqnpLyXe/EZ7iB5eIIbIwluun7VO+tvvfO331Ogy1wcWxQEwCQ s0mg== X-Gm-Message-State: ALoCoQmQX1Tk3Qf1ytule1lfZj0TOn1NCZsDrPvKIIwMhrj2NZ+OgxeLG95+Sll1chGHZdfk/And X-Received: by 10.70.89.208 with SMTP id bq16mr18885725pdb.3.1405620066539; Thu, 17 Jul 2014 11:01:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.142 with SMTP id r14ls759166qgr.16.gmail; Thu, 17 Jul 2014 11:01:06 -0700 (PDT) X-Received: by 10.236.124.236 with SMTP id x72mr19913289yhh.59.1405620066349; Thu, 17 Jul 2014 11:01:06 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id z14si8464181yhj.146.2014.07.17.11.01.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Jul 2014 11:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hy4so5343316vcb.36 for ; Thu, 17 Jul 2014 11:01:06 -0700 (PDT) X-Received: by 10.52.244.138 with SMTP id xg10mr17764767vdc.40.1405620066071; Thu, 17 Jul 2014 11:01:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp56180vcb; Thu, 17 Jul 2014 11:01:05 -0700 (PDT) X-Received: by 10.68.163.100 with SMTP id yh4mr25777049pbb.122.1405620064835; Thu, 17 Jul 2014 11:01:04 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yh3si3117481pab.170.2014.07.17.11.01.04; Thu, 17 Jul 2014 11:01:04 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752928AbaGQSAy (ORCPT + 23 others); Thu, 17 Jul 2014 14:00:54 -0400 Received: from mail-ig0-f176.google.com ([209.85.213.176]:39417 "EHLO mail-ig0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751328AbaGQR7S (ORCPT ); Thu, 17 Jul 2014 13:59:18 -0400 Received: by mail-ig0-f176.google.com with SMTP id hn18so6602025igb.3 for ; Thu, 17 Jul 2014 10:59:18 -0700 (PDT) X-Received: by 10.50.79.195 with SMTP id l3mr30200434igx.23.1405619958113; Thu, 17 Jul 2014 10:59:18 -0700 (PDT) Received: from localhost.localdomain (c-24-245-18-91.hsd1.mn.comcast.net. [24.245.18.91]) by mx.google.com with ESMTPSA id j10sm8487955igv.17.2014.07.17.10.59.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Jul 2014 10:59:17 -0700 (PDT) From: Alex Elder To: akpm@linux-foundation.org Cc: kay@vrfy.org, pmladek@suse.cz, bp@suse.de, john.stultz@linaro.org, jack@suse.cz, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] printk: update previous message for LOG_PREFIX Date: Thu, 17 Jul 2014 12:59:10 -0500 Message-Id: <1405619953-5475-3-git-send-email-elder@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1405619953-5475-1-git-send-email-elder@linaro.org> References: <1405619953-5475-1-git-send-email-elder@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: elder@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If log_store() gets flags containing LOG_PREFIX, it indicates the record getting stored should implicitly complete the previous log record and start a new one. We can also ensure the previous record is completed by keeping track of the previously-logged record, and adding the LOG_NEWLINE flag to it when log_store() sees a LOG_PREFIX flag. Signed-off-by: Alex Elder --- kernel/printk/printk.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index e35d91a..6b72a77 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -242,6 +242,9 @@ static size_t syslog_partial; static u64 log_first_seq; static u32 log_first_idx; +/* Pointer to the last record written into the log */ +static struct printk_log *log_last_msg; + /* index and sequence number of the next record to store in the buffer */ static u64 log_next_seq; static u32 log_next_idx; @@ -425,7 +428,13 @@ static int log_store(int facility, int level, log_next_idx = 0; } - /* fill message */ + /* + * If we're forcing a new log record, update the flags for + * the previous one to mark it complete. + */ + if (flags & LOG_PREFIX && log_last_msg) + log_last_msg->flags |= LOG_NEWLINE; + msg = (struct printk_log *)(log_buf + log_next_idx); memcpy(log_text(msg), text, text_len); msg->text_len = text_len; @@ -449,6 +458,9 @@ static int log_store(int facility, int level, log_next_idx += msg->len; log_next_seq++; + /* Save our previous record address for next time. */ + log_last_msg = msg; + return msg->text_len; }