From patchwork Fri Dec 7 13:13:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1009409 X-Patchwork-Delegate: zajec5@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mro7tA60"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LQ3dNCPU"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43BCbJ6Gk2z9s3Z for ; Sat, 8 Dec 2018 00:13:48 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=iNJU3bleLAmOSWz7PKMhTNw6YxGOUircgme+2J7wglY=; b=mro7tA60yh+p4g zHN5e9eOcSP49rk2XBBGl1/jgTa7/gVrypJ+D6cVCUpLxx99MD8wxyqoKdAVkOxZ8Yc6XM49eU6S8 QM7eDX238vdtNsTEVlkudQdqoDmskaXyohiXJr9DCROz9O0IgJeouiZQeKxF8g8z8qr1Ka4SkNGHh w5KqHjLVAvw87esK7Y8dIRxvg9AKXBOQtcubEh4XSnFodKJgvkMcVREUHfw/7KUSZNEUvD36kYZ04 IPfK4alQlLJCHurRRGQ6N5ScwIZlYIMRiBZScjCuEVkfspmiw98IWn9ieJ5TeHryR9grMm2J+F0/7 cfnhYz3N/eO30GxGW8LA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gVFwr-00051E-Ld; Fri, 07 Dec 2018 13:13:41 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gVFwi-0004oA-Ew for openwrt-devel@lists.openwrt.org; Fri, 07 Dec 2018 13:13:38 +0000 Received: by mail-lf1-x12e.google.com with SMTP id u18so2976564lff.10 for ; Fri, 07 Dec 2018 05:13:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kfdmQgUQMncdProS+3r2eHqbQhs/e0+7Ypb4dE284U0=; b=LQ3dNCPUaDziQe0IQ7/vuqZsIGOOmf1xybC/sLBYXmjmrzTh8AUeCEX3+KwNr0SH81 5LIpWAInrpEXTvP3ngkRwHeHAPL9rpCRg6sgIhYAlAFjTguqEg4WMofpnYSP67WgT0IM EfA4/apQUnUrQkZXNUUKvA3t+iRfKgRFX6+Xn4CzJtYA64zp8irz0/959VuLRhOO3bbw kz7F0tHwUbSvXy0MPo88Zxy6VWWyXwGFeeyLyn//d8RUfHC3evVkIyKlP9KPZnza9Rnr CyMcBOKG2fFNmuourplJgYtsSzuQe0C36wSlg+YR6m7VCgD2zZ/Boshx3T7xlWqOWRrU B7gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kfdmQgUQMncdProS+3r2eHqbQhs/e0+7Ypb4dE284U0=; b=osaGTZ278XTfYsgEL302c24NLylimULZgXGbOihgIBVUcgf44kDqVhrZmvJMN7jBQG 2dpyop+dz6dYzFvclaWF7MnFfn488s6Wssyu2hvmlUMIbbvMNmt/W1hv50+FrTjjkxp6 lGOQvVwjxZqqggoIl3HgkLvUhQYr+i3KRkMkQGp5RZd7BHrfD5p8ho/Pc0S9RnNrp/0N WiFK1CGE7Ae7AfFK/Hhj6wuaqQRqDbzkDpD8bddoF1WmHULVB0OHEqEiMDEJ15Kwam0s CyrKXbtWEhIxSxNnGuSqukAr8FqawuUMpjKCy6gXE3xihY8K+uMAuJvm8RF+iJXFf4Vj EOGQ== X-Gm-Message-State: AA+aEWYn3LO5cdn+8TcrbnUR7JVDwoEO8QjrqKr9LPTrI4K83jX2IEvN 7GTz0XE7S3chgGs1Kta4g/55A+7V X-Google-Smtp-Source: AFSGD/XSDVUK08fznuByJ18gGWptUKe/Qkj7j1gNdxkyvSRk0EZcJkrELoFBDExXAJJzkNsb6HoweA== X-Received: by 2002:a19:9a8c:: with SMTP id c134mr1248462lfe.152.1544188399771; Fri, 07 Dec 2018 05:13:19 -0800 (PST) Received: from linux-veee.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id l3-v6sm567257ljg.21.2018.12.07.05.13.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Dec 2018 05:13:18 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: openwrt-devel@lists.openwrt.org Date: Fri, 7 Dec 2018 14:13:10 +0100 Message-Id: <20181207131310.12324-1-zajec5@gmail.com> X-Mailer: git-send-email 2.13.7 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181207_051332_959511_AD6B68D0 X-CRM114-Status: GOOD ( 10.22 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:12e listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (zajec5[at]gmail.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zajec5[at]gmail.com) 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH fstools] blockd: don't reparse blob msg in the vlist callbacks X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Rafał Miłecki ubus message is parsed in the block_hotplug() which fills all the struct device fields. Once that is done there is no need to parse original message again - it's enough to get required data from the struct. This also fixes handling messages with "autofs" set to 0. They were incorrectly interpreted due to the missing blobmsg_get_u32(). Signed-off-by: Rafał Miłecki Acked-by: John Crispin --- blockd.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/blockd.c b/blockd.c index 1379635..29d16f2 100644 --- a/blockd.c +++ b/blockd.c @@ -111,29 +111,19 @@ block(char *cmd, char *action, char *device) static void device_free(struct device *device) { - struct blob_attr *data[__MOUNT_MAX]; - - blobmsg_parse(mount_policy, __MOUNT_MAX, data, - blob_data(device->msg), blob_len(device->msg)); - - if (data[MOUNT_AUTOFS] && device->target) + if (device->autofs && device->target) unlink(device->target); } static void device_add(struct device *device) { - struct blob_attr *data[__MOUNT_MAX]; char path[64]; - blobmsg_parse(mount_policy, __MOUNT_MAX, data, - blob_data(device->msg), blob_len(device->msg)); - - if (!data[MOUNT_AUTOFS]) + if (!device->autofs) return; - snprintf(path, sizeof(path), "/tmp/run/blockd/%s", - blobmsg_get_string(data[MOUNT_DEVICE])); + snprintf(path, sizeof(path), "/tmp/run/blockd/%s", device->name); if (symlink(path, device->target)) ULOG_ERR("failed to symlink %s->%s\n", device->target, path); }