From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from eddie.linux-mips.org ([148.251.95.138] helo=cvs.linux-mips.org) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1hP28v-0004z3-BG for rauc@pengutronix.de; Fri, 10 May 2019 11:48:41 +0200 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23991965AbfEJJsj5hExN (ORCPT ); Fri, 10 May 2019 11:48:39 +0200 Date: Fri, 10 May 2019 11:48:38 +0200 From: Ladislav Michl Message-ID: <20190510094838.GB29451@lenoch> References: <20190510094803.GA29451@lenoch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190510094803.GA29451@lenoch> Subject: [RAUC] [PATCH 1/3] Normalize device names to find mounted slots (2) List-Id: RAUC Project - Discussion List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: rauc-bounces@pengutronix.de Sender: "RAUC" To: rauc@pengutronix.de Cc: Trent Piepho VGhpcyBvbmUgaXMgbWVhbnQgdG8gYmUgc3F1YXNoZWQgaW50byB0aGlzIG9uZToKaHR0cHM6Ly9n aXRodWIuY29tL3JhdWMvcmF1Yy9wdWxsLzQwNgotLS0KIHNyYy9jb25maWdfZmlsZS5jIHwgNjAg KysrKysrKysrKysrKysrKysrKysrKysrKystLS0tLS0tLS0tLS0tLS0tLS0tLS0KIDEgZmlsZSBj aGFuZ2VkLCAzMyBpbnNlcnRpb25zKCspLCAyNyBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9z cmMvY29uZmlnX2ZpbGUuYyBiL3NyYy9jb25maWdfZmlsZS5jCmluZGV4IDg3NWUwZWUuLmQ5NjY1 MzMgMTAwNjQ0Ci0tLSBhL3NyYy9jb25maWdfZmlsZS5jCisrKyBiL3NyYy9jb25maWdfZmlsZS5j CkBAIC00OTQsMzggKzQ5NCw0NC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