From patchwork Mon Oct 23 21:40:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10023187 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B9575603D7 for ; Mon, 23 Oct 2017 21:42:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB76128921 for ; Mon, 23 Oct 2017 21:42:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A05522894F; Mon, 23 Oct 2017 21:42:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E03D28932 for ; Mon, 23 Oct 2017 21:42:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932176AbdJWVmw (ORCPT ); Mon, 23 Oct 2017 17:42:52 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:45676 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932244AbdJWVml (ORCPT ); Mon, 23 Oct 2017 17:42:41 -0400 Received: by mail-io0-f193.google.com with SMTP id i38so21713958iod.2; Mon, 23 Oct 2017 14:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=q4ysmxM1Tc8eT1daOT1MgVemWjX6+/LfBa3mlqqW5UI=; b=upHOoXMzBopebaQdaFztRT7emgSQ3m9N/DGoH0rDp15I/217Vjv8l2lc2bIo0r5xM1 F917nKkqT4WktmiC64Z2T/gZC0CTA57BbNFAfrrmcSwFp1RfL01faY+vW7sfLDQrVsIr JVQjLKsCsPDFq9+DpN/9C4xW+6yery4+pW1vg5XxjaN5wYlEAwX3ARiAa42ypVMHFxGC X9SshHuMYLxFWa8eJx0uNfDUwXQoxJ/sRW/REbZFr94jKqTkIAavukU6QjcCEuoY8IaU MSTH5ey8FB+aWXDf/qcuUwGHt3Xw44ZP5vS4ZQjTpAKm71F4NO31XrnDi58Ja9Re9jtX 0uPQ== 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; bh=q4ysmxM1Tc8eT1daOT1MgVemWjX6+/LfBa3mlqqW5UI=; b=EgRnRKceGrTLYC2rwUdVOVZNZLm8n1yQIo+zPJqEF8q/EAn5H9mcY5WglY7ww8/QLp HuuX77TFjso1vxlJgZS5WkNFUGfGSRaJ70qf967VAO+rwipkRmYWdUyopMW/ar8+3tyv Lrtzp+KQ1BVPQDIQjrFJzzeGS5r80uoGSxuJpEu1wzXycYSohuwcrE++BNH2zTMER3BH w9kwaQGMt9xjm9g36lXZw4jbgeD0me53UsJo/EXuI3WzKotjgUpXjBawLRE43b+WTvGY 1KxLyXcmwnbinOQbIPsnv23WGDKpeLnGcZUVaEJ+kw6DBKxXnTHGOaTozvrJb4utJIxj /lUQ== X-Gm-Message-State: AMCzsaXABQCgetbvxmWnhUnXsGwQnakPomwZWrVKfdP0Hc1Y17OI7g15 0/AWH74foAS/OUJVmtp7sqnOo0b1 X-Google-Smtp-Source: ABhQp+RuKIGNC4ir0VKFmsI9dyfMpyICcYq5Bu/hz1SRAzQQT2INFz4DqV4Iy9bJ/aCZbZa7+iJAnQ== X-Received: by 10.107.186.87 with SMTP id k84mr19309825iof.121.1508794960096; Mon, 23 Oct 2017 14:42:40 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.175.88]) by smtp.gmail.com with ESMTPSA id i63sm3558482ioi.68.2017.10.23.14.42.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Oct 2017 14:42:39 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, linux-api@vger.kernel.org, keyrings@vger.kernel.org, "Theodore Y . Ts'o" , Jaegeuk Kim , Gwendal Grignou , Ryo Hashimoto , Sarthak Kukreti , Nick Desaulniers , Michael Halcrow , Eric Biggers Subject: [RFC PATCH 23/25] f2fs crypto: wire up FS_IOC_GET_ENCRYPTION_POLICY_EX Date: Mon, 23 Oct 2017 14:40:56 -0700 Message-Id: <20171023214058.128121-24-ebiggers3@gmail.com> X-Mailer: git-send-email 2.15.0.rc0.271.g36b669edcc-goog In-Reply-To: <20171023214058.128121-1-ebiggers3@gmail.com> References: <20171023214058.128121-1-ebiggers3@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers FS_IOC_GET_ENCRYPTION_POLICY_EX allows filesystem encryption users to retrieve the encryption policy for files and directories that use a v2 encryption policy. Unlike the original FS_IOC_GET_ENCRYPTION_POLICY, FS_IOC_GET_ENCRYPTION_POLICY_EX is also extensible to new versions of the policy struct that may be added in the future. Signed-off-by: Eric Biggers --- fs/f2fs/file.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 0296a9594fe7..68b6ba732f25 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1887,11 +1887,6 @@ static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long arg) return fscrypt_ioctl_set_policy(filp, (const void __user *)arg); } -static int f2fs_ioc_get_encryption_policy(struct file *filp, unsigned long arg) -{ - return fscrypt_ioctl_get_policy(filp, (void __user *)arg); -} - static int f2fs_ioc_get_encryption_pwsalt(struct file *filp, unsigned long arg) { struct inode *inode = file_inode(filp); @@ -2647,10 +2642,12 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) return f2fs_ioc_fitrim(filp, arg); case F2FS_IOC_SET_ENCRYPTION_POLICY: return f2fs_ioc_set_encryption_policy(filp, arg); - case F2FS_IOC_GET_ENCRYPTION_POLICY: - return f2fs_ioc_get_encryption_policy(filp, arg); case F2FS_IOC_GET_ENCRYPTION_PWSALT: return f2fs_ioc_get_encryption_pwsalt(filp, arg); + case F2FS_IOC_GET_ENCRYPTION_POLICY: + return fscrypt_ioctl_get_policy(filp, (void __user *)arg); + case FS_IOC_GET_ENCRYPTION_POLICY_EX: + return fscrypt_ioctl_get_policy_ex(filp, (void __user *)arg); case FS_IOC_ADD_ENCRYPTION_KEY: return fscrypt_ioctl_add_key(filp, (void __user *)arg); case FS_IOC_REMOVE_ENCRYPTION_KEY: @@ -2737,6 +2734,7 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case F2FS_IOC_SET_ENCRYPTION_POLICY: case F2FS_IOC_GET_ENCRYPTION_PWSALT: case F2FS_IOC_GET_ENCRYPTION_POLICY: + case FS_IOC_GET_ENCRYPTION_POLICY_EX: case FS_IOC_ADD_ENCRYPTION_KEY: case FS_IOC_REMOVE_ENCRYPTION_KEY: case FS_IOC_GET_ENCRYPTION_KEY_STATUS: