From patchwork Wed Apr 28 13:54:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1471190 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::43e; helo=mail-wr1-x43e.google.com; envelope-from=swupdate+bncbcxploxj6ikrbv6suwcamgqe5awlmya@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=EL4vr9Al; dkim-atps=neutral Received: from mail-wr1-x43e.google.com (mail-wr1-x43e.google.com [IPv6:2a00:1450:4864:20::43e]) (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 4FVgBh74rVz9sX2 for ; Wed, 28 Apr 2021 23:55:40 +1000 (AEST) Received: by mail-wr1-x43e.google.com with SMTP id 93-20020adf80e60000b0290106fab45006sf17886737wrl.20 for ; Wed, 28 Apr 2021 06:55:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1619618135; cv=pass; d=google.com; s=arc-20160816; b=olIA8JlUzxlyrwbG4XU+iMnzdzMYjOTGxgydAaRc53ZOHyYvJjIHhBWAmd33iQS1Ok cHYS7dvz5FLCsbBeLXZrrso0k5TiItp8skH+oz97+/tw04SuC6f045Ef3f5tWzhIQWGl YUwfh7o9Ed+h4pxYMT5xBNLtio3uLox5sWdCDn9saxHBXwSUP3FfOd7mk5+vWcCkMgB/ EyWVoo4ikobuJ5onjxqmDod+WRI4/Qgh5/YOEH85EjuZlI0Xn2mucAbmHfmVcFsa7ZTE QyjZSGHgQk3Wc34DzPDRADyKYZmQ1zK3yGVc+tugAG0xBg8e68v42j9QZeXTxfnQSHe+ bQHQ== ARC-Message-Signature: i=2; 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=7cZ7vZsfOPfYu/aKLXNapvTnTkOwuhw95nAFTfwPyEA=; b=g9UsjvCn4AggW479/xJ6bRz7qE3jvszx2EPlSZ7tIFQIA7827OHv26MK8WMtNQRoF0 iVY8bNVC+vjVie/+OGEdzRypieEtm6Y4YGCSve2eSuKMSEc6eXGeApjMW3zE1DqlQxcN iiCU6FLTp2nSqW+65xe25f9vHsldshAiyY88QpfCl2TsPSK34w0G5qvpBZcS3Ifckm88 4tXA0S6WMv4c8l86CY/jzfe6k1W0ls0bytks+E7lCjM4U+iwNVOjzmlyXRhdx2ZmlKqX Hjb6zlbe15DAPqrzj6zJpRxdDUArdlzjDjcbvjUZwcVWX3D1Pyy5qYO/kRgWhPgWAwfq o3VA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=OTdGESXl; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de 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=7cZ7vZsfOPfYu/aKLXNapvTnTkOwuhw95nAFTfwPyEA=; b=EL4vr9Al5bbfkmtvghu6M7Gw/Gd72cq+JphuI6InUzZzlp6e2IY3f/8nPRp21P9OGN +VSXAywBQg4Zzf7raNgkxPqNxaFdgtkxtW6qdgUYjIL76Qd7Fy/DSB0k5GH7kGN0Lo5m 6I3u6MWgV6TC95PiZXU2yuFYo3llk7nCVPEjV/KqU0VpxCnE6eVqI1sm++pqlBtFCIft jwpEuc/hhY5LYgUgGJDcBHX/W48ugSDxjVC6DamguLCkmCgNsPOPAABP7RDy1f/YKQ7K K+G+1wZgP4cN0pIcp55GbAO1z/8OfJi3ZtpHOfn7655rTd0PDyLlI8/oVclioQOlFw4v 0Erw== 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=7cZ7vZsfOPfYu/aKLXNapvTnTkOwuhw95nAFTfwPyEA=; b=R5DOu3scNsIMAm9TYVo37eQ5dmZKVp+jQbIJ5NW6ZJm4mIoCT2skhqODpidKL3ceNY v0BbN6XYgDJy1R8XF6YjGrYlUswOlRdU/HdPf1Eo5n5t3yYF8eortHSYbI2Pjl1k8kN4 8/2NtbQ10KRys6Aje8qhZhRRF9oTTctFhVR4BrPB2G+EYO9OCf/0TcnACufS99JXnoU+ nmFJWPBZbE4fpd0tIB1PfMzh78wnpbCf5/OIZfbJkizPsI9LE/rqr+oG3r16Lz2eI0yc tfEVc7m1QFpKqcxbvlotaNk1mwFxRkiXQ+mu63rOq00KMpg7FQPt0eHXjyNkNA2hDavK 047A== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM532Po5L9ack6TN3qP6A5pvPJqyPsR9xjfcZSP50OP3JPRrcuXLpZ 1X5lSL6sgTxS2noxWqTFlwA= X-Google-Smtp-Source: ABdhPJyUWOoLzo1JB8rPCDgnOKrIEAtaDxDJ01r+z5rE17PgkYyjSiM6drbxG15vQMKYKbrsCqzZSQ== X-Received: by 2002:a1c:c910:: with SMTP id f16mr4783226wmb.136.1619618135862; Wed, 28 Apr 2021 06:55:35 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:600c:2314:: with SMTP id 20ls5817wmo.0.gmail; Wed, 28 Apr 2021 06:55:35 -0700 (PDT) X-Received: by 2002:a05:600c:22c9:: with SMTP id 9mr13303039wmg.85.1619618135082; Wed, 28 Apr 2021 06:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619618135; cv=none; d=google.com; s=arc-20160816; b=WUz2GvluzXj16d/2RoWUzhUYEyyrX3gKH4OmZ2ahn2gepxr1sJ5Gbpn577a4E83Af7 hfsYfLbPIYT6ny4WzqNGs6rFVDuhgpE3nBDl2TOus4cxlWaVzRrj1BCKmDgbnaV9fSPJ AERhwNWURWGSVoZN9gRokFB4kl47eG5E3DEoExG8i+/FQQLACh8ATWUlFSYosVrIP3y/ grIZjCzxGdAMq8PnQnILqGh4DKvr9NbA63iPc2Uo0/oeUHXAKNouyB+H+G/5l92pOhOv sZ+bxAnxE4XsCS1+OaSSsmfPm68ySpGyoJ9zW/b8a7nTnl2XxE2IfTDHwGMYria/znYF VfsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=nrAcqgSWwk+Zl9vJ+951PuiolqhXAsUtDsR0U6z+7U8=; b=b2hcbFEZN5LAraTmdqDJG13m+lTbssazSwGtlCUvm2UgaivzUx1eLbhBtNFmsnko7z fxGKh0SCAEobMyNk6p/h5pjod0TGQHfIHR8Pt9jPDImJdjDIO/c+V5Z5xCjUFDjAO3+1 gbxCylCYpsson/zcnKcp0YWFUo3915Ag45CdW0885V35NAZ6oBkPUiHKN1oG7ab40GH/ tVaJvfmMiBpQbUmZapvAhsQUdj5IC0J66oxYTAuctyNwsK/wxIUGOw3L9IIE8O/Li3dQ tejYNth84xbaNWZiCzFcubcwZwWR3ol0Kqv7mHr5B46vVKYyJLVFeVlVIRJS8csZTKzn FHDg== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=OTdGESXl; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by gmr-mx.google.com with ESMTPS id x11si813126wrn.1.2021.04.28.06.55.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 06:55:35 -0700 (PDT) Received-SPF: pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id B2FF282CD6 for ; Wed, 28 Apr 2021 15:55:34 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id 21EF4182AF3 for ; Wed, 28 Apr 2021 15:55:04 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 531) id BD73A1A005C; Wed, 28 Apr 2021 15:55:01 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 1/9] Move fatfs to fs (filesystem) Date: Wed, 28 Apr 2021 15:54:51 +0200 Message-Id: <20210428135459.951203-2-sbabic@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210428135459.951203-1-sbabic@denx.de> References: <20210428135459.951203-1-sbabic@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=OTdGESXl; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de 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: , This as preparation to add more filesystem format support, not only FAT. Signed-off-by: Stefano Babic --- Makefile | 2 +- {fatfs => fs}/Config.in | 0 {fatfs => fs}/Makefile | 0 {fatfs => fs}/diskio.c | 0 {fatfs => fs}/diskio.h | 0 {fatfs => fs}/fat_fs.c | 0 {fatfs => fs}/ff.c | 0 {fatfs => fs}/ff.h | 0 {fatfs => fs}/ffconf.h | 0 handlers/Config.in | 2 +- 10 files changed, 2 insertions(+), 2 deletions(-) rename {fatfs => fs}/Config.in (100%) rename {fatfs => fs}/Makefile (100%) rename {fatfs => fs}/diskio.c (100%) rename {fatfs => fs}/diskio.h (100%) rename {fatfs => fs}/fat_fs.c (100%) rename {fatfs => fs}/ff.c (100%) rename {fatfs => fs}/ff.h (100%) rename {fatfs => fs}/ffconf.h (100%) diff --git a/Makefile b/Makefile index 37e4d33..917e608 100644 --- a/Makefile +++ b/Makefile @@ -363,7 +363,7 @@ include $(srctree)/Makefile.flags # Defaults to vmlinux, but the arch makefile usually adds further targets objs-y := core handlers -libs-y := corelib mongoose parser suricatta bootloader fatfs +libs-y := corelib mongoose parser suricatta bootloader fs bindings-y := bindings tools-y := tools diff --git a/fatfs/Config.in b/fs/Config.in similarity index 100% rename from fatfs/Config.in rename to fs/Config.in diff --git a/fatfs/Makefile b/fs/Makefile similarity index 100% rename from fatfs/Makefile rename to fs/Makefile diff --git a/fatfs/diskio.c b/fs/diskio.c similarity index 100% rename from fatfs/diskio.c rename to fs/diskio.c diff --git a/fatfs/diskio.h b/fs/diskio.h similarity index 100% rename from fatfs/diskio.h rename to fs/diskio.h diff --git a/fatfs/fat_fs.c b/fs/fat_fs.c similarity index 100% rename from fatfs/fat_fs.c rename to fs/fat_fs.c diff --git a/fatfs/ff.c b/fs/ff.c similarity index 100% rename from fatfs/ff.c rename to fs/ff.c diff --git a/fatfs/ff.h b/fs/ff.h similarity index 100% rename from fatfs/ff.h rename to fs/ff.h diff --git a/fatfs/ffconf.h b/fs/ffconf.h similarity index 100% rename from fatfs/ffconf.h rename to fs/ffconf.h diff --git a/handlers/Config.in b/handlers/Config.in index 31cb582..bca7219 100644 --- a/handlers/Config.in +++ b/handlers/Config.in @@ -118,7 +118,7 @@ menuconfig DISKFORMAT if DISKFORMAT -source fatfs/Config.in +source fs/Config.in endif From patchwork Wed Apr 28 13:54:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1471184 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::140; helo=mail-lf1-x140.google.com; envelope-from=swupdate+bncbcxploxj6ikrbqgsuwcamgqebdkn7pq@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=sVskFUf0; dkim-atps=neutral Received: from mail-lf1-x140.google.com (mail-lf1-x140.google.com [IPv6:2a00:1450:4864:20::140]) (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 4FVgBC6361z9t23 for ; Wed, 28 Apr 2021 23:55:15 +1000 (AEST) Received: by mail-lf1-x140.google.com with SMTP id e29-20020a19691d0000b02901ae573d705fsf13523096lfc.23 for ; Wed, 28 Apr 2021 06:55:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1619618112; cv=pass; d=google.com; s=arc-20160816; b=plcq1aFNNB7PUj17bsV78gqUfZ3GiYCkZwvfCqHU3CsnHOHYPyTMhPJPWzH7qIova4 V0pCqZDVmdatyx0FL0dxptvQ7u1UTHkhm6KjTYXQqAcVJ5GBmqBoA/BFlygjYb2QgJ15 nW0HbFtaeXrYP+dVtruJ5MyL5dYgqloGDBQkzFxvrb4o5+FtbIMGWmPlS79TjKAUWEDF RgBQOw8SiFmvqAiWt4526gTqNe+A2lW1Va4uKhIcS3Otz5cB08LRMFyM22a79/VxkUtk /52xtRBCn9bO2G1P0l6SX9cShJH8Pn4s031WdGJ20WrqNwDnkj2WVKGeQNGZcAJxyzIY VIbg== ARC-Message-Signature: i=2; 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=w5CQ+mapVWvcHswSaA4zoT6O/DYstzPjnvLrQ+ldwOU=; b=xDZ9ERKcNAgs///EHzuEsL/r38iualTEKmPjHh1Cq3CtkPQetMyKRbbNT7hqhbRIyj Oni3NP9rJzmM9v9dIBm9OMW7TpkD5DqeYWGglA1K++/OD1Ol7UjyINWDn4Gh0ByWLGki riiBwjzN8zdcXAcG6jvdKnIZ/yeiuoB6n5LLujob0GtuuKmzJ0rlErMlv+HDqduaDDHI 29+bDAHpCTfyTlkLcrYMCPyLYuTqJjwNFdQB1/dn7peS8tuLrb+ZROOm24nCHpWXN2NB UPMn8VIzdN07ABDTeSI1tjm+4VTS8hamIbtvc+KYvDDct/zMoHLvoDho2n6LKvFjObmA lI3Q== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=ESi5W9rU; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de 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=w5CQ+mapVWvcHswSaA4zoT6O/DYstzPjnvLrQ+ldwOU=; b=sVskFUf0rmITWF7wmIeWOkW5znlAms30NpmMMnxjtL0lPFOTorsq6QOemM6K3VeuZ0 nbuiwo/VezB5/SSPOY/SSyk+IN6y/4pqBb3fwORRLXqdgKmHq3uGA1J8rvcHVzCBPPJV cedCBH51QW8gxVypzmcQc4k+YzCSM/8RcrFNvXqUVJTsB2cTtsJSLfdf8nJuxOj1bM0k ILl28L4Ee/vXmgcAQ0ERIGrcreMmafMIBs7L4bfXQCrT3qrW9xVXBm4bL3EIjn/c7gkX 1BnuL9GYiFOHepLNHdLKyM38rgXLYu30GHEjWrTxHVjA7tj398RJb2q0zlqBui6m600V +fpA== 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=w5CQ+mapVWvcHswSaA4zoT6O/DYstzPjnvLrQ+ldwOU=; b=Y917z9pry0T1IMn3m7iX55TykuCp1i/Cx0hn9nmLc5RX80+EBnEMx3N7Yr3ANE/HHF YoOgt5rseHRAEq9jbjoVVjEKRu17HCNVxiEgLzXDE6JG0R7pQkNZsqr0HHI5DgZs8crG Q/uASWMN2QLL+5pjMxLL0Z+cOVscOWRm67xmuDTmEfFHkx6D4t3IXuQzlgvrasIM94sJ locTKyuPdqCwAT+8qiNw95aEC4SCACl0Lkf5jI2r3R9Vw1NYWajmzN4XFJWjfAj+agIM CeUlJTX3dz3dlDKp1wVqt6e4/fSDW9UiBL4pzyCPsEFPq2l+GOLKYeP4gWZDJMJ2wKBt 6C3A== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM531PlaouBGH7CeKNS+I5OprhLN/NQhFzIY9/rfgHpIAwhkx0UXDF QhpYS0JaSyz/cxSWyE1ZpKQ= X-Google-Smtp-Source: ABdhPJyi1suPRGpxt01pVZcQILt0XIkdua2NbbiCX1mU8wm8oPFRH5SiLMVZApZuAhpqJX1NLS01Hw== X-Received: by 2002:a2e:b4ac:: with SMTP id q12mr20644079ljm.221.1619618112287; Wed, 28 Apr 2021 06:55:12 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a19:f815:: with SMTP id a21ls1228074lff.1.gmail; Wed, 28 Apr 2021 06:55:11 -0700 (PDT) X-Received: by 2002:a05:6512:114b:: with SMTP id m11mr21522849lfg.46.1619618111293; Wed, 28 Apr 2021 06:55:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619618111; cv=none; d=google.com; s=arc-20160816; b=cq33wJjP9J3eVzq0kWJmK4L5abOqIDDP53ft4JJxpl1+tpFd3NapXexxMSOqvougpZ GVIqdvITBuIB/W+p6bF5VSP0ko8OwvSq6jDSLlg9Qe0o7PUYsjxhcP3o58H3XqkH6jdZ iPsG7PMg83Rzb6hGwbEaSS3f4EukdqxY3Os+vX9YwajHHtwxycCSAPXmI5EWfmRvtTQm F7KnQnrw247u438rMphUdATrGPWDLpYxUBgDayfeg7c8KNoaLRo0Pasd7aYREBMOey0s M7IyKFOEPk/I59b3QzgfuzH34PuMFzIAa0ZKUmBFJ0iiWEs6KCv/dkM+VQ6RYuuT8z82 Jcdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=g0CBHIg/9UfTr+TGkBqkCKavvZqUjmi6wFE/YGZ29Qc=; b=nB+8jU5ygU7+CwbVKITIfDsDKi3PWGwpflhvGcTIgZAFQr/PiVh0LCEt05FdDHwb0u HjlWoduzmeabDb6mfEx0fvs2mOv8WUQE+JpjxTajXqVtbyHWyvvkaM3ce2mKFPO6ztR1 Gg5A/D65wVL7nl5jiKrh6LVqJXL7M7vjeRD4RpHnXnH7kseHmbGqqmcKFnlrSVjLfUhf FMLA6I18Oa7qSqdCEK/Gpp3+G2ih3QOMSU1NMLouvrCguOThOS/Rf9NixXPDUOWfkqTN fZ1PoxFkgj+aq3ZhoerAo/uFEQL/3Aem6PZHmLRS+9uqinEkwUw4hhKeCGeh8BEJ8GT2 lGHQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=ESi5W9rU; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by gmr-mx.google.com with ESMTPS id b39si797ljr.1.2021.04.28.06.55.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 06:55:11 -0700 (PDT) Received-SPF: pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 6461282CB1 for ; Wed, 28 Apr 2021 15:55:10 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id E83F5182B7B for ; Wed, 28 Apr 2021 15:55:01 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 531) id C53FB1A8BC8; Wed, 28 Apr 2021 15:55:01 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 2/9] FATFS: constify input parameters Date: Wed, 28 Apr 2021 15:54:52 +0200 Message-Id: <20210428135459.951203-3-sbabic@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210428135459.951203-1-sbabic@denx.de> References: <20210428135459.951203-1-sbabic@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=ESi5W9rU; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de 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: , Signed-off-by: Stefano Babic --- fs/diskio.c | 2 +- fs/ff.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/diskio.c b/fs/diskio.c index 39445be..383e3ea 100644 --- a/fs/diskio.c +++ b/fs/diskio.c @@ -28,7 +28,7 @@ static int file_descriptor = -1; * Extension to FatFs library: fatfs_init associates the fatfs library with * a disk device file. It has to be called before using any FatFs API function. */ -int fatfs_init(char *device) +int fatfs_init(const char *device) { if (file_descriptor >= 0) { ERROR("Called fatfs_init second time without fatfs_release"); diff --git a/fs/ff.h b/fs/ff.h index ac41fa4..8c6410f 100644 --- a/fs/ff.h +++ b/fs/ff.h @@ -378,7 +378,7 @@ int ff_del_syncobj (FF_SYNC_t sobj); /* Delete a sync object */ #endif /* Function for assigning UNIX devices to FatFs library. */ -extern int fatfs_init(char *device); +extern int fatfs_init(const char *device); extern void fatfs_release(void); /*--------------------------------------------------------------*/ From patchwork Wed Apr 28 13:54:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1471191 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::63c; helo=mail-ej1-x63c.google.com; envelope-from=swupdate+bncbcxploxj6ikrbwwsuwcamgqemrnbcva@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=h/jtbDg1; dkim-atps=neutral Received: from mail-ej1-x63c.google.com (mail-ej1-x63c.google.com [IPv6:2a00:1450:4864:20::63c]) (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 4FVgBj6Q1zz9t23 for ; Wed, 28 Apr 2021 23:55:41 +1000 (AEST) Received: by mail-ej1-x63c.google.com with SMTP id r14-20020a1709062cceb0290373a80b4002sf12384428ejr.20 for ; Wed, 28 Apr 2021 06:55:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1619618138; cv=pass; d=google.com; s=arc-20160816; b=Sd6OzRaTOODza9BBDpWRiyK7c4Pwh9QVejn+8ANQ/NoYQWhp/YFos0PBOdh6NvPen5 orGUmnhSb9WEQeq06fwZ18W12E+xjZ+TUU9nYIPmMuGXmQQaSp5t1hRAHIkb+BNMMsa5 xUJd/u+B9n82CyQ9/9YhhhKXFLgOMFZu5oEfEpVwwdHihSQqyTccqUn1UMAKiFACUbmH mW3TREwAQAK+Dix6Jv5jj+RQYgnV0o+MWte1LvWSu5ECfptgne5lopZaM7rKUTEdERJj 9DYgXDpK4C7UMxRVHJ8WicvBwBGfN0aWyIFru/OZD/kgK67eon83ti0UNY+WjWvfPMig VFfw== ARC-Message-Signature: i=2; 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=HI3so7czC9BuCyqFuZBx+Fq3JNPjM9g/tC8NJzU+cnM=; b=jLGFUZmF1eTcf5HqImFnQkl/scRrbUMJAXTJ4jBfyeA9OCsLn/kZ/WxFavwruHfixL 4zLaMK+da6nN4zYyCw5KysJgsOgJEq1KeRIvvJJVluAoJeOkR822r7cZwsW9mJVMcRWH 6VImeQmPKy1iQ+VUWRBug5e1xtMoiZsyUzxf5aOqKJq1MsTLYopnY2uuy9wfmZH94o+J hHMjTdJIJzbTVx3Kj/dI/u5vVswRAo53+vUUjRdOjdt8AH9KXQ/7N9IbtvR1nAOt/X99 Wc0+oX8lOpNSiQj+aPfIG//NfkgRYgLkbgL5v7AlG52bhjgzNt6AAhLV+BesxlO2ibb6 Z/jA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=rJ9UetIC; spf=pass (google.com: domain of sbabic@denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=sbabic@denx.de 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=HI3so7czC9BuCyqFuZBx+Fq3JNPjM9g/tC8NJzU+cnM=; b=h/jtbDg1xJL1NZLlVKTBq4VhTZTaKGIMsCtSjd7wIjRCqhW7kHIH0XHEd8B8JiNGPJ Up7oaoAWA01ru1XSElgBXjyYktQExWvscd0uuXquZs/eEiXcKFRjsXzfuO5eLvynDDnt QaFj7ZxFPSzRWAraD/zUM5qKjFQdqtHFKVuQuoLUzHOv5etCWyJpp8S04Hi5zz4vzaXz yv93hKJl3tU3WiVdHHfoQ+wI2B+A3tfh0h9gUFkmWUD4T7O/nW9QPN4NeKFTZBPRSovN sumrUXKnZ/xaU/epIqC4gP15QlT58zrIwNKmGx9/t0pT/Fg6j7/8PQUroiv1mj9oDi5k sfcQ== 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=HI3so7czC9BuCyqFuZBx+Fq3JNPjM9g/tC8NJzU+cnM=; b=qn851OZuNOIOI5j90zwl37h70HduQ0Lqk+VIiE3FeebAjLr9aPDUoiit/MimRp+AnB gqaxjiy1eHLXLQXaa/lBf2h+yCZ7HU/4w75O5mND2bogovP8uGCT6OhoOXzUEenv0IW4 iCZxAYEaDr6OBdEgq472dJDI9ws9USMxTXcPcQ9nVqLqCYfREQJsiKKMjju+WJcsItk3 d//OkautA1eEmYvJMkTfuO+ZD/Sp4Js+1GOV/CggnIa/nfWI2rnpnaNhD9zYFdYSx9TH bwHnUvHqca/aL84tlYR+/hx3eHl5FeAD2IDwIS5+l/CF50JYo8KIvVRjY/AfVGxIw+DJ vkzg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM533hslPYF64lexMt6uaafqQ3PZkN5QPMLtBi6l5fFsScDuoZmYn+ M/cExe3khyMl5weXmr8fPPs= X-Google-Smtp-Source: ABdhPJxRPqkiCriqtpSwRLN9HZKUpIPDAsGysT8s8tMhcwOzCJDFvsrqQqXr6VB6W0+sE06VHiPROA== X-Received: by 2002:aa7:d046:: with SMTP id n6mr11670023edo.357.1619618138291; Wed, 28 Apr 2021 06:55:38 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6402:50cd:: with SMTP id h13ls158315edb.3.gmail; Wed, 28 Apr 2021 06:55:37 -0700 (PDT) X-Received: by 2002:aa7:c3c2:: with SMTP id l2mr3126179edr.41.1619618137445; Wed, 28 Apr 2021 06:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619618137; cv=none; d=google.com; s=arc-20160816; b=ONBFDd6H7D8HrDbCkjJBf4SgvpN30JFRFRNHIrMyPDddiEHv5lvVOl0Rt5k6ga01V9 5+f8BgqFzW/aEd8u9SF/6UOS9ivqLZJaPiW4B5gB4XzRbY3KbW9Ces7jHEUPx9rZXTSX hL7K1dO4wmHkJCDL+Mr2ZRiXaTwluzdepLCmzVrXs5Aa1T3sD/VREEpZxyeR3UIkYjGT GnCCKSHLaQHpozM5VvKj0NEaPY1fVxepaPYZiG26ppoiOooesmkl6OHmwiVRoCewd3Vz kb7DI3rWF0a5P1OY5naLvvri8g6vzdTrBc1Vms0nQFzZGVAG6t7jAZLyH0DdumpUVUB8 tfmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=KLNxqrMWfKcwEdQcErP08sS/Itp/lrrdgFQcrHCOFA8=; b=W0iPsk5FWqC4vSXuRMZnl0yKnJZuIG7IHD/Nd3uIlR5CwPoOFo5zuCEQssEXkP+CAK GLNz/Nc/db2xD1kX6+WAyokVjJ7FMTJqrNGZeS7275t1Hc/0Wt7ZFPkHW2y92zf0/wRe vlRAVzAHkmH2wz/01zZDkmpiLmwA4dAgO6ZHhPFZ5oAjhgKnclxhcs6uIB6leQPOxjfI +pj2YWxiEPKsDwKfGLi6naHazobw5S4AGdRoivSgiEz0YKTlP1ta+bRAtPvyCZ3CRQ+q tV8pPO+C5MJkt4MFsyI9Yu61xFcCd49wy/GzrVestLwYC1fE5GCEU5tpcmlRfclosUdy 5Vrw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=rJ9UetIC; spf=pass (google.com: domain of sbabic@denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=sbabic@denx.de Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by gmr-mx.google.com with ESMTPS id g7si655715edm.3.2021.04.28.06.55.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 06:55:37 -0700 (PDT) Received-SPF: pass (google.com: domain of sbabic@denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 2064682CC3 for ; Wed, 28 Apr 2021 15:55:37 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id 233D9182B8C for ; Wed, 28 Apr 2021 15:55:04 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 531) id CDC761A8BC9; Wed, 28 Apr 2021 15:55:01 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 3/9] diskpart: add a pause for rereading partitions Date: Wed, 28 Apr 2021 15:54:53 +0200 Message-Id: <20210428135459.951203-4-sbabic@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210428135459.951203-1-sbabic@denx.de> References: <20210428135459.951203-1-sbabic@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=rJ9UetIC; spf=pass (google.com: domain of sbabic@denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=sbabic@denx.de 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: , It could be that the kernel needs some more time after rereading the partitions to make them available for user space, so introduce a one second delay after partitioning was finished. Signed-off-by: Stefano Babic --- handlers/diskpart_handler.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c index ad9ddfc..89ab151 100644 --- a/handlers/diskpart_handler.c +++ b/handlers/diskpart_handler.c @@ -383,6 +383,7 @@ static int diskpart(struct img_type *img, ERROR("Partition table cannot be written on disk"); if (fdisk_reread_partition_table(cxt)) WARN("Table cannot be reread from the disk, be careful !"); + sleep(2); } else { ret = 0; TRACE("Same partition table on disk, do not touch partition table !"); @@ -433,6 +434,14 @@ handler_release: fdisk_unref_context(cxt); + /* + * Kernel rereads the partition table and add just a delay to be sure + * that SWUpdate does not try to access the partitions before the kernel is + * ready + */ + + sleep(2); + return ret; } From patchwork Wed Apr 28 13:54:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1471185 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::137; helo=mail-lf1-x137.google.com; envelope-from=swupdate+bncbcxploxj6ikrbr6suwcamgqe7pzrqna@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=oqZ2YFLj; dkim-atps=neutral Received: from mail-lf1-x137.google.com (mail-lf1-x137.google.com [IPv6:2a00:1450:4864:20::137]) (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 4FVgBL4gxgz9t14 for ; Wed, 28 Apr 2021 23:55:22 +1000 (AEST) Received: by mail-lf1-x137.google.com with SMTP id x5-20020a0565121305b029019cde1790dfsf17612950lfu.15 for ; Wed, 28 Apr 2021 06:55:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1619618119; cv=pass; d=google.com; s=arc-20160816; b=tnchYE9cBOcAVeYVramoKLSGt/tLutFzL79oLFuf1NwNbnhet/uuCOdOY5wLazIkKK V99uH3XO6x2ziZ0Yra+tKs/TYt3tbnNFM6MfKlMclzMz/fkmcAYrqz7V3DkxQ766FvQX HsRMX/kiXCqld4yaxiZndRpbKmcqCGvIraD/AEkoYtBvfAIjcexwio7y1RzvkKiYm5qh ZuB088AUj9KsIJaxdaNypPRFK+j7if2BIciFdLHCxtvVwzRvVjktNUEOjUWO875Tbtrq Tj8I7bIKEfkD8XVb4o4ZSRHY7U8Iu8dBPyKqBphXCmbW0dmYLFYXpDuu6sIkda7+x5Gv 4LyA== ARC-Message-Signature: i=2; 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=mO3scgWT+Y+ixa6DTtnWIT/2RZA7g3rXKmz4sVcELPA=; b=VB277nvnwPXySVKAIX0GAtJq6n8K5EI3YV+RYLAAHZIlPOLuva35bsZiP3dLV07ujZ lW5kEiuyrpSvDjVwDexi/gFOXTHn86irnJrNTaRxWtZTktjMrGaKpET8l2zxb4ByX0uF jQKSfXrwsuo2NFZSiM1s4sV9ltHDvr+sCQsAcLriKDDOX5ItIkEUcQ1BpNU6G5BLeol9 K6GP0HZYbNn6lY4/bMiAz7/+ClsUPALy4tZuk8Wjd/dWIlDkV9Zy+NuvHx42l0edlqXu ATibOoUkvJgsvwTXCqNYcld76N6Yf2s+m2FEvYWFV71ZrW1KorhxSM0x2DdUWCovIgf1 xA6w== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=Fnnlklls; spf=pass (google.com: domain of sbabic@denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=sbabic@denx.de 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=mO3scgWT+Y+ixa6DTtnWIT/2RZA7g3rXKmz4sVcELPA=; b=oqZ2YFLjvMaOW6r/ZZ9qXweXWzTu9js9YfJX0huKnLsS3qz0lPmzbd7dMRAIDrpC/N FIGNdZiO7fT8pMtyj+mnJ0SFQS2H98gQ0CvkhcvXnZcLM4FYjhn6oOTS1h7ULBkCPeu+ RYKmU2t0+q4kMrLKJ9/9upeGW1Yr6ok35ioj/uoI6weztaNHan1wTehp8GaZSIB5VouQ RHgeeZJrUHb286Xmj4MkEga8hP9+PKDK4H+QF4CIyjdptAoIAkmnRGTVDCdihk0e4VoK tv9VOOs4zL313yAGjgEKCGarW1iReSVPpliOsaQe4NMVGUhgreESSSI/dHUnx85Itv56 FW+g== 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=mO3scgWT+Y+ixa6DTtnWIT/2RZA7g3rXKmz4sVcELPA=; b=bxxAvN1uxP5k6QNLpCcn6ll0sz3HPS1GhGUjyVDJu0ondmnaYaXfA3NYjrEF5G6ayO mRoQDiRXW/4wgyj6mB62RfL9xTS9mlyAcUUznTIsaYCR+C4yoqAU+JGo3qZzKkHG5l5J tPpA830iNrwsfJ9LJlQBGnc76l3iZ/z2BqZjrkaeRpW+SJMQJaX9xcS3TcL8V0ojNeZy u3pl3vM3ynEV6IPPF+zPI+ZtnxdP9Uf8bfA+ljthK7PL62HNznjSwdABtVAwWxJbxYkC sVsnbejXZAHppXqzFoioxUYJFCAtG28vS6ZExOr3Wryx0UiALDEiqHZtCAQIQQ4L+cCU ZYmQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM532WPEiDaJtCEl4oNh5nsqmrKOkvAReWTiUwd1sEvHvVqpXJF+2S /Buk7kb26JaAmynixDVN7R0= X-Google-Smtp-Source: ABdhPJyx9RlDFnEB+mzCXP/6XZbjy0aLMLtAyB2lSq6A5DIqKJrlvMX6ucIZymHv0on8HNfT8eyPew== X-Received: by 2002:a05:651c:604:: with SMTP id k4mr20371903lje.254.1619618119203; Wed, 28 Apr 2021 06:55:19 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:ac2:5624:: with SMTP id b4ls1227204lff.0.gmail; Wed, 28 Apr 2021 06:55:18 -0700 (PDT) X-Received: by 2002:a19:c154:: with SMTP id r81mr21376472lff.344.1619618118288; Wed, 28 Apr 2021 06:55:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619618118; cv=none; d=google.com; s=arc-20160816; b=uhtna+kzBs3IGqXYGsC35zdRHFc+F9grPlqgHpvi6ZHB2/wshiGvTgV+Z841js/+Xb c1t2Fe+bXhiqjQDwwsF+qIKDklLot5acJV5o4CrZIhyyzP8BcTaBSMmzAfw6E3X8fJ0Z 6AM25nj7wZxbOqTZoO61MV1gIsHg9ju0SJgXH7tAVQEFo5n9jJbVY0TkmbeobT13Ajwz si8hHH0vI3OXAm2QkibkqxdcYub6rgbhl0wYJnU//vatgGyfWy5H+bP4N39xy4SZgNSS VyHAT8xYDnvLmine2sfl7LSCyq7YWMLDRXNH3CVuXshAGeAfjvi/V3TPxlIGaLBF1rJZ Ma2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=8puamc/2JxZeudL3dXxqROb1ugYCFgYw6GHtZLR0sNY=; b=Z7bsgpCwuNqyj/9NGpwby7AsdCXjSF00LE5/H68/4JKZEFtSdeRLT831E1AJWiB/b7 RwnFvOt523YThox0VWxPZZoaFv42WKROd2XuSvSkJpu6k3DZA0uvfHlH67CK+3Bwsgyf M45ABp9kvkZYLtWIOf0wlmAtyZBxZuo+Y8IYLbSzMAaKtQX63QUkpYs/ohDbYiVPgC+a DXH8lVR02x80uBsgHwwFTEs3zKcRA7u3fZpYU8kQCh6EOHbiyZrfiEHwOAdYXf53TWb9 Twwdcene5yCYne7Rx116CXWN2FD74HId+79GhApm8HIMUxZd3V7SXktjt2M85IAnscgQ GETg== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=Fnnlklls; spf=pass (google.com: domain of sbabic@denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=sbabic@denx.de Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by gmr-mx.google.com with ESMTPS id b2si1037ljf.0.2021.04.28.06.55.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 06:55:18 -0700 (PDT) Received-SPF: pass (google.com: domain of sbabic@denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 7374682CBE for ; Wed, 28 Apr 2021 15:55:17 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id F15F5182B85 for ; Wed, 28 Apr 2021 15:55:01 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 531) id D668C1A8BCA; Wed, 28 Apr 2021 15:55:01 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 4/9] Introduce a generic mkfile interface Date: Wed, 28 Apr 2021 15:54:54 +0200 Message-Id: <20210428135459.951203-5-sbabic@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210428135459.951203-1-sbabic@denx.de> References: <20210428135459.951203-1-sbabic@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=Fnnlklls; spf=pass (google.com: domain of sbabic@denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=sbabic@denx.de 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: , Replace specific file system include file with a more generic that can be used for both FATFS and EXT filesystems. Signed-off-by: Stefano Babic --- fs/fat_fs.c | 4 ++-- handlers/diskpart_handler.c | 2 +- include/fatfs_interface.h | 13 ------------- include/fs_interface.h | 19 +++++++++++++++++++ 4 files changed, 22 insertions(+), 16 deletions(-) delete mode 100644 include/fatfs_interface.h create mode 100644 include/fs_interface.h diff --git a/fs/fat_fs.c b/fs/fat_fs.c index 86eb1a7..93e3489 100644 --- a/fs/fat_fs.c +++ b/fs/fat_fs.c @@ -8,14 +8,14 @@ #include #include -#include +#include #include #include #include "ff.h" -int fat_mkfs(char *device_name) +int fat_mkfs(const char *device_name, const char __attribute__ ((__unused__)) *fstype) { if (fatfs_init(device_name)) return -1; diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c index 89ab151..bc3a8c8 100644 --- a/handlers/diskpart_handler.c +++ b/handlers/diskpart_handler.c @@ -18,7 +18,7 @@ #include "swupdate.h" #include "handler.h" #include "util.h" -#include "fatfs_interface.h" +#include "fs_interface.h" void diskpart_handler(void); diff --git a/include/fatfs_interface.h b/include/fatfs_interface.h deleted file mode 100644 index 0cefb94..0000000 --- a/include/fatfs_interface.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (C) 2021 Weidmueller Interface GmbH & Co. KG - * Roland Gaudig - * - * SPDX-License-Identifier: GPL-2.0-only - */ - -#ifndef _FATFS_INTERFACE_H -#define _FATFS_INTERFACE_H - -extern int fat_mkfs(char *device_name); - -#endif diff --git a/include/fs_interface.h b/include/fs_interface.h new file mode 100644 index 0000000..e871257 --- /dev/null +++ b/include/fs_interface.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 Stefano Babic + * + * SPDX-License-Identifier: GPL-2.0-only + */ + +#ifndef _FS_INTERFACE_H +#define _FS_INTERFACE_H + +#if defined(CONFIG_FAT_FILESYSTEM) +extern int fat_mkfs(const char *device_name, const char *fstype); +#endif + +#if defined (CONFIG_EXT_FILESYSTEM) +extern int ext_mkfs(const char *device_name, const char *fstype, unsigned long features, + const char *volume_label); +#endif + +#endif From patchwork Wed Apr 28 13:54:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1471192 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::13b; helo=mail-lf1-x13b.google.com; envelope-from=swupdate+bncbcxploxj6ikrbx6suwcamgqe24soviq@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=ANBRGsRN; dkim-atps=neutral Received: from mail-lf1-x13b.google.com (mail-lf1-x13b.google.com [IPv6:2a00:1450:4864:20::13b]) (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 4FVgBq1nVRz9sX2 for ; Wed, 28 Apr 2021 23:55:47 +1000 (AEST) Received: by mail-lf1-x13b.google.com with SMTP id x28-20020a056512047cb02901ae692ee37esf12285986lfd.3 for ; Wed, 28 Apr 2021 06:55:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1619618143; cv=pass; d=google.com; s=arc-20160816; b=a0R3jdXiab4tDhWcuoitZQQOU7meq2yQCTiFaspi5MfZ9tHk+JXd5UBZ1FGF+uO/pu gHre2gojlPFL2DJgwebahruu5J8SEO600dLsNTdenJmdeBFLPco6GZhl4I53LhzMhCyV F9GcxekwfhGGMEWHd+oB8iAGMYksPG9VBks5LSI8Q6i0Mk1mPo+szvbKJjsAVsPO1g+t 21kLr8ZLcu0YuQqDop1XDWOYNLPu43+HemLT0Iby+JS1vu9ErSh/qUx5I8deBw/DSgHj OrIE7ualpPJqGZkSut0AVU2K3yzJC7iEnCzFFAZXW9TaLfaKoIZgbBhmG87mEqfx04Al DCIA== ARC-Message-Signature: i=2; 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=AOx4e0DDayzRO+pPVsT7+Qp1vpizfJ1oaOhaIlGhaHU=; b=zaXtVdL9soxbD/VxsdBhE9xbSDD4fCAfuULp5uJq3jWncyf8/nXXAot7iV1wXjE9yh LQwIxql9puqqyxeTjPmkWmF2Hw2ZQ5qF9UkW6JqybG8rCAkOuWguKR5/8kqImPW3N26g X1A0dkGS0vK5rXVyJNCQmun3Z7b/1eD9oKOUZJ2gcLQMdNOjbacPhnzCPqY6m/m0OWo5 xekYqLukfmzhhldfzA3X0FzyGlxP9lwyRxYwcckGPI6O/KEttZYs6JvdQcIC0O8ArzrV 4CjHdnRf6OQhjOFPtvQLuoR4y6bkMC8s7If3ze5dooIGLuUhcvwtw2iMIcb8iAu0TLke MnIQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b="lanx/RdH"; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de 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=AOx4e0DDayzRO+pPVsT7+Qp1vpizfJ1oaOhaIlGhaHU=; b=ANBRGsRNIC/0/pBBSQPlBOKVhLdzgYO8cqa9fFP896Migo7YFnwLR6p0s4XqrGpWp6 97s20y6kdSJbagCzOrJHxPOlqjo9NrM5CqLtBiWD0bfQvVrZenT3wlGSb5ahGnA9s803 EuzW7+Rykt+E31Nm0O06/LFWbYfN6nBYR/WL0JnlFWCewQbiKusRB2ynACd7B41yyltM sENb1xnmtuT6w2hJQiCSZr61KeW0JY3Uu+M7D5Y8pEk7Bjhdz1K72ipNfmxn7OypOy/y F89LUioGDV6BElxi54xf8nqti//2pUkOLmigrWLcqeLwlupXVqy6Xu56JNT7SbBwqcpI +aHA== 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=AOx4e0DDayzRO+pPVsT7+Qp1vpizfJ1oaOhaIlGhaHU=; b=s/bM7NoeuP8uyLZ1Wjitu1VxdYtcwo6UfLsYJvBniXFGH8eDQdyfrzOYT01Nht+N45 RH42pbB+okBEAw91sMEpSlKoPGQwkk2AHuNYUDES8ecJOlLkep00dJSEXqGObtzwzdB8 08SiZHPkJryh4famrrkZEFCCjCdIAqvCeWqiUZOgElR8HxUKqOxwexpgYFtO1GV9H0hG M+PHHCaJITd1bAShOqC/J0v3QPXyAnwYDLl5xSGoTLr5ArGq1fkONTjNJhA36Hdhb+Kj xmnt/uS2zIW33nkSNzp3eKCBkkhhEX67mkO6F14jAl0ef/Mgqw3J01n5PVnAWZKh6vmA LAgw== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM532ovKlsmAgHiyBZpL+TWLKF+rY4K84C2Vs+YHJ5fGGDLgEcI3jj lOIUV2+fpzFIQ+DAcUh3LLc= X-Google-Smtp-Source: ABdhPJxdGVXR6QLP1ZIm592uqtTZIK2nJhMpUwLVi5yKKJ7o9HVHmAgS5AFdUpKEh9kpiJU0TiQXbw== X-Received: by 2002:ac2:5e39:: with SMTP id o25mr20661668lfg.619.1619618143624; Wed, 28 Apr 2021 06:55:43 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:ac2:5f9a:: with SMTP id r26ls1228431lfe.2.gmail; Wed, 28 Apr 2021 06:55:42 -0700 (PDT) X-Received: by 2002:ac2:511a:: with SMTP id q26mr20768636lfb.399.1619618142591; Wed, 28 Apr 2021 06:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619618142; cv=none; d=google.com; s=arc-20160816; b=p3fdX2AmNQ9n3Cmsidji7fg2Rk0V0tnacXFLW0SHDo4oy90PoxS4HbjXvcfGBHYSC0 bcmFDuXshh5o1pbleYARR5PgTLbNYlmPJ5gT/y/ti1ivdZUfFzPmcOO47nneOFB62tk/ 9CwjGkUx7Pby4EJLMFoz8TPd38Gr5uWd+tCRVkrrOJoa42wFj5GAQy06L6QlbCNtzFLq GX65f6C6ait4uW8ZvDaaR4cV1BmNuOAgbhJozJ5GgjnC5wklvOmR+7j8peITdD07cHSf vPupf4ECgt814BWf0aBD2Ge2vdwNcUKpUW4qmlrBsvR4k1lTc3nAEUlRXkMLnXTeGka5 buQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=uk5W7+JNbXZxINVr0eb2LNdaTVa2DXSZPkt9Ii7oigI=; b=UAi7nDL5Ky2zTIhyHviE7wIfkH3KvD95le31UUbehl4z+dMKUb45ds+K+EqoTfxsVM 77H+y+NH40VHPgtax0xXVy517sv+IjAUhO+XYEMABTmYIZ61u2vpX6NlhFAmpBpdkbKb sBGf2UeH2n5mECkmy9RKWxwlDkLo/ntYwKEEpLziembQKhYs5hyDpa9IUq8FEZUCzcyb UIbzNsV7dMJ6Ny2hJVexIYy3trVjQS+HXjiJR1vjp00KvygNpUoxzin9Vdn8H7LehtyB S6RKbkUbBEcCORnCcB+TU9sJz2ovSCwnBPDN29+/t1gRxTl3ZSkcrwt0SsYXZbiqdblq ruBw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b="lanx/RdH"; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by gmr-mx.google.com with ESMTPS id b12si215ljo.3.2021.04.28.06.55.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 06:55:42 -0700 (PDT) Received-SPF: pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id E853682CBF for ; Wed, 28 Apr 2021 15:55:41 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id 1B53F182B73 for ; Wed, 28 Apr 2021 15:55:08 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 531) id E10631A8BCB; Wed, 28 Apr 2021 15:55:01 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 5/9] Format extX filesystem Date: Wed, 28 Apr 2021 15:54:55 +0200 Message-Id: <20210428135459.951203-6-sbabic@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210428135459.951203-1-sbabic@denx.de> References: <20210428135459.951203-1-sbabic@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b="lanx/RdH"; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de 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: , The diskpart handler can repartition a device but it was not able to format with a filesystem. Commit c35590 introduces the format capability for VFAT filesystem. This patch goes in the same direction and adds support for extX (ext2 / ext3 / ext4) filesystem. The code to initialize the filesystem is largely taken from the mke2fs utility present on all Linux distribution. Code was rearranged to work as library, and it was simplified using the default setup. It does not support all features of mke2fs, and it substitutes the profiles used in the original code with a fix set of features. It has the same functionalities as : mke2fs -t [ext2 | ext3 | ext4] Signed-off-by: Stefano Babic --- Makefile.flags | 4 + fs/Config.in | 7 + fs/Makefile | 1 + fs/mke2fs.c | 1070 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1082 insertions(+) create mode 100644 fs/mke2fs.c diff --git a/Makefile.flags b/Makefile.flags index 79b37b5..d3ca49d 100644 --- a/Makefile.flags +++ b/Makefile.flags @@ -185,6 +185,10 @@ ifeq ($(CONFIG_DISKPART),y) LDLIBS += fdisk endif +ifeq ($(CONFIG_EXT_FILESYSTEM),y) +LDLIBS += ext2fs uuid blkid +endif + ifeq ($(CONFIG_UNIQUEUUID),y) LDLIBS += blkid endif diff --git a/fs/Config.in b/fs/Config.in index 0d1b478..1a3bc85 100644 --- a/fs/Config.in +++ b/fs/Config.in @@ -8,3 +8,10 @@ config FAT_FILESYSTEM default n help Enable support for creating FAT file systems. + +config EXT_FILESYSTEM + bool "EXT2 / EXT3 / EXT4 file system creation support" + depends on DISKFORMAT + default n + help + Enable support for creating EXT file systems. diff --git a/fs/Makefile b/fs/Makefile index fbae9c7..7fe70ae 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -5,3 +5,4 @@ lib-$(CONFIG_FAT_FILESYSTEM) += diskio.o \ fat_fs.o \ ff.o +lib-$(CONFIG_EXT_FILESYSTEM) += mke2fs.o \ diff --git a/fs/mke2fs.c b/fs/mke2fs.c new file mode 100644 index 0000000..29b2c03 --- /dev/null +++ b/fs/mke2fs.c @@ -0,0 +1,1070 @@ +/* + * Copyright (C) 2021 Stefano Babic, sbabic@denx.de + * + * The code is mostly taken and modified from + * mke2fs.c - Make a ext2fs filesystem. + * + * Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, + * 2003, 2004, 2005 by Theodore Ts'o. + * + * SPDX-License-Identifier: GPL-2.0-only + */ + +/* + * mke2fs uses the libe2fs library, but there is a lot of to do + * to initialize a extX filesystem. mke2fs has a lot of options + * and features that are not required by SWUpdate. + * This is a port from the original mke2fs, with these goals: + * - create a library to initialize a fs instead of a tool + * - use just default options + * + * This library has the same functionality compared to call + * mke2fs without option, that is: + * + * mke2fs -t + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "util.h" +#include "fs_interface.h" + +#include +#include + +#define STRIDE_LENGTH 8 + +#define MAX_32_NUM ((((unsigned long long) 1) << 32) - 1) + +static __u64 offset; + +static __u32 zero_buf[4]; + +static int int_log2(unsigned long long arg) +{ + int l = 0; + + arg >>= 1; + while (arg) { + l++; + arg >>= 1; + } + return l; +} + +/* + * Determine the number of journal blocks to use, either via + * user-specified # of megabytes, or via some intelligently selected + * defaults. + * + * Find a reasonable journal file size (in blocks) given the number of blocks + * in the filesystem. For very small filesystems, it is not reasonable to + * have a journal that fills more than half of the filesystem. + */ +static unsigned int figure_journal_size(int size, ext2_filsys fs) +{ + int j_blocks; + + j_blocks = ext2fs_default_journal_size(ext2fs_blocks_count(fs->super)); + if (j_blocks < 0) { + WARN("Filesystem too small for a journal"); + return 0; + } + + if (size > 0) { + j_blocks = size * 1024 / (fs->blocksize / 1024); + if (j_blocks < 1024 || j_blocks > 10240000) { + ERROR("\nThe requested journal " + "size is %d blocks; it must be\n" + "between 1024 and 10240000 blocks. " + "Aborting.\n", + j_blocks); + return 0; + } + if ((unsigned) j_blocks > ext2fs_free_blocks_count(fs->super) / 2) { + WARN("Journal size too big for filesystem.\n"); + return 0; + } + } + return j_blocks; +} + +static int write_reserved_inodes(ext2_filsys fs) +{ + errcode_t retval; + ext2_ino_t ino; + struct ext2_inode *inode; + + retval = ext2fs_get_memzero(EXT2_INODE_SIZE(fs->super), &inode); + if (retval) { + ERROR("inode_init while allocating memory: %ld", retval); + return -ENOMEM; + } + + for (ino = 1; ino < EXT2_FIRST_INO(fs->super); ino++) { + retval = ext2fs_write_inode_full(fs, ino, inode, + EXT2_INODE_SIZE(fs->super)); + if (retval) { + ERROR("ext2fs_write_inode_full while writing reserved inodes : %ld", retval); + return -1; + } + } + + ext2fs_free_mem(&inode); + + return 0; +} + +static errcode_t packed_allocate_tables(ext2_filsys fs) +{ + errcode_t retval; + dgrp_t i; + blk64_t goal = 0; + + for (i = 0; i < fs->group_desc_count; i++) { + retval = ext2fs_new_block2(fs, goal, NULL, &goal); + if (retval) + return retval; + ext2fs_block_alloc_stats2(fs, goal, +1); + ext2fs_block_bitmap_loc_set(fs, i, goal); + } + for (i = 0; i < fs->group_desc_count; i++) { + retval = ext2fs_new_block2(fs, goal, NULL, &goal); + if (retval) + return retval; + ext2fs_block_alloc_stats2(fs, goal, +1); + ext2fs_inode_bitmap_loc_set(fs, i, goal); + } + for (i = 0; i < fs->group_desc_count; i++) { + blk64_t end = ext2fs_blocks_count(fs->super) - 1; + retval = ext2fs_get_free_blocks2(fs, goal, end, + fs->inode_blocks_per_group, + fs->block_map, &goal); + if (retval) + return retval; + ext2fs_block_alloc_stats_range(fs, goal, + fs->inode_blocks_per_group, +1); + ext2fs_inode_table_loc_set(fs, i, goal); + ext2fs_group_desc_csum_set(fs, i); + } + return 0; +} + +static int write_inode_tables(ext2_filsys fs, int lazy_flag, int itable_zeroed) +{ + errcode_t retval; + blk64_t blk; + dgrp_t i; + int num; + + for (i = 0; i < fs->group_desc_count; i++) { + + blk = ext2fs_inode_table_loc(fs, i); + num = fs->inode_blocks_per_group; + + if (lazy_flag) + num = ext2fs_div_ceil((fs->super->s_inodes_per_group - + ext2fs_bg_itable_unused(fs, i)) * + EXT2_INODE_SIZE(fs->super), + EXT2_BLOCK_SIZE(fs->super)); + if (!lazy_flag || itable_zeroed) { + /* The kernel doesn't need to zero the itable blocks */ + ext2fs_bg_flags_set(fs, i, EXT2_BG_INODE_ZEROED); + ext2fs_group_desc_csum_set(fs, i); + } + if (!itable_zeroed) { + retval = ext2fs_zero_blocks2(fs, blk, num, &blk, &num); + if (retval) { + ERROR("Could not write %d " + "blocks in inode table starting at %llu", + num, blk); + return -1; + } + } + } + + /* Reserved inodes must always have correct checksums */ + if (ext2fs_has_feature_metadata_csum(fs->super)) + write_reserved_inodes(fs); + + return 0; +} + +static int create_root_dir(ext2_filsys fs, uid_t root_uid, gid_t root_gid) +{ + errcode_t retval; + struct ext2_inode inode; + + retval = ext2fs_mkdir(fs, EXT2_ROOT_INO, EXT2_ROOT_INO, 0); + if (retval) { + ERROR("%s ext2fs_mkdir while creating root dir", strerror(retval)); + return -1; + } + if (root_uid != 0 || root_gid != 0) { + retval = ext2fs_read_inode(fs, EXT2_ROOT_INO, &inode); + if (retval) { + ERROR("%s ext2fs_read_inode while reading root inode", strerror(retval)); + return -1; + } + + inode.i_uid = root_uid; + ext2fs_set_i_uid_high(inode, root_uid >> 16); + inode.i_gid = root_gid; + ext2fs_set_i_gid_high(inode, root_gid >> 16); + + retval = ext2fs_write_new_inode(fs, EXT2_ROOT_INO, &inode); + if (retval) { + ERROR("%s ext2fs_write_inode while setting root inode ownership", strerror(retval)); + return -1; + } + } + + return 0; +} + +static int create_lost_and_found(ext2_filsys fs) +{ + unsigned int lpf_size = 0; + errcode_t retval; + ext2_ino_t ino; + const char *name = "lost+found"; + int i; + + fs->umask = 077; + retval = ext2fs_mkdir(fs, EXT2_ROOT_INO, 0, name); + if (retval) { + ERROR("%s ext2fs_mkdir while creating /lost+found", strerror(retval)); + return -1; + } + + retval = ext2fs_lookup(fs, EXT2_ROOT_INO, name, strlen(name), 0, &ino); + if (retval) { + ERROR("%s ext2_lookup while looking up /lost+found", strerror(retval)); + return -1; + } + + for (i=1; i < EXT2_NDIR_BLOCKS; i++) { + /* Ensure that lost+found is at least 2 blocks, so we always + * test large empty blocks for big-block filesystems. */ + if ((lpf_size += fs->blocksize) >= 16*1024 && + lpf_size >= 2 * fs->blocksize) + break; + retval = ext2fs_expand_dir(fs, ino); + if (retval) { + ERROR("%s ext2fs_expand_dir while expanding /lost+found", strerror(retval)); + return -1; + } + } + + return 0; +} + +static int create_bad_block_inode(ext2_filsys fs, badblocks_list bb_list) +{ + errcode_t retval; + + ext2fs_mark_inode_bitmap2(fs->inode_map, EXT2_BAD_INO); + ext2fs_inode_alloc_stats2(fs, EXT2_BAD_INO, +1, 0); + retval = ext2fs_update_bb_inode(fs, bb_list); + if (retval) { + ERROR("ext2fs_update_bb_inode %ld" + "while setting bad block inode", retval); + return -1; + } + + return 0; +} + +static void reserve_inodes(ext2_filsys fs) +{ + ext2_ino_t i; + + for (i = EXT2_ROOT_INO + 1; i < EXT2_FIRST_INODE(fs->super); i++) + ext2fs_inode_alloc_stats2(fs, i, +1, 0); + ext2fs_mark_ib_dirty(fs); +} + +#define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */ +#define BSD_MAGICDISK (0x57455682UL) /* The disk magic number reversed */ +#define BSD_LABEL_OFFSET 64 + +static int zap_sector(ext2_filsys fs, int sect, int nsect) +{ + char *buf; + int retval; + unsigned int *magic; + + buf = calloc(512, nsect); + if (!buf) { + ERROR("Out of memory erasing sectors %d-%d\n", + sect, sect + nsect - 1); + return -ENOMEM; + } + + if (sect == 0) { + /* Check for a BSD disklabel, and don't erase it if so */ + retval = io_channel_read_blk64(fs->io, 0, -512, buf); + if (retval) + WARN("Warning: could not read block 0: %s\n", + strerror(retval)); + else { + magic = (unsigned int *) (buf + BSD_LABEL_OFFSET); + if ((*magic == BSD_DISKMAGIC) || + (*magic == BSD_MAGICDISK)) + return 0; + } + } + + memset(buf, 0, 512*nsect); + io_channel_set_blksize(fs->io, 512); + retval = io_channel_write_blk64(fs->io, sect, -512*nsect, buf); + io_channel_set_blksize(fs->io, fs->blocksize); + free(buf); + if (retval) + WARN("Warning: could not erase sector %d: %d", + sect, retval); + + return 0; +} + +/* + * Sets the geometry of a device (stripe/stride), and returns the + * device's alignment offset, if any, or a negative error. + */ +static int get_device_geometry(const char *file, + struct ext2_super_block *param, + unsigned int psector_size) +{ + int rc = -1; + unsigned int blocksize; + blkid_probe pr; + blkid_topology tp; + unsigned long min_io; + unsigned long opt_io; + struct stat statbuf; + + /* Nothing to do for a regular file */ + if (!stat(file, &statbuf) && S_ISREG(statbuf.st_mode)) + return 0; + + pr = blkid_new_probe_from_filename(file); + if (!pr) + goto out; + + tp = blkid_probe_get_topology(pr); + if (!tp) + goto out; + + min_io = blkid_topology_get_minimum_io_size(tp); + opt_io = blkid_topology_get_optimal_io_size(tp); + blocksize = EXT2_BLOCK_SIZE(param); + if ((min_io == 0) && (psector_size > blocksize)) + min_io = psector_size; + if ((opt_io == 0) && min_io) + opt_io = min_io; + if ((opt_io == 0) && (psector_size > blocksize)) + opt_io = psector_size; + + /* setting stripe/stride to blocksize is pointless */ + if (min_io > blocksize) + param->s_raid_stride = min_io / blocksize; + if (opt_io > blocksize) + param->s_raid_stripe_width = opt_io / blocksize; + + rc = blkid_topology_get_alignment_offset(tp); +out: + blkid_free_probe(pr); + return rc; +} + +static int mkfs_prepare(const char *device_name, struct ext2_super_block *pfs_param) +{ + int cluster_size = 0; + char *tmp; + int explicit_fssize = 0; + int blocksize = 0; + int inode_ratio = 0; + int inode_size = 0; + unsigned long flex_bg_size = 0; + double reserved_ratio = -1.0; + int lsector_size = 0, psector_size = 0; + unsigned long long num_inodes = 0; /* unsigned long long to catch too-large input */ + errcode_t retval; + char * usage_types = 0; + int num_backups = 2; /* number of backup bg's for sparse_super2 */ + blk64_t dev_size; + int sys_page_size = 4096; + + /* + * NOTE: A few words about fs_blocks_count and blocksize: + * + * Initially, blocksize is set to zero, which implies 1024. + * If -b is specified, blocksize is updated to the user's value. + * + * Next, the device size or the user's "blocks" command line argument + * is used to set fs_blocks_count; the units are blocksize. + * + * Later, if blocksize hasn't been set and the profile specifies a + * blocksize, then blocksize is updated and fs_blocks_count is scaled + * appropriately. Note the change in units! + * + * Finally, we complain about fs_blocks_count > 2^32 on a non-64bit fs. + */ + blk64_t fs_blocks_count = 0; + int use_bsize; + + pfs_param->s_rev_level = 1; /* Create revision 1 filesystems now */ + + /* Determine the size of the device (if possible) */ + retval = ext2fs_get_device_size2(device_name, + EXT2_BLOCK_SIZE(pfs_param), + &dev_size); + if (retval && (retval != EXT2_ET_UNIMPLEMENTED)) { + ERROR("%s while trying to determine filesystem size", strerror(retval)); + return -EINVAL; + } + + if (retval == EXT2_ET_UNIMPLEMENTED) { + ERROR("Couldn't determine device size; you " + "must specify the size of the " + "filesystem"); + return -EINVAL; + } else { + if (dev_size == 0) { + ERROR("Device size reported to be zero. " + "Invalid partition specified, or" + "partition table wasn't reread " + "after running fdisk, due to" + "a modified partition being busy " + "and in use."); + ERROR("You may need to reboot" + "to re-read your partition table." + ); + return -EINVAL; + } + fs_blocks_count = dev_size; + if (sys_page_size > EXT2_BLOCK_SIZE(pfs_param)) + fs_blocks_count &= ~((blk64_t) ((sys_page_size / + EXT2_BLOCK_SIZE(pfs_param))-1)); + } + + /* + * We have the file system (or device) size, so we can now + * determine the appropriate file system types so the fs can + * be appropriately configured. + */ + + /* Get the hardware sector sizes, if available */ + retval = ext2fs_get_device_sectsize(device_name, &lsector_size); + if (retval) { + ERROR("%s while trying to determine hardware sector size", strerror(retval)); + return -EFAULT; + } + retval = ext2fs_get_device_phys_sectsize(device_name, &psector_size); + if (retval) { + ERROR("%s while trying to determine physical sector size", strerror(retval)); + return -EFAULT; + } + + /* Older kernels may not have physical/logical distinction */ + if (!psector_size) + psector_size = lsector_size; + + use_bsize = sys_page_size; + if (lsector_size && use_bsize < lsector_size) + use_bsize = lsector_size; + if ((blocksize < 0) && (use_bsize < (-blocksize))) + use_bsize = -blocksize; + blocksize = use_bsize; + fs_blocks_count /= (blocksize / 1024); + + + pfs_param->s_log_block_size = + int_log2(blocksize >> EXT2_MIN_BLOCK_LOG_SIZE); + + /* + * We now need to do a sanity check of fs_blocks_count for + * 32-bit vs 64-bit block number support. + */ + if ((fs_blocks_count > MAX_32_NUM) && + ext2fs_has_feature_64bit(pfs_param)) + ext2fs_clear_feature_resize_inode(pfs_param); + + if ((fs_blocks_count > MAX_32_NUM) && + !ext2fs_has_feature_64bit(pfs_param)) { + ERROR("Size of device (0x%llx blocks) %s " + "too big to be expressed " + "in 32 bits using a blocksize of %d.", + fs_blocks_count, device_name, + EXT2_BLOCK_SIZE(pfs_param)); + return -EFAULT; + } + /* + * Guard against group descriptor count overflowing... Mostly to avoid + * strange results for absurdly large devices. This is in log2: + * (blocksize) * (bits per byte) * (maximum number of block groups) + */ + if (fs_blocks_count > + (1ULL << (EXT2_BLOCK_SIZE_BITS(pfs_param) + 3 + 32)) - 1) { + ERROR("Size of device (0x%llx blocks) %s " + "too big to create " + "a filesystem using a blocksize of %d.", + fs_blocks_count, device_name, + EXT2_BLOCK_SIZE(pfs_param)); + return -EFAULT; + } + + ext2fs_blocks_count_set(pfs_param, fs_blocks_count); + + /* Get reserved_ratio from profile if not specified on cmd line. */ + reserved_ratio = 5.0; + + if (ext2fs_has_feature_journal_dev(pfs_param)) { + reserved_ratio = 0; + pfs_param->s_feature_incompat = EXT3_FEATURE_INCOMPAT_JOURNAL_DEV; + pfs_param->s_feature_compat = 0; + pfs_param->s_feature_ro_compat &= + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM; + } + + /* Check the user's mkfs options for 64bit */ + if (ext2fs_has_feature_64bit(pfs_param) && + !ext2fs_has_feature_extents(pfs_param)) { + ERROR("Extents MUST be enabled for a 64-bit " + "filesystem. Pass -O extents to rectify."); + return -EINVAL; + } + + /* Set first meta blockgroup via an environment variable */ + /* (this is mostly for debugging purposes) */ + if (ext2fs_has_feature_meta_bg(pfs_param) && + (tmp = getenv("MKE2FS_FIRST_META_BG"))) + pfs_param->s_first_meta_bg = atoi(tmp); + if (ext2fs_has_feature_bigalloc(pfs_param)) { + if (!cluster_size) + cluster_size = blocksize*16; + + pfs_param->s_log_cluster_size = + int_log2(cluster_size >> EXT2_MIN_CLUSTER_LOG_SIZE); + if (pfs_param->s_log_cluster_size && + pfs_param->s_log_cluster_size < pfs_param->s_log_block_size) { + ERROR("The cluster size may not be " + "smaller than the block size."); + return -EINVAL; + } + } else if (cluster_size) { + ERROR("specifying a cluster size requires the " + "bigalloc feature"); + return -EINVAL; + } else + pfs_param->s_log_cluster_size = pfs_param->s_log_block_size; + + if (inode_ratio == 0) { + inode_ratio = 8192; + if (inode_ratio < blocksize) + inode_ratio = blocksize; + if (inode_ratio < EXT2_CLUSTER_SIZE(pfs_param)) + inode_ratio = EXT2_CLUSTER_SIZE(pfs_param); + } + + retval = get_device_geometry(device_name, pfs_param, + (unsigned int) psector_size); + if (retval < 0) { + WARN("warning: Unable to get device geometry for %s\n", + device_name); + } else if (retval) { + TRACE("%s alignment is offset by %lu bytes.", + device_name, retval); + TRACE("This may result in very poor performance, " + "(re)-partitioning suggested."); + } + + blocksize = EXT2_BLOCK_SIZE(pfs_param); + + /* + * Initialize s_desc_size so that the parse_extended_opts() + * can correctly handle "-E resize=NNN" if the 64-bit option + * is set. + */ + if (ext2fs_has_feature_64bit(pfs_param)) + pfs_param->s_desc_size = EXT2_MIN_DESC_SIZE_64BIT; + + /* This check should happen beyond the last assignment to blocksize */ + if (blocksize > sys_page_size) { + WARN("Warning: %d-byte blocks too big for system " + "(max %d), forced to continue\n", + blocksize, sys_page_size); + } + + if (explicit_fssize == 0 && offset > 0) { + fs_blocks_count -= offset / EXT2_BLOCK_SIZE(pfs_param); + ext2fs_blocks_count_set(pfs_param, fs_blocks_count); + WARN("Warning: offset specified without an " + "explicit file system size.\n" + "Creating a file system with %llu blocks " + "but this might\n" + "not be what you want.", + (unsigned long long) fs_blocks_count); + } + + if (ext2fs_has_feature_casefold(pfs_param) && + ext2fs_has_feature_encrypt(pfs_param)) { + ERROR("The encrypt and casefold features are not " + "compatible.\nThey can not be both enabled " + "simultaneously."); + return -EINVAL; + } + + /* Don't allow user to set both metadata_csum and uninit_bg bits. */ + if (ext2fs_has_feature_metadata_csum(pfs_param) && + ext2fs_has_feature_gdt_csum(pfs_param)) + ext2fs_clear_feature_gdt_csum(pfs_param); + + /* Can't support bigalloc feature without extents feature */ + if (ext2fs_has_feature_bigalloc(pfs_param) && + !ext2fs_has_feature_extents(pfs_param)) { + ERROR("Can't support bigalloc feature without " + "extents feature"); + return -EINVAL; + } + + if (ext2fs_has_feature_meta_bg(pfs_param) && + ext2fs_has_feature_resize_inode(pfs_param)) { + ERROR("The resize_inode and meta_bg " + "features are not compatible.\n" + "They can not be both enabled " + "simultaneously.\n"); + return -EINVAL; + } + + + /* + * Since sparse_super is the default, we would only have a problem + * here if it was explicitly disabled. + */ + if (ext2fs_has_feature_resize_inode(pfs_param) && + !ext2fs_has_feature_sparse_super(pfs_param)) { + ERROR("reserved online resize blocks not supported " + "on non-sparse filesystem"); + return -EINVAL; + } + + if (pfs_param->s_blocks_per_group) { + if (pfs_param->s_blocks_per_group < 256 || + pfs_param->s_blocks_per_group > 8 * (unsigned) blocksize) { + ERROR("blocks per group count out of range"); + return -EINVAL; + } + } + + /* + * If the bigalloc feature is enabled, then the -g option will + * specify the number of clusters per group. + */ + if (ext2fs_has_feature_bigalloc(pfs_param)) { + pfs_param->s_clusters_per_group = pfs_param->s_blocks_per_group; + pfs_param->s_blocks_per_group = 0; + } + + if (inode_size == 0) + inode_size = 256; + if (!flex_bg_size && ext2fs_has_feature_flex_bg(pfs_param)) + flex_bg_size = 16; + if (flex_bg_size) { + if (!ext2fs_has_feature_flex_bg(pfs_param)) { + ERROR("Flex_bg feature not enabled, so " + "flex_bg size may not be specified"); + return -EINVAL; + } + pfs_param->s_log_groups_per_flex = int_log2(flex_bg_size); + } + + if (inode_size && pfs_param->s_rev_level >= EXT2_DYNAMIC_REV) { + if (inode_size < EXT2_GOOD_OLD_INODE_SIZE || + inode_size > EXT2_BLOCK_SIZE(pfs_param) || + inode_size & (inode_size - 1)) { + ERROR("invalid inode size %d (min %d/max %d)", + inode_size, EXT2_GOOD_OLD_INODE_SIZE, + blocksize); + return -EINVAL; + } + pfs_param->s_inode_size = inode_size; + } + + /* + * If inode size is 128 and inline data is enabled, we need + * to notify users that inline data will never be useful. + */ + if (ext2fs_has_feature_inline_data(pfs_param) && + pfs_param->s_inode_size == EXT2_GOOD_OLD_INODE_SIZE) { + ERROR("%d byte inodes are too small for inline data; " + "specify larger size", + pfs_param->s_inode_size); + return -EINVAL; + } + + /* Make sure number of inodes specified will fit in 32 bits */ + unsigned long long n; + n = ext2fs_blocks_count(pfs_param) * blocksize / inode_ratio; + if (n > MAX_32_NUM) { + if (ext2fs_has_feature_64bit(pfs_param)) + num_inodes = MAX_32_NUM; + else { + ERROR("too many inodes (%llu), raise " + "inode ratio?", n); + return -EINVAL; + } + } + + /* + * Calculate number of inodes based on the inode ratio + */ + pfs_param->s_inodes_count = num_inodes ? num_inodes : + (ext2fs_blocks_count(pfs_param) * blocksize) / inode_ratio; + + if ((((unsigned long long)pfs_param->s_inodes_count) * + (inode_size ? inode_size : EXT2_GOOD_OLD_INODE_SIZE)) >= + ((ext2fs_blocks_count(pfs_param)) * + EXT2_BLOCK_SIZE(pfs_param))) { + ERROR("inode_size (%u) * inodes_count " + "(%u) too big for a\n\t" + "filesystem with %llu blocks, " + "specify higher inode_ratio (-i)\n\t" + "or lower inode count (-N).\n", + inode_size ? inode_size : EXT2_GOOD_OLD_INODE_SIZE, + pfs_param->s_inodes_count, + (unsigned long long) ext2fs_blocks_count(pfs_param)); + return -EINVAL; + } + + /* + * Calculate number of blocks to reserve + */ + ext2fs_r_blocks_count_set(pfs_param, reserved_ratio * + ext2fs_blocks_count(pfs_param) / 100.0); + + if (ext2fs_has_feature_sparse_super2(pfs_param)) { + if (num_backups >= 1) + pfs_param->s_backup_bgs[0] = 1; + if (num_backups >= 2) + pfs_param->s_backup_bgs[1] = ~0; + } + + free(usage_types); + + return 0; +} + +static void fix_cluster_bg_counts(ext2_filsys fs) +{ + blk64_t block, num_blocks, last_block, next; + blk64_t tot_free = 0; + errcode_t retval; + dgrp_t group = 0; + int grp_free = 0; + + num_blocks = ext2fs_blocks_count(fs->super); + last_block = ext2fs_group_last_block2(fs, group); + block = fs->super->s_first_data_block; + while (block < num_blocks) { + retval = ext2fs_find_first_zero_block_bitmap2(fs->block_map, + block, last_block, &next); + if (retval == 0) + block = next; + else { + block = last_block + 1; + goto next_bg; + } + + retval = ext2fs_find_first_set_block_bitmap2(fs->block_map, + block, last_block, &next); + if (retval) + next = last_block + 1; + grp_free += EXT2FS_NUM_B2C(fs, next - block); + tot_free += next - block; + block = next; + + if (block > last_block) { + next_bg: + ext2fs_bg_free_blocks_count_set(fs, group, grp_free); + ext2fs_group_desc_csum_set(fs, group); + grp_free = 0; + group++; + last_block = ext2fs_group_last_block2(fs, group); + } + } + ext2fs_free_blocks_count_set(fs->super, tot_free); +} + +int ext_mkfs(const char *device_name, const char *fstype, unsigned long features, + const char *volume_label) +{ + errcode_t retval = 0; + ext2_filsys fs; + badblocks_list bb_list = 0; + unsigned int journal_blocks = 0; + io_manager io_ptr; + char opt_string[40]; + int itable_zeroed = 0; + unsigned long flags; + struct ext2_super_block fs_param; + uid_t root_uid = 0; + gid_t root_gid = 0; + blk64_t journal_location = ~0LL; + int lazy_itable_init; + int journal_flags = 0; + int journal_size = 0; + + memset(&fs_param, 0, sizeof(struct ext2_super_block)); + + if (!features) { + fs_param.s_feature_compat = EXT2_FEATURE_COMPAT_DIR_INDEX | + EXT2_FEATURE_COMPAT_RESIZE_INODE | + EXT2_FEATURE_COMPAT_EXT_ATTR; + fs_param.s_feature_incompat = EXT2_FEATURE_INCOMPAT_FILETYPE; + fs_param.s_feature_ro_compat = EXT2_FEATURE_RO_COMPAT_LARGE_FILE | + EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER; + if (!strcmp(fstype, "ext4")) { + fs_param.s_feature_compat |= EXT3_FEATURE_COMPAT_HAS_JOURNAL; + fs_param.s_feature_incompat = EXT2_FEATURE_INCOMPAT_FILETYPE | + EXT3_FEATURE_INCOMPAT_EXTENTS | + EXT4_FEATURE_INCOMPAT_64BIT | + EXT4_FEATURE_INCOMPAT_FLEX_BG; + fs_param.s_feature_ro_compat = EXT4_FEATURE_RO_COMPAT_METADATA_CSUM | + EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | + EXT4_FEATURE_RO_COMPAT_DIR_NLINK | + EXT4_FEATURE_RO_COMPAT_HUGE_FILE | + EXT2_FEATURE_RO_COMPAT_LARGE_FILE | + EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER; + journal_size = -1; + } + if (!strcmp(fstype, "ext3")) { + fs_param.s_feature_compat |= EXT3_FEATURE_COMPAT_HAS_JOURNAL; + journal_size = -1; + } + } else + fs_param.s_feature_compat = features; + + TRACE("mke2fs parms for %s: compat 0x%x incompat 0x%x ro %x", + fstype, + fs_param.s_feature_compat, + fs_param.s_feature_incompat, + fs_param.s_feature_ro_compat); + + retval = mkfs_prepare(device_name, &fs_param); + + if (retval) + return retval; + + io_ptr = unix_io_manager; + + /* + * Initialize the superblock.... + */ + flags = EXT2_FLAG_EXCLUSIVE; + flags |= EXT2_FLAG_64BITS; + + retval = ext2fs_initialize(device_name, flags, &fs_param, + io_ptr, &fs); + if (retval) { + ERROR("%s: while setting up superblock", strerror(retval)); + return -EFAULT; + } + + if (ext2fs_has_feature_csum_seed(fs->super) && + !ext2fs_has_feature_metadata_csum(fs->super)) { + ERROR("The metadata_csum_seed feature " + "requires the metadata_csum feature."); + return -EINVAL; + } + + lazy_itable_init = 0; + + if (access("/sys/fs/ext4/features/lazy_itable_init", R_OK) == 0) + lazy_itable_init = 1; + + /* Calculate journal blocks */ + if (journal_size || + ext2fs_has_feature_journal(&fs_param)) + journal_blocks = figure_journal_size(journal_size, fs); + + sprintf(opt_string, "tdb_data_size=%d", fs->blocksize <= 4096 ? + 32768 : fs->blocksize * 8); + io_channel_set_options(fs->io, opt_string); + if (offset) { + sprintf(opt_string, "offset=%llu", offset); + io_channel_set_options(fs->io, opt_string); + } + + if (fs_param.s_flags & EXT2_FLAGS_TEST_FILESYS) + fs->super->s_flags |= EXT2_FLAGS_TEST_FILESYS; + + if (ext2fs_has_feature_flex_bg(&fs_param) || + ext2fs_has_feature_huge_file(&fs_param) || + ext2fs_has_feature_gdt_csum(&fs_param) || + ext2fs_has_feature_dir_nlink(&fs_param) || + ext2fs_has_feature_metadata_csum(&fs_param) || + ext2fs_has_feature_extra_isize(&fs_param)) + fs->super->s_kbytes_written = 1; + + /* + * Wipe out the old on-disk superblock + */ + if (zap_sector(fs, 2, 6) < 0) + return -EFAULT; + + /* + * Generate a UUID for the filesystem + */ + uuid_generate(fs->super->s_uuid); + + if (ext2fs_has_feature_csum_seed(fs->super)) + fs->super->s_checksum_seed = ext2fs_crc32c_le(~0, + fs->super->s_uuid, sizeof(fs->super->s_uuid)); + + ext2fs_init_csum_seed(fs); + + /* + * Initialize the directory index variables + */ + + if (memcmp(fs_param.s_hash_seed, zero_buf, + sizeof(fs_param.s_hash_seed)) != 0) { + memcpy(fs->super->s_hash_seed, fs_param.s_hash_seed, + sizeof(fs->super->s_hash_seed)); + } else + uuid_generate((unsigned char *) fs->super->s_hash_seed); + + /* + * Do not enable periodic fsck + */ + fs->super->s_max_mnt_count = -1; + + /* + * Set the volume label... + */ + if (volume_label) { + memset(fs->super->s_volume_name, 0, + sizeof(fs->super->s_volume_name)); + strncpy(fs->super->s_volume_name, volume_label, + sizeof(fs->super->s_volume_name) - 1); + } + + /* Set current default encryption algorithms for data and + * filename encryption */ + if (ext2fs_has_feature_encrypt(fs->super)) { + fs->super->s_encrypt_algos[0] = + EXT4_ENCRYPTION_MODE_AES_256_XTS; + fs->super->s_encrypt_algos[1] = + EXT4_ENCRYPTION_MODE_AES_256_CTS; + } + + if (ext2fs_has_feature_metadata_csum(fs->super)) + fs->super->s_checksum_type = EXT2_CRC32C_CHKSUM; + + fs->stride = fs->super->s_raid_stride; + if (ext2fs_has_feature_flex_bg(fs->super)) + retval = packed_allocate_tables(fs); + else + retval = ext2fs_allocate_tables(fs); + if (retval) { + ERROR("while trying to allocate filesystem tables"); + return -EFAULT; + } + + retval = ext2fs_convert_subcluster_bitmap(fs, &fs->block_map); + if (retval) { + ERROR("while converting subcluster bitmap"); + return -EFAULT; + } + + + /* rsv must be a power of two (64kB is MD RAID sb alignment) */ + blk64_t rsv = 65536 / fs->blocksize; + blk64_t blocks = ext2fs_blocks_count(fs->super); + blk64_t start; + blk64_t ret_blk; + + if (zap_sector(fs, 0, 2) < 0) + return -EFAULT; + + /* + * Wipe out any old MD RAID (or other) metadata at the end + * of the device. This will also verify that the device is + * as large as we think. Be careful with very small devices. + */ + start = (blocks & ~(rsv - 1)); + if (start > rsv) + start -= rsv; + if (start > 0) + retval = ext2fs_zero_blocks2(fs, start, blocks - start, + &ret_blk, NULL); + + if (retval) { + ERROR("while zeroing block %llu at end of filesystem", + ret_blk); + } + if (write_inode_tables(fs, lazy_itable_init, itable_zeroed) < 0 || + create_root_dir(fs, root_uid, root_gid) < 0 || + create_lost_and_found(fs) < 0) + return -EFAULT; + reserve_inodes(fs); + if (create_bad_block_inode(fs, bb_list) < 0) + return -EFAULT; + if (ext2fs_has_feature_resize_inode(fs->super)) { + retval = ext2fs_create_resize_inode(fs); + if (retval) { + ERROR("while reserving blocks for online resize"); + return -EFAULT; + } + } + + journal_flags |= EXT2_MKJOURNAL_NO_MNT_CHECK; + + if ((journal_size) || + ext2fs_has_feature_journal(&fs_param)) { + + if (!journal_blocks) { + ext2fs_clear_feature_journal(fs->super); + goto no_journal; + } + retval = ext2fs_add_journal_inode2(fs, journal_blocks, + journal_location, + journal_flags); + if (retval) { + ERROR("while trying to create journal"); + return -EFAULT; + } + } +no_journal: + if (ext2fs_has_feature_mmp(fs->super)) { + retval = ext2fs_mmp_init(fs); + if (retval) { + ERROR("Error while enabling multiple " + "mount protection feature."); + return -EFAULT; + } + } + + if (ext2fs_has_feature_bigalloc(&fs_param)) + fix_cluster_bg_counts(fs); + + retval = ext2fs_close_free(&fs); + if (retval) { + ERROR("while writing out and closing file system"); + retval = 1; + } + return retval; +} From patchwork Wed Apr 28 13:54:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1471193 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::63b; helo=mail-ej1-x63b.google.com; envelope-from=swupdate+bncbcxploxj6ikrby6suwcamgqe5acqawa@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=aq3tEOWM; dkim-atps=neutral Received: from mail-ej1-x63b.google.com (mail-ej1-x63b.google.com [IPv6:2a00:1450:4864:20::63b]) (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 4FVgBv165tz9sX2 for ; Wed, 28 Apr 2021 23:55:51 +1000 (AEST) Received: by mail-ej1-x63b.google.com with SMTP id ne22-20020a1709077b96b02903803a047edesf11082145ejc.3 for ; Wed, 28 Apr 2021 06:55:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1619618148; cv=pass; d=google.com; s=arc-20160816; b=e+MejAE/UUGiSN+IJaQk6gC9SZlcX/1oignPHbfdTzHmvy89QoiZQPgfaZhSWQ2Ctu GoK8bP68UBng+0lTi8PeStppTPnW26e/YzXp2fypsDQDLi67WATvVgCyBmmidcvSE9zb dMvLzpFoMg8qftPD35/iO0v8zfs35Fh50DR2ka7mkPgGDDi6O7lV+fBjG+UBso2Bz+gQ h1yA8zEI9blgo1tBYWindJW02qBG9S53Yf4rYLuBYu/12QQapn9eUnitudhHChuQgCa9 R385Po6jBR11bXdN6ShSy8Vim7/5KQu6SUEOqqBEg1rh2isuB1QscHyV4fdsPPvUwI7k cu7g== ARC-Message-Signature: i=2; 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=FWR3WbxQRY7uTURL9dQ69e56IVkpfWOCCgizgBMBzpE=; b=gFE6+qpctgQ3tRIRyojaDwBln1h1/bbVlIbMYXgEJxH5n4zfFFur+eNydGniVyLIRH UomFXE/GU4ODxVeMgZM8CoIo1h5QDzyOqHXDpS9ij0gu+PZjlkqBTU+iEh+zxqnQCZFC dUwZEZa5bgymtme6KnMoHYN9JkGpfMkB5RoVhtdUfDFmrHQcnT62lNLRAqbvJNGqrCtP teLXWs+NLM7PlWJ2LltDnwO3BQIWEDafsMxRon+SlsvJrPNlr8ttyTIDCV5AlhA2dIte AgQXXnvJmgEVgNS+5uI+1RB0g73DdEpDtQgzwLXFZi9O2bZrtVCkWNM/lCe1TX6586SV LBpA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=0Oegu03o; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de 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=FWR3WbxQRY7uTURL9dQ69e56IVkpfWOCCgizgBMBzpE=; b=aq3tEOWMYCRSdStFP2dYryJnOiucH4E3RtTyb6jazE4HknLzb5o7U6eVyVbnx7u/M2 oGCxiUpUakyTPsvsTm439dfvDAIfX02G1+Oyn+92M4Xi+WQzFHUswjXGSk0Wurur2iXe hF3VP+r5HcoerK5A40axdLvAUFef/rG1E4EwTs6VyNMzgj+jf7JDcMZmYlbDQ1DvsVbV NHxrPlCXaZY51PdurBHk/trwfG23G+7fl98pGJDAfq17+8l9KYDJ4b2XGnoG1rPlN3FK rMq9ZmEfASStMP6q7N44Cgx0jWVcdgOrWkR5v99uSoHiMnLOBmt3vDC13X2zAFnEGrk+ 7UVA== 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=FWR3WbxQRY7uTURL9dQ69e56IVkpfWOCCgizgBMBzpE=; b=RqiOEdlFsA2hJWVF0HxXWIwllSwjEWRf8WnLnP3S0NejVxKoXARzvwEZOVjhPd7cRL Yyto+Vy/yjMs5kZnSmipyNbSv3u24rGLoOMQ6j28ujATdKcGlkUazcYonOPuTFvwJt1h gwgVO0uUXEFanENxDOkBsNFOECKLI5SkPGTV04/l6Zscbk2+tz6fIWW+sTxlrfk9gtLu KnwwkGZ71Bod5Oeaw4sRavo2+8dDYnO5GfduHjmxr0Zr5iIrTKqDQpa/R0Uv2nX0+lNz e0uGTMdaOud6vLHBknMdNI0vZFFnaulJZcuMntEmJAWp++PBREjgFwvtYfaxUEBNzIdy pK3Q== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM533ir6tsSrNrMft5fkAX2b6fpk4jSApu+Kt0DawVr61yTdkpeArF 00LAF7dsy7C5n8TGEEcDa2g= X-Google-Smtp-Source: ABdhPJyy3SZ3JzQBjfAr6j4ptNIu1WOIVnaZDL+NLe2/alWTI7G/PgNXrhc36XM/j8tVgBJeog3Kyw== X-Received: by 2002:a17:906:90cf:: with SMTP id v15mr22339334ejw.432.1619618148031; Wed, 28 Apr 2021 06:55:48 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a17:907:97c9:: with SMTP id js9ls10877870ejc.10.gmail; Wed, 28 Apr 2021 06:55:47 -0700 (PDT) X-Received: by 2002:a17:907:399:: with SMTP id ss25mr7356003ejb.134.1619618147271; Wed, 28 Apr 2021 06:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619618147; cv=none; d=google.com; s=arc-20160816; b=rlgCCVn/vtC4wUxbs6l/HDLideGGYaMUloR40k6HiB0m8PQDiD9Bldv6FuXEdXAGCR UzpnHHGRbmvKInac6V69VwspcgEt1WPmi4Y6RCZ9Ic56nax+V4DIuOkWimHxdLDByUJ0 Dt4zRnD90tkTOE8cmL+bW+zE8i7p1kEjbEcdX2avWc+sVYmovOFRih+QNN7W/hRx1ikS iSRoSv523gvrQ4PV82sc/UBGyxktFPEeCQCTH0V2frcEGkahl/BS24Op/Ug5T6COMKrL rYuvy2A/vgXvXpU5cRo16vWOzyQG9HT6lD2bFbuOd0fqA5ajEUFtgXXFKhSOpyCaZ+o/ EN2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=CmzyNnB/G4vkAaUxmgmxNeSsDRJ/LSd2kPyh+QAcqxQ=; b=bJDVl6HaVhgaTmeHNT2JzyPysqNLrVjyZjA2VOHqAfP8+CVjHkKNL0DQ+Pw9RHcNsm lmakNiHsAaWOfFK6w2AOMWiqpPOFZsKUtoFog37qoFxaf2ykqPHup3Cpm8gM6jNGfQd3 ybOAts/qwgydj2eDUxdF/sXjajLTnv3h1Lv2IMtG7DCLMm3NHnBDVQ8vJBZKxxPeBIT+ +o8bFEMSw5k0FEsujOS7eLnAS9WmRf+lRlht2jBDxXGpCNZShZO9D7wa5FKJ7XMXp0FS mt2vd014Wm1Ox6iZjs7XDw+2AQXnWyys/7gvt+aTI6O/Csxmzkw9+qJysJLaA9GZP0l/ 0HqQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=0Oegu03o; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by gmr-mx.google.com with ESMTPS id d24si1518069edy.0.2021.04.28.06.55.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 06:55:47 -0700 (PDT) Received-SPF: pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id DA2D782CC9 for ; Wed, 28 Apr 2021 15:55:46 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id 1FAEE182B79 for ; Wed, 28 Apr 2021 15:55:12 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 531) id E7E311A8BC6; Wed, 28 Apr 2021 15:55:01 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 6/9] diskpart: add support for mke2fs Date: Wed, 28 Apr 2021 15:54:56 +0200 Message-Id: <20210428135459.951203-7-sbabic@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210428135459.951203-1-sbabic@denx.de> References: <20210428135459.951203-1-sbabic@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=0Oegu03o; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de 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: , Format filesystem as last step in the handler after releasing all resources for partitions. Add a delay before formatting to allow to the kernel to reread the partitions, and add support for extX filesystems. Signed-off-by: Stefano Babic --- handlers/diskpart_handler.c | 105 ++++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 39 deletions(-) diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c index bc3a8c8..dd573cf 100644 --- a/handlers/diskpart_handler.c +++ b/handlers/diskpart_handler.c @@ -30,6 +30,27 @@ 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 + +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 @@ -119,7 +140,7 @@ static bool diskpart_partition_cmp(const char *lbtype, struct fdisk_partition *f return true; if (firstpa && secondpa && (fdisk_partition_cmp_partno(firstpa, secondpa) || - (!fdisk_partition_start_is_default(firstpa) && !fdisk_partition_start_is_default(secondpa) && + (!fdisk_partition_start_is_default(firstpa) && !fdisk_partition_start_is_default(secondpa) && fdisk_partition_cmp_start(firstpa, secondpa)) || (!strcmp(lbtype, "gpt") && (strcmp(fdisk_parttype_get_string(fdisk_partition_get_type(firstpa)), @@ -221,7 +242,7 @@ static int diskpart(struct img_type *img, strncpy(part->type, equal, sizeof(part->type)); break; case PART_NAME: - strncpy(part->name, equal, sizeof(part->name)); + strncpy(part->name, equal, sizeof(part->name)); break; case PART_FSTYPE: strncpy(part->fstype, equal, sizeof(part->fstype)); @@ -310,9 +331,9 @@ static int diskpart(struct img_type *img, * GPT uses strings instead of hex code for partition type */ if (fdisk_is_label(cxt, GPT)) { - parttype = fdisk_label_get_parttype_from_string(lb, part->type); + parttype = fdisk_label_get_parttype_from_string(lb, part->type); if (!parttype) - parttype = fdisk_label_get_parttype_from_string(lb, GPT_DEFAULT_ENTRY_TYPE); + parttype = fdisk_label_get_parttype_from_string(lb, GPT_DEFAULT_ENTRY_TYPE); } else { parttype = fdisk_label_get_parttype_from_code(lb, ustrtoull(part->type, 16)); } @@ -383,41 +404,11 @@ static int diskpart(struct img_type *img, ERROR("Partition table cannot be written on disk"); if (fdisk_reread_partition_table(cxt)) WARN("Table cannot be reread from the disk, be careful !"); - sleep(2); } else { ret = 0; TRACE("Same partition table on disk, do not touch partition table !"); } -#ifdef CONFIG_DISKFORMAT - /* Create filesystems */ - LIST_FOREACH(part, &priv.listparts, next) { - /* - * priv.listparts counts partitions starting with 0, - * but fdisk_partname expects the first partition having - * the number 1. - */ - size_t partno = part->partno + 1; - - if (!strlen(part->fstype)) - continue; /* Don't touch partitions without fstype */ - -#ifdef CONFIG_FAT_FILESYSTEM - if (!strcmp(part->fstype, "vfat")) { - char *device = NULL; - device = fdisk_partname(img->device, partno); - TRACE("Creating vfat file system on partition-%lu, device %s", partno, device); - ret = fat_mkfs(device); - if (ret) - ERROR("creating vfat file system failed. %d", ret); - free(device); - continue; - } -#endif - ERROR("partition-%lu %s filesystem type not supported.", partno, part->fstype); - } -#endif - handler_exit: if (tb) fdisk_unref_table(tb); @@ -427,11 +418,6 @@ handler_exit: WARN("Error deassign device %s", img->device); handler_release: - LIST_FOREACH_SAFE(part, &priv.listparts, next, tmp) { - LIST_REMOVE(part, next); - free(part); - } - fdisk_unref_context(cxt); /* @@ -442,6 +428,47 @@ handler_release: sleep(2); +#ifdef CONFIG_DISKFORMAT + /* Create filesystems */ + if (!ret) { + LIST_FOREACH(part, &priv.listparts, next) { + int index; + /* + * priv.listparts counts partitions starting with 0, + * but fdisk_partname expects the first partition having + * the number 1. + */ + size_t partno = part->partno + 1; + + 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); + 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); + free(device); + if (ret) { + ERROR("creating %s file system failed. %d", part->fstype, ret); + break; + } + } + } +#endif + + LIST_FOREACH_SAFE(part, &priv.listparts, next, tmp) { + LIST_REMOVE(part, next); + free(part); + } + return ret; } From patchwork Wed Apr 28 13:54:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1471186 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::439; helo=mail-wr1-x439.google.com; envelope-from=swupdate+bncbcxploxj6ikrbtosuwcamgqed3hayqq@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=LUozorAO; dkim-atps=neutral Received: from mail-wr1-x439.google.com (mail-wr1-x439.google.com [IPv6:2a00:1450:4864:20::439]) (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 4FVgBT0jxHz9t14 for ; Wed, 28 Apr 2021 23:55:28 +1000 (AEST) Received: by mail-wr1-x439.google.com with SMTP id s7-20020adfc5470000b0290106eef17cbdsf18930226wrf.11 for ; Wed, 28 Apr 2021 06:55:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1619618126; cv=pass; d=google.com; s=arc-20160816; b=sHWDTiB91KFrvICLblSgtwVORUIJiECDv5INT/L96Vqq9FMDFljAPz6lvCMliRS8++ qC+uxjt5koi9yBQn6YMC6UXjMzeCeyQ6U6IwyZ181P1ol3gSa4G7om7hrU4b8yXIYLKK Yz/QVy0+9fORIZu6bAMGWlnixyoM6qSWNjEIwCbY6cFmRqOBkWWHrOoQ10e489Wmg6fr iGb+E90hLsQ7dgh5BOkAHBLMD568DgFLm7WV1GYi9j4roikwJpIDgPwuU2me7nhL3g27 MxTCzZL9eCwhHOIBvmMqqcb2dlC17xcZ1m5MmPaZQGAt8LozCws5aBUUg6z2WCdzmvid Jzqg== ARC-Message-Signature: i=2; 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=SuCDj+7GrUxqzifWSHuuZg3YDpXjAY+oOngbOYgffQc=; b=X0iDRZvcBjOsfgxticOJjs08JK9zvDtXDdyfXPH1i4Y9yNf/HzsjZWMjILRbYWxQr/ r9EeghL6duj6xmdYljXgVas7M7ndoY30Rmm+RRyNtL2Mi+npK76hxPFHYhcOhbd7T9qm 166cBey/mYVGGPiEKU+DBHlQ/iNtKBC6IIGxQv+dO9CoXKSQINQM51WMq7Bi/KkaQ/Db VwikQAVMjorq6Saef3dQzu6Bv+OtLNe+xCcWuN03OWq58vLeoMa+mqoRlBSPhxvViHaa FFBN0lWsjibySWdsWoIj3AEkeOk88TU6Hw1za1oo3HMRD3T9i5BZZn5E2r0RwR+xIdG2 oqRQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=AK4XTNW6; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de 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=SuCDj+7GrUxqzifWSHuuZg3YDpXjAY+oOngbOYgffQc=; b=LUozorAOGikHs3es5oJDyj5HI3FJx1m4KxCknCRdWFhUTzCwZEosWWi8evKQTEEKfY 9YWOWQaGJxd0dho3HzBRJHuw9XiopHoUti+9KUrUjb/0Xoa0WkmyIByq8DsmuYa65xoU Ne0B1hMgRfTsRBfmXyY/AMVHOwSP0R/xEn0lFQNcj8huzqMkMu936aDVSPTXHbxltqLJ QoQz4p4+5oXXlImVQHMskLLb8Zxq6msnkBzhDitE7uajp1CnWv+v9Ufe3P6vPYL7GegU 1ijzhdW/IVvp06pHlP9IYiGwMd/ES3BOube07ANyJ8YrSfVxp5miOy22bbL/84NhYII9 6AUw== 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=SuCDj+7GrUxqzifWSHuuZg3YDpXjAY+oOngbOYgffQc=; b=RdBRNnQSJZww/0+UG1Ognz94M7xDQDpLF6arImoO5TumcaEoT1J+94LAOhkjJnFlL5 VXGAduIINng+p/IbrgaczoqZ5SNjbaAxqKungSRK2rqR0/Qxc95U4pqpHx4KH/kbYfa1 5CHd+L7jLQn2tvldXtbjeUczJagCBb2DdwQjztT9YWeSJmoQF13RGsPrAZc2a4OMNYhl /govlkVoyClHWRLiBz9HhLYpnaMBlczlmXKr1j5nrFxupWVfwyUZrm+Hacrc/xGykTXH kgT53iofdlnURViuaTJkWswjL7M+f7A5AYN0K8MPSrk9FKpPs4InILWOUV9KQk6HnqH+ MPdw== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM5337MiOpw1PmILpjlsNYNvU/uaeOsegwA6PLCZna1NZQCW+wpyAS PihKXivZFj2/SmSpsOcssgQ= X-Google-Smtp-Source: ABdhPJzc8nnGiyqqdCJEpR1kKSKoLowN74Deu+2FsUGCcN/qswYtTMMtpSZhtmKBbTJy28s2RTTrPw== X-Received: by 2002:a5d:4b46:: with SMTP id w6mr19176102wrs.5.1619618126063; Wed, 28 Apr 2021 06:55:26 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:adf:fb47:: with SMTP id c7ls1534803wrs.0.gmail; Wed, 28 Apr 2021 06:55:25 -0700 (PDT) X-Received: by 2002:a05:6000:144:: with SMTP id r4mr28006012wrx.128.1619618125309; Wed, 28 Apr 2021 06:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619618125; cv=none; d=google.com; s=arc-20160816; b=watP8Fe+F10RnzQpmimBVLK3bBfY8CmdiLNxMf6RQpJL9ebooBKd4UFSTi764F5LK6 jlNjfksxJ0n6u6fr3XFendgOsp/R9CiArkg20Zn1B6OGSQMPKK738k1biUj+kHZyoamg a98co7qBhDEs2VcLyAr+GUSpyYjtt8nuyHaQH+Gb5LepRbL1iCzm20+btpGuJv19btPj HOwoOBuJBEF5aGXEEw6aNb4pg/jgDtw/2KvSAfi/7Mhulo9f837j4L/whOiXiB8dYSNG BbHHyGmASPZVgYWrr8xkjzizJBATJ4a9rcUT8qcpPulgqBGsYZPESxkpAni+2s+W26+U YDhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=OedhM95OFhsAq+Iim6hiZDUV8LXHUmiLagQoKHnroI0=; b=NQcWQKfSMgu/DVIACfTvZOsAbcWCCG++l+Zw2Y9vlAKfkndaksOgQhMk1P/z8F6S75 QEN0d4W0gOLgNYZ+m0PUlmPdkgb00qbbl4qAQZY17DfB0Mxm7iP0N+05B+l+V4TK4Cwo g7SL9XdpXgqNKRD17n2yjFiet4cT50f/PUd/fmu4Tj7KrUVXWhA9WwcqhE3fdzpmYgDS GokXvoAXUSprvZlRJzRZfQLcOm+mqbqoqQ0YDdevkolGCgtAo+dwdc8UCO+1JLMmpsiT A3otb+uxzfIp5YRTZaUA65G1ND2Ho2qfMFGykPtQJg/NozNYeRikb9/+xD1XiRonKmBB +yLg== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=AK4XTNW6; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by gmr-mx.google.com with ESMTPS id l2si197211wmq.0.2021.04.28.06.55.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 06:55:25 -0700 (PDT) Received-SPF: pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id D0D2682CCD for ; Wed, 28 Apr 2021 15:55:24 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id 0EE7C182B88 for ; Wed, 28 Apr 2021 15:55:02 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 531) id 0461A1A8BCA; Wed, 28 Apr 2021 15:55:02 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 7/9] all_handlers_defconfig: add mke2fs library Date: Wed, 28 Apr 2021 15:54:57 +0200 Message-Id: <20210428135459.951203-8-sbabic@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210428135459.951203-1-sbabic@denx.de> References: <20210428135459.951203-1-sbabic@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=AK4XTNW6; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de 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: , Signed-off-by: Stefano Babic --- configs/all_handlers_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/all_handlers_defconfig b/configs/all_handlers_defconfig index 1f7b668..c7f2dd1 100644 --- a/configs/all_handlers_defconfig +++ b/configs/all_handlers_defconfig @@ -16,6 +16,7 @@ CONFIG_CFI=y CONFIG_DISKPART=y CONFIG_DISKFORMAT=y CONFIG_FAT_FILESYSTEM=y +CONFIG_EXT_FILESYSTEM=y CONFIG_RAW=y CONFIG_RDIFFHANDLER=y CONFIG_READBACKHANDLER=y From patchwork Wed Apr 28 13:54:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1471188 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::13f; helo=mail-lf1-x13f.google.com; envelope-from=swupdate+bncbcxploxj6ikrbugsuwcamgqe6tenv4a@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=sCw9Q0FC; dkim-atps=neutral Received: from mail-lf1-x13f.google.com (mail-lf1-x13f.google.com [IPv6:2a00:1450:4864:20::13f]) (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 4FVgBX13WYz9t14 for ; Wed, 28 Apr 2021 23:55:32 +1000 (AEST) Received: by mail-lf1-x13f.google.com with SMTP id d29-20020a194f1d0000b02901c350034e79sf84156lfb.10 for ; Wed, 28 Apr 2021 06:55:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1619618128; cv=pass; d=google.com; s=arc-20160816; b=pHDQ+skNmus0H24EM+x+SfhV6HXvXQjityvtBYPPoP15F6yyebSIpoHcu3le2tGZJJ EGVoygX11geUJYPuGKUH03fl96gZF4VzISU+8JYhtvYK5B8PO8PwEDFfA1ydXPkLwkTN ZY9WzXnvHwA9vPuno2aR5WZBEajT6cyt9rEsIjdxk9V1r5UFrB2KB5+DUBApAy5vgwIE 7FNn8N90bE0o0MBhH5Ih2epTISIO+WcVJBvEXAGyX3y4DCp7CfvpWKRA79EOmvDhJuIp 6tFa+sA/rALXD4XsMzTEPN0uKwykjaVV/grXoV8pWbghAALVc1MkzuCYnlpevr4skJ8m rx0Q== ARC-Message-Signature: i=2; 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=Xi36CtvAh+WF3mt7p+gx4iwCWu4vfTYzhHIzQ7eFiyQ=; b=0suQLIO01SFAce+fdnyUkcK2X4miN9Bu3y5P5qHPw966Jytj0Dt3SwxImWBCbTwkZs dDsJXmbNwCqNL74XQ0BiIiaEs2GIVGViW5PlZ9li8VnXpLE79fwoE9Pg5xttXzTtAqrz QhMpaRbCnq8qws1EsGgU1XMuzfXa3KycVGSB2w47m64RqTrCDLdqsYxWc8ArDCmLF00Q /EijcDY0RYrFguU7O0lHgkIGxulKKs9/N6wd813kBv1DG41SGaaMAYT98Kbd8bgufSpm Z2PkOiESDFYv/LwMxLQdPLlaT8FtNDx567xkoc4Y/L46S7dNL1XQxWO/yFdAeKwXBB60 6E2w== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=fe1PwxIY; spf=pass (google.com: domain of sbabic@denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=sbabic@denx.de 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=Xi36CtvAh+WF3mt7p+gx4iwCWu4vfTYzhHIzQ7eFiyQ=; b=sCw9Q0FCnWZnGzzJB8FdHDv4d6RVK+PoAnQ4/MsKboqHJdNeuavYGAGTEOcD3JidKD MBMChyI84B3qmS/J4CwP1rvqbkvPxommQUDr6EkdHNO1uoRq6zRxnyPUqCaqdRA4OEuW d4exF0q6qtjWYi2BbbUPTbjipYyjRa5OJQEpTc0r5QKj0Mar368rjhjDFeybvn8gyVWG dMnsX6fMqhCKw7uvn2S3QaP2+cu8V5+JigDFZ0M46onEU4TAL+ASLPp32O1sGGXb/0g7 YjIL1PJg3aSG0xx1Bpo/TN2aMbLtzIYgcMIszN3cmYvPdxkUj6jFHY3OduLxkOM+Ol84 4Y2Q== 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=Xi36CtvAh+WF3mt7p+gx4iwCWu4vfTYzhHIzQ7eFiyQ=; b=sv9wl4fzM/QKeunF16HjQF1CwxMc3HKQQoQtZm2UPeYu3hgPJY8cx34Lx3WUbB7wV/ d3i9FjohWdC6eSzB/F2wNbSVlJ+HncHxla8IsEuVTf9GqBccBeHyrYAE9Tw/l98Vfdjf Kle+416XLb0p8akn7KbjElRNO5Z558t4d/N0AUxuYXikijVjWj+MCV+CDXCEXRm0nCME wp4XymkKlNBM+F/qFw3TaoPN++LyRoPV9U2PvcdtsFKf4GRv78Xyi2OPLPD75PV93bP+ 05g2SpZMLy3VinogmsAubLM54HNy1wXqNpYXQP6JXdfNHIFWzzhFcOljTJBqbEQ8/ScP zfWA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM531mueP0FJjaaE08tAYFZDNqQT541+CK04KjUwmdbMg3tWwScfQ9 bXgauL84cABbYFwdx6+MuC8= X-Google-Smtp-Source: ABdhPJwjdHd9w7NIw1/9aBNOzA86I0tLtSe//4d2h51zj3jGnQVqWrglBLbgihRYdKyknEWm7J3eHA== X-Received: by 2002:a2e:9710:: with SMTP id r16mr21833570lji.25.1619618128860; Wed, 28 Apr 2021 06:55:28 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a19:f815:: with SMTP id a21ls1228754lff.1.gmail; Wed, 28 Apr 2021 06:55:28 -0700 (PDT) X-Received: by 2002:a05:6512:5cc:: with SMTP id o12mr8713499lfo.633.1619618128033; Wed, 28 Apr 2021 06:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619618128; cv=none; d=google.com; s=arc-20160816; b=h9Mg0JKqrpKdD4mFy7SSXIA1HPfVbjNBtFVpAbqKMyg57lSCW08/yyv1yUvbXlp0nF zRbAGS0J6SeTugms5RZb16RX7NIZT8y7s5vlgM8Wsl3zYVVnUBPEBTz/I2UqtM57QrUZ ZrME5jzytfpov5On/l/FUToMjXsX8CVyl3fHSA8p8W0MCZbb1qdc6TXudvzyy4lH8vw7 g5aeH9DQVFsLENoW5iop61+EUvrifDgnRmbVr6qRLLFb3BSkBMkkz+mypXsdRmoNvVIv xVGOKggV2bVHMike2uhEw7uWbejvABsJi1MPo0QfS+fIMpY2CDApYGA0yukx5S/TZJsD Ysng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=M3bLMqheXLR7eEdKyI6+COyjcPrBsF+anmClM1CeKGw=; b=xCV3QP3BEEFJYpB4gUoNhucfxdkZ7nIiPff7HBNEDgzbSjz7TGxH6F/LzfzaiBxcQh tWq52uqYQTLAf45D3/QW2J8L290KV/aw7Tktyvf/vrnkpVX8v05ZCkk6fTRLlmTQrXkx G97v2QKL41R6MDyqtzn7UY0CFULrlS6j/qDgcwydlG+LpIPygXhNWlcQQuKJbRWBtCUL MDJ7KauSun2lHcYFZWn0H+H7+/Iv67w5KtbbHJ6aHbAfh58burGnsNLdWA+S+bDvF782 mfgwE0AtvFSSok0ttsBbg1V+Gc4/qEkszeq5UO5qEP1da5u0Ky+Cub/ykiu9Ixtoe6RN zoVQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=fe1PwxIY; spf=pass (google.com: domain of sbabic@denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=sbabic@denx.de Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by gmr-mx.google.com with ESMTPS id a10si3706lfs.11.2021.04.28.06.55.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 06:55:27 -0700 (PDT) Received-SPF: pass (google.com: domain of sbabic@denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 4859482CCE for ; Wed, 28 Apr 2021 15:55:27 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id 1776C182B89 for ; Wed, 28 Apr 2021 15:55:02 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 531) id 0D38C1A8BC5; Wed, 28 Apr 2021 15:55:02 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 8/9] ci: add e2fsprogs library for mke2fs Date: Wed, 28 Apr 2021 15:54:58 +0200 Message-Id: <20210428135459.951203-9-sbabic@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210428135459.951203-1-sbabic@denx.de> References: <20210428135459.951203-1-sbabic@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=fe1PwxIY; spf=pass (google.com: domain of sbabic@denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=sbabic@denx.de 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: , Signed-off-by: Stefano Babic --- ci/setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/setup.sh b/ci/setup.sh index 2744732..440f761 100755 --- a/ci/setup.sh +++ b/ci/setup.sh @@ -39,6 +39,7 @@ $_SUDO apt-get install -y \ check \ librsync2 \ librsync-dev \ + libext2fs-dev \ liburiparser-dev \ doxygen \ graphviz \ From patchwork Wed Apr 28 13:54:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1471189 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::337; helo=mail-wm1-x337.google.com; envelope-from=swupdate+bncbcxploxj6ikrbvosuwcamgqe3pv3fdq@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=WejOfmrP; dkim-atps=neutral Received: from mail-wm1-x337.google.com (mail-wm1-x337.google.com [IPv6:2a00:1450:4864:20::337]) (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 4FVgBc3sbXz9sX2 for ; Wed, 28 Apr 2021 23:55:36 +1000 (AEST) Received: by mail-wm1-x337.google.com with SMTP id d78-20020a1c1d510000b0290132794b7801sf5199781wmd.1 for ; Wed, 28 Apr 2021 06:55:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1619618133; cv=pass; d=google.com; s=arc-20160816; b=d69UkCn6txRCF7gaDLFTgCNKoIcDxd3scgpopyOo2Ah1TfkMuPvPXyEfSwUdvavNuX JCHvgK6H52A15O6Smlv66H/iC/ncikyZ+UxIaIqnowpKrUgn8wyvnVA6PHsrphQYlkSV YLCjOq94V5AzMg+XUrfurF3mi1H+VaYrX15z3bqmqrm6WpOVgoKIW95wMqT2OO7SXwZd aB4DoFa16PtquVAzuQxaEDA6MWNok+k9pU5QRl4G0aVJVzfAiCt3Hv4czzhEdd1hht3T KVpke2yq8L2/pCN0MI2HUqjQrn348FiSLRQ50ATD6rEqxVZuKd2kF1GIap4eKL+MmWQC sVuQ== ARC-Message-Signature: i=2; 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=7LM59BEMAY5dgJgVGJTmWTCZUvIqsqXDHOukEIY9oXk=; b=yfx6bvbVOIrI4t6okWRySDZgesIvC/wwdtN/IYCVBWyOzaC53CF76F762dNSlyIY7J sm2WqAJm3DUEtkEsMPnkE6GOef7jThtm7QnawrTLHYNCarVccqlihokeg/i/qCayAXKe 7ZEoJN3mF5/xMx9w8z/dozjkyimqMKo5JvPcuYQXuf6+VH2joO/Xy8rg6K+AHSloj1YM 9VWvW5k2ZxRejWc+Ag1OUm2dLB1Bd/jLXatDqu1OxXGUA70AmnkVq9Ze024vmqmj6GFu I+NqV2IPUWZYnyVR7kKjtWHa/R6jKgca2pRv75NQWTkiudRWxUDNuXN8XZs2R5uNKWJP uSJA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=dkAmfc+S; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de 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=7LM59BEMAY5dgJgVGJTmWTCZUvIqsqXDHOukEIY9oXk=; b=WejOfmrP5h9DmTLAm1k957Mv0Lhw1c81rqkODt4SU2WP+GbOdDyG4b7UuOGAA7buyR TXAsfUJLIPWFEyBQFDqIi4vUKhbo8v73gIQgTCweQk8h/d8UfK0L7S6lMhaM5iVofo7J euJy0/rNxvW5ySn5r3hk+m/MlcVsaelf4KA+M/vdJ3lc0HNN9clv/Ct2QSN3Y5FJFGsx KWa5rMIjQCDMqIHatm4FKkDGnVNRWhs/PY5mPBURp4QwVLR4Z03Xsi/Pge76ruMaAu6y LPCwm5H5vo8zQo2wqcV/wgzDoL68/oF1pn6i27/tzCJ2BTqNzBM97pNMl40RJ42/+Fll sJAA== 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=7LM59BEMAY5dgJgVGJTmWTCZUvIqsqXDHOukEIY9oXk=; b=qU6MQbw2v+aQ2BbfNd5lNxZ+f7Mp3+LM6GtiZXh7mMLckdsXTNAoQo+5ZN0MYo+S98 pkPoSNrzrm4IgY9PkPESY4TQlDM7hN1mK8hVkter/yg6sF0SvMnJEfK6Ll9QuDaTKNYK L8MwIAxvspEoRbtJk1K3pm1yRqkhoTfG+loj/U+wDZ0/dUmnzsXhlBSNL1YOuujVsWec wE7JIaV1+x4KiTPOIK2P7Fp1bw7pFziQ0s5lbGB0XabUcpGAm1R2izCMVQW2nlUjhL04 fp+yvfgdbyj4H1lybqHltlbNJ9i0u2+2UICTISXj/WmNnCcM8NZVaB0/HgFdDAPN4cOD veqQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM5333ciq6tL3BSYFrrx0AzzZ7XWZU97EA+keElpCFyT0EHjY6YakG mod/faZ0Inyxh6/iMalGgms= X-Google-Smtp-Source: ABdhPJxODhq5eT+POawvnnEwXQJEpVUdxbTTszJAUwVgFVZhO6v5YYRRwfuisG/WJS6rZJnM7wAA4Q== X-Received: by 2002:a5d:4cce:: with SMTP id c14mr37488494wrt.29.1619618133405; Wed, 28 Apr 2021 06:55:33 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:600c:4f16:: with SMTP id l22ls2625094wmq.3.canary-gmail; Wed, 28 Apr 2021 06:55:32 -0700 (PDT) X-Received: by 2002:a05:600c:414d:: with SMTP id h13mr17223751wmm.62.1619618132638; Wed, 28 Apr 2021 06:55:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619618132; cv=none; d=google.com; s=arc-20160816; b=ech/rhQ+U43RQbsCs85ZCYTL68vqVh2G4wujR7gD5mIjFG8dI6YmhveVljrrlzrLHm xRHcLKa67ke0k+I4WyUkIfwgCbUHCW8sTz4cm1+n5RtTHpGvKUI2MlMVcGP9EdgcM7Gt Wl7iyJPX9QwNJe9BJut/hX/5umA/esEhqyFlhog5eBdmi+3QmgNKUms6VYq4b38hrYBc FpZe8ACqo0mfO18mllkCVcUte8BLCAiv2O93QqYF4TLb/v5sgt1franjI2q4sV2EKIKU /mD1w1JppaFUlA9/+f5qgLbwU0rxn6at2mk6gv+bHgUywDBEO9s93tP0B9LuxlA1ml7d Fi+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=uQ67jysmL3VDfFLsr8XfwUFYAoCmLoCyOvEPKiNWhEQ=; b=cgpd+QUiAL1DYbPs8A7OvC1+HPWyUARAqAel5/r4EOmu0ObJLMRXtkiAbMUokSpVf9 fzzwYY7cXqZe+rRa2JJoLW/U5Xy1EdiHxcwGMS1IbijEmTVfrDFSr0hR4QR0rpwYosZ1 gMqkJEDH39VcXxjR1rcREb3BPT5XTgYpkuzBVTx6Nx3hmQv5TfhoQzVFhs1ea8LgcUAC kT/JfBDlMUxeVEM8ziThJe56u3Bn29QlTMBBNk+PBLxMt5ZL6vbBGjHW9TNTTDVWJcLY hvalUqPRixpNzfMTX6DQs1NeQiiunnwZ91Ul8Pwsf/FXiUU/HweqsIiNPvpQ0KTnvnf1 XCBg== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=dkAmfc+S; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by gmr-mx.google.com with ESMTPS id 7si10wmg.0.2021.04.28.06.55.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 06:55:32 -0700 (PDT) Received-SPF: pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 4D32E82CBE for ; Wed, 28 Apr 2021 15:55:32 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id 1FDC3182B8B for ; Wed, 28 Apr 2021 15:55:02 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 531) id 14E241A8BCA; Wed, 28 Apr 2021 15:55:02 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 9/9] doc: extend filesystem support in diskpart Date: Wed, 28 Apr 2021 15:54:59 +0200 Message-Id: <20210428135459.951203-10-sbabic@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210428135459.951203-1-sbabic@denx.de> References: <20210428135459.951203-1-sbabic@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=dkAmfc+S; spf=pass (google.com: domain of sbabic@denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=sbabic@denx.de 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: , Signed-off-by: Stefano Babic --- doc/source/handlers.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst index 84dffd6..e280d02 100644 --- a/doc/source/handlers.rst +++ b/doc/source/handlers.rst @@ -795,7 +795,7 @@ supported: | fstype | string | Optional filesystem type to be created on the | | | | partition. If no fstype key is given, no file | | | | will be created on the corresponding partition. | - | | | (currently only `vfat` file system is supported) | + | | | vfat / ext2 / ext3 /ext4 file system is supported | +-------------+----------+----------------------------------------------------+ @@ -816,7 +816,7 @@ GPT example: "name=ldata", "type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "fstype=vfat"]; partition-3 = ["size=512M", "start=657408", - "name=log", "type=0FC63DAF-8483-4772-8E79-3D69D8477DE4"]; + "name=log", "fstype =ext4", 63DAF-8483-4772-8E79-3D69D8477DE4"]; partition-4 = ["size=4G", "start=1705984", "name=system", "type=0FC63DAF-8483-4772-8E79-3D69D8477DE4"]; partition-5 = ["size=512M", "start=10094592",