Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp989425imm; Wed, 1 Aug 2018 08:26:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc8cQdrqOfQoGw30/+FZqmgh713LjXYUNlG8Gny4XzVsJPX2k2ejrlLO+y6oPnjGMyufY1l X-Received: by 2002:a65:4849:: with SMTP id i9-v6mr25040566pgs.350.1533137184546; Wed, 01 Aug 2018 08:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533137184; cv=none; d=google.com; s=arc-20160816; b=vPJ4YQUhGwJ2N5Q0rbrOGnXqIF4qQN81IB1ZNSYk9X5+6KYzoY79dk/P253u1l4Owr xzkqjMxngDfDa5W8hKzA488qBQ30JEUzvvn1ni9LYcLYxXR9fce5bgeakVDn7CCa3uKl Cn9fiHNmZfH34AcYyaIYopFDa4MnHz28smAr5pfTH4IJdT4tLT9poAN7nnwYHDZeMOuv GHDUNP2hjF154411NbNVGiZOR8rII4mYpq1+myJFzPo6cjB7iKzaYu4aVzuBISE7aisw wqVVPSxpy5kUrLtic9Zzyd+2MMT3EqN4nUvtGgC+W+ZTT33OK1+RV9irN5DYF9act9LH oFXA== 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=AUn4tywCyirvOiam32D6x1CXoxO5Bz63CbrCiiLEM3l3hVpGprMFGSWgwQJ51tUf2l pZIrdgHC+oJtxCDODuqAZTHA4difHcg4sqPCEl09gQIsuBOSewdOMNs806hn503hILuf xCz4K9GNmpCkB0Pk9xvGP6oifRFF9l9xGYvFsHk1r0ZW8LsozFvyQKaEa6y4RDVYxK3I 75/3HYqVY0gJZPMSFx9ta1QvicBKotlXHhFVJsmjbYuDGuiPNWSzypwfc8qOfHtTsV7u Zi+1vG8ZcqVdKIEmvLwYJadvwInkZAmnVounI64sTgi3F6zpGxR4BIgS+dUQYc0m8E3r Rbow== 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 5-v6si16385016pgp.439.2018.08.01.08.26.09; Wed, 01 Aug 2018 08:26:24 -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 S2389910AbeHARLA (ORCPT + 99 others); Wed, 1 Aug 2018 13:11:00 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40996 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389709AbeHARLA (ORCPT ); Wed, 1 Aug 2018 13:11:00 -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 38FC381663C7; Wed, 1 Aug 2018 15:24:46 +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 3CB0C1C701; Wed, 1 Aug 2018 15:24:44 +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/33] vfs: Introduce logging functions [ver #11] 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: Wed, 01 Aug 2018 16:24:43 +0100 Message-ID: <153313708376.13253.12307715668519958367.stgit@warthog.procyon.org.uk> In-Reply-To: <153313703562.13253.5766498657900728120.stgit@warthog.procyon.org.uk> References: <153313703562.13253.5766498657900728120.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]); Wed, 01 Aug 2018 15:24:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 01 Aug 2018 15:24:46 +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 */