From patchwork Wed Jun 22 07:51:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: olivier.hardouin@gmail.com X-Patchwork-Id: 639008 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (caladan.dune.hu [78.24.191.180]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rZGyK24crz9t0X for ; Wed, 22 Jun 2016 17:51:52 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=UwQYv0AU; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 915C2B91684; Wed, 22 Jun 2016 09:51:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP; Wed, 22 Jun 2016 09:51:44 +0200 (CEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id A523CB9167F for ; Wed, 22 Jun 2016 09:51:42 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .gmail. - helo: .mail-lb0-f195.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -7 Received: from mail-lb0-f195.google.com (mail-lb0-f195.google.com [209.85.217.195]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Wed, 22 Jun 2016 09:51:41 +0200 (CEST) Received: by mail-lb0-f195.google.com with SMTP id ur4so3387526lbc.3 for ; Wed, 22 Jun 2016 00:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GcfhvbapVoWjA6jvJSAh1ILb4+ZZ7KjBhvhJqhLLqG4=; b=UwQYv0AUteAmWD9iMLf+TH6md+VMkS7ID59pWIKHJAGhXg5O/KwsF4/8lPM5Ehyrot S3roUpSWilDXMKV0JaVuRchusyqET32EUszc0/AFnrZ012d78ghsXcbTIINx+cnoY6L1 Q+qHyUWWNdz2PmSPzk+eg4wkfGpC8IZ1jBMO8gT9F9FRJD1ZyYfGleHPJsetRCmk54st 8jUMjz2L/ObFGByz3ALHVwiLJUxt/R2wmWwe6/LNvynrn9pnJ0AjPWBIJb+P+RNS0gl4 krrU525QKyDRsJTCl6qzvNJaiCoHUrvXxHxJyQNrWjV4UQTwVv5Qomr8OAIN2rt+5ut1 US/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GcfhvbapVoWjA6jvJSAh1ILb4+ZZ7KjBhvhJqhLLqG4=; b=g0/P82HnVbtU17v5mBwT6zIJ/mqHppX5+PamH6Ox4agXxkNWA2hQk/3PWcgvjDx4Uv PXNfSTTP7DYN20NjZDnZAwjMETqwiQufLNkhS1b4csbftfgjAt2uQUnKEsxdGsffJudK UvWNAfo+5aJs4ire0MLmJiJvnmerolT70DqepzQSmj3rzjsugCO89yzynfiTJbPnLcU8 QpkgLSwPLPd32I5wVYma2lAhgYq7fOvgS61FsnOEMWfwFV311jTHYaFhlSce9HJa8TOt pdI4CWub+U3v+QK7Tjf8CavNF9RNMzatQe7Ly3sEws7dFiSo8w7Ie2GGVUolfYXZBL/t IXug== X-Gm-Message-State: ALyK8tLdXYgzB+eYuK7Zw0FwatKtCt6bzPiD+EjLtOEw/RulsQQOnPY9SxK+/0GOWGDpoQ== X-Received: by 10.194.243.101 with SMTP id wx5mr22966074wjc.132.1466581900762; Wed, 22 Jun 2016 00:51:40 -0700 (PDT) Received: from ubuntu32bits.eu.thmulti.com ([91.183.48.131]) by smtp.gmail.com with ESMTPSA id x128sm6758820wmf.6.2016.06.22.00.51.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Jun 2016 00:51:40 -0700 (PDT) From: olivier.hardouin@gmail.com To: openwrt-devel@lists.openwrt.org, lede-dev@lists.infradead.org Date: Wed, 22 Jun 2016 09:51:19 +0200 Message-Id: <1466581879-9862-2-git-send-email-olivier.hardouin@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466581879-9862-1-git-send-email-olivier.hardouin@gmail.com> References: <1466581879-9862-1-git-send-email-olivier.hardouin@gmail.com> Subject: [OpenWrt-Devel] [PATCH mountd 2/2] support for disk without partition table X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" if no partition found, try to mount the block device itself Signed-off-by: Olivier Hardouin --- mount.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mount.c b/mount.c index 0c2862a..7cbb8ff 100644 --- a/mount.c +++ b/mount.c @@ -693,13 +693,19 @@ static void mount_enum_drives(void) char tmp[64]; snprintf(tmp, 64, "/sys/block/%s/", namelist[n]->d_name); m = scandir(tmp, &namelist2, dir_filter2, dir_sort); - while(m--) + if(m > 0) { - strncpy(&block[blk_cnt][0], namelist2[m]->d_name, MAX_BLOCK); + while(m--) + { + strncpy(&block[blk_cnt][0], namelist2[m]->d_name, MAX_BLOCK); + blk_cnt++; + free(namelist2[m]); + } + free(namelist2); + } else { + strncpy(&block[blk_cnt][0], namelist[n]->d_name, MAX_BLOCK); blk_cnt++; - free(namelist2[m]); } - free(namelist2); } free(namelist[n]); }