Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1243115ybt; Tue, 7 Jul 2020 10:49:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyl++dFQ1SMZwzfNc5x3FEsKmZp/PgdSFleDSSMOI3REhh+aRCBFoT9GERrGOnbzgJYwRuW X-Received: by 2002:a17:907:11ce:: with SMTP id va14mr38798724ejb.189.1594144167222; Tue, 07 Jul 2020 10:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594144167; cv=none; d=google.com; s=arc-20160816; b=oeu1kBkyDHSFy7Xx4rLJfA8gqVzU/1847V4/JLxGxGoDseDihxqYir6VOcm9NUlgSX Hc1vrI8phRDhj61rCuwMeBjFp6ykF7Ilh+jTCkZXsWNWgNDzLaN4AwcXBLidf7QCBZSI Xp6gouFGa58hbkX5v9VXlDNpGdKbiKlXJB092PHbiG2UpPjWbfyPejd5Jwd0EDGKcz6L 6iJ7NGI3QIFuAl9+KORobZ0F4AsIzQpyQy6oP6zrceMEe+NUqftmT7bTkyUrt6Kqw4Og XCL4Psm7+7CH16iawAZE7whGnpcl1CXrwBE6eXV2sXjjgJck/KVnkatg8JoKbW5QV7cS 6YCg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NA8lGOC4BC4BRu8ev38I4oygB9glKOvDb9c92iDVn1E=; b=Of43zEX/bd4St643mD/6Zi8mk/llyCzRlju2jXeFlnD/mxEusRCYfamgHlKUpYb1RC QSIea9Is/Hv1SaKIDZI2KvANcmej7cZ3b1EaebNrLWDiUoHAOMSf8mM2ybsd5WwhgsWo QGZeXg7iHPJ3HgOemchyQOq6fu0fkccqsFmDnw2yTieRlnDG/vnuTUS00MwkV/4Y/8Ao /fjZG1ASGEl70EVlDGvZ3PXBX1rG0nCkR9waZRWuhWs3Jdyk67QDVUcxSU4hKmYX2Gs+ r/1GxQFj7Wa2gj57Dim6jv6206Grd7ooaqeZLUHAof2eGHKaW1zLzZQ/lBDxGqke42z8 BsIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=lCeLmb3s; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z16si14512250eju.554.2020.07.07.10.49.03; Tue, 07 Jul 2020 10:49:27 -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=fail header.i=@infradead.org header.s=casper.20170209 header.b=lCeLmb3s; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728709AbgGGRsm (ORCPT + 99 others); Tue, 7 Jul 2020 13:48:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728677AbgGGRsg (ORCPT ); Tue, 7 Jul 2020 13:48:36 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33535C061755; Tue, 7 Jul 2020 10:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=NA8lGOC4BC4BRu8ev38I4oygB9glKOvDb9c92iDVn1E=; b=lCeLmb3suH99pmI4X62B5drqwA skczlsEs84laHHAjzSZxxIU1lj5lkgaZnsQufQV5oNCs7YmlGFZSbWS/9NXYYCc7i+Y1TdwMyKHxd DAJ4gI9vYovb+nxyuo1L5n8DNSlkJdQCYuimkIe3Tukah4QcodtAywbWWrd7rp1wOezvaWKDeMVSB fSGQoGUvGk0kPFIusTE0bHnu7+v7xSkfEHzTVOL7FKcE/vHTSTI9ogb1z9f4uq7BIsq/aNDV4PrSg dVxeQEI4W4gKTGUzZQ2HPklSAIeK8I3UfZBX5qkkpX7Dr8LUGXei+nIEdfVH5L+JTnfwQIg1tXViv 9NIbfKwA==; Received: from [2001:4bb8:18c:3b3b:a49f:8154:a2b7:8b6c] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsrhk-0003LU-0Y; Tue, 07 Jul 2020 17:48:28 +0000 From: Christoph Hellwig To: Al Viro , Linus Torvalds , Stephen Rothwell Cc: Luis Chamberlain , Matthew Wilcox , Kees Cook , Iurii Zaikin , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 17/23] proc: cleanup the compat vs no compat file ops Date: Tue, 7 Jul 2020 19:47:55 +0200 Message-Id: <20200707174801.4162712-18-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200707174801.4162712-1-hch@lst.de> References: <20200707174801.4162712-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of providing a special no-compat version provide a special compat version for operations with ->compat_ioctl. Signed-off-by: Christoph Hellwig --- fs/proc/inode.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 016b1302cbabc0..93dd2045737504 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -572,9 +572,6 @@ static const struct file_operations proc_reg_file_ops = { .write = proc_reg_write, .poll = proc_reg_poll, .unlocked_ioctl = proc_reg_unlocked_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = proc_reg_compat_ioctl, -#endif .mmap = proc_reg_mmap, .get_unmapped_area = proc_reg_get_unmapped_area, .open = proc_reg_open, @@ -582,12 +579,13 @@ static const struct file_operations proc_reg_file_ops = { }; #ifdef CONFIG_COMPAT -static const struct file_operations proc_reg_file_ops_no_compat = { +static const struct file_operations proc_reg_file_ops_compat = { .llseek = proc_reg_llseek, .read = proc_reg_read, .write = proc_reg_write, .poll = proc_reg_poll, .unlocked_ioctl = proc_reg_unlocked_ioctl, + .compat_ioctl = proc_reg_compat_ioctl, .mmap = proc_reg_mmap, .get_unmapped_area = proc_reg_get_unmapped_area, .open = proc_reg_open, @@ -646,8 +644,8 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) inode->i_op = de->proc_iops; inode->i_fop = &proc_reg_file_ops; #ifdef CONFIG_COMPAT - if (!de->proc_ops->proc_compat_ioctl) - inode->i_fop = &proc_reg_file_ops_no_compat; + if (de->proc_ops->proc_compat_ioctl) + inode->i_fop = &proc_reg_file_ops_compat; #endif } else if (S_ISDIR(inode->i_mode)) { inode->i_op = de->proc_iops; -- 2.26.2