From patchwork Tue Oct 7 00:08:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 5043851 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 446219F30B for ; Tue, 7 Oct 2014 08:03:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 59D6420148 for ; Tue, 7 Oct 2014 08:03:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66B012015E for ; Tue, 7 Oct 2014 08:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752915AbaJGIDb (ORCPT ); Tue, 7 Oct 2014 04:03:31 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:45240 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752784AbaJGID0 (ORCPT ); Tue, 7 Oct 2014 04:03:26 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s9783Lol030427 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 7 Oct 2014 08:03:22 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s9783Kq6007017 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Oct 2014 08:03:21 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s9783K77024575; Tue, 7 Oct 2014 08:03:20 GMT Received: from OL.sg.oracle.com (/10.186.101.34) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 07 Oct 2014 01:03:20 -0700 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH] btrfs-progs: btrfs_scan_block_devices is unused function delete it Date: Tue, 7 Oct 2014 08:08:31 +0800 Message-Id: <1412640511-21840-1-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 2.0.0.153.g79dcccc In-Reply-To: <1410571282-3482-4-git-send-email-anand.jain@oracle.com> References: <1410571282-3482-4-git-send-email-anand.jain@oracle.com> X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY,URIBL_RHS_DOB 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 After Patch: remove BTRFS_SCAN_PROC scan method There isn't any consumer for btrfs_scan_block_devices() so delete it. Signed-off-by: Anand Jain --- utils.c | 83 ----------------------------------------------------------------- utils.h | 1 - 2 files changed, 84 deletions(-) diff --git a/utils.c b/utils.c index 48d2d9a..b23f332 100644 --- a/utils.c +++ b/utils.c @@ -1542,89 +1542,6 @@ int set_label(const char *btrfs_dev, const char *label) return ret; } -int btrfs_scan_block_devices(int run_ioctl) -{ - - struct stat st; - int ret; - int fd; - struct btrfs_fs_devices *tmp_devices; - u64 num_devices; - FILE *proc_partitions; - int i; - char buf[1024]; - char fullpath[110]; - int scans = 0; - int special; - -scan_again: - proc_partitions = fopen("/proc/partitions","r"); - if (!proc_partitions) { - fprintf(stderr, "Unable to open '/proc/partitions' for scanning\n"); - return -ENOENT; - } - /* skip the header */ - for (i = 0; i < 2; i++) - if (!fgets(buf, 1023, proc_partitions)) { - fprintf(stderr, - "Unable to read '/proc/partitions' for scanning\n"); - fclose(proc_partitions); - return -ENOENT; - } - - strcpy(fullpath,"/dev/"); - while(fgets(buf, 1023, proc_partitions)) { - i = sscanf(buf," %*d %*d %*d %99s", fullpath+5); - - /* - * multipath and MD devices may register as a btrfs filesystem - * both through the original block device and through - * the special (/dev/mapper or /dev/mdX) entry. - * This scans the special entries last - */ - special = strncmp(fullpath, "/dev/dm-", strlen("/dev/dm-")) == 0; - if (!special) - special = strncmp(fullpath, "/dev/md", strlen("/dev/md")) == 0; - - if (scans == 0 && special) - continue; - if (scans > 0 && !special) - continue; - - ret = lstat(fullpath, &st); - if (ret < 0) { - fprintf(stderr, "failed to stat %s\n", fullpath); - continue; - } - if (!S_ISBLK(st.st_mode)) { - continue; - } - - fd = open(fullpath, O_RDONLY); - if (fd < 0) { - if (errno != ENOMEDIUM) - fprintf(stderr, "failed to open %s: %s\n", - fullpath, strerror(errno)); - continue; - } - ret = btrfs_scan_one_device(fd, fullpath, &tmp_devices, - &num_devices, - BTRFS_SUPER_INFO_OFFSET, 0); - if (ret == 0 && run_ioctl > 0) { - btrfs_register_one_device(fullpath); - } - close(fd); - } - - fclose(proc_partitions); - - if (scans == 0) { - scans++; - goto scan_again; - } - return 0; -} - /* * A not-so-good version fls64. No fascinating optimization since * no one except parse_size use it diff --git a/utils.h b/utils.h index 1536469..e332fd1 100644 --- a/utils.h +++ b/utils.h @@ -100,7 +100,6 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_bytes, unsigned unit_mo }) int get_mountpt(char *dev, char *mntpt, size_t size); -int btrfs_scan_block_devices(int run_ioctl); u64 parse_size(char *s); u64 arg_strtou64(const char *str); int open_file_or_dir(const char *fname, DIR **dirstream);