From patchwork Tue Mar 6 08:33:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 10260939 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 6CA4B60211 for ; Tue, 6 Mar 2018 08:33:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5844828E9B for ; Tue, 6 Mar 2018 08:33:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D48D28E9D; Tue, 6 Mar 2018 08:33:59 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 C976C28E9B for ; Tue, 6 Mar 2018 08:33:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750907AbeCFId5 (ORCPT ); Tue, 6 Mar 2018 03:33:57 -0500 Received: from mgwkm04.jp.fujitsu.com ([202.219.69.171]:11073 "EHLO mgwkm04.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750769AbeCFId4 (ORCPT ); Tue, 6 Mar 2018 03:33:56 -0500 Received: from kw-mxq.gw.nic.fujitsu.com (unknown [192.168.231.130]) by mgwkm04.jp.fujitsu.com with smtp id 58f6_a6e0_c1a92565_8bc5_4817_b773_1794c67c79c4; Tue, 06 Mar 2018 17:33:50 +0900 Received: from g01jpfmpwyt02.exch.g01.fujitsu.local (g01jpfmpwyt02.exch.g01.fujitsu.local [10.128.193.56]) by kw-mxq.gw.nic.fujitsu.com (Postfix) with ESMTP id 26D7AAC00C9 for ; Tue, 6 Mar 2018 17:33:50 +0900 (JST) Received: from g01jpexchyt36.g01.fujitsu.local (unknown [10.128.193.4]) by g01jpfmpwyt02.exch.g01.fujitsu.local (Postfix) with ESMTP id 55E675842B7 for ; Tue, 6 Mar 2018 17:33:49 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.5.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20170217-enc X-SHieldMailCheckerMailID: 4d960a6c1ef34460a35e4259cbbcc41b Subject: [RFC PATCH 1/7] btrfs-progs: Add 2 definitions of new unprivileged ioctl From: "Misono, Tomohiro" To: linux-btrfs References: <94a0bad6-d696-a72e-ba7b-287d1d442997@jp.fujitsu.com> Message-ID: Date: Tue, 6 Mar 2018 17:33:45 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <94a0bad6-d696-a72e-ba7b-287d1d442997@jp.fujitsu.com> Content-Language: en-US X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add 2 definitions of new unprivileged ioctl (BTRFS_IOC_GET_SUBVOL_INFO and BTRFS_IOC_INO_LOOKUP_USER). They will be used to implement user version of "btrfs subvolume list" etc. Signed-off-by: Tomohiro Misono --- ioctl.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ioctl.h b/ioctl.h index 709e996f..c5181dd9 100644 --- a/ioctl.h +++ b/ioctl.h @@ -320,6 +320,21 @@ struct btrfs_ioctl_ino_lookup_args { }; BUILD_ASSERT(sizeof(struct btrfs_ioctl_ino_lookup_args) == 4096); +#define BTRFS_INO_LOOKUP_USER_PATH_MAX (4072-BTRFS_VOL_NAME_MAX) +struct btrfs_ioctl_ino_lookup_user_args { + /* in */ + __u64 treeid; + /* in, 'dirid' is the same as objectid in btrfs_ioctl_ino_lookup_args */ + __u64 dirid; + /* in, subvolume id */ + __u64 subid; + /* out, name of the subvolume whose objectid is 'subid' */ + char name[BTRFS_VOL_NAME_MAX]; + /* out, 'path' is the same as 'name' in btrfs_ioctl_ino_lookup_args */ + char path[BTRFS_INO_LOOKUP_USER_PATH_MAX]; +}; +BUILD_ASSERT(sizeof(struct btrfs_ioctl_ino_lookup_user_args) == 4096); + struct btrfs_ioctl_search_key { /* which root are we searching. 0 is the tree of tree roots */ __u64 tree_id; @@ -828,6 +843,10 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code) struct btrfs_ioctl_feature_flags[3]) #define BTRFS_IOC_RM_DEV_V2 _IOW(BTRFS_IOCTL_MAGIC, 58, \ struct btrfs_ioctl_vol_args_v2) +#define BTRFS_IOC_GET_SUBVOL_INFO _IOWR(BTRFS_IOCTL_MAGIC, 60, \ + struct btrfs_ioctl_search_args) +#define BTRFS_IOC_INO_LOOKUP_USER _IOWR(BTRFS_IOCTL_MAGIC, 61, \ + struct btrfs_ioctl_ino_lookup_args) #ifdef __cplusplus } #endif