Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1071712imm; Fri, 27 Jul 2018 10:38:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeJlq4kfvT5CeuvJEF8bKjBvWZuDjRz1l4+Z0C7qndjNW0Zds7SBN0Dwh4xZAk0QN8yvJls X-Received: by 2002:a63:cc53:: with SMTP id q19-v6mr2812793pgi.87.1532713093978; Fri, 27 Jul 2018 10:38:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532713093; cv=none; d=google.com; s=arc-20160816; b=lt1Dfud5BZW9uSMPo/r21t3GSwyR3AO1u4RcRyQB5mUPjGG1wi2qMcQ5NMQIcMpVYZ L6Y1UTIqTr9YubpebwUGLC1xnvErshkOXpilUAKwMQR7Wipr2QL0nf9F6Fziz61eKOGr auT2ncp0Ir0LjzSfIbbJ/0FtAxywH+1fEevniXbmtdxtXqlF8tPsvccp8h9MAa9bHaIL NEhC8D/JutyEzPdVDQSEvrr1+EooHMkQroQhrslQbQnSIjBBwGw47Ax2QNEQr8lm2RfQ irmJk4DWIGxYOEDSyZGtMqILeMhrXoRb36ZP5POV0VjWu79kDNyC/4DgiKOmKY3Y7ddu BAXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:arc-authentication-results; bh=5DpC6SsfJ1GXBftaoNsnV4ItveeZD5xuxciFnt75naY=; b=UalcuCdkLs/Bo26IvuWCTtSJrZRS+FZThnATjobAsyl6cKXiZ1IkVYIqIz2H90EusQ 0pRReSdsqm2PSX8Nwrn6vAwicuABIGIE8iHmehwiZt7fMqa/Wl2l+cl00bzaPVgfbnD1 a9z0pe+ir6XNIWsKILIK2JdC8fAONyJLyn22N+N4l3F3GskdVELxIJhY7Xz+XTL7dqMj kcLrS2yWUmucgDDk4bqWCSctvDdeXKggJL/LRVd2wggi6KMZz5BHSoKLMeQ/VryVUTMf yD611nN05zFkFVvpjAG2dmSNhaN0/Lyry3+RLimd0GgRY7ZUZdTSvofFkswPEN/4cDIO 4kXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si3861700plg.154.2018.07.27.10.37.59; Fri, 27 Jul 2018 10:38:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389594AbeG0S7U (ORCPT + 99 others); Fri, 27 Jul 2018 14:59:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40298 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389347AbeG0Sy6 (ORCPT ); Fri, 27 Jul 2018 14:54:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDA9181663CE; Fri, 27 Jul 2018 17:32:04 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-116.rdu2.redhat.com [10.10.120.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 546851C5B9; Fri, 27 Jul 2018 17:32:04 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 06/38] vfs: Introduce logging functions [ver #10] From: David Howells To: viro@zeniv.linux.org.uk Cc: torvalds@linux-foundation.org, dhowells@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 27 Jul 2018 18:32:02 +0100 Message-ID: <153271272284.9458.1302779298307992140.stgit@warthog.procyon.org.uk> In-Reply-To: <153271267980.9458.7640156373438016898.stgit@warthog.procyon.org.uk> References: <153271267980.9458.7640156373438016898.stgit@warthog.procyon.org.uk> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 27 Jul 2018 17:32:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 27 Jul 2018 17:32:04 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce a set of logging functions through which informational messages, warnings and error messages incurred by the mount procedure can be logged and, in a future patch, passed to userspace instead by way of the filesystem configuration context file descriptor. There are four functions: (1) infof(const char *fmt, ...); Logs an informational message. (2) warnf(const char *fmt, ...); Logs a warning message. (3) errorf(const char *fmt, ...); Logs an error message. (4) invalf(const char *fmt, ...); As errof(), but returns -EINVAL so can be used on a return statement. Signed-off-by: David Howells --- include/linux/fs_context.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h index 0ff4969f9d5a..a88b54752f86 100644 --- a/include/linux/fs_context.h +++ b/include/linux/fs_context.h @@ -98,4 +98,46 @@ struct fs_context_operations { int (*get_tree)(struct fs_context *fc); }; +#define logfc(FC, FMT, ...) pr_notice(FMT, ## __VA_ARGS__) + +/** + * infof - Store supplementary informational message + * @fc: The context in which to log the informational message + * @fmt: The format string + * + * Store the supplementary informational message for the process if the process + * has enabled the facility. + */ +#define infof(fc, fmt, ...) ({ logfc(fc, fmt, ## __VA_ARGS__); }) + +/** + * warnf - Store supplementary warning message + * @fc: The context in which to log the error message + * @fmt: The format string + * + * Store the supplementary warning message for the process if the process has + * enabled the facility. + */ +#define warnf(fc, fmt, ...) ({ logfc(fc, fmt, ## __VA_ARGS__); }) + +/** + * errorf - Store supplementary error message + * @fc: The context in which to log the error message + * @fmt: The format string + * + * Store the supplementary error message for the process if the process has + * enabled the facility. + */ +#define errorf(fc, fmt, ...) ({ logfc(fc, fmt, ## __VA_ARGS__); }) + +/** + * invalf - Store supplementary invalid argument error message + * @fc: The context in which to log the error message + * @fmt: The format string + * + * Store the supplementary error message for the process if the process has + * enabled the facility and return -EINVAL. + */ +#define invalf(fc, fmt, ...) ({ errorf(fc, fmt, ## __VA_ARGS__); -EINVAL; }) + #endif /* _LINUX_FS_CONTEXT_H */