Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3847658pxj; Tue, 15 Jun 2021 09:54:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfyrYxo8w191SfgUhO2RarPb+OodbxSyvmV0JtCuDA94vSYyNUUWpRiRZ6ve4O5tFzuTq9 X-Received: by 2002:a17:906:b34e:: with SMTP id cd14mr518732ejb.69.1623776066990; Tue, 15 Jun 2021 09:54:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623776066; cv=none; d=google.com; s=arc-20160816; b=gGYYicshtvsuOXO5n051432XtbZ9PwOzu9LRKiw5LCAoowaAZmhn8rSjHt0vBU13HY HQXWjmi6YbOkMwuBil7V2bzVYHqli7BfOgWz64rMCWNRej8W7ldrMZVElZsThnIrPaN2 x9rRPjEBXJU7hYfyUM1PnAHxHfUso/CGghqGvKRKrhEz7easF5ifW58N/51T9wBdDE2B yiOz6yUVkDWvGpdM8akiURiNpuex1DXXsmD+yyc+vey3B0xPzVutotlQ6ccjzm8j31J/ HgGuKvbrnnHb9bqUzWEuccsz0puuXAiVOxu8Jq+VduHI15Zr5o9ymYb1J6e0p9U99Sjk jJnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=uI/pvHsTTyZh3fHaDustrSZwRrihBhp8OG6erc+b6b4=; b=gT4R3wPmmiqAsAsZETpdL6igNImx/3GFGItbRvqq8qiUTHGLpx9Ed4UcRfk12GXKNK LwpYVUeGr/xz9h1RsCjmnt5+E64YxeI2atpUZ0xnFux8bOvFqhwbcfLPn+nqNfsKgG6A tZg3paS+n964j37Qf17zUpC0k2MCsf4rxrSxAWuNuvAS7CXmuZwl5ePTBgZihwJj42zq SZ7UhJGpV9A4B8laEmqStMCt4r8Foet0iQblflGK1PBL5Xd7Kuwae7lVlYgCfzuHG9Bv Dn8THYwlx8LkHxmhbfETPzJTBuKqQfsLxgQuR/1yvQhJFUHlUuIkc2i6kvAKUn4TT2Wt nGMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=hoTnGfb+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si15519683ejb.555.2021.06.15.09.54.03; Tue, 15 Jun 2021 09:54:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=hoTnGfb+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231209AbhFOQzF (ORCPT + 99 others); Tue, 15 Jun 2021 12:55:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230526AbhFOQy7 (ORCPT ); Tue, 15 Jun 2021 12:54:59 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBB2EC061767 for ; Tue, 15 Jun 2021 09:52:53 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id q5so19119289wrm.1 for ; Tue, 15 Jun 2021 09:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uI/pvHsTTyZh3fHaDustrSZwRrihBhp8OG6erc+b6b4=; b=hoTnGfb+m4geMCZOBOrWzbmU1Gq/amOTtwODvcF9OOIIuN12EU5V6PEogeiyGyg1BT jsjboT4FriHBs26cJvNZYC7uamgXkv9VOEdIczn2LfFcVF1Jv7XAZjMZEdbJwWgk/qKb xb8XufN9y8PyxT8UqlhRlZ93PztCVIzyqtGaw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=uI/pvHsTTyZh3fHaDustrSZwRrihBhp8OG6erc+b6b4=; b=CDoAUYMbhH+1BDcBrFluiFqG8l9kokICY1Jmij0ttbvvBV4yECuK2hqNzGoR+AQ/c2 MakfTsTXrGUe7rp1tFW0XbqS6NZYKWgkGnRtgmcpQ+FDCsTNnELPxmWTAhoS/0zhwcQP UvmQL+S1j5OOFdUYeG5mHWv1+Y+ZfPSaoylWw3sZ9I/MxRzGpoSAZJuPegD6Uw2Qh145 efID0m9neVBe9yRmQhOj9Hj+YjVgasauN0o0ZRb+9xYnWbMMTSu2MmblX9eCkXuqjTy4 88cVod6Kf4cNikx5tW88r90vv9FXivc4wZ7LAHsFX7EvhAeu4HJwIjywO+7hcCnI0bEU 8IGQ== X-Gm-Message-State: AOAM532UBp0ZnW7zGcDeR7Sr5cdJg+mENlzv4rXkpu7tq2fiwhP9jfRR u5ofadX+Ww8awDFJt3FHmwpvlpH1kvykLYAeheI= X-Received: by 2002:adf:fe8c:: with SMTP id l12mr82258wrr.26.1623775972146; Tue, 15 Jun 2021 09:52:52 -0700 (PDT) Received: from localhost ([2a01:4b00:8432:8a00:63de:dd93:20be:f460]) by smtp.gmail.com with ESMTPSA id a1sm1006399wra.63.2021.06.15.09.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 09:52:51 -0700 (PDT) Date: Tue, 15 Jun 2021 17:52:51 +0100 From: Chris Down To: linux-kernel@vger.kernel.org Cc: Petr Mladek , Jessica Yu , Sergey Senozhatsky , John Ogness , Steven Rostedt , Greg Kroah-Hartman , Johannes Weiner , Kees Cook , Andy Shevchenko , Rasmus Villemoes , kernel-team@fb.com Subject: [PATCH v7 3/5] printk: Rework parse_prefix into printk_parse_prefix Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.1 (4b100969) (2021-06-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org parse_prefix is needed externally by later patches, so move it into a context where it can be used as such. Also give it the printk_ prefix to reduce the chance of collisions. Signed-off-by: Chris Down Cc: Petr Mladek --- kernel/printk/internal.h | 2 ++ kernel/printk/printk.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h index 1075e60fcd98..1596e2837318 100644 --- a/kernel/printk/internal.h +++ b/kernel/printk/internal.h @@ -57,6 +57,8 @@ bool printk_percpu_data_ready(void); void defer_console_output(void); +u16 printk_parse_prefix(const char *text, int *level, + enum printk_info_flags *flags); #else /* diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 3201bb0c269c..26d52aea9969 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -1957,7 +1957,7 @@ static inline u32 printk_caller_id(void) } /** - * parse_prefix - Parse level and control flags. + * printk_parse_prefix - Parse level and control flags. * * @text: The terminated text message. * @level: A pointer to the current level value, will be updated. @@ -1973,7 +1973,7 @@ static inline u32 printk_caller_id(void) * * Return: The length of the parsed level and control flags. */ -static u16 parse_prefix(char *text, int *level, +u16 printk_parse_prefix(const char *text, int *level, enum printk_info_flags *flags) { u16 prefix_len = 0; @@ -2019,7 +2019,7 @@ static u16 printk_sprint(char *text, u16 size, int facility, if (facility == 0) { u16 prefix_len; - prefix_len = parse_prefix(text, NULL, NULL); + prefix_len = printk_parse_prefix(text, NULL, NULL); if (prefix_len) { text_len -= prefix_len; memmove(text, text + prefix_len, text_len); @@ -2068,7 +2068,7 @@ int vprintk_store(int facility, int level, /* Extract log level or control flags. */ if (facility == 0) - parse_prefix(&prefix_buf[0], &level, &flags); + printk_parse_prefix(&prefix_buf[0], &level, &flags); if (level == LOGLEVEL_DEFAULT) level = default_message_loglevel; -- 2.31.1