From patchwork Mon Feb 15 17:34:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 8317381 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 63D07C02AA for ; Mon, 15 Feb 2016 17:36:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 885282039C for ; Mon, 15 Feb 2016 17:36:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4F78202E5 for ; Mon, 15 Feb 2016 17:36:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753639AbcBORfc (ORCPT ); Mon, 15 Feb 2016 12:35:32 -0500 Received: from mx2.suse.de ([195.135.220.15]:34966 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751742AbcBOReu (ORCPT ); Mon, 15 Feb 2016 12:34:50 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 69AC4ACCC; Mon, 15 Feb 2016 17:34:49 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 6A442DA9DC; Mon, 15 Feb 2016 18:34:46 +0100 (CET) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba , anand.jain@oracle.com Subject: [PATCH 15/15] btrfs: rename flags for vol args v2 Date: Mon, 15 Feb 2016 18:34:46 +0100 Message-Id: <533b0847dc15f8d719aaf6198cf18953899f2164.1455556900.git.dsterba@suse.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Rename BTRFS_DEVICE_BY_ID so it's more descriptive that we specify the device by id, it'll be part of the public API. The mask of supported flags is also renamed, only for internal use. The error code for unknown flags is EOPNOTSUPP, fixed. Signed-off-by: David Sterba Reviewed-by: Anand Jain --- fs/btrfs/ioctl.c | 8 ++++---- include/uapi/linux/btrfs.h | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 57fb05960435..6bcd7700b9fd 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2689,8 +2689,8 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg) } /* Check for compatibility reject unknown flags */ - if (vol_args->flags & ~BTRFS_VOL_ARG_V2_FLAGS) - return -ENOTTY; + if (vol_args->flags & ~BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED) + return -EOPNOTSUPP; if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, 1)) { @@ -2699,7 +2699,7 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg) } mutex_lock(&root->fs_info->volume_mutex); - if (vol_args->flags & BTRFS_DEVICE_BY_ID) { + if (vol_args->flags & BTRFS_DEVICE_SPEC_BY_ID) { ret = btrfs_rm_device(root, NULL, vol_args->devid); } else { vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; @@ -2709,7 +2709,7 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg) atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); if (!ret) { - if (vol_args->flags & BTRFS_DEVICE_BY_ID) + if (vol_args->flags & BTRFS_DEVICE_SPEC_BY_ID) btrfs_info(root->fs_info, "device deleted: id %llu", vol_args->devid); else diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h index 396a4efca775..3975e683af72 100644 --- a/include/uapi/linux/btrfs.h +++ b/include/uapi/linux/btrfs.h @@ -36,12 +36,13 @@ struct btrfs_ioctl_vol_args { #define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0) #define BTRFS_SUBVOL_RDONLY (1ULL << 1) #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) -#define BTRFS_DEVICE_BY_ID (1ULL << 3) -#define BTRFS_VOL_ARG_V2_FLAGS \ +#define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3) + +#define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED \ (BTRFS_SUBVOL_CREATE_ASYNC | \ BTRFS_SUBVOL_RDONLY | \ BTRFS_SUBVOL_QGROUP_INHERIT | \ - BTRFS_DEVICE_BY_ID) + BTRFS_DEVICE_SPEC_BY_ID) #define BTRFS_FSID_SIZE 16 #define BTRFS_UUID_SIZE 16