Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp249838pxb; Wed, 3 Feb 2021 04:48:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5vFJBJ/OP/v9XwjrzOOwMHIcuzBTYHn3r/xNIFwqB2LhYSGYI9x8FELkbWP0rP/nakut9 X-Received: by 2002:a17:906:7804:: with SMTP id u4mr3033752ejm.97.1612356501980; Wed, 03 Feb 2021 04:48:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612356501; cv=none; d=google.com; s=arc-20160816; b=kE45s01VYs+mlRJP1glh6MOect1E46vCzSOKZIxlBbZcwnqfBLpTYjIpdO8LYFzlpQ BxvCu+SXoSdlPmXSgb/Pd5ojz34R36FAWSiVYKaLE9GmFi9ORiUL3IPQV0Pbk8j7/gCR UEAcanta1EjYBcsSARNJVSG9jvAUC/gAYThZKnzV9wI5DN88okZ2I6jvwgXJ6ISSTr5x 7NLyMPg/AGvX8a92/3Gs6jIZUw9Xe9Whyux5iqAMbZgVw0aSDpFl5i7bVd2/KUmvqELQ W6GI1ZCxbOeqss53Nvtv0ytsrOk4F0qLqkhXGN1SHAbd1qBTq+cTn89+bWaHgmVufl9B vWzA== 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=TejRLSU/4tO3xbWCWCiZBCPi7mB6er1iGbgx5H+3dxg=; b=ww7E2OlzKYfmocNt7mg0kyhH6Ot6L7WSRMclikvycKHvFxl+IPRys5qsNwBJrh78qk kgCdhIrfv/KsepSzV4Zu4TEjp0+/F9GLRd8k95jhoDLLcPBaxfLqWnxM+eNojrGJrqP1 wRI4CoJk/h4Iu2bBjizGOxp/cLKlFrOQnrpsTSz8fEvS2hAlc8yFAF5sYmwjAbf2DisV ov9VC0LudZ67MEMdL2hZt0x798LgqM15VYA0x7D9XhnTmu3Doa42Y5cYCa7FQLsMAFY9 RWfnOofZFCQdpEbWc1udqHKeFxL7XGxo3xISsQt+hBN2F/R+zEnIg0u/esk+mv7PzRvb Qjng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F8G9ZMUp; 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 y14si1275600edm.154.2021.02.03.04.47.57; Wed, 03 Feb 2021 04:48:21 -0800 (PST) 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=F8G9ZMUp; 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 S230191AbhBCMrX (ORCPT + 99 others); Wed, 3 Feb 2021 07:47:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56096 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231286AbhBCMnZ (ORCPT ); Wed, 3 Feb 2021 07:43:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612356118; 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=TejRLSU/4tO3xbWCWCiZBCPi7mB6er1iGbgx5H+3dxg=; b=F8G9ZMUp0K/Ej/Z9o3diAxgFAwO1NqvLL2KyHmMFgk86WCPxZfQNSymZS8JjEjLQPMTKSY +wXy7bZV1ss0v2AlVRzyLyar7H9DF+0e3E0EZkeCllrB7bYE6sRy+ZukPJ+nDU5sCV0mFX x5RqSlVDXve44ePVecaDxqCv/yhrZvY= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-273-t93luqozMyWyMPNQtAZKwQ-1; Wed, 03 Feb 2021 07:41:56 -0500 X-MC-Unique: t93luqozMyWyMPNQtAZKwQ-1 Received: by mail-ej1-f71.google.com with SMTP id m4so11899190ejc.14 for ; Wed, 03 Feb 2021 04:41:56 -0800 (PST) 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=TejRLSU/4tO3xbWCWCiZBCPi7mB6er1iGbgx5H+3dxg=; b=kP9ky2Wh+yb//XIyqMggXPdWsmHlYmbZLbG3xuXRRWRiNbbaSduvp4E1KGFaMoiIWS Hn+fi96Nk4QKTUImutsESgGePw8TrAB650/CyQaoL1dACJWZNGnHW0E3fhVgUsgjzxPl XvSVKN4JzIo9+7JSBF1NrZRDtA9KUjNm0ld2GKcWZKhQXbpsRJwDsII3Wqjg6Frhg3s4 M6oA0MQ9oGW8iIsQ6NSgBy+tuX0ghxX1XISlqQs+Vg2WgpHkKJ2kWkHlZq1hvAo4cS/q oTLfRquT92otv9gaNF4MDXpq5UGPason/lKi5Ro/kaloKJEHww0FM3NkttUnRRSR0GTA W2QA== X-Gm-Message-State: AOAM530Wbyiv1aSOzFFwyxpicVx7/WDfGQpiTfg5z1qtJWifj/Oqmbjz ooXAiG3+lnyZxp9/EGa+pIlKL+rVS9ykJI6He1YelLUqMC5zNsxiDtx9I0qaN2tb1932yc0bu34 Qo8VId4kAnZgNWyYbOOHEDctX X-Received: by 2002:a17:906:af58:: with SMTP id ly24mr3082687ejb.208.1612356115159; Wed, 03 Feb 2021 04:41:55 -0800 (PST) X-Received: by 2002:a17:906:af58:: with SMTP id ly24mr3082673ejb.208.1612356114937; Wed, 03 Feb 2021 04:41:54 -0800 (PST) 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 u9sm953320ejc.57.2021.02.03.04.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 04:41:54 -0800 (PST) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 18/18] vfs: remove unused ioctl helpers Date: Wed, 3 Feb 2021 13:41:12 +0100 Message-Id: <20210203124112.1182614-19-mszeredi@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210203124112.1182614-1-mszeredi@redhat.com> References: <20210203124112.1182614-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 --- 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 6442d97d9a4a..8771d3edbd0b 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -2293,89 +2292,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 ca3bab7d5f6e..fc1727003f3a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3452,18 +3452,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.26.2