From patchwork Thu Jul 17 17:59:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 33803 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f71.google.com (mail-oi0-f71.google.com [209.85.218.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8B2F720CA0 for ; Thu, 17 Jul 2014 18:00:06 +0000 (UTC) Received: by mail-oi0-f71.google.com with SMTP id e131sf3566690oig.2 for ; Thu, 17 Jul 2014 11:00: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=onM8DmsGV35Ip7RbInExhLED3mumpWMSlGpZkStg+C0=; b=VkaCviDBFwuHixG9RxGI4ckzNvS993y5CF+mtxAAAVxq58z+VCcVTMapRD7nvdp512 IUtYvA2Ggswf5DvrH7vwt+wYrBCdfaZFSCXBAwNqM65tclUwjavrn/JmbBbWoPOZ2M0J pen8J8D9J5HqFmz+tad9RhqJ2i0fcpef647HA7HEEIm03K577NxuZvhgjZHTf/19dfCv A1B3Mmp0vH2JW2YJp1h7A8UOMUuvkxbNsaRHBxgk/pWie/1lfFqlTW301uJsE3kbC0rs F/9z4vAnLxTggQgNvI6Ln6HKv5bVM7n8Cto0KAdigZKNqz74UVRvVJMkzGPP6jV1lZBa KiUA== X-Gm-Message-State: ALoCoQlpfqd8hvLEEbaa8JftOR9lEXsoLmLREqfzjGOMOU5gBoy15RUqHDDYh9sCmaexDN8bGLS6 X-Received: by 10.50.28.15 with SMTP id x15mr10357261igg.5.1405620006375; Thu, 17 Jul 2014 11:00:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.29.133 with SMTP id b5ls366390qgb.43.gmail; Thu, 17 Jul 2014 11:00:06 -0700 (PDT) X-Received: by 10.236.101.138 with SMTP id b10mr15429922yhg.91.1405620006275; Thu, 17 Jul 2014 11:00:06 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id m5si8501448yha.135.2014.07.17.11.00.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Jul 2014 11:00:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id hu12so5413088vcb.28 for ; Thu, 17 Jul 2014 11:00:06 -0700 (PDT) X-Received: by 10.52.244.138 with SMTP id xg10mr17756031vdc.40.1405620006073; Thu, 17 Jul 2014 11:00: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 tc5csp56112vcb; Thu, 17 Jul 2014 11:00:05 -0700 (PDT) X-Received: by 10.70.90.161 with SMTP id bx1mr4719050pdb.150.1405620005227; Thu, 17 Jul 2014 11:00:05 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si1573012pdn.229.2014.07.17.11.00.04; Thu, 17 Jul 2014 11:00: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 S1752380AbaGQR7T (ORCPT + 23 others); Thu, 17 Jul 2014 13:59:19 -0400 Received: from mail-ig0-f179.google.com ([209.85.213.179]:43875 "EHLO mail-ig0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752050AbaGQR7R (ORCPT ); Thu, 17 Jul 2014 13:59:17 -0400 Received: by mail-ig0-f179.google.com with SMTP id h18so3381937igc.0 for ; Thu, 17 Jul 2014 10:59:17 -0700 (PDT) X-Received: by 10.50.137.73 with SMTP id qg9mr30172338igb.19.1405619956988; Thu, 17 Jul 2014 10:59:16 -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.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Jul 2014 10:59:16 -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 1/5] printk: kill LOG_CONT Date: Thu, 17 Jul 2014 12:59:09 -0500 Message-Id: <1405619953-5475-2-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.169 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: , The LOG_CONT and LOG_NEWLINE flags are mutually exclusive, i.e., the presence of LOG_NEWLINE implies the absense of LOG_CONT, and vice-versa. As a result, wherever LOG_CONT is used, we can equivalently substitute !LOG_NEWLINE; and we can use LOG_NEWLINE wherever !LOG_CONT is used. Switch to using LOG_NEWLINE only, and get rid of LOG_CONT. Make some refinements on a nearby block of comments. Signed-off-by: Alex Elder --- kernel/printk/printk.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index eff68a4..e35d91a 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -211,7 +211,6 @@ enum log_flags { LOG_NOCONS = 1, /* already flushed, do not print to console */ LOG_NEWLINE = 2, /* text ended with a newline */ LOG_PREFIX = 4, /* text started with a prefix */ - LOG_CONT = 8, /* text is a fragment of a continuation line */ }; struct printk_log { @@ -613,16 +612,18 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, do_div(ts_usec, 1000); /* - * If we couldn't merge continuation line fragments during the print, - * export the stored flags to allow an optional external merge of the - * records. Merging the records isn't always necessarily correct, like - * when we hit a race during printing. In most cases though, it produces - * better readable output. 'c' in the record flags mark the first - * fragment of a line, '+' the following. + * Sometimes it's necessary to flush an incomplete record to the log. + * When this happens, consecutive records should be merged to produce + * a logically complete message. + * + * Indicate this to user space with a flag character. A 'c' indicates + * the first of a series of incomplete log records. A '+' indicates + * a record that should be merged with one or more earlier records. + * And a '-' indicates a "normal" self-contained single record. */ - if ((user->prev & LOG_CONT) && !(msg->flags & LOG_PREFIX)) + if (!(user->prev & LOG_NEWLINE) && !(msg->flags & LOG_PREFIX)) cont = '+'; - else if (msg->flags & LOG_CONT) + else if (!(msg->flags & LOG_NEWLINE)) cont = 'c'; else cont = '-'; @@ -1007,10 +1008,10 @@ static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev, bool newline = true; size_t len = 0; - if ((prev & LOG_CONT) && !(msg->flags & LOG_PREFIX)) + if (!(prev & LOG_NEWLINE) && !(msg->flags & LOG_PREFIX)) prefix = false; - if (msg->flags & LOG_CONT) + if (!(msg->flags & LOG_NEWLINE)) newline = false; do { @@ -1516,7 +1517,7 @@ static bool cont_add(int facility, int level, const char *text, size_t len) if (cont.len + len > sizeof(cont.buf)) { /* the line gets too long, split it up in separate records */ - cont_flush(LOG_CONT); + cont_flush(0); return false; } @@ -1534,7 +1535,7 @@ static bool cont_add(int facility, int level, const char *text, size_t len) cont.len += len; if (cont.len > (sizeof(cont.buf) * 80) / 100) - cont_flush(LOG_CONT); + cont_flush(0); return true; } @@ -1647,8 +1648,6 @@ asmlinkage int vprintk_emit(int facility, int level, if (text_len && text[text_len-1] == '\n') { text_len--; lflags = LOG_NEWLINE; - } else { - lflags = LOG_CONT; } /* strip kernel syslog prefix and extract log level or control flags */