From patchwork Mon Mar 21 07:21:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 8629851 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 162069F8A8 for ; Mon, 21 Mar 2016 07:21:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B27C20279 for ; Mon, 21 Mar 2016 07:21:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4CB8C20274 for ; Mon, 21 Mar 2016 07:21:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752635AbcCUHV2 (ORCPT ); Mon, 21 Mar 2016 03:21:28 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:20300 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752281AbcCUHVX (ORCPT ); Mon, 21 Mar 2016 03:21:23 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u2L7LKbF031831 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 21 Mar 2016 07:21:20 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u2L7LJP5027262 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 21 Mar 2016 07:21:20 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u2L7LJ0s008024; Mon, 21 Mar 2016 07:21:19 GMT Received: from arch2.sg.oracle.com (/10.186.101.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Mar 2016 00:21:19 -0700 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH 4/6] btrfs-progs: move get_subvol_name() to utils.c Date: Mon, 21 Mar 2016 15:21:03 +0800 Message-Id: <1458544865-16467-5-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1458544865-16467-1-git-send-email-anand.jain@oracle.com> References: <1458137673-464-1-git-send-email-anand.jain@oracle.com> <1458544865-16467-1-git-send-email-anand.jain@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] 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=unavailable 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 Signed-off-by: Anand Jain --- cmds-send.c | 11 ----------- utils.c | 12 ++++++++++++ utils.h | 1 + 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmds-send.c b/cmds-send.c index 3e34d75bb834..7605ed94cd64 100644 --- a/cmds-send.c +++ b/cmds-send.c @@ -335,17 +335,6 @@ out: return ret; } -char *get_subvol_name(char *mnt, char *full_path) -{ - int len = strlen(mnt); - if (!len) - return full_path; - if (mnt[len - 1] != '/') - len += 1; - - return full_path + len; -} - static int init_root_path(struct btrfs_send *s, const char *subvol) { int ret = 0; diff --git a/utils.c b/utils.c index 110a4badb764..9aae7df04902 100644 --- a/utils.c +++ b/utils.c @@ -3156,3 +3156,15 @@ int test_issubvolume(const char *path) return (int)stfs.f_type == BTRFS_SUPER_MAGIC; } + +char *get_subvol_name(char *mnt, char *full_path) +{ + int len = strlen(mnt); + if (!len) + return full_path; + + if (mnt[len - 1] != '/') + len += 1; + + return full_path + len; +} diff --git a/utils.h b/utils.h index 32bb02005719..08543ff278ee 100644 --- a/utils.h +++ b/utils.h @@ -195,6 +195,7 @@ const char* group_profile_str(u64 flags); int test_minimum_size(const char *file, u32 leafsize); int test_issubvolname(const char *name); int test_issubvolume(const char *path); +char *get_subvol_name(char *mnt, char *full_path); int test_isdir(const char *path); /*