Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp731925pxf; Thu, 25 Mar 2021 12:43:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVywz5TeWzYp5e1qoratpDwPri18EducxeKBgBWpBscchYZQUDrEAms1hdHLySTSk04WEe X-Received: by 2002:a05:6402:1a3c:: with SMTP id be28mr11030925edb.125.1616701406933; Thu, 25 Mar 2021 12:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616701406; cv=none; d=google.com; s=arc-20160816; b=iqqS2vBtSGApDhl+wD7BLJVY6Gc225vYvKqnrfO55HhioXbDAqO2Y3boA5Kwo6rviG 6XyE6AoI6CXF/dpLMdlJmObZwrL0RlMAmaV1cLYWYJ3E+jlRMG26Je1ClZcPRq+7VrYp QgCR5n5Txs1I6zv2FmYW+QzITnk8I0PP8zb2f2OAkvdOAAn4IFOTKbvG84+lGReiVitj GvhkEqXclFGOx01SqowggnWJ/BcKcy6X73BKP74Dkaq2lnjan3DaiYN6I5vEU5TWZIRF DRK3I+AEAsdkIwra3tQU5echFIIeDmuMinvo9wgcf9qIUwRmlo8FCVutAdaw2i5RLmef mJCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Xe1RgBQE/G9XF6ytQooX6iFiFRZ4POCra4z89XvkUPk=; b=bLTtQy0Zy2ECddfyTfZI+/JITzn4aCyxPLdiD1Hk0oF7YoSrIsZqZS7ZacSw2Ik51Y 6EPTtSrUQc6v4lDvQhYcygW7acVQ4gb1xr+QKDOWCGt0dEy5v2HIZ7FuNOTDXDQ9FDFM oMiZ7OBFOTcEa5878ayqVv47wyQ0lH+h6Swqa5uKXL6w4/dua4XGOibQQOwzkDXgy0f9 Q+UAzHqUXBMZeGyN4DupAsM8e8LMqJLU5iN4426dZT013NTG79CPXQtGn99/r4E0Oj3t RN9WKWLYUOdYAK2vqTj1HPMPIPvH17eeDAAYrnMoLcFQZuiQm3a9S97qn+0+hX23lJQR r1KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bv8rVwqg; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu13si4909629edb.498.2021.03.25.12.43.03; Thu, 25 Mar 2021 12:43: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=@redhat.com header.s=mimecast20190719 header.b=bv8rVwqg; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231185AbhCYTjI (ORCPT + 99 others); Thu, 25 Mar 2021 15:39:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39793 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230336AbhCYTiU (ORCPT ); Thu, 25 Mar 2021 15:38:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616701100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xe1RgBQE/G9XF6ytQooX6iFiFRZ4POCra4z89XvkUPk=; b=bv8rVwqgg4vp37IELv55gLkTJ5dxGXVtjj218QPj++8Y4/7s9AtJHIW0QAokH03CpvMxsd Cz2iwJbyuEjPavwmKGNQXgPguMoLecRQjXublQQvqrwuwO0XkTNq6KMgVveFi+RLOQlkQ6 4N6BN8SQpYNgEhIJK5qWHC41VQc/xuU= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-415-wB4Z5PwgMg2JXO-aYHtpcQ-1; Thu, 25 Mar 2021 15:38:18 -0400 X-MC-Unique: wB4Z5PwgMg2JXO-aYHtpcQ-1 Received: by mail-ed1-f70.google.com with SMTP id bi17so3202115edb.6 for ; Thu, 25 Mar 2021 12:38:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xe1RgBQE/G9XF6ytQooX6iFiFRZ4POCra4z89XvkUPk=; b=Hgc5KKGS8K35nIbabtJouNRg6xEx+Wi7AipBD0jlMtQSzNJIvX5LZihL65r0aWIxXl akOBfmK3K6QC7+jEm5Ku4hAZxBOOyzQ7l5IVgct3tnjPgH9FfB+in1zM3CQJQNwuAgiX 3kHkt12qx65igCC6P3SyAR0LsJt41tofveCvTh3ZoK4N3Omx2d45NuzJ/KvEpZpw2kz5 mn6++kcd4H5RdZ2J8PKZ8xq5qATUmUeBvkqAMNP3DDD7QrhPq7bQWN1tKNbSILIvC0Rg gKy5F1oVjOMoCd49wOfu6zQrMtmjD50A0GTNqG4fbjVN6aZ2Cv9QtXMkv5V01byu52fM v9Mg== X-Gm-Message-State: AOAM531H187CHywu/jEUCFTQR9OkU15Z/ueu3CjdrML/MYEctKEKv6HF IrWK3q6L2SpvyQMNkc2tDT1bjY5EWnw4f9HXAKzLkKaUTkxtkKO0BK6IAYEY20e432RiYhr1ArE mirEIqdsFbso7X4HCBUTRflwG X-Received: by 2002:a17:907:720a:: with SMTP id dr10mr11045117ejc.375.1616701096907; Thu, 25 Mar 2021 12:38:16 -0700 (PDT) X-Received: by 2002:a17:907:720a:: with SMTP id dr10mr11045102ejc.375.1616701096688; Thu, 25 Mar 2021 12:38:16 -0700 (PDT) Received: from miu.piliscsaba.redhat.com (catv-86-101-169-67.catv.broadband.hu. [86.101.169.67]) by smtp.gmail.com with ESMTPSA id si7sm2881996ejb.84.2021.03.25.12.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Mar 2021 12:38:16 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: Al Viro , linux-kernel@vger.kernel.org, "Darrick J . Wong" Subject: [PATCH v3 18/18] vfs: remove unused ioctl helpers Date: Thu, 25 Mar 2021 20:37:55 +0100 Message-Id: <20210325193755.294925-19-mszeredi@redhat.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210325193755.294925-1-mszeredi@redhat.com> References: <20210325193755.294925-1-mszeredi@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove vfs_ioc_setflags_prepare(), vfs_ioc_fssetxattr_check() and simple_fill_fsxattr(), which are no longer used. Signed-off-by: Miklos Szeredi Reviewed-by: Darrick J. Wong --- fs/inode.c | 87 ---------------------------------------------- include/linux/fs.h | 12 ------- 2 files changed, 99 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index a047ab306f9a..ae526fd9c0a4 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -2314,89 +2313,3 @@ struct timespec64 current_time(struct inode *inode) return timestamp_truncate(now, inode); } EXPORT_SYMBOL(current_time); - -/* - * Generic function to check FS_IOC_SETFLAGS values and reject any invalid - * configurations. - * - * Note: the caller should be holding i_mutex, or else be sure that they have - * exclusive access to the inode structure. - */ -int vfs_ioc_setflags_prepare(struct inode *inode, unsigned int oldflags, - unsigned int flags) -{ - /* - * The IMMUTABLE and APPEND_ONLY flags can only be changed by - * the relevant capability. - * - * This test looks nicer. Thanks to Pauline Middelink - */ - if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL) && - !capable(CAP_LINUX_IMMUTABLE)) - return -EPERM; - - return fscrypt_prepare_setflags(inode, oldflags, flags); -} -EXPORT_SYMBOL(vfs_ioc_setflags_prepare); - -/* - * Generic function to check FS_IOC_FSSETXATTR values and reject any invalid - * configurations. - * - * Note: the caller should be holding i_mutex, or else be sure that they have - * exclusive access to the inode structure. - */ -int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa, - struct fsxattr *fa) -{ - /* - * Can't modify an immutable/append-only file unless we have - * appropriate permission. - */ - if ((old_fa->fsx_xflags ^ fa->fsx_xflags) & - (FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND) && - !capable(CAP_LINUX_IMMUTABLE)) - return -EPERM; - - /* - * Project Quota ID state is only allowed to change from within the init - * namespace. Enforce that restriction only if we are trying to change - * the quota ID state. Everything else is allowed in user namespaces. - */ - if (current_user_ns() != &init_user_ns) { - if (old_fa->fsx_projid != fa->fsx_projid) - return -EINVAL; - if ((old_fa->fsx_xflags ^ fa->fsx_xflags) & - FS_XFLAG_PROJINHERIT) - return -EINVAL; - } - - /* Check extent size hints. */ - if ((fa->fsx_xflags & FS_XFLAG_EXTSIZE) && !S_ISREG(inode->i_mode)) - return -EINVAL; - - if ((fa->fsx_xflags & FS_XFLAG_EXTSZINHERIT) && - !S_ISDIR(inode->i_mode)) - return -EINVAL; - - if ((fa->fsx_xflags & FS_XFLAG_COWEXTSIZE) && - !S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) - return -EINVAL; - - /* - * It is only valid to set the DAX flag on regular files and - * directories on filesystems. - */ - if ((fa->fsx_xflags & FS_XFLAG_DAX) && - !(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) - return -EINVAL; - - /* Extent size hints of zero turn off the flags. */ - if (fa->fsx_extsize == 0) - fa->fsx_xflags &= ~(FS_XFLAG_EXTSIZE | FS_XFLAG_EXTSZINHERIT); - if (fa->fsx_cowextsize == 0) - fa->fsx_xflags &= ~FS_XFLAG_COWEXTSIZE; - - return 0; -} -EXPORT_SYMBOL(vfs_ioc_fssetxattr_check); diff --git a/include/linux/fs.h b/include/linux/fs.h index 156b78f42a28..820fdc62ac30 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3571,18 +3571,6 @@ extern int vfs_fadvise(struct file *file, loff_t offset, loff_t len, extern int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice); -int vfs_ioc_setflags_prepare(struct inode *inode, unsigned int oldflags, - unsigned int flags); - -int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa, - struct fsxattr *fa); - -static inline void simple_fill_fsxattr(struct fsxattr *fa, __u32 xflags) -{ - memset(fa, 0, sizeof(*fa)); - fa->fsx_xflags = xflags; -} - /* * Flush file data before changing attributes. Caller must hold any locks * required to prevent further writes to this file until we're done setting -- 2.30.2