From patchwork Mon Aug 2 14:43:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Gaudig X-Patchwork-Id: 1512454 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::43a; helo=mail-wr1-x43a.google.com; envelope-from=swupdate+bncbaabbhejuceamgqe2gj4bzy@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=ISZd5F/2; dkim-atps=neutral Received: from mail-wr1-x43a.google.com (mail-wr1-x43a.google.com [IPv6:2a00:1450:4864:20::43a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gdgjr6KJ8z9sRK for ; Tue, 3 Aug 2021 00:43:44 +1000 (AEST) Received: by mail-wr1-x43a.google.com with SMTP id c5-20020adfed850000b02901537ecbecc6sf6498539wro.19 for ; Mon, 02 Aug 2021 07:43:43 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1627915421; cv=pass; d=google.com; s=arc-20160816; b=rpy1xqyGyWLER/Uq24ZXwVQaIQQiFwFWyH6E9kLGqGaDMTDihkpYgqdWAlSmiocwo5 NSYgVHr4k960+BuH9Gq/I95fCWW3+GK/tzK00e3kIoJ4vKqzyUnFhd7rTyNRhgP3btCw nNi8IWoSScrNkZsNey68pjMmUs3CR1MgH1oB3Kv+SnqnDdWsHIxXf5fmAYj0hX9jildk ftXpLuUOZDNVgnFnNTqY9BWHIE1GvtJ2cZXQK4WojV3LAZQNv0wz5v0Ai1B3yzWl9ioo L9jOpgf7+kJODc/Q9OC5Gy3DxqWhE7zUGP6dhzLwnHUC058h32bFZdT0tIEh9RiaCOaO cwyg== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=2zHr75tfn3Y7NwGvrfvR8mMUCmubfadiNEDjw2rTPzY=; b=PjUjkRPpwrtXTCsRUD8fwaUGQnimTL2UhsZ+FG0ks36VnCEuNNRMrc3cagjhakTyVV E+UUtSpOvvEX/3uKyZ/zldE+H2xXEt9ssplVQwspzSLEHM7w72IvzLI1cktUh/7h4wiV fmw55j2XOW+3InOUHtSrpsbYWji5dUAxLVrK0TLFRAMukC1QGNk7gbeXUc4ier5i2Xvf w8wJfWPvptOveB1v2Ip8j9yD8C9p+vTzPsw8GJ9Hxx4RQiO14XESeb4r0ACflTQuRxku rW3vngYEuvEmGlWhqJFeVW9D5pffdLlPromMeevAz5IIoT/hGAb2B/UskUPq7C0aF3qu pg7A== ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@weidmueller.onmicrosoft.com header.s=selector1-weidmueller-onmicrosoft-com header.b=CCHQ+2Ix; arc=pass (i=1 spf=pass spfdomain=weidmueller.com dkim=pass dkdomain=weidmueller.com dmarc=pass fromdomain=weidmueller.com); spf=pass (google.com: domain of roland.gaudig-oss@weidmueller.com designates 40.107.8.55 as permitted sender) smtp.mailfrom=roland.gaudig-oss@weidmueller.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=weidmueller.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=2zHr75tfn3Y7NwGvrfvR8mMUCmubfadiNEDjw2rTPzY=; b=ISZd5F/2Nedeo86CeKWMxrEMcgoG7ZGaXOOaXYCBFkMnLYnKSLcVq+/3XXHNgvFnTV gBTXaWXJQkaD6wpD+opWUzn7x1MZn0Ct5W0U+T5Xt7rn/SF+pc7u/H0wFVDllehQrBwD CFLIVnGTRDdxZtV7tkRLY68SsYzXUAtb4J6TSFTtlQZS42NwfjuRRCnh9aDJoZPKqnOE Vfx4+u/XsVtYc3QquW1+Jw71N0ECEkJKSBW4JTZwqpJFeBvM78A++rOLh9auAJSEDlfL oDMtGbmjka/IuVDEchpKjmyETSWEY6NZ0OSqnzMLDy+XYDNEBlf9gctRhwBbnz5JZpAt PZqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=2zHr75tfn3Y7NwGvrfvR8mMUCmubfadiNEDjw2rTPzY=; b=RPvZPNTFmA3VXTrrnFX9lwGwATUGTCqPgmZm4W2SAwSsVUcf0OtAQO72bMV8HkFQEF ezK/x0XYFY/cCpi8GqW7722XgUlY/8nmYsnyxP+tY53DjdM5SJFfdiPEWf4Da7+QYal2 Ib2yLAiXdq6/TPR7dec7GDdv91lbP/QfsLDPwr6IZ8RVuvTS6/JcEIHvPNNq8Nl7uEmZ HqeUxDppyQxyduKuROz5YELB2Eqkz+qDfOh7N1gHNllqnABDK6TtBtclmTzUlE9QRLW2 S7drmhfrtKsGw8gaC7M4UcDHfE6rqUaV+xYEGCilV63rrRerGrKAwFeLpv+jZMN9GKI5 +03Q== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM5300NFXr6AyNlR84xE6gcvHE2UQyH2RuBLd7lN7luKFBIdlRWy0p x1VitrGc6dif8hQxagU3HHE= X-Google-Smtp-Source: ABdhPJxMT5pjA88Z6yanJA0V/menYSqlFlUWsE4JvUsOFMcFez0NaqWqYRlzB6vfluqzDZ0Rcvw5BQ== X-Received: by 2002:adf:f80f:: with SMTP id s15mr17823336wrp.330.1627915420932; Mon, 02 Aug 2021 07:43:40 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:adf:a2cf:: with SMTP id t15ls746136wra.0.gmail; Mon, 02 Aug 2021 07:43:40 -0700 (PDT) X-Received: by 2002:adf:e5cf:: with SMTP id a15mr17991413wrn.362.1627915420250; Mon, 02 Aug 2021 07:43:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1627915420; cv=pass; d=google.com; s=arc-20160816; b=R69Je2yXe0hivAro0jX23g5Lll5gtmP6cNTlz39fDcSeSJHkfOisOcHrPekhB9Gr64 9Ws6X/WePcwwP4mBd2JOiEn95AW1BJZWWJOWQIG9JKCvF56EfiFJuDRiC0W5EWzQLAA3 r8UM/VJzIp2rlYZ0u8nCVqg+eBuZSbu56zCU3FmlS1a8vVOeWJv0I1WluvAOHBaR47Oi S63x737Y8fZoIK1A4Apisr491cGgNP2OuMmtu7yAZgtnkTKjA5V83YVbUqX0K7qFHOmp LXtlVHDuLsrv5tcwzdaBRUwJySmwVDYx3XNdkEMvGE7mc55k5z7sXWxxIA5oaggSn35O TVgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=5G4nU89ttNXAa3QhjqpCk8qFIpBbvkB4RS0w2Ejeotk=; b=zNcpSKZHx+GA5fxD7lCRWLgeMlq8XCopPCv4DlFqhRHx03CTdISUwBnnwZ5rQjyAnj GCiXSQ/foq5cwBmwmrM7OD0TcQIaIrj0kqhlDA6w8WgBXpmjskY8nKHnOLs8rv76pQR9 Ozktrkqfm5dYYVzpOwSBEyEmRUx1SseiGcLi511myaVC9Za+/MjS5KQHL3aLHq+n/03J 6wgnhyoXONv6A/HmoTngfznMEvhwQ+yShUXD5IbSMguNksQoADZ9XReTxTSbJV5AEQAe 3Sc4OufxDtIW2p2FJxPb+SaVpWkTi84Z7Wr/w0t9OjvqIKkahTdOYB2CLzFpmO457hSg eyqQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@weidmueller.onmicrosoft.com header.s=selector1-weidmueller-onmicrosoft-com header.b=CCHQ+2Ix; arc=pass (i=1 spf=pass spfdomain=weidmueller.com dkim=pass dkdomain=weidmueller.com dmarc=pass fromdomain=weidmueller.com); spf=pass (google.com: domain of roland.gaudig-oss@weidmueller.com designates 40.107.8.55 as permitted sender) smtp.mailfrom=roland.gaudig-oss@weidmueller.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=weidmueller.com Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80055.outbound.protection.outlook.com. [40.107.8.55]) by gmr-mx.google.com with ESMTPS id c26si5282wml.0.2021.08.02.07.43.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Aug 2021 07:43:40 -0700 (PDT) Received-SPF: pass (google.com: domain of roland.gaudig-oss@weidmueller.com designates 40.107.8.55 as permitted sender) client-ip=40.107.8.55; ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I33FTjU41HqNhyRLFGWxzqnM8AXD7uUEqQkeoG0Uby5jGi0Wh6T+x6sTjwzdLJgqYexMx1lNPSD9UvwIwE4mqiMKTz8JY+Wk8bYka41hUFaCLtjGTE+YUZGIoZGIcqbR6oY2oetALqllMOXwYgLMWHdbTlJkyonua0SnUHWTlcqUiqCOOgM1jG2wxBeYv1Oqo+hZbhWk7Ex4yvh0CZH0pV1or9wQGyxqDfIaG2oBzmxEFI+FSbgIv4R8BCODuXekV4ao69zsfnX3eglXIiGAEQgsofcQnGDWvWWuV3YQOU4ZIazqJ8unz1oswHDAXixi8DiGmkwoOYzisd3HLKab9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5G4nU89ttNXAa3QhjqpCk8qFIpBbvkB4RS0w2Ejeotk=; b=iyv+aHOyu/3Kmbphd3ojgH1473FePdqlDnwITWpCkTR6/yYEe5xSz0mH62U8ZI0DqWZe8fZKBsn7BtqGUT/BHhrXcBSx8tBcweK0DA1VYIdaGebgWsTGeT4rsJJfJcxdL0k8bzWk856CRzzDsf93dSJ0Zqjf6DNK8iKPJ5OnHQ1LB9ZtTgpaJyI5P0oXU4nPqEdCv5egt9mdYvyiGGiykLd709Xs3MV0PUIa4wGjAUaBHFldD4TTryM9974CchiF18hPBJI/NUpi5kLwdO5v+ga6TTRxwQuzW9LtEVUAmBy24HPiYAf6EeXiMxB40uTXhIxfk8mcuK2XJVDC3PRGzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=weidmueller.com; dmarc=pass action=none header.from=weidmueller.com; dkim=pass header.d=weidmueller.com; arc=none Received: from DB9PR08MB6729.eurprd08.prod.outlook.com (2603:10a6:10:2ac::15) by DBBPR08MB4855.eurprd08.prod.outlook.com (2603:10a6:10:da::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18; Mon, 2 Aug 2021 14:43:39 +0000 Received: from DB9PR08MB6729.eurprd08.prod.outlook.com ([fe80::1d23:5e54:ef16:e7b0]) by DB9PR08MB6729.eurprd08.prod.outlook.com ([fe80::1d23:5e54:ef16:e7b0%7]) with mapi id 15.20.4373.026; Mon, 2 Aug 2021 14:43:39 +0000 From: Roland Gaudig To: swupdate@googlegroups.com Cc: sbabic@denx.de, james.hilliard1@gmail.com, Roland Gaudig Subject: [swupdate] [PATCH v1 1/2] handlers: add diskformat handler Date: Mon, 2 Aug 2021 14:43:25 +0000 Message-Id: <20210802144326.28642-2-roland.gaudig-oss@weidmueller.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210802144326.28642-1-roland.gaudig-oss@weidmueller.com> References: <20210802144326.28642-1-roland.gaudig-oss@weidmueller.com> X-ClientProxiedBy: AM0PR02CA0026.eurprd02.prod.outlook.com (2603:10a6:208:3e::39) To DB9PR08MB6729.eurprd08.prod.outlook.com (2603:10a6:10:2ac::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from DE12086.weidmueller.com.com (84.138.76.65) by AM0PR02CA0026.eurprd02.prod.outlook.com (2603:10a6:208:3e::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18 via Frontend Transport; Mon, 2 Aug 2021 14:43:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5b5b930c-aa5b-4383-a573-08d955c3ea2c X-MS-TrafficTypeDiagnostic: DBBPR08MB4855: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:58; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s0sM0DsyS/GIkAWkfXl8ota2qX2JQ5e4Pzgf5E5PRXad8vlh70GYTHsyv2aS7YBVldILpnIIRIqIQUIrRcuNnpII34c3V3+3P/UVK2+pAQ5rqEGTRzEJI6rreS7CeFNu58HeOIXeYXetSrQTNeq25YlWC8Ku5LMpqOqUSBiZ72R3Dh/MljNV6dM5axuv0CUSvYfKR1NXHDU2yFl5pIgsGTEIwXQNJMnoOHokJqr6w5gc3aKT2I4OlMjEbZjxA4qG1mBmN4B8JSxx45odkCPhxgraEgVcIhChsOK86SnG378LLJCTBXAGnYaQxFg5xIzzsQ/XMmirAMbfLxd+kN3IAKAH1cJYLmEZDiJk3lQxK1ugC9zdKaWaAjW0NmqBdLXq/msMo4AYp7vlZpXulDeR01GVK68DKWUzY9sMQvk43wtwHh8xYxRyLW6ssZTl2SKxypOB5DaJh7F3XQNBC1FpJiOuceKFYqR1jUxOckCbFqdOcsxPeAgfbxHfN4FEayTNHMZI0uvurueeo9J+qkc81085w0DOXfLjEp2AfIkWf6cQT4KqkDjV7qBdMXhAUFHmLbFfD1sg9tA5wKnaj3mZ3by0+0+iyrXCLl9zlRFUXl7B94iyRyUS25ayg+XZhDqLmDL/bT8X5XvxDPGU7FgFKeOOMMOM2L0DYR/LA8Is3HXixr7z/ufzykiLSC3TKBuSiByXPuNvl6y/6Cnj9brGgw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR08MB6729.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(107886003)(6486002)(86362001)(316002)(26005)(66946007)(66556008)(66476007)(6512007)(6666004)(6916009)(52116002)(7696005)(186003)(8676002)(1076003)(83380400001)(4326008)(956004)(36756003)(30864003)(5660300002)(8936002)(508600001)(38100700002)(38350700002)(2616005)(2906002)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gq/zfMVGRhxmHBYvLxqKAJVYIp6q4SQb5hhOw7wKgL0zEubjC5b1J21OuCkZvTevK3J4l9IPBODi8/f5lGi5ZLaTBMI4DTLqfoHHaq0G6a2jIMnUsM+A90JuOaxLlkae/mgVx9ZQ7rmg/mOH/wOLSLLXMhmNqC4uNszRjLcsgAjr9Ud6cWeNgEFnezGe5ROic8iBmYc6bfqmxb0WpHBfzLo2r7ouLfskgJhQ56ctl4OUIQNeq6TyJws9TWm/VtmGwjmR+07p6D/UkZ3F/vp00mO9jJLTXuBwXhKhx5cLDCJ3NAEcPq2IdpZLVblJLXTnwb64pjJaQ2o9kzz/EoEzrh7nQ7WtY7PZVMt3apKRPy66OHI6QMjCwbx/DYeOnt9GJxOVpUlfooBWuoeOHKqaij9jA4x9wQQHRBtkMsh3MC+KNhRCye2dsEi10rSw+6Ndn0M/XCMII2Dho77oYLIH+2MNMk0U2Z9cWPM6zMp08feb4pHi0g0cVH91/glfepHWImRyNL+D6dIjYBEZNnYWCXBPZ+PwTjDVzdEc0i2GpGIw6fKmeN4kjesYL0DzLoP9xhNQhKXGV0RI3OI3Dz72LjqzwYpJJ2WJLW1nOG0XWcM6gLLR6QiknITl0akZ6q36hkqcFm2jzE7nEVwGW1EhTcouz6QcF2naYZ3hFU11SNVB08paOQdJ4e2TO/AhDJLI4g+r2tD98ClUQnVz86W5wip1sc1Nx1frD0jIx4zL4uTazmoQkU6lqAUBLinucml4w6Iwz4hU/p6tNwnorfN/t8W/SQ1ggg69LzPy4NmG/46uiTTbsZ1Zc52affgxCNiEggAJhgX56qrMRD1m8OD6FEjReO+JnnOJWWGPoxLvwaVG8hwV/5PluTa82X3Bpq6teARBWp3px8VqRIidS+UV+iT7qcYG7bpuAg1wVracE0KdFq6eKaUY87NsM89S9oHXsXf9hVjB6W90f/Ft09HkcW6krVrrVed+K7Olq9i893xsTfZllQUG9HK6yrQ57ZohguFaMmbhU4RkTkBEZakYvrez9hFoKZlQOgVcqfl/iUwR1Eh8iyqIuhOrDdZNUtmzICHpftzW3Zo5nC+WsGgrauX7BvFsHsNlHqOW3lwwtwQ9ZMUore0OwnpaBDRtQUwYAZxA6A6mOlDgjI0UntN1f9ODN3xNcZhasnB8YQVvNvSA3yKf+F1Oo2CD19m11oc7/POOGZhlZ7BXSZp7hxu4KEyu0GFbqydoTa0tFJ9PCfyOANwAEM92okEItz+igQSloE91XZDFSuAt6We+zI4D9TBVNQLiSDnN8q9R3WKO0nnNdRvzenDWdRCgF/Cw30mK X-OriginatorOrg: weidmueller.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b5b930c-aa5b-4383-a573-08d955c3ea2c X-MS-Exchange-CrossTenant-AuthSource: DB9PR08MB6729.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2021 14:43:39.0780 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e4289438-1c5f-4c95-a51a-ee553b8b18ec X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sxe3Phb2ypPqEj6u7732BLeMoRbCPI+fNND9A7eKfSf51BdEHLnSshkIjgRBy2M6k+bo2HwZMDtVZn5blEvMzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4855 X-Original-Sender: roland.gaudig-oss@weidmueller.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@weidmueller.onmicrosoft.com header.s=selector1-weidmueller-onmicrosoft-com header.b=CCHQ+2Ix; arc=pass (i=1 spf=pass spfdomain=weidmueller.com dkim=pass dkdomain=weidmueller.com dmarc=pass fromdomain=weidmueller.com); spf=pass (google.com: domain of roland.gaudig-oss@weidmueller.com designates 40.107.8.55 as permitted sender) smtp.mailfrom=roland.gaudig-oss@weidmueller.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=weidmueller.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , From: Roland Gaudig Currently the discpart handler only creates a new file system when the partition table has changed. In cases where there exists an unused and unformatted spare partion which shall be activated by a later update, it is necessary to format such a partition even if the partition table has not been altered. Also there are cases when creating a file system on a single partition is desired, but there is no partitioning scheme specified inside the sw-description. Therefore, this commit introduces a new diskformat handler which allows creating a file system independently from the partitioning process. Before creating a new file system it checks whether the desired file system already exists and only writes if not. In case it is desired to create a new file system anyway, this can be achieved by setting the property "force" to "true". partitions: ( { type = "diskformat"; device = "/dev/mmcblk0p1"; properties: { fstype = "vfat"; force = "true"; } }) The diskformat handler will be active when the configuration option CONFIG_DISKFORMAT_HANDLER is selected. Signed-off-by: Roland Gaudig --- Makefile.flags | 4 ++ handlers/Config.in | 18 +++--- handlers/Makefile | 2 + handlers/diskformat.h | 13 +++++ handlers/diskformat_common.c | 68 +++++++++++++++++++++++ handlers/diskformat_handler.c | 100 ++++++++++++++++++++++++++++++++++ handlers/diskpart_handler.c | 42 ++------------ 7 files changed, 201 insertions(+), 46 deletions(-) create mode 100644 handlers/diskformat.h create mode 100644 handlers/diskformat_common.c create mode 100644 handlers/diskformat_handler.c diff --git a/Makefile.flags b/Makefile.flags index d3ca49d..e549b46 100644 --- a/Makefile.flags +++ b/Makefile.flags @@ -185,6 +185,10 @@ ifeq ($(CONFIG_DISKPART),y) LDLIBS += fdisk endif +ifeq ($(CONFIG_DISKFORMAT_HANDLER),y) +LDLIBS += blkid +endif + ifeq ($(CONFIG_EXT_FILESYSTEM),y) LDLIBS += ext2fs uuid blkid endif diff --git a/handlers/Config.in b/handlers/Config.in index a0cc5a3..36f3ca4 100644 --- a/handlers/Config.in +++ b/handlers/Config.in @@ -106,15 +106,19 @@ config DISKPART comment "diskpart support needs libfdisk" depends on !HAVE_LIBFDISK -if DISKPART - -menuconfig DISKFORMAT - bool "diskpart extension for creating file systems" +config DISKFORMAT + bool "diskpart extension for creating file systems" depends on DISKPART + help + This extension allows formatting newly created partitions. + +config DISKFORMAT_HANDLER + bool "diskformat handler for creating file systems" + select DISKFORMAT default n help - This extension of the diskpart handler allows creating filesystems - on empty partitions. + The diskformat handler allows creating filesystems on empty + partitions. if DISKFORMAT @@ -122,8 +126,6 @@ source fs/Config.in endif -endif - config UNIQUEUUID bool "uniqueuuid" depends on HAVE_LIBBLKID diff --git a/handlers/Makefile b/handlers/Makefile index 1f61f60..a37ce78 100644 --- a/handlers/Makefile +++ b/handlers/Makefile @@ -11,6 +11,8 @@ obj-y += dummy_handler.o obj-$(CONFIG_ARCHIVE) += archive_handler.o obj-$(CONFIG_BOOTLOADERHANDLER) += boot_handler.o obj-$(CONFIG_CFI) += flash_handler.o +obj-$(CONFIG_DISKFORMAT) += diskformat_common.o +obj-$(CONFIG_DISKFORMAT_HANDLER) += diskformat_handler.o obj-$(CONFIG_DISKPART) += diskpart_handler.o obj-$(CONFIG_UNIQUEUUID) += uniqueuuid_handler.o obj-$(CONFIG_CFIHAMMING1)+= flash_hamming1_handler.o diff --git a/handlers/diskformat.h b/handlers/diskformat.h new file mode 100644 index 0000000..441d291 --- /dev/null +++ b/handlers/diskformat.h @@ -0,0 +1,13 @@ +/* + * Copyright (C) 2021 Weidmueller Interface GmbH & Co. KG + * Roland Gaudig + * + * SPDX-License-Identifier: GPL-2.0-only + */ + +#ifndef _DISKFORMAT_H +#define _DISKFORMAT_H + +int diskformat_mkfs(char *device, char *fstype); + +#endif diff --git a/handlers/diskformat_common.c b/handlers/diskformat_common.c new file mode 100644 index 0000000..7f21c90 --- /dev/null +++ b/handlers/diskformat_common.c @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2021 Weidmueller Interface GmbH & Co. KG + * Roland Gaudig + * + * SPDX-License-Identifier: GPL-2.0-only + */ + +#include +#include +#include +#include +#include +#include +#include "diskformat.h" + +#if defined(CONFIG_EXT_FILESYSTEM) +static inline int ext_mkfs_short(const char *device_name, const char *fstype) +{ + return ext_mkfs(device_name, fstype, 0, NULL); +} +#endif + +struct supported_filesystems { + const char *fstype; + int (*mkfs)(const char *device_name, const char *fstype); +}; + +static struct supported_filesystems fs[] = { +#if defined(CONFIG_FAT_FILESYSTEM) + {"vfat", fat_mkfs}, +#endif +#if defined(CONFIG_EXT_FILESYSTEM) + {"ext2", ext_mkfs_short}, + {"ext3", ext_mkfs_short}, + {"ext4", ext_mkfs_short}, +#endif +}; + +int diskformat_mkfs(char *device, char *fstype) +{ + int index; + int ret = 0; + + if (!device || !fstype) { + ERROR("Uninitialized pointer as device/fstype argument"); + return -EINVAL; + } + + for (index = 0; index < ARRAY_SIZE(fs); index++) { + if (!strcmp(fs[index].fstype, fstype)) + break; + } + if (index >= ARRAY_SIZE(fs)) { + ERROR("%s file system type not supported.", fstype); + return -EINVAL; + } + + TRACE("Creating %s file system on %s", fstype, device); + ret = fs[index].mkfs(device, fstype); + + if (ret) { + ERROR("creating %s file system on %s failed. %d", + fstype, device, ret); + return -EFAULT; + } + + return ret; +} diff --git a/handlers/diskformat_handler.c b/handlers/diskformat_handler.c new file mode 100644 index 0000000..a4449cf --- /dev/null +++ b/handlers/diskformat_handler.c @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2021 Weidmueller Interface GmbH & Co. KG + * Roland Gaudig + * + * SPDX-License-Identifier: GPL-2.0-only + */ + +#include +#include +#include +#include +#include +#include +#include "diskformat.h" + +void diskformat_handler(void); + +/* + * Checks if file system fstype already exists on device. + * return 0 if not exists, 1 if exists, negative values on failure + */ +static int fs_exists(char *device, char *fstype) +{ + char buf[10]; + const char *value = buf; + size_t len; + blkid_probe pr; + int ret = 0; + + pr = blkid_new_probe_from_filename(device); + + if (!pr) { + ERROR("%s: failed to create libblkid probe", + device); + return -EFAULT; + } + + while (blkid_do_probe(pr) == 0) { + if (blkid_probe_lookup_value(pr, "TYPE", &value, &len)) { + ERROR("blkid_probe_lookup_value failed"); + ret = -EFAULT; + break; + } + + if (!strncmp(value, fstype, sizeof(buf))) { + ret = 1; + break; + } + } + blkid_free_probe(pr); + + return ret; +} + +static int diskformat(struct img_type *img, + void __attribute__ ((__unused__)) *data) +{ + int ret = 0; + + if (!strlen(img->device)) { + ERROR("diskpart handler requires setting \"device\" attribute"); + return -EINVAL; + } + + char *fstype = dict_get_value(&img->properties, "fstype"); + + if (!fstype) { + ERROR("diskpart handler requires setting \"fstype\" attribute"); + return -EINVAL; + } + + char *force = dict_get_value(&img->properties, "force"); + + if (force != NULL && strcmp(force, "true") == 0) { + ; /* Skip file system exists check */ + } else { + /* Check if file system exists */ + ret = fs_exists(img->device, fstype); + + if (ret < 0) + return ret; + + if (ret) { + TRACE("Found %s file system on %s, skip mkfs", + fstype, img->device); + return 0; + } + } + + /* File system does not exist, create new file system */ + ret = diskformat_mkfs(img->device, fstype); + return ret; +} + +__attribute__((constructor)) +void diskformat_handler(void) +{ + register_handler("diskformat", diskformat, + PARTITION_HANDLER | NO_DATA_HANDLER, NULL); +} diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c index b5c9a42..272d0b8 100644 --- a/handlers/diskpart_handler.c +++ b/handlers/diskpart_handler.c @@ -19,7 +19,7 @@ #include "swupdate.h" #include "handler.h" #include "util.h" -#include "fs_interface.h" +#include "diskformat.h" void diskpart_handler(void); @@ -31,12 +31,6 @@ void diskpart_handler(void); /* Linux native partition type */ #define GPT_DEFAULT_ENTRY_TYPE "0FC63DAF-8483-4772-8E79-3D69D8477DE4" -#if defined (CONFIG_EXT_FILESYSTEM) -static inline int ext_mkfs_short(const char *device_name, const char *fstype) { - return ext_mkfs(device_name,fstype, 0, NULL); -} -#endif - /* * We will only have a parent in hybrid mode. */ @@ -47,22 +41,6 @@ static inline int ext_mkfs_short(const char *device_name, const char *fstype) { */ #define PARENT(cxt) fdisk_get_parent(cxt) ? fdisk_get_parent(cxt) : cxt -struct supported_filesystems { - const char *fstype; - int (*mkfs) (const char *device_name, const char *fstype); -}; - -static struct supported_filesystems fs[] = { -#if defined(CONFIG_FAT_FILESYSTEM) - {"vfat", fat_mkfs}, -#endif -#if defined (CONFIG_EXT_FILESYSTEM) - {"ext2", ext_mkfs_short}, - {"ext3", ext_mkfs_short}, - {"ext4", ext_mkfs_short}, -#endif -}; - /** * Keys for the properties field in sw-description */ @@ -942,7 +920,6 @@ handler_release: /* Create filesystems */ if (!ret && createtable->parent) { LIST_FOREACH(part, &priv.listparts, next) { - int index; /* * priv.listparts counts partitions starting with 0, * but fdisk_partname expects the first partition having @@ -952,25 +929,14 @@ handler_release: if (!strlen(part->fstype)) continue; /* Don't touch partitions without fstype */ - for (index = 0; index < ARRAY_SIZE(fs); index++) { - if (!strcmp(fs[index].fstype, part->fstype)) - break; - } - if (index >= ARRAY_SIZE(fs)) { - ERROR("partition-%lu %s filesystem type not supported.", partno, part->fstype); - ret = -EINVAL; - break; - } char *device = NULL; + device = fdisk_partname(img->device, partno); - TRACE("Creating %s file system on partition-%lu, device %s", part->fstype, partno, device); - ret = fs[index].mkfs(device, part->fstype); + ret = diskformat_mkfs(device, part->fstype); free(device); - if (ret) { - ERROR("creating %s file system failed. %d", part->fstype, ret); + if (ret) break; - } } } #endif From patchwork Mon Aug 2 14:43:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Gaudig X-Patchwork-Id: 1512456 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::540; helo=mail-ed1-x540.google.com; envelope-from=swupdate+bncbaabbh4juceamgqekbdw2ba@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=LrOUaZB5; dkim-atps=neutral Received: from mail-ed1-x540.google.com (mail-ed1-x540.google.com [IPv6:2a00:1450:4864:20::540]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gdgjt4SsXz9sRK for ; Tue, 3 Aug 2021 00:43:46 +1000 (AEST) Received: by mail-ed1-x540.google.com with SMTP id u25-20020aa7d8990000b02903bb6a903d90sf8917484edq.17 for ; Mon, 02 Aug 2021 07:43:46 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1627915423; cv=pass; d=google.com; s=arc-20160816; b=M6zBc+/Yc7GfLPAJzM7NMsBl4odjoypH+KuvPv4YLHp9IhHBWNZRcW+BRPEgBt4GLd aWvXM/dizKyjuQkixx49bi86iIaZinkk6ge65jzFtA/qkPRc8bixUawlk63GZGzpmJfU vN/PfeLrYyIGtXz5206Qo+WGNdyGxv5W7NTAYQ8b0lGeWxJrEb/nxS4fMLZSLvVwIZGK tHe1JTfwLEh8rUe79J4vjX19lw2014QtHt4dYiQRc19+Tp/HtNIUG9/YNqhFYq7kgdiA Dwed9h0zRBB2+yFSBOhfA7YxEwuLILqrnEz1ga7O90wm4ClKJOe9GKlavx7sv6jTWkmP Y5xg== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=sicabvdJrRRSXDZD3Uw7FrXHD2oNgK/l0E/gyartT/4=; b=eC7ZmDXFxjc2t+G0/3ay8kOw9TIwbO6TLA+OOaKX9iQBt114XtFwU2wg1/nBCCyvEp +YiES6oWXyEy1aXWLOGByJXgNCqcXhpQnQt0DI67WpuCJ0o7oDbTKm8BAplZAO742El/ CsZJfeI6vMNIjMQ4I4YrqV/kN7UR6qyt+8gOIJ63TVvsInLOoPJl9qcrMECHC6c/4ser dfCM8NGm8+1KD0/PEYi2gGSkAXNT0CKVg9ID/urD3DnhSGix92wmx1zbuWHltolv6hrN 4mQ3CaTGcAtBUjMk1uKrk1jvd2alA0hCnpievLWio2IPAq23TrlsfI+LIWc6/3q840LE qDpA== ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@weidmueller.onmicrosoft.com header.s=selector1-weidmueller-onmicrosoft-com header.b=kBuOucV8; arc=pass (i=1 spf=pass spfdomain=weidmueller.com dkim=pass dkdomain=weidmueller.com dmarc=pass fromdomain=weidmueller.com); spf=pass (google.com: domain of roland.gaudig-oss@weidmueller.com designates 40.107.8.42 as permitted sender) smtp.mailfrom=roland.gaudig-oss@weidmueller.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=weidmueller.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=sicabvdJrRRSXDZD3Uw7FrXHD2oNgK/l0E/gyartT/4=; b=LrOUaZB5xDFOUAJNyk3jlNQLwAm7UOKzGonhBd71XSikiadBGjMIf6TmkA6dz/lHK3 XIT839ILogvZjCEFqNmbdPm0LIsvXEL4WZviA9AlUiuUxwgcV6NDLUI7VZxegFolZ4Vw KaLox2GvBK2a9GwAuvlhdiGJjuUcEMhrqRvxcB8g0KCH+LmGo0GhDrDmIqIAF49WuVVT ZY6pOf11Wb7n+acCqed/HGPA608IW7UGADMC+qAZetsWvrF9PPsCe07i9weLFuZ9lVcw rLGJwtSwVq6JUhyZmtm2kMpawiBIv5pofhBjFLU0MqP66m419EGjzK7RjWf/vpaIa+jv +0Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=sicabvdJrRRSXDZD3Uw7FrXHD2oNgK/l0E/gyartT/4=; b=SwqIad9uV152LoL9PF8C5Pz2yn57VxYxgOclh/lDFAteWTFcXlxofvoSH7y9msNr8f SYHS9PwFhx/c4AZhRAs9ccN2FYWgcTQE9C1V76w6fiAb6sFaUAllisIPQ/94W6Kd5i/0 CjqNQNpmuRlk0mQm9My3AxNgsi3MQe5Sdgzo7nRP9PyUtALY9hD8sVRSmZpyt6QOUqsy 33WY3hTGURWHadQSJr+PXY3qAyABPJrLOP9ejKNIDspfp1XQYhw1jgUJHXYa4MHXpims wwcwoHmxygLRa6P3eDE7I/e1WTm55tJ10bJaVZCvKzXeJL3IBHe8Gx8HvTiIH86qZCiE qyIA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM532LsSw0fbfHJ61mBSGFwFKBUZ7cB0c6+oibAvzfDIKvJHIxG837 uniUtwSEzXNwfF8SQlLihwk= X-Google-Smtp-Source: ABdhPJz8I95syUQu8/pJ5weFnKI7DxSZWShyqPll6ZpcdMsNUOBBRGk4DWyf4oHLHgF86aPDCPJyUw== X-Received: by 2002:aa7:c74b:: with SMTP id c11mr20003638eds.353.1627915423358; Mon, 02 Aug 2021 07:43:43 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6402:34c2:: with SMTP id w2ls301580edc.1.gmail; Mon, 02 Aug 2021 07:43:42 -0700 (PDT) X-Received: by 2002:a05:6402:1487:: with SMTP id e7mr19990989edv.285.1627915422748; Mon, 02 Aug 2021 07:43:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1627915422; cv=pass; d=google.com; s=arc-20160816; b=hRqG06YkiiUsQGNm4/zKICJNLxt+e+AvdAMk8qNVOMZ3ft4YkJMwj/mxzoDMW5NUc7 K8OL7B/a6KtjSKaaE36Ho8W4KRsFEm4SpvRHvj/+UH32/xsUnT2GIR6sh5WhKozazbXD m5Y9/fRZLx3dWZDl44+MXTG8JkSUvIoYWzveki2LtqXWjPARItT5y8XMQPxAgpBPBU/Z ImFOe1LjcuxJ1wroswiWSzf1IjCNR3Nt7pArcRIf8ncXUcVBj3+2sMH2Gb2+IfWYQOiq d0USzDuLn/XFxpQoznUMy4wQeNZ3m43ZhXFeCU6nrjdIVTtKeg4tVJ9oZWItWlRSyE3U RsAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=hAHRrXbdp95Ha5ecT1zOQzxjXUBLCyXMqKlCUEKf7Ps=; b=u1Zq4GnIZSQNcOdfOGJ3oIEjYdCMjddbsCe6wLnDck00hZbTgOGlPBi9kdBPkgvsfr 4lWTXcMz031tXF8uwcArYndm5buEzIlEgbhVEM7042ZaCPC5G4ZHxRODN80HFscejUP0 4QjN5GRUkCJSCNqcLz4n2fI75A2lr/RKQCQaHAw6R04kWkrFJ/LL5Gl5ENYxc5qiEmpJ bNHi+M9bCedUBJ6+CiDnuPJN6+ZoX3gL17YYOtcA9vtIaB4aVeFY6RTcHach/1rW5tTj LEOo4cqXYxx4RoRXKo3JiSKDgrCKaqVofoHFeCvYMs3wwDJseIVYmFjTYyeQJOZpVaaz x3Qw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@weidmueller.onmicrosoft.com header.s=selector1-weidmueller-onmicrosoft-com header.b=kBuOucV8; arc=pass (i=1 spf=pass spfdomain=weidmueller.com dkim=pass dkdomain=weidmueller.com dmarc=pass fromdomain=weidmueller.com); spf=pass (google.com: domain of roland.gaudig-oss@weidmueller.com designates 40.107.8.42 as permitted sender) smtp.mailfrom=roland.gaudig-oss@weidmueller.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=weidmueller.com Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80042.outbound.protection.outlook.com. [40.107.8.42]) by gmr-mx.google.com with ESMTPS id w14si679581edu.1.2021.08.02.07.43.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Aug 2021 07:43:42 -0700 (PDT) Received-SPF: pass (google.com: domain of roland.gaudig-oss@weidmueller.com designates 40.107.8.42 as permitted sender) client-ip=40.107.8.42; ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bIoq+o+WHlSYOeB0CVS8gmiCKOA8+9mNIX67Jql71fbapq9/G8L8rPbV1aG1MIuGtyMNKsTgkwotlYWIqJyJSh7tv1KzXPwmrTivcuGKqY+LTO6I5MJyq/2rHCj86qqIYYtJVmFErBb+JvlW8fOO0sJLGIRD2R1hJkb1gOHU87ntrX7cM2gwJnWywloJ1ynhwrOUGheb/pFkNCHoMUgL/6K8wL2wqfNIqumYdKwYrqq1ODaKijXIbgopNqfmlUw/RJUhr2n2D225njG2jjGzT7LLkdMrUTwLH3pMzNOlsIS3XRZeqRYxx3d1nGqPsWN7koeKWbUEgj5lFA04vbdQ0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hAHRrXbdp95Ha5ecT1zOQzxjXUBLCyXMqKlCUEKf7Ps=; b=VNRBZh5hOPT42dLZE91jmktA4KPuL7v3M0FLI6ND8RJP/kB0suS8AKFU9EtuuVscgZP2xItRrXXacWF+H5+NhxOQnKrxhxIuBZMH42LgGMSVQAzG0BElrZZmstYIK3XJj+6N6h0dADjL91kRfDMkpx9hicy2AJzBl+g5Ixc5sHuQGbdDsSQVXzX+572wH3svy5+oLa9ak79t3716Yl/S1oEIpB+hGnIo9qsyLJ597GcXZ/M4vMuuPBoIq7VYbIiht38vJh3dwqhYuxZ/RFI0V4Psahx6FhGnhaeXRmWvsDBj+tzXavCTth+vBBlqjiZ2ywPz1ow86ro5RzddBZjbKw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=weidmueller.com; dmarc=pass action=none header.from=weidmueller.com; dkim=pass header.d=weidmueller.com; arc=none Received: from DB9PR08MB6729.eurprd08.prod.outlook.com (2603:10a6:10:2ac::15) by DBBPR08MB4855.eurprd08.prod.outlook.com (2603:10a6:10:da::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18; Mon, 2 Aug 2021 14:43:41 +0000 Received: from DB9PR08MB6729.eurprd08.prod.outlook.com ([fe80::1d23:5e54:ef16:e7b0]) by DB9PR08MB6729.eurprd08.prod.outlook.com ([fe80::1d23:5e54:ef16:e7b0%7]) with mapi id 15.20.4373.026; Mon, 2 Aug 2021 14:43:41 +0000 From: Roland Gaudig To: swupdate@googlegroups.com Cc: sbabic@denx.de, james.hilliard1@gmail.com, Roland Gaudig Subject: [swupdate] [PATCH v1 2/2] doc: handlers: add diskformat handler description Date: Mon, 2 Aug 2021 14:43:26 +0000 Message-Id: <20210802144326.28642-3-roland.gaudig-oss@weidmueller.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210802144326.28642-1-roland.gaudig-oss@weidmueller.com> References: <20210802144326.28642-1-roland.gaudig-oss@weidmueller.com> X-ClientProxiedBy: AM0PR02CA0026.eurprd02.prod.outlook.com (2603:10a6:208:3e::39) To DB9PR08MB6729.eurprd08.prod.outlook.com (2603:10a6:10:2ac::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from DE12086.weidmueller.com.com (84.138.76.65) by AM0PR02CA0026.eurprd02.prod.outlook.com (2603:10a6:208:3e::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18 via Frontend Transport; Mon, 2 Aug 2021 14:43:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 234b53fb-ed8a-4bea-829b-08d955c3ec04 X-MS-TrafficTypeDiagnostic: DBBPR08MB4855: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KRGZboLJMozdLRCwqelPeXFe7oMQVOgsQB53D3rVycL7ZSpjNHQLkTlAyNQZFLSHcWu2os8gvYMmEHzpJ42RJBIidUCjWNvDkM+5pue+GzS4HjtTZD15h1gummbVbPA1p7P0jVMNbU32i+mJmRgZPlaX4lDmzDoNnVDXN07YUu+cT/6CfkTs1HIzRR7DjGBsCJT5Xe9VN1jC4lFyVHhnhQTpWEZidFN870h9qrbrEzJha6bW4e3IucOEYHc6Z1KLBIPiiRqRoI5KOFBtoWmSVQiOddlSdrFr9R5tpRxzzB96myrSJEttzgRg3h+1kbPuioQH1hoRCzsHIPuqJNc3g0DjqRHOgqXqaC4ApR+6b9grCFeL7oMzNToWIITCmGntShuPuK61/mMV2pZ/uwVoFjMW/wJKIpOrgOoR6mhFOZIXoW+12+PbvdNcsbu4HHg9h6bwJ1gjG/zaF9z6TL9sp11pThKkOHsNZKlAVP2zJW99StljHhKY6RciwP/aU++Zw+io63O+wLkNvKWGRFXnPhNM/v2Lud9v/KkbYug7mjntJHIYDa7eE3sakDiCuJ0iL5lP0iEvDJ04EK1egekEw3/kyiMdQuTHqEJ2JnpcbkStNHEAMHaw94GXmlN3YOWe8iXdIJZPpfK2Djd44GYrjY7zQSoKSdVrAqwH3qKcLvTnIbdekSORw69K4dPgbfvR X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR08MB6729.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(107886003)(6486002)(86362001)(316002)(26005)(66946007)(66556008)(66476007)(6512007)(6666004)(4744005)(6916009)(52116002)(7696005)(186003)(8676002)(1076003)(4326008)(956004)(36756003)(5660300002)(8936002)(508600001)(38100700002)(38350700002)(2616005)(2906002)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Y9uzzThR8EyWpGLtcL6BSUae7M+jR7gSTZMvCo1sJz4LIP8MUaIaBIW3dO28L3+WH1ZZ/FCOCoi05pqgR/Y3ArtF56HVi6/VwPvMYt7AjAeCc+1YzX3FdRzbUUiFUNx9PQPhH1lIrCs3I9xSGz17sX7mzfxObThcjEKjgjVfr12v5OSdzm6P6FF4ywxJ3Cxn1zbfoRltFgizfY4ywDekBcPM7Dn9nF4Y0bIymmRiM94WI65bcFbAbWItjFF3ZZahM/069mAj2uf9sBM9ywP8a9YwXbVrqOmND2SRjRV7DsdkQgB535fpfo6x7mLfvk20Lpjupogt777Zb/rMOrUILxuOn406RXeGYDLXDUqGCA+2vM/q2DDUb9c2ZsBFh0thG4Vhxfp0p9RwTj5IARIyUezyhmBYI6yhPDkQTs8OT0BuH7+0hakycmIkJEN9OqLMFc18qIuCmX8FUV+QIwvBeA7upO3PDUR2lyAIBejSuRz+x8cJ8isyyoOnILqHxdBNjwjcPU9fGZx88XOBOG5PaNXFJCyuwjfhC+kHbDiQ3g70yLkXJfePIUmCy3rwkHMzYWSmQh2f+qkk7HIWOGpCr9ZVMEr1kAOKAKH254L8WZzKL2OwtmmTw9La2j2A02XxQi38xgsVHd/Ds21XynJk7RSRGLC4HkChjusUIota237cF3YBzxSPSa3FqfYOhFQMk3dYBW5deN3JMn1ZsUvWenHH4UbUDjaO5H2AbJPv5btk42ydrILzthTIOHQmmTE84AJ44Nfb0NN1OAEK/8qxf3irg5dhIDnLdApjVuOCKBevFSw8Iupnrr0NRcm2K+RWh3eqIeDYaV7FC0+RRG9v1NqoGe5vXVz2v3YMCNlwaN1khI2uBvpAbftQC6YdJilLJ/TI0+O7sl1ggzHOugmsbaMuvTjmwG01GdntMSssMHW1gndZle3qUf4LIPxxmgBK0ZoD1SJTmRH/J0S1eDjmNhCv0otByVwAt0MRnwhtEqZqwXKSw4mA8JmxTx4OVsxTaDEioSso7claiLDTx2yZpfWlAyGFe4dl/DgqvWu+hqyhiFIzBK1kDVkw4zCdAJeVTX+Ql8bgPQ6zOxAPhUCN+6trcqm2IJqm8ghtbDsn7k+gplfM8bJNO/PlJIGz7/WhGKiHbdUsUyhL45VIWiER9IPFwB0hFF+ctLRYyignmIxxIUypkjGiErKQa6fbaqIv8Kw2gA9ObP8aTbmyxEJkkvM73ub23ofTJ3h/bZZQfMeUS7XUhjMgAb4ERR4ZUI7y/cyWL6FXOS7TTQucjo0mol6NfYpAsitL8sKmvxKNN7jEs1lLPQ9ulydMiLCPKvFg X-OriginatorOrg: weidmueller.com X-MS-Exchange-CrossTenant-Network-Message-Id: 234b53fb-ed8a-4bea-829b-08d955c3ec04 X-MS-Exchange-CrossTenant-AuthSource: DB9PR08MB6729.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2021 14:43:41.7343 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e4289438-1c5f-4c95-a51a-ee553b8b18ec X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: h0eNNnUpg9QKnTKySL/7abVOqN9/pJb+rDscT+RRUvhm2/Ub/GdXcq9vOQBLuXiksGcmG2+mFhVrYX6WLQWIvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4855 X-Original-Sender: roland.gaudig-oss@weidmueller.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@weidmueller.onmicrosoft.com header.s=selector1-weidmueller-onmicrosoft-com header.b=kBuOucV8; arc=pass (i=1 spf=pass spfdomain=weidmueller.com dkim=pass dkdomain=weidmueller.com dmarc=pass fromdomain=weidmueller.com); spf=pass (google.com: domain of roland.gaudig-oss@weidmueller.com designates 40.107.8.42 as permitted sender) smtp.mailfrom=roland.gaudig-oss@weidmueller.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=weidmueller.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , From: Roland Gaudig Add documentation for the diskformat handler. Signed-off-by: Roland Gaudig --- doc/source/handlers.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst index 81f61df..747e8ae 100644 --- a/doc/source/handlers.rst +++ b/doc/source/handlers.rst @@ -861,6 +861,28 @@ MBR Example: } } +Diskformat Handler +------------------ + +This handler checks if the device already has a file system of the specified +type. (Available only if CONFIG_DISKFORMAT is set.) +If the file system does not yet exist, it will be created. +In case an existing file system shall be overwitten, this can be achieved +by setting the property ``force`` to ``true``. + +:: + + partitions: ( + { + type = "diskformat"; + device = "/dev/loop0p1"; + + properties: { + fstype = "vfat"; + force = "true"; + } + }) + Unique UUID Handler -------------------