public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib
@ 2022-04-07 22:01 Pedro Falcato
  2022-04-07 22:01 ` [PATCH edk2-platforms 1/3] Ext4Pkg: Replace the CRC implementations with BaseLib Pedro Falcato
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Pedro Falcato @ 2022-04-07 22:01 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Michael D Kinney, Liming Gao, Zhiguang Liu

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3745
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871

Hi all,

This patch-set attempts to address two open feature requests for Ext4Pkg
by adding ext2/3 support (id 3745) and moving crc16-ansi/crc32c to BaseLib (id 3871).

The previous patch-set regarding 3871 attempted to merge the different crc16 implementations
but failed because, contrary to what I thought, there are many, many different CRC16s which
are all slightly different. This one (plus the separate edk2 patch) attempts to just merge
CRC16-ANSI (confusingly, also known as CRC16) into BaseLib.

Since this patch set grew to be considerably different from the original, I didn't mark it
as v2 but rather a separate, new patch-set.

CC'ing the edk2-platforms stewards (as I cannot review my own code) and the CC's of the MdePkg
patch.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Pedro Falcato (3):
  Ext4Pkg: Replace the CRC implementations with BaseLib
  Ext4Pkg: Format using uncrustify
  Ext4Pkg: Add ext2/3 support

 Features/Ext4Pkg/Ext4Dxe/BlockGroup.c |  10 +-
 Features/Ext4Pkg/Ext4Dxe/BlockMap.c   | 279 +++++++++++++++++
 Features/Ext4Pkg/Ext4Dxe/Collation.c  |   4 +-
 Features/Ext4Pkg/Ext4Dxe/Crc16.c      |  75 -----
 Features/Ext4Pkg/Ext4Dxe/Crc32c.c     |  84 ------
 Features/Ext4Pkg/Ext4Dxe/Directory.c  |  13 +-
 Features/Ext4Pkg/Ext4Dxe/DiskUtil.c   |   6 +-
 Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   |  30 +-
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c    |  95 +++---
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    | 417 ++++++++++++++------------
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  |   3 +-
 Features/Ext4Pkg/Ext4Dxe/Extents.c    |  27 +-
 Features/Ext4Pkg/Ext4Dxe/File.c       |  19 +-
 Features/Ext4Pkg/Ext4Dxe/Inode.c      |  33 +-
 Features/Ext4Pkg/Ext4Dxe/Partition.c  |  12 +-
 Features/Ext4Pkg/Ext4Dxe/Superblock.c |  20 +-
 16 files changed, 640 insertions(+), 487 deletions(-)
 create mode 100644 Features/Ext4Pkg/Ext4Dxe/BlockMap.c
 delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc16.c
 delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc32c.c

-- 
2.35.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH edk2-platforms 1/3] Ext4Pkg: Replace the CRC implementations with BaseLib
  2022-04-07 22:01 [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib Pedro Falcato
@ 2022-04-07 22:01 ` Pedro Falcato
  2022-04-07 22:01 ` [PATCH edk2-platforms 2/3] Ext4Pkg: Format using uncrustify Pedro Falcato
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Pedro Falcato @ 2022-04-07 22:01 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Michael D Kinney

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871

Since the existing CRC16/CRC32c implementations have been/will be
a part of BaseLib, use BaseLib and remove the Crc16.c/Crc32c.c.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>

Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
---
 Features/Ext4Pkg/Ext4Dxe/BlockGroup.c | 10 ++--
 Features/Ext4Pkg/Ext4Dxe/Crc16.c      | 75 ------------------------
 Features/Ext4Pkg/Ext4Dxe/Crc32c.c     | 84 ---------------------------
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    | 34 +----------
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  |  2 -
 5 files changed, 6 insertions(+), 199 deletions(-)
 delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc16.c
 delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc32c.c

diff --git a/Features/Ext4Pkg/Ext4Dxe/BlockGroup.c b/Features/Ext4Pkg/Ext4Dxe/BlockGroup.c
index abfeff52b139..9a1a41901f36 100644
--- a/Features/Ext4Pkg/Ext4Dxe/BlockGroup.c
+++ b/Features/Ext4Pkg/Ext4Dxe/BlockGroup.c
@@ -168,12 +168,12 @@ Ext4CalculateBlockGroupDescChecksumGdtCsum (
 
   Dummy = 0;
 
-  Csum = CalculateCrc16 (Partition->SuperBlock.s_uuid, 16, 0);
-  Csum = CalculateCrc16 (&BlockGroupNum, sizeof (BlockGroupNum), Csum);
-  Csum = CalculateCrc16 (BlockGroupDesc, OFFSET_OF (EXT4_BLOCK_GROUP_DESC, bg_checksum), Csum);
-  Csum = CalculateCrc16 (&Dummy, sizeof (Dummy), Csum);
+  Csum = CalculateCrc16Ansi (Partition->SuperBlock.s_uuid, 16, 0);
+  Csum = CalculateCrc16Ansi (&BlockGroupNum, sizeof (BlockGroupNum), Csum);
+  Csum = CalculateCrc16Ansi (BlockGroupDesc, OFFSET_OF (EXT4_BLOCK_GROUP_DESC, bg_checksum), Csum);
+  Csum = CalculateCrc16Ansi (&Dummy, sizeof (Dummy), Csum);
   Csum =
-    CalculateCrc16 (
+    CalculateCrc16Ansi (
       &BlockGroupDesc->bg_block_bitmap_hi,
       Partition->DescSize - OFFSET_OF (EXT4_BLOCK_GROUP_DESC, bg_block_bitmap_hi),
       Csum
diff --git a/Features/Ext4Pkg/Ext4Dxe/Crc16.c b/Features/Ext4Pkg/Ext4Dxe/Crc16.c
deleted file mode 100644
index 58d0220e4d30..000000000000
--- a/Features/Ext4Pkg/Ext4Dxe/Crc16.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/** @file
-  CRC16 calculation routines.
-
-  Copyright (c) 2021 Pedro Falcato All rights reserved.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#include <Uefi.h>
-
-STATIC CONST UINT16  gCrc16LookupTable[256] =
-{
-  0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
-  0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
-  0x0919, 0x1890, 0x2a0b, 0x3b82, 0x4f3d, 0x5eb4, 0x6c2f, 0x7da6,
-  0x8551, 0x94d8, 0xa643, 0xb7ca, 0xc375, 0xd2fc, 0xe067, 0xf1ee,
-  0x1232, 0x03bb, 0x3120, 0x20a9, 0x5416, 0x459f, 0x7704, 0x668d,
-  0x9e7a, 0x8ff3, 0xbd68, 0xace1, 0xd85e, 0xc9d7, 0xfb4c, 0xeac5,
-  0x1b2b, 0x0aa2, 0x3839, 0x29b0, 0x5d0f, 0x4c86, 0x7e1d, 0x6f94,
-  0x9763, 0x86ea, 0xb471, 0xa5f8, 0xd147, 0xc0ce, 0xf255, 0xe3dc,
-  0x2464, 0x35ed, 0x0776, 0x16ff, 0x6240, 0x73c9, 0x4152, 0x50db,
-  0xa82c, 0xb9a5, 0x8b3e, 0x9ab7, 0xee08, 0xff81, 0xcd1a, 0xdc93,
-  0x2d7d, 0x3cf4, 0x0e6f, 0x1fe6, 0x6b59, 0x7ad0, 0x484b, 0x59c2,
-  0xa135, 0xb0bc, 0x8227, 0x93ae, 0xe711, 0xf698, 0xc403, 0xd58a,
-  0x3656, 0x27df, 0x1544, 0x04cd, 0x7072, 0x61fb, 0x5360, 0x42e9,
-  0xba1e, 0xab97, 0x990c, 0x8885, 0xfc3a, 0xedb3, 0xdf28, 0xcea1,
-  0x3f4f, 0x2ec6, 0x1c5d, 0x0dd4, 0x796b, 0x68e2, 0x5a79, 0x4bf0,
-  0xb307, 0xa28e, 0x9015, 0x819c, 0xf523, 0xe4aa, 0xd631, 0xc7b8,
-  0x48c8, 0x5941, 0x6bda, 0x7a53, 0x0eec, 0x1f65, 0x2dfe, 0x3c77,
-  0xc480, 0xd509, 0xe792, 0xf61b, 0x82a4, 0x932d, 0xa1b6, 0xb03f,
-  0x41d1, 0x5058, 0x62c3, 0x734a, 0x07f5, 0x167c, 0x24e7, 0x356e,
-  0xcd99, 0xdc10, 0xee8b, 0xff02, 0x8bbd, 0x9a34, 0xa8af, 0xb926,
-  0x5afa, 0x4b73, 0x79e8, 0x6861, 0x1cde, 0x0d57, 0x3fcc, 0x2e45,
-  0xd6b2, 0xc73b, 0xf5a0, 0xe429, 0x9096, 0x811f, 0xb384, 0xa20d,
-  0x53e3, 0x426a, 0x70f1, 0x6178, 0x15c7, 0x044e, 0x36d5, 0x275c,
-  0xdfab, 0xce22, 0xfcb9, 0xed30, 0x998f, 0x8806, 0xba9d, 0xab14,
-  0x6cac, 0x7d25, 0x4fbe, 0x5e37, 0x2a88, 0x3b01, 0x099a, 0x1813,
-  0xe0e4, 0xf16d, 0xc3f6, 0xd27f, 0xa6c0, 0xb749, 0x85d2, 0x945b,
-  0x65b5, 0x743c, 0x46a7, 0x572e, 0x2391, 0x3218, 0x0083, 0x110a,
-  0xe9fd, 0xf874, 0xcaef, 0xdb66, 0xafd9, 0xbe50, 0x8ccb, 0x9d42,
-  0x7e9e, 0x6f17, 0x5d8c, 0x4c05, 0x38ba, 0x2933, 0x1ba8, 0x0a21,
-  0xf2d6, 0xe35f, 0xd1c4, 0xc04d, 0xb4f2, 0xa57b, 0x97e0, 0x8669,
-  0x7787, 0x660e, 0x5495, 0x451c, 0x31a3, 0x202a, 0x12b1, 0x0338,
-  0xfbcf, 0xea46, 0xd8dd, 0xc954, 0xbdeb, 0xac62, 0x9ef9, 0x8f70
-};
-
-/**
-   Calculates the CRC16 checksum of the given buffer.
-
-   @param[in]      Buffer        Pointer to the buffer.
-   @param[in]      Length        Length of the buffer, in bytes.
-   @param[in]      InitialValue  Initial value of the CRC.
-
-   @return The CRC16 checksum.
-**/
-UINT16
-CalculateCrc16 (
-  IN CONST VOID  *Buffer,
-  IN UINTN       Length,
-  IN UINT16      InitialValue
-  )
-{
-  CONST UINT8  *Buf;
-  UINT16       Crc;
-
-  Buf = Buffer;
-
-  Crc = ~InitialValue;
-
-  while (Length-- != 0) {
-    Crc = gCrc16LookupTable[(Crc & 0xFF) ^ *(Buf++)] ^ (Crc >> 8);
-  }
-
-  return ~Crc;
-}
diff --git a/Features/Ext4Pkg/Ext4Dxe/Crc32c.c b/Features/Ext4Pkg/Ext4Dxe/Crc32c.c
deleted file mode 100644
index 9601316240d7..000000000000
--- a/Features/Ext4Pkg/Ext4Dxe/Crc32c.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file
-  CRC32c calculation routines.
-
-  Copyright (c) 2021 Pedro Falcato All rights reserved.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#include <Uefi.h>
-
-STATIC CONST UINT32  gCrc32cLookupTable[256] = {
-  0x00000000, 0xf26b8303, 0xe13b70f7, 0x1350f3f4, 0xc79a971f, 0x35f1141c,
-  0x26a1e7e8, 0xd4ca64eb, 0x8ad958cf, 0x78b2dbcc, 0x6be22838, 0x9989ab3b,
-  0x4d43cfd0, 0xbf284cd3, 0xac78bf27, 0x5e133c24, 0x105ec76f, 0xe235446c,
-  0xf165b798, 0x030e349b, 0xd7c45070, 0x25afd373, 0x36ff2087, 0xc494a384,
-  0x9a879fa0, 0x68ec1ca3, 0x7bbcef57, 0x89d76c54, 0x5d1d08bf, 0xaf768bbc,
-  0xbc267848, 0x4e4dfb4b, 0x20bd8ede, 0xd2d60ddd, 0xc186fe29, 0x33ed7d2a,
-  0xe72719c1, 0x154c9ac2, 0x061c6936, 0xf477ea35, 0xaa64d611, 0x580f5512,
-  0x4b5fa6e6, 0xb93425e5, 0x6dfe410e, 0x9f95c20d, 0x8cc531f9, 0x7eaeb2fa,
-  0x30e349b1, 0xc288cab2, 0xd1d83946, 0x23b3ba45, 0xf779deae, 0x05125dad,
-  0x1642ae59, 0xe4292d5a, 0xba3a117e, 0x4851927d, 0x5b016189, 0xa96ae28a,
-  0x7da08661, 0x8fcb0562, 0x9c9bf696, 0x6ef07595, 0x417b1dbc, 0xb3109ebf,
-  0xa0406d4b, 0x522bee48, 0x86e18aa3, 0x748a09a0, 0x67dafa54, 0x95b17957,
-  0xcba24573, 0x39c9c670, 0x2a993584, 0xd8f2b687, 0x0c38d26c, 0xfe53516f,
-  0xed03a29b, 0x1f682198, 0x5125dad3, 0xa34e59d0, 0xb01eaa24, 0x42752927,
-  0x96bf4dcc, 0x64d4cecf, 0x77843d3b, 0x85efbe38, 0xdbfc821c, 0x2997011f,
-  0x3ac7f2eb, 0xc8ac71e8, 0x1c661503, 0xee0d9600, 0xfd5d65f4, 0x0f36e6f7,
-  0x61c69362, 0x93ad1061, 0x80fde395, 0x72966096, 0xa65c047d, 0x5437877e,
-  0x4767748a, 0xb50cf789, 0xeb1fcbad, 0x197448ae, 0x0a24bb5a, 0xf84f3859,
-  0x2c855cb2, 0xdeeedfb1, 0xcdbe2c45, 0x3fd5af46, 0x7198540d, 0x83f3d70e,
-  0x90a324fa, 0x62c8a7f9, 0xb602c312, 0x44694011, 0x5739b3e5, 0xa55230e6,
-  0xfb410cc2, 0x092a8fc1, 0x1a7a7c35, 0xe811ff36, 0x3cdb9bdd, 0xceb018de,
-  0xdde0eb2a, 0x2f8b6829, 0x82f63b78, 0x709db87b, 0x63cd4b8f, 0x91a6c88c,
-  0x456cac67, 0xb7072f64, 0xa457dc90, 0x563c5f93, 0x082f63b7, 0xfa44e0b4,
-  0xe9141340, 0x1b7f9043, 0xcfb5f4a8, 0x3dde77ab, 0x2e8e845f, 0xdce5075c,
-  0x92a8fc17, 0x60c37f14, 0x73938ce0, 0x81f80fe3, 0x55326b08, 0xa759e80b,
-  0xb4091bff, 0x466298fc, 0x1871a4d8, 0xea1a27db, 0xf94ad42f, 0x0b21572c,
-  0xdfeb33c7, 0x2d80b0c4, 0x3ed04330, 0xccbbc033, 0xa24bb5a6, 0x502036a5,
-  0x4370c551, 0xb11b4652, 0x65d122b9, 0x97baa1ba, 0x84ea524e, 0x7681d14d,
-  0x2892ed69, 0xdaf96e6a, 0xc9a99d9e, 0x3bc21e9d, 0xef087a76, 0x1d63f975,
-  0x0e330a81, 0xfc588982, 0xb21572c9, 0x407ef1ca, 0x532e023e, 0xa145813d,
-  0x758fe5d6, 0x87e466d5, 0x94b49521, 0x66df1622, 0x38cc2a06, 0xcaa7a905,
-  0xd9f75af1, 0x2b9cd9f2, 0xff56bd19, 0x0d3d3e1a, 0x1e6dcdee, 0xec064eed,
-  0xc38d26c4, 0x31e6a5c7, 0x22b65633, 0xd0ddd530, 0x0417b1db, 0xf67c32d8,
-  0xe52cc12c, 0x1747422f, 0x49547e0b, 0xbb3ffd08, 0xa86f0efc, 0x5a048dff,
-  0x8ecee914, 0x7ca56a17, 0x6ff599e3, 0x9d9e1ae0, 0xd3d3e1ab, 0x21b862a8,
-  0x32e8915c, 0xc083125f, 0x144976b4, 0xe622f5b7, 0xf5720643, 0x07198540,
-  0x590ab964, 0xab613a67, 0xb831c993, 0x4a5a4a90, 0x9e902e7b, 0x6cfbad78,
-  0x7fab5e8c, 0x8dc0dd8f, 0xe330a81a, 0x115b2b19, 0x020bd8ed, 0xf0605bee,
-  0x24aa3f05, 0xd6c1bc06, 0xc5914ff2, 0x37faccf1, 0x69e9f0d5, 0x9b8273d6,
-  0x88d28022, 0x7ab90321, 0xae7367ca, 0x5c18e4c9, 0x4f48173d, 0xbd23943e,
-  0xf36e6f75, 0x0105ec76, 0x12551f82, 0xe03e9c81, 0x34f4f86a, 0xc69f7b69,
-  0xd5cf889d, 0x27a40b9e, 0x79b737ba, 0x8bdcb4b9, 0x988c474d, 0x6ae7c44e,
-  0xbe2da0a5, 0x4c4623a6, 0x5f16d052, 0xad7d5351
-};
-
-/**
-   Calculates the CRC32c checksum of the given buffer.
-
-   @param[in]      Buffer        Pointer to the buffer.
-   @param[in]      Length        Length of the buffer, in bytes.
-   @param[in]      InitialValue  Initial value of the CRC.
-
-   @return The CRC32c checksum.
-**/
-UINT32
-CalculateCrc32c (
-  IN CONST VOID  *Buffer,
-  IN UINTN       Length,
-  IN UINT32      InitialValue
-  )
-{
-  CONST UINT8  *Buf;
-  UINT32       Crc;
-
-  Buf = Buffer;
-  Crc = ~InitialValue;
-
-  while (Length-- != 0) {
-    Crc = gCrc32cLookupTable[(Crc & 0xFF) ^ *(Buf++)] ^ (Crc >> 8);
-  }
-
-  return ~Crc;
-}
diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h
index 1d9a4ac6bad3..fbdffd21f918 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h
+++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h
@@ -1,7 +1,7 @@
 /** @file
   Common header for the driver
 
-  Copyright (c) 2021 Pedro Falcato All rights reserved.
+  Copyright (c) 2021 - 2022 Pedro Falcato All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -929,38 +929,6 @@ Ext4FreeExtentsMap (
   IN EXT4_FILE  *File
   );
 
-/**
-   Calculates the CRC32c checksum of the given buffer.
-
-   @param[in]      Buffer        Pointer to the buffer.
-   @param[in]      Length        Length of the buffer, in bytes.
-   @param[in]      InitialValue  Initial value of the CRC.
-
-   @return The CRC32c checksum.
-**/
-UINT32
-CalculateCrc32c (
-  IN CONST VOID  *Buffer,
-  IN UINTN       Length,
-  IN UINT32      InitialValue
-  );
-
-/**
-   Calculates the CRC16 checksum of the given buffer.
-
-   @param[in]      Buffer        Pointer to the buffer.
-   @param[in]      Length        Length of the buffer, in bytes.
-   @param[in]      InitialValue  Initial value of the CRC.
-
-   @return The CRC16 checksum.
-**/
-UINT16
-CalculateCrc16 (
-  IN CONST VOID  *Buffer,
-  IN UINTN       Length,
-  IN UINT16      InitialValue
-  );
-
 /**
    Calculates the checksum of the given buffer.
    @param[in]      Partition     Pointer to the opened EXT4 partition.
diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf
index 6533de6247dc..12e89bf1fdfc 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf
+++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf
@@ -109,8 +109,6 @@
   Extents.c
   File.c
   Collation.c
-  Crc32c.c
-  Crc16.c
   Ext4Disk.h
   Ext4Dxe.h
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH edk2-platforms 2/3] Ext4Pkg: Format using uncrustify
  2022-04-07 22:01 [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib Pedro Falcato
  2022-04-07 22:01 ` [PATCH edk2-platforms 1/3] Ext4Pkg: Replace the CRC implementations with BaseLib Pedro Falcato
@ 2022-04-07 22:01 ` Pedro Falcato
  2022-04-07 22:01 ` [PATCH edk2-platforms 3/3] Ext4Pkg: Add ext2/3 support Pedro Falcato
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Pedro Falcato @ 2022-04-07 22:01 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Michael D Kinney

Previously, Ext4Pkg was formatted using uncrustify with an older config file.
Re-format it using the upstream edk2 uncrustify config file.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
---
 Features/Ext4Pkg/Ext4Dxe/Collation.c  |   4 +-
 Features/Ext4Pkg/Ext4Dxe/Directory.c  |  13 +-
 Features/Ext4Pkg/Ext4Dxe/DiskUtil.c   |   6 +-
 Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   |  28 +-
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c    |  95 +++----
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    | 365 ++++++++++++++------------
 Features/Ext4Pkg/Ext4Dxe/Extents.c    |  10 +-
 Features/Ext4Pkg/Ext4Dxe/File.c       |  19 +-
 Features/Ext4Pkg/Ext4Dxe/Inode.c      |  24 +-
 Features/Ext4Pkg/Ext4Dxe/Partition.c  |  12 +-
 Features/Ext4Pkg/Ext4Dxe/Superblock.c |  13 +-
 11 files changed, 316 insertions(+), 273 deletions(-)

diff --git a/Features/Ext4Pkg/Ext4Dxe/Collation.c b/Features/Ext4Pkg/Ext4Dxe/Collation.c
index 510ab24ebdf3..91d172b1cb89 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Collation.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Collation.c
@@ -58,7 +58,7 @@ Ext4InitialiseUnicodeCollationInternal (
   CHAR8                           *BestLanguage;
 
   Iso639Language = (BOOLEAN)(ProtocolGuid == &gEfiUnicodeCollationProtocolGuid);
-  RetStatus = EFI_UNSUPPORTED;
+  RetStatus      = EFI_UNSUPPORTED;
   GetEfiGlobalVariable2 (VariableName, (VOID **)&Language, NULL);
 
   Status = gBS->LocateHandleBuffer (
@@ -96,7 +96,7 @@ Ext4InitialiseUnicodeCollationInternal (
     if (BestLanguage != NULL) {
       FreePool (BestLanguage);
       gUnicodeCollationInterface = Uci;
-      RetStatus = EFI_SUCCESS;
+      RetStatus                  = EFI_SUCCESS;
       break;
     }
   }
diff --git a/Features/Ext4Pkg/Ext4Dxe/Directory.c b/Features/Ext4Pkg/Ext4Dxe/Directory.c
index 9e003ea43719..682f66ad5525 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Directory.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Directory.c
@@ -121,7 +121,7 @@ Ext4RetrieveDirent (
 
   Off = 0;
 
-  Inode = Directory->Inode;
+  Inode      = Directory->Inode;
   DirInoSize = EXT4_INODE_SIZE (Inode);
 
   DivU64x32Remainder (DirInoSize, Partition->BlockSize, &BlockRemainder);
@@ -141,7 +141,7 @@ Ext4RetrieveDirent (
     }
 
     for (BlockOffset = 0; BlockOffset < Partition->BlockSize; ) {
-      Entry = (EXT4_DIR_ENTRY *)(Buf + BlockOffset);
+      Entry          = (EXT4_DIR_ENTRY *)(Buf + BlockOffset);
       RemainingBlock = Partition->BlockSize - BlockOffset;
       // Check if the minimum directory entry fits inside [BlockOffset, EndOfBlock]
       if (RemainingBlock < EXT4_MIN_DIR_ENTRY_LEN) {
@@ -154,7 +154,7 @@ Ext4RetrieveDirent (
         return EFI_VOLUME_CORRUPTED;
       }
 
-      if (Entry->name_len > RemainingBlock || Entry->rec_len > RemainingBlock) {
+      if ((Entry->name_len > RemainingBlock) || (Entry->rec_len > RemainingBlock)) {
         // Corrupted filesystem
         FreePool (Buf);
         return EFI_VOLUME_CORRUPTED;
@@ -191,8 +191,9 @@ Ext4RetrieveDirent (
         continue;
       }
 
-      if (Entry->name_len == StrLen (Name) &&
-          !Ext4StrCmpInsensitive (DirentUcs2Name, (CHAR16 *)Name)) {
+      if ((Entry->name_len == StrLen (Name)) &&
+          !Ext4StrCmpInsensitive (DirentUcs2Name, (CHAR16 *)Name))
+      {
         ToCopy = MIN (Entry->rec_len, sizeof (EXT4_DIR_ENTRY));
 
         CopyMem (Result, Entry, ToCopy);
@@ -595,7 +596,7 @@ Ext4AddDentry (
 **/
 EXT4_DENTRY *
 Ext4CreateDentry (
-  IN CONST CHAR16              *Name,
+  IN CONST CHAR16     *Name,
   IN OUT EXT4_DENTRY  *Parent  OPTIONAL
   )
 {
diff --git a/Features/Ext4Pkg/Ext4Dxe/DiskUtil.c b/Features/Ext4Pkg/Ext4Dxe/DiskUtil.c
index da8120374772..32da35f7d9f5 100644
--- a/Features/Ext4Pkg/Ext4Dxe/DiskUtil.c
+++ b/Features/Ext4Pkg/Ext4Dxe/DiskUtil.c
@@ -60,11 +60,11 @@ Ext4ReadBlocks (
   // Check for overflow on the block -> byte conversions.
   // Partition->BlockSize is never 0, so we don't need to check for that.
 
-  if (Offset > DivU64x32 ((UINT64)- 1, Partition->BlockSize)) {
+  if (Offset > DivU64x32 ((UINT64)-1, Partition->BlockSize)) {
     return EFI_INVALID_PARAMETER;
   }
 
-  if (Length > (UINTN)- 1/Partition->BlockSize) {
+  if (Length > (UINTN)-1/Partition->BlockSize) {
     return EFI_INVALID_PARAMETER;
   }
 
@@ -94,7 +94,7 @@ Ext4AllocAndReadBlocks (
 
   Length = NumberBlocks * Partition->BlockSize;
 
-  if (Length > (UINTN)- 1/Partition->BlockSize) {
+  if (Length > (UINTN)-1/Partition->BlockSize) {
     return NULL;
   }
 
diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h b/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h
index 756b1bbe1087..5f812215fbb8 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h
+++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h
@@ -130,16 +130,16 @@
 
 #define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER   0x0001
 #define EXT4_FEATURE_RO_COMPAT_LARGE_FILE     0x0002
-#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR      0x0004     // Unused
+#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR      0x0004// Unused
 #define EXT4_FEATURE_RO_COMPAT_HUGE_FILE      0x0008
 #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM       0x0010
 #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK      0x0020
 #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE    0x0040
-#define EXT4_FEATURE_RO_COMPAT_HAS_SNAPSHOT   0x0080     // Not implemented in ext4
+#define EXT4_FEATURE_RO_COMPAT_HAS_SNAPSHOT   0x0080// Not implemented in ext4
 #define EXT4_FEATURE_RO_COMPAT_QUOTA          0x0100
 #define EXT4_FEATURE_RO_COMPAT_BIGALLOC       0x0200
 #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM  0x0400
-#define EXT4_FEATURE_RO_COMPAT_REPLICA        0x0800     // Not used
+#define EXT4_FEATURE_RO_COMPAT_REPLICA        0x0800// Not used
 
 // We explicitly don't recognise this, so we get read only.
 #define EXT4_FEATURE_RO_COMPAT_READONLY  0x1000
@@ -149,7 +149,7 @@
  * Absolutely needed features:
  *    1) Every incompat, because we might want to mount root filesystems
  *    2) Relevant RO_COMPATs(I'm not sure of what to do wrt quota, project)
-**/
+ **/
 
 #define EXT4_INO_TYPE_FIFO       0x1000
 #define EXT4_INO_TYPE_CHARDEV    0x2000
@@ -259,7 +259,7 @@ typedef struct {
   UINT64    s_mmp_block;
   UINT32    s_raid_stride_width;
   UINT8     s_log_groups_per_flex;
-  UINT8     s_checksum_type;   // Only valid value is 1 - CRC32C
+  UINT8     s_checksum_type; // Only valid value is 1 - CRC32C
   UINT16    s_reserved_pad;
   UINT64    s_kbytes_written;
 
@@ -283,7 +283,7 @@ typedef struct {
   UINT32    s_usr_quota_inum;
   UINT32    s_grp_quota_inum;
   UINT32    s_overhead_blocks;
-  UINT32    s_backup_bgs[2];    // sparse_super2
+  UINT32    s_backup_bgs[2]; // sparse_super2
   UINT8     s_encrypt_algos[4];
   UINT8     s_encrypt_pw_salt[16];
   UINT32    s_lpf_ino;
@@ -293,7 +293,10 @@ typedef struct {
   UINT32    s_checksum;
 } EXT4_SUPERBLOCK;
 
-STATIC_ASSERT (sizeof (EXT4_SUPERBLOCK) == 1024, "ext4 superblock struct has incorrect size");
+STATIC_ASSERT (
+  sizeof (EXT4_SUPERBLOCK) == 1024,
+  "ext4 superblock struct has incorrect size"
+  );
 
 typedef struct {
   UINT32    bg_block_bitmap_lo;
@@ -355,7 +358,8 @@ typedef struct _Ext4_I_OSD2_Hurd {
 } EXT4_OSD2_HURD;
 
 typedef union {
-  // Note: Toolchain-specific defines (such as "linux") stops us from using simpler names down here.
+  // Note: Toolchain-specific defines (such as "linux") stops us from using
+  // simpler names down here.
   EXT4_OSD2_LINUX    data_linux;
   EXT4_OSD2_HURD     data_hurd;
 } EXT4_OSD2;
@@ -418,7 +422,8 @@ typedef struct {
 typedef struct {
   // This index covers logical blocks from 'ei_block'
   UINT32    ei_block;
-  // Block of the next level of the extent tree, similarly split in a high and low portion.
+  // Block of the next level of the extent tree, similarly split in a high and
+  // low portion.
   UINT32    ei_leaf_lo;
   UINT16    ei_leaf_hi;
 
@@ -451,8 +456,9 @@ typedef struct {
 /**
  * EXT4 has this feature called uninitialized extents:
  * An extent has a maximum of 32768 blocks (2^15 or 1 << 15).
- * When we find an extent with > 32768 blocks, this extent is called uninitialized.
- * Long story short, it's an extent that behaves as a file hole but has blocks already allocated.
+ * When we find an extent with > 32768 blocks, this extent is called
+ * uninitialized. Long story short, it's an extent that behaves as a file hole
+ * but has blocks already allocated.
  */
 #define EXT4_EXTENT_MAX_INITIALIZED  (1 << 15)
 
diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c
index d9fbe9ea78e1..43b9340d3956 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c
@@ -104,11 +104,11 @@ Ext4ComponentNameGetDriverName (
 EFI_STATUS
 EFIAPI
 Ext4ComponentNameGetControllerName (
-  IN  EFI_COMPONENT_NAME_PROTOCOL                                  *This,
-  IN  EFI_HANDLE                                                   ControllerHandle,
-  IN  EFI_HANDLE                                      ChildHandle  OPTIONAL,
-  IN  CHAR8                                                        *Language,
-  OUT CHAR16                                                       **ControllerName
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  EFI_HANDLE                   ControllerHandle,
+  IN  EFI_HANDLE                   ChildHandle  OPTIONAL,
+  IN  CHAR8                        *Language,
+  OUT CHAR16                       **ControllerName
   );
 
 extern EFI_COMPONENT_NAME_PROTOCOL  gExt4ComponentName;
@@ -175,9 +175,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL  gExt4ComponentName2
 EFI_STATUS
 EFIAPI
 Ext4IsBindingSupported (
-  IN EFI_DRIVER_BINDING_PROTOCOL           *BindingProtocol,
-  IN EFI_HANDLE                            ControllerHandle,
-  IN EFI_DEVICE_PATH *RemainingDevicePath  OPTIONAL
+  IN EFI_DRIVER_BINDING_PROTOCOL  *BindingProtocol,
+  IN EFI_HANDLE                   ControllerHandle,
+  IN EFI_DEVICE_PATH              *RemainingDevicePath  OPTIONAL
   );
 
 /**
@@ -218,9 +218,9 @@ Ext4IsBindingSupported (
 EFI_STATUS
 EFIAPI
 Ext4Bind (
-  IN EFI_DRIVER_BINDING_PROTOCOL           *BindingProtocol,
-  IN EFI_HANDLE                            ControllerHandle,
-  IN EFI_DEVICE_PATH *RemainingDevicePath  OPTIONAL
+  IN EFI_DRIVER_BINDING_PROTOCOL  *BindingProtocol,
+  IN EFI_HANDLE                   ControllerHandle,
+  IN EFI_DEVICE_PATH              *RemainingDevicePath  OPTIONAL
   );
 
 /**
@@ -252,10 +252,10 @@ Ext4Bind (
 EFI_STATUS
 EFIAPI
 Ext4Stop (
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,
-  IN EFI_HANDLE                     ControllerHandle,
-  IN UINTN                          NumberOfChildren,
-  IN EFI_HANDLE *ChildHandleBuffer  OPTIONAL
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
+  IN EFI_HANDLE                   ControllerHandle,
+  IN UINTN                        NumberOfChildren,
+  IN EFI_HANDLE                   *ChildHandleBuffer  OPTIONAL
   );
 
 EFI_DRIVER_BINDING_PROTOCOL  gExt4BindingProtocol =
@@ -309,11 +309,11 @@ EFI_DRIVER_BINDING_PROTOCOL  gExt4BindingProtocol =
 EFI_STATUS
 EFIAPI
 Ext4ComponentNameGetControllerName (
-  IN  EFI_COMPONENT_NAME_PROTOCOL                                  *This,
-  IN  EFI_HANDLE                                                   ControllerHandle,
-  IN  EFI_HANDLE                                      ChildHandle  OPTIONAL,
-  IN  CHAR8                                                        *Language,
-  OUT CHAR16                                                       **ControllerName
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  EFI_HANDLE                   ControllerHandle,
+  IN  EFI_HANDLE                   ChildHandle  OPTIONAL,
+  IN  CHAR8                        *Language,
+  OUT CHAR16                       **ControllerName
   )
 {
   EFI_STATUS  Status;
@@ -410,10 +410,10 @@ Ext4ComponentNameGetDriverName (
 EFI_STATUS
 EFIAPI
 Ext4Stop (
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,
-  IN EFI_HANDLE                     ControllerHandle,
-  IN UINTN                          NumberOfChildren,
-  IN EFI_HANDLE *ChildHandleBuffer  OPTIONAL
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
+  IN EFI_HANDLE                   ControllerHandle,
+  IN UINTN                        NumberOfChildren,
+  IN EFI_HANDLE                   *ChildHandleBuffer  OPTIONAL
   )
 {
   EFI_STATUS                       Status;
@@ -637,16 +637,16 @@ Ext4Unload (
 EFI_STATUS
 EFIAPI
 Ext4IsBindingSupported (
-  IN EFI_DRIVER_BINDING_PROTOCOL           *BindingProtocol,
-  IN EFI_HANDLE                            ControllerHandle,
-  IN EFI_DEVICE_PATH *RemainingDevicePath  OPTIONAL
+  IN EFI_DRIVER_BINDING_PROTOCOL  *BindingProtocol,
+  IN EFI_HANDLE                   ControllerHandle,
+  IN EFI_DEVICE_PATH              *RemainingDevicePath  OPTIONAL
   )
 {
-  EFI_STATUS            Status;
-  EFI_DISK_IO_PROTOCOL  *DiskIo;
-  EFI_BLOCK_IO_PROTOCOL *BlockIo;
+  EFI_STATUS             Status;
+  EFI_DISK_IO_PROTOCOL   *DiskIo;
+  EFI_BLOCK_IO_PROTOCOL  *BlockIo;
 
-  DiskIo = NULL;
+  DiskIo  = NULL;
   BlockIo = NULL;
 
   //
@@ -655,7 +655,7 @@ Ext4IsBindingSupported (
   Status = gBS->OpenProtocol (
                   ControllerHandle,
                   &gEfiDiskIoProtocolGuid,
-                  (VOID **) &DiskIo,
+                  (VOID **)&DiskIo,
                   BindingProtocol->DriverBindingHandle,
                   ControllerHandle,
                   EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -664,13 +664,14 @@ Ext4IsBindingSupported (
   if (EFI_ERROR (Status)) {
     return Status;
   }
+
   //
   // Open the IO Abstraction(s) needed to perform the supported test
   //
   Status = gBS->OpenProtocol (
                   ControllerHandle,
                   &gEfiBlockIoProtocolGuid,
-                  (VOID **) &BlockIo,
+                  (VOID **)&BlockIo,
                   BindingProtocol->DriverBindingHandle,
                   ControllerHandle,
                   EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -687,20 +688,22 @@ Ext4IsBindingSupported (
   //
   if (DiskIo != NULL) {
     gBS->CloseProtocol (
-          ControllerHandle,
-          &gEfiDiskIoProtocolGuid,
-          BindingProtocol->DriverBindingHandle,
-          ControllerHandle
-          );
+           ControllerHandle,
+           &gEfiDiskIoProtocolGuid,
+           BindingProtocol->DriverBindingHandle,
+           ControllerHandle
+           );
   }
+
   if (BlockIo != NULL) {
     gBS->CloseProtocol (
-          ControllerHandle,
-          &gEfiBlockIoProtocolGuid,
-          BindingProtocol->DriverBindingHandle,
-          ControllerHandle
-          );
+           ControllerHandle,
+           &gEfiBlockIoProtocolGuid,
+           BindingProtocol->DriverBindingHandle,
+           ControllerHandle
+           );
   }
+
   return Status;
 }
 
@@ -742,9 +745,9 @@ Ext4IsBindingSupported (
 EFI_STATUS
 EFIAPI
 Ext4Bind (
-  IN EFI_DRIVER_BINDING_PROTOCOL           *BindingProtocol,
-  IN EFI_HANDLE                            ControllerHandle,
-  IN EFI_DEVICE_PATH *RemainingDevicePath  OPTIONAL
+  IN EFI_DRIVER_BINDING_PROTOCOL  *BindingProtocol,
+  IN EFI_HANDLE                   ControllerHandle,
+  IN EFI_DEVICE_PATH              *RemainingDevicePath  OPTIONAL
   )
 {
   EFI_DISK_IO_PROTOCOL   *DiskIo;
diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h
index fbdffd21f918..03e0586cbb05 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h
+++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h
@@ -18,16 +18,16 @@
 #include <Protocol/DiskIo2.h>
 #include <Protocol/SimpleFileSystem.h>
 
-#include <Library/PcdLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
 #include <Library/BaseLib.h>
 #include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
 #include <Library/MemoryAllocationLib.h>
-#include <Library/UefiDriverEntryPoint.h>
+#include <Library/OrderedCollectionLib.h>
+#include <Library/PcdLib.h>
 #include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiLib.h>
 #include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/OrderedCollectionLib.h>
 
 #include "Ext4Disk.h"
 
@@ -40,7 +40,8 @@
 
    @param[in]        DeviceHandle     Handle to the block device.
    @param[in]        DiskIo           Pointer to an EFI_DISK_IO_PROTOCOL.
-   @param[in opt]    DiskIo2          Pointer to an EFI_DISK_IO2_PROTOCOL, if supported.
+   @param[in opt]    DiskIo2          Pointer to an EFI_DISK_IO2_PROTOCOL,
+if supported.
    @param[in]        BlockIo          Pointer to an EFI_BLOCK_IO_PROTOCOL.
 
    @retval EFI_SUCCESS      The opening was successful.
@@ -54,8 +55,8 @@ Ext4OpenPartition (
   IN EFI_BLOCK_IO_PROTOCOL           *BlockIo
   );
 
-typedef struct _Ext4File EXT4_FILE;
-typedef struct _Ext4_Dentry EXT4_DENTRY;
+typedef struct _Ext4File     EXT4_FILE;
+typedef struct _Ext4_Dentry  EXT4_DENTRY;
 
 typedef struct _Ext4_PARTITION {
   EFI_SIMPLE_FILE_SYSTEM_PROTOCOL    Interface;
@@ -88,12 +89,12 @@ typedef struct _Ext4_PARTITION {
 
 /**
    This structure represents a directory entry inside our directory entry tree.
-   For now, it will be used as a way to track file names inside our opening code,
-   but it may very well be used as a directory cache in the future.
+   For now, it will be used as a way to track file names inside our opening
+   code, but it may very well be used as a directory cache in the future.
    Because it's not being used as a directory cache right now,
    an EXT4_DENTRY structure is not necessarily unique name-wise in the list of
-   children. Therefore, the dentry tree does not accurately reflect the filesystem
-   structure.
+   children. Therefore, the dentry tree does not accurately reflect the
+   filesystem structure.
  */
 struct _Ext4_Dentry {
   UINTN                  RefCount;
@@ -104,7 +105,7 @@ struct _Ext4_Dentry {
   LIST_ENTRY             ListNode;
 };
 
-#define EXT4_DENTRY_FROM_DENTRY_LIST(Node)  BASE_CR (Node, EXT4_DENTRY, ListNode)
+#define EXT4_DENTRY_FROM_DENTRY_LIST(Node)  BASE_CR(Node, EXT4_DENTRY, ListNode)
 
 /**
    Creates a new dentry object.
@@ -118,7 +119,7 @@ struct _Ext4_Dentry {
 EXT4_DENTRY *
 Ext4CreateDentry (
   IN CONST CHAR16     *Name,
-  IN OUT EXT4_DENTRY  *Parent  OPTIONAL
+  IN OUT EXT4_DENTRY  *Parent OPTIONAL
   );
 
 /**
@@ -147,7 +148,8 @@ Ext4UnrefDentry (
 /**
    Opens and parses the superblock.
 
-   @param[out]     Partition Partition structure to fill with filesystem details.
+   @param[out]     Partition Partition structure to fill with filesystem
+details.
    @retval EFI_SUCCESS       Parsing was succesful and the partition is a
                              valid ext4 partition.
 **/
@@ -219,15 +221,15 @@ Ext4ReadDiskIo (
 **/
 EFI_STATUS
 Ext4ReadBlocks (
-  IN  EXT4_PARTITION  *Partition,
-  OUT VOID            *Buffer,
-  IN  UINTN           NumberBlocks,
-  IN  EXT4_BLOCK_NR   BlockNumber
+  IN EXT4_PARTITION  *Partition,
+  OUT VOID           *Buffer,
+  IN UINTN           NumberBlocks,
+  IN EXT4_BLOCK_NR   BlockNumber
   );
 
 /**
-   Allocates a buffer and reads blocks from the partition's disk using the DISK_IO protocol.
-   This function is deprecated and will be removed in the future.
+   Allocates a buffer and reads blocks from the partition's disk using the
+DISK_IO protocol. This function is deprecated and will be removed in the future.
 
    @param[in]  Partition      Pointer to the opened ext4 partition.
    @param[in]  NumberBlocks   Length of the read, in filesystem blocks.
@@ -244,13 +246,15 @@ Ext4AllocAndReadBlocks (
   );
 
 /**
-   Checks if the opened partition has the 64-bit feature (see EXT4_FEATURE_INCOMPAT_64BIT).
+   Checks if the opened partition has the 64-bit feature (see
+EXT4_FEATURE_INCOMPAT_64BIT).
 
    @param[in]  Partition      Pointer to the opened ext4 partition.
 
    @return TRUE if EXT4_FEATURE_INCOMPAT_64BIT is enabled, else FALSE.
 **/
-#define EXT4_IS_64_BIT(Partition)  ((Partition->FeaturesIncompat & EXT4_FEATURE_INCOMPAT_64BIT) != 0)
+#define EXT4_IS_64_BIT(Partition)                                              \
+  ((Partition->FeaturesIncompat & EXT4_FEATURE_INCOMPAT_64BIT) != 0)
 
 /**
    Composes an EXT4_BLOCK_NR safely, from two halfs.
@@ -261,8 +265,8 @@ Ext4AllocAndReadBlocks (
 
    @return The block number formed by Low, and if 64 bit is enabled, High.
 **/
-#define EXT4_BLOCK_NR_FROM_HALFS(Partition, Low, High) \
-  EXT4_IS_64_BIT (Partition) ? (Low | LShiftU64 (High, 32)) : Low
+#define EXT4_BLOCK_NR_FROM_HALFS(Partition, Low, High)                         \
+  EXT4_IS_64_BIT(Partition) ? (Low | LShiftU64(High, 32)) : Low
 
 /**
    Retrieves a block group descriptor of the ext4 filesystem.
@@ -283,15 +287,16 @@ Ext4GetBlockGroupDesc (
 
    @param[in]    Partition  Pointer to the opened partition.
    @param[in]    InodeNum   Number of the desired Inode
-   @param[out]   OutIno     Pointer to where it will be stored a pointer to the read inode.
+   @param[out]   OutIno     Pointer to where it will be stored a pointer to the
+read inode.
 
    @return Status of the inode read.
 **/
 EFI_STATUS
 Ext4ReadInode (
-  IN  EXT4_PARTITION  *Partition,
-  IN  EXT4_INO_NR     InodeNum,
-  OUT EXT4_INODE      **OutIno
+  IN EXT4_PARTITION  *Partition,
+  IN EXT4_INO_NR     InodeNum,
+  OUT EXT4_INODE     **OutIno
   );
 
 /**
@@ -302,7 +307,8 @@ Ext4ReadInode (
 
    @return The number of bytes.
 **/
-#define EXT4_BLOCK_TO_BYTES(Partition, Block)  MultU64x32 (Block, Partition->BlockSize)
+#define EXT4_BLOCK_TO_BYTES(Partition, Block)                                  \
+  MultU64x32(Block, Partition->BlockSize)
 
 /**
    Reads from an EXT4 inode.
@@ -311,17 +317,18 @@ Ext4ReadInode (
    @param[out]     Buffer        Pointer to the buffer.
    @param[in]      Offset        Offset of the read.
    @param[in out]  Length        Pointer to the length of the buffer, in bytes.
-                                 After a succesful read, it's updated to the number of read bytes.
+                                 After a succesful read, it's updated to the
+number of read bytes.
 
    @return Status of the read operation.
 **/
 EFI_STATUS
 Ext4Read (
-  IN     EXT4_PARTITION  *Partition,
-  IN     EXT4_FILE       *File,
-  OUT    VOID            *Buffer,
-  IN     UINT64          Offset,
-  IN OUT UINTN           *Length
+  IN EXT4_PARTITION  *Partition,
+  IN EXT4_FILE       *File,
+  OUT VOID           *Buffer,
+  IN UINT64          Offset,
+  IN OUT UINTN       *Length
   );
 
 /**
@@ -331,24 +338,27 @@ Ext4Read (
 
    @return The size of the inode, in bytes.
 **/
-#define EXT4_INODE_SIZE(Inode)  (LShiftU64 (Inode->i_size_hi, 32) | Inode->i_size_lo)
+#define EXT4_INODE_SIZE(Inode)                                                 \
+  (LShiftU64(Inode->i_size_hi, 32) | Inode->i_size_lo)
 
 /**
    Retrieves an extent from an EXT4 inode.
    @param[in]      Partition     Pointer to the opened EXT4 partition.
    @param[in]      File          Pointer to the opened file.
-   @param[in]      LogicalBlock  Block number which the returned extent must cover.
-   @param[out]     Extent        Pointer to the output buffer, where the extent will be copied to.
+   @param[in]      LogicalBlock  Block number which the returned extent must
+cover.
+   @param[out]     Extent        Pointer to the output buffer, where the extent
+will be copied to.
 
    @retval EFI_SUCCESS        Retrieval was succesful.
    @retval EFI_NO_MAPPING     Block has no mapping.
 **/
 EFI_STATUS
 Ext4GetExtent (
-  IN  EXT4_PARTITION  *Partition,
-  IN  EXT4_FILE       *File,
-  IN  EXT4_BLOCK_NR   LogicalBlock,
-  OUT EXT4_EXTENT     *Extent
+  IN EXT4_PARTITION  *Partition,
+  IN EXT4_FILE       *File,
+  IN EXT4_BLOCK_NR   LogicalBlock,
+  OUT EXT4_EXTENT    *Extent
   );
 
 struct _Ext4File {
@@ -369,7 +379,8 @@ struct _Ext4File {
   EXT4_DENTRY           *Dentry;
 };
 
-#define EXT4_FILE_FROM_OPEN_FILES_NODE(Node)  BASE_CR (Node, EXT4_FILE, OpenFilesListNode)
+#define EXT4_FILE_FROM_OPEN_FILES_NODE(Node)                                   \
+  BASE_CR(Node, EXT4_FILE, OpenFilesListNode)
 
 /**
    Retrieves a directory entry.
@@ -383,9 +394,9 @@ struct _Ext4File {
 **/
 EFI_STATUS
 Ext4RetrieveDirent (
-  IN  EXT4_FILE       *Directory,
-  IN  CONST CHAR16    *NameUnicode,
-  IN  EXT4_PARTITION  *Partition,
+  IN EXT4_FILE        *Directory,
+  IN CONST CHAR16     *NameUnicode,
+  IN EXT4_PARTITION   *Partition,
   OUT EXT4_DIR_ENTRY  *Result
   );
 
@@ -402,11 +413,11 @@ Ext4RetrieveDirent (
 **/
 EFI_STATUS
 Ext4OpenFile (
-  IN  EXT4_FILE       *Directory,
-  IN  CONST CHAR16    *Name,
-  IN  EXT4_PARTITION  *Partition,
-  IN  UINT64          OpenMode,
-  OUT EXT4_FILE       **OutFile
+  IN EXT4_FILE       *Directory,
+  IN CONST CHAR16    *Name,
+  IN EXT4_PARTITION  *Partition,
+  IN UINT64          OpenMode,
+  OUT EXT4_FILE      **OutFile
   );
 
 /**
@@ -422,11 +433,11 @@ Ext4OpenFile (
 **/
 EFI_STATUS
 Ext4OpenDirent (
-  IN  EXT4_PARTITION  *Partition,
-  IN  UINT64          OpenMode,
-  OUT EXT4_FILE       **OutFile,
-  IN  EXT4_DIR_ENTRY  *Entry,
-  IN  EXT4_FILE       *Directory
+  IN EXT4_PARTITION  *Partition,
+  IN UINT64          OpenMode,
+  OUT EXT4_FILE      **OutFile,
+  IN EXT4_DIR_ENTRY  *Entry,
+  IN EXT4_FILE       *Directory
   );
 
 /**
@@ -447,20 +458,22 @@ Ext4AllocateInode (
   Open the root directory on a volume.
 
   @param[in]   This A pointer to the volume to open the root directory.
-  @param[out]  Root A pointer to the location to return the opened file handle for the
-                    root directory.
+  @param[out]  Root A pointer to the location to return the opened file handle
+for the root directory.
 
   @retval EFI_SUCCESS          The device was opened.
-  @retval EFI_UNSUPPORTED      This volume does not support the requested file system type.
+  @retval EFI_UNSUPPORTED      This volume does not support the requested file
+system type.
   @retval EFI_NO_MEDIA         The device has no medium.
   @retval EFI_DEVICE_ERROR     The device reported an error.
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
   @retval EFI_ACCESS_DENIED    The service denied access to the file.
-  @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources.
-  @retval EFI_MEDIA_CHANGED    The device has a different medium in it or the medium is no
-                               longer supported. Any existing file handles for this volume are
-                               no longer valid. To access the files on the new medium, the
-                               volume must be reopened with OpenVolume().
+  @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of
+resources.
+  @retval EFI_MEDIA_CHANGED    The device has a different medium in it or the
+medium is no longer supported. Any existing file handles for this volume are no
+longer valid. To access the files on the new medium, the volume must be reopened
+with OpenVolume().
 
 **/
 EFI_STATUS
@@ -501,30 +514,32 @@ Ext4CloseInternal (
 /**
   Opens a new file relative to the source file's location.
 
-  @param[in]  This       A pointer to the EFI_FILE_PROTOCOL instance that is the file
-                         handle to the source location. This would typically be an open
-                         handle to a directory.
-  @param[out] NewHandle  A pointer to the location to return the opened handle for the new
-                         file.
-  @param[in]  FileName   The Null-terminated string of the name of the file to be opened.
-                         The file name may contain the following path modifiers: "\", ".",
-                         and "..".
-  @param[in]  OpenMode   The mode to open the file. The only valid combinations that the
-                         file may be opened with are: Read, Read/Write, or Create/Read/Write.
-  @param[in]  Attributes Only valid for EFI_FILE_MODE_CREATE, in which case these are the
-                         attribute bits for the newly created file.
+  @param[in]  This       A pointer to the EFI_FILE_PROTOCOL instance that is the
+file handle to the source location. This would typically be an open handle to a
+directory.
+  @param[out] NewHandle  A pointer to the location to return the opened handle
+for the new file.
+  @param[in]  FileName   The Null-terminated string of the name of the file to
+be opened. The file name may contain the following path modifiers: "\", ".", and
+"..".
+  @param[in]  OpenMode   The mode to open the file. The only valid combinations
+that the file may be opened with are: Read, Read/Write, or Create/Read/Write.
+  @param[in]  Attributes Only valid for EFI_FILE_MODE_CREATE, in which case
+these are the attribute bits for the newly created file.
 
   @retval EFI_SUCCESS          The file was opened.
-  @retval EFI_NOT_FOUND        The specified file could not be found on the device.
+  @retval EFI_NOT_FOUND        The specified file could not be found on the
+device.
   @retval EFI_NO_MEDIA         The device has no medium.
-  @retval EFI_MEDIA_CHANGED    The device has a different medium in it or the medium is no
-                               longer supported.
+  @retval EFI_MEDIA_CHANGED    The device has a different medium in it or the
+medium is no longer supported.
   @retval EFI_DEVICE_ERROR     The device reported an error.
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
-  @retval EFI_WRITE_PROTECTED  An attempt was made to create a file, or open a file for write
-                               when the media is write-protected.
+  @retval EFI_WRITE_PROTECTED  An attempt was made to create a file, or open a
+file for write when the media is write-protected.
   @retval EFI_ACCESS_DENIED    The service denied access to the file.
-  @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.
+  @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
+file.
   @retval EFI_VOLUME_FULL      The volume is full.
 
 **/
@@ -541,8 +556,8 @@ Ext4Open (
 /**
   Closes a specified file handle.
 
-  @param[in]  This          A pointer to the EFI_FILE_PROTOCOL instance that is the file
-                            handle to close.
+  @param[in]  This          A pointer to the EFI_FILE_PROTOCOL instance that is
+the file handle to close.
 
   @retval EFI_SUCCESS   The file was closed.
 
@@ -556,11 +571,13 @@ Ext4Close (
 /**
   Close and delete the file handle.
 
-  @param[in]  This                     A pointer to the EFI_FILE_PROTOCOL instance that is the
-                                       handle to the file to delete.
+  @param[in]  This                     A pointer to the EFI_FILE_PROTOCOL
+instance that is the handle to the file to delete.
 
-  @retval EFI_SUCCESS              The file was closed and deleted, and the handle was closed.
-  @retval EFI_WARN_DELETE_FAILURE  The handle was closed, but the file was not deleted.
+  @retval EFI_SUCCESS              The file was closed and deleted, and the
+handle was closed.
+  @retval EFI_WARN_DELETE_FAILURE  The handle was closed, but the file was not
+deleted.
 
 **/
 EFI_STATUS
@@ -572,21 +589,23 @@ Ext4Delete (
 /**
   Reads data from a file.
 
-  @param[in]      This             A pointer to the EFI_FILE_PROTOCOL instance that is the file
-                                   handle to read data from.
-  @param[in out]  BufferSize       On input, the size of the Buffer. On output, the amount of data
-                                   returned in Buffer. In both cases, the size is measured in bytes.
+  @param[in]      This             A pointer to the EFI_FILE_PROTOCOL instance
+that is the file handle to read data from.
+  @param[in out]  BufferSize       On input, the size of the Buffer. On output,
+the amount of data returned in Buffer. In both cases, the size is measured in
+bytes.
   @param[out]     Buffer           The buffer into which the data is read.
 
   @retval EFI_SUCCESS          Data was read.
   @retval EFI_NO_MEDIA         The device has no medium.
   @retval EFI_DEVICE_ERROR     The device reported an error.
   @retval EFI_DEVICE_ERROR     An attempt was made to read from a deleted file.
-  @retval EFI_DEVICE_ERROR     On entry, the current file position is beyond the end of the file.
+  @retval EFI_DEVICE_ERROR     On entry, the current file position is beyond the
+end of the file.
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
-  @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory
-                               entry. BufferSize has been updated with the size
-                               needed to complete the request.
+  @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current
+directory entry. BufferSize has been updated with the size needed to complete
+the request.
 
 **/
 EFI_STATUS
@@ -600,10 +619,10 @@ Ext4ReadFile (
 /**
   Writes data to a file.
 
-  @param[in]      This        A pointer to the EFI_FILE_PROTOCOL instance that is the file
-                              handle to write data to.
-  @param[in out]  BufferSize  On input, the size of the Buffer. On output, the amount of data
-                              actually written. In both cases, the size is measured in bytes.
+  @param[in]      This        A pointer to the EFI_FILE_PROTOCOL instance that
+is the file handle to write data to.
+  @param[in out]  BufferSize  On input, the size of the Buffer. On output, the
+amount of data actually written. In both cases, the size is measured in bytes.
   @param[in]      Buffer      The buffer of data to write.
 
   @retval EFI_SUCCESS          Data was written.
@@ -628,13 +647,15 @@ Ext4WriteFile (
 /**
   Returns a file's current position.
 
-  @param[in]   This            A pointer to the EFI_FILE_PROTOCOL instance that is the file
-                               handle to get the current position on.
-  @param[out]  Position        The address to return the file's current position value.
+  @param[in]   This            A pointer to the EFI_FILE_PROTOCOL instance that
+is the file handle to get the current position on.
+  @param[out]  Position        The address to return the file's current position
+value.
 
   @retval EFI_SUCCESS      The position was returned.
   @retval EFI_UNSUPPORTED  The request is not valid on open directories.
-  @retval EFI_DEVICE_ERROR An attempt was made to get the position from a deleted file.
+  @retval EFI_DEVICE_ERROR An attempt was made to get the position from a
+deleted file.
 
 **/
 EFI_STATUS
@@ -647,14 +668,16 @@ Ext4GetPosition (
 /**
   Sets a file's current position.
 
-  @param[in]  This            A pointer to the EFI_FILE_PROTOCOL instance that is the
-                              file handle to set the requested position on.
-  @param[in] Position        The byte position from the start of the file to set.
+  @param[in]  This            A pointer to the EFI_FILE_PROTOCOL instance that
+is the file handle to set the requested position on.
+  @param[in] Position        The byte position from the start of the file to
+set.
 
   @retval EFI_SUCCESS      The position was set.
   @retval EFI_UNSUPPORTED  The seek request for nonzero is not valid on open
                            directories.
-  @retval EFI_DEVICE_ERROR An attempt was made to set the position of a deleted file.
+  @retval EFI_DEVICE_ERROR An attempt was made to set the position of a deleted
+file.
 
 **/
 EFI_STATUS
@@ -667,21 +690,22 @@ Ext4SetPosition (
 /**
   Returns information about a file.
 
-  @param[in]      This            A pointer to the EFI_FILE_PROTOCOL instance that is the file
-                                  handle the requested information is for.
-  @param[in]      InformationType The type identifier for the information being requested.
-  @param[in out]  BufferSize      On input, the size of Buffer. On output, the amount of data
-                                  returned in Buffer. In both cases, the size is measured in bytes.
-  @param[out]     Buffer          A pointer to the data buffer to return. The buffer's type is
-                                  indicated by InformationType.
+  @param[in]      This            A pointer to the EFI_FILE_PROTOCOL instance
+that is the file handle the requested information is for.
+  @param[in]      InformationType The type identifier for the information being
+requested.
+  @param[in out]  BufferSize      On input, the size of Buffer. On output, the
+amount of data returned in Buffer. In both cases, the size is measured in bytes.
+  @param[out]     Buffer          A pointer to the data buffer to return. The
+buffer's type is indicated by InformationType.
 
   @retval EFI_SUCCESS          The information was returned.
   @retval EFI_UNSUPPORTED      The InformationType is not known.
   @retval EFI_NO_MEDIA         The device has no medium.
   @retval EFI_DEVICE_ERROR     The device reported an error.
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
-  @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.
-                               BufferSize has been updated with the size needed to complete
+  @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current
+directory entry. BufferSize has been updated with the size needed to complete
                                the request.
 **/
 EFI_STATUS
@@ -696,35 +720,36 @@ Ext4GetInfo (
 /**
   Sets information about a file.
 
-  @param[in]  This            A pointer to the EFI_FILE_PROTOCOL instance that is the file
-                              handle the information is for.
+  @param[in]  This            A pointer to the EFI_FILE_PROTOCOL instance that
+is the file handle the information is for.
   @param[in]  InformationType The type identifier for the information being set.
   @param[in]  BufferSize      The size, in bytes, of Buffer.
-  @param[in]  Buffer          A pointer to the data buffer to write. The buffer's type is
-                              indicated by InformationType.
+  @param[in]  Buffer          A pointer to the data buffer to write. The
+buffer's type is indicated by InformationType.
 
   @retval EFI_SUCCESS          The information was set.
   @retval EFI_UNSUPPORTED      The InformationType is not known.
   @retval EFI_NO_MEDIA         The device has no medium.
   @retval EFI_DEVICE_ERROR     The device reported an error.
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
-  @retval EFI_WRITE_PROTECTED  InformationType is EFI_FILE_INFO_ID and the media is
-                               read-only.
-  @retval EFI_WRITE_PROTECTED  InformationType is EFI_FILE_PROTOCOL_SYSTEM_INFO_ID
-                               and the media is read only.
-  @retval EFI_WRITE_PROTECTED  InformationType is EFI_FILE_SYSTEM_VOLUME_LABEL_ID
-                               and the media is read-only.
-  @retval EFI_ACCESS_DENIED    An attempt is made to change the name of a file to a
-                               file that is already present.
-  @retval EFI_ACCESS_DENIED    An attempt is being made to change the EFI_FILE_DIRECTORY
-                               Attribute.
-  @retval EFI_ACCESS_DENIED    An attempt is being made to change the size of a directory.
-  @retval EFI_ACCESS_DENIED    InformationType is EFI_FILE_INFO_ID and the file was opened
-                               read-only and an attempt is being made to modify a field
-                               other than Attribute.
+  @retval EFI_WRITE_PROTECTED  InformationType is EFI_FILE_INFO_ID and the media
+is read-only.
+  @retval EFI_WRITE_PROTECTED  InformationType is
+EFI_FILE_PROTOCOL_SYSTEM_INFO_ID and the media is read only.
+  @retval EFI_WRITE_PROTECTED  InformationType is
+EFI_FILE_SYSTEM_VOLUME_LABEL_ID and the media is read-only.
+  @retval EFI_ACCESS_DENIED    An attempt is made to change the name of a file
+to a file that is already present.
+  @retval EFI_ACCESS_DENIED    An attempt is being made to change the
+EFI_FILE_DIRECTORY Attribute.
+  @retval EFI_ACCESS_DENIED    An attempt is being made to change the size of a
+directory.
+  @retval EFI_ACCESS_DENIED    InformationType is EFI_FILE_INFO_ID and the file
+was opened read-only and an attempt is being made to modify a field other than
+Attribute.
   @retval EFI_VOLUME_FULL      The volume is full.
-  @retval EFI_BAD_BUFFER_SIZE  BufferSize is smaller than the size of the type indicated
-                               by InformationType.
+  @retval EFI_BAD_BUFFER_SIZE  BufferSize is smaller than the size of the type
+indicated by InformationType.
 
 **/
 EFI_STATUS
@@ -760,8 +785,8 @@ Ext4FileIsReg (
   IN CONST EXT4_FILE  *File
   );
 
-// In EFI we can't open FIFO pipes, UNIX sockets, character/block devices since these concepts are
-// at the kernel level and are OS dependent.
+// In EFI we can't open FIFO pipes, UNIX sockets, character/block devices since
+// these concepts are at the kernel level and are OS dependent.
 
 /**
    Checks if a file is openable.
@@ -772,11 +797,11 @@ Ext4FileIsReg (
            it's a regular file or a directory, since most other file types
            don't make sense under UEFI.
 **/
-#define Ext4FileIsOpenable(File)  (Ext4FileIsReg (File) || Ext4FileIsDir (File))
+#define Ext4FileIsOpenable(File)  (Ext4FileIsReg(File) || Ext4FileIsDir(File))
 
-#define EXT4_INODE_HAS_FIELD(Inode, \
-                             Field)  (Inode->i_extra_isize + EXT4_GOOD_OLD_INODE_SIZE >= OFFSET_OF (EXT4_INODE, Field) + \
-                                      sizeof (((EXT4_INODE *)NULL)->Field))
+#define EXT4_INODE_HAS_FIELD(Inode, Field)                                     \
+  (Inode->i_extra_isize + EXT4_GOOD_OLD_INODE_SIZE >=                          \
+   OFFSET_OF(EXT4_INODE, Field) + sizeof(((EXT4_INODE *)NULL)->Field))
 
 /**
    Calculates the physical space used by a file.
@@ -815,8 +840,8 @@ Ext4FileMTime (
    Gets the file's creation time, if possible.
    @param[in]      File   Pointer to the opened file.
    @param[out]     Time   Pointer to an EFI_TIME structure.
-                          In the case where the the creation time isn't recorded,
-                          Time is zeroed.
+                          In the case where the the creation time isn't
+recorded, Time is zeroed.
 **/
 VOID
 Ext4FileCreateTime (
@@ -825,8 +850,9 @@ Ext4FileCreateTime (
   );
 
 /**
-   Initialises Unicode collation, which is needed for case-insensitive string comparisons
-   within the driver (a good example of an application of this is filename comparison).
+   Initialises Unicode collation, which is needed for case-insensitive string
+comparisons within the driver (a good example of an application of this is
+filename comparison).
 
    @param[in]      DriverHandle    Handle to the driver image.
 
@@ -839,8 +865,8 @@ Ext4InitialiseUnicodeCollation (
   );
 
 /**
-   Does a case-insensitive string comparison. Refer to EFI_UNICODE_COLLATION_PROTOCOL's StriColl
-   for more details.
+   Does a case-insensitive string comparison. Refer to
+EFI_UNICODE_COLLATION_PROTOCOL's StriColl for more details.
 
    @param[in]      Str1   Pointer to a null terminated string.
    @param[in]      Str2   Pointer to a null terminated string.
@@ -859,7 +885,8 @@ Ext4StrCmpInsensitive (
    Retrieves the filename of the directory entry and converts it to UTF-16/UCS-2
 
    @param[in]      Entry   Pointer to a EXT4_DIR_ENTRY.
-   @param[out]      Ucs2FileName   Pointer to an array of CHAR16's, of size EXT4_NAME_MAX + 1.
+   @param[out]      Ucs2FileName   Pointer to an array of CHAR16's, of size
+EXT4_NAME_MAX + 1.
 
    @retval EFI_SUCCESS   Unicode collation was successfully initialised.
    @retval !EFI_SUCCESS  Failure.
@@ -871,7 +898,8 @@ Ext4GetUcs2DirentName (
   );
 
 /**
-   Retrieves information about the file and stores it in the EFI_FILE_INFO format.
+   Retrieves information about the file and stores it in the EFI_FILE_INFO
+format.
 
    @param[in]      File           Pointer to an opened file.
    @param[out]     Info           Pointer to a EFI_FILE_INFO.
@@ -881,9 +909,9 @@ Ext4GetUcs2DirentName (
 **/
 EFI_STATUS
 Ext4GetFileInfo (
-  IN     EXT4_FILE      *File,
-  OUT    EFI_FILE_INFO  *Info,
-  IN OUT UINTN          *BufferSize
+  IN EXT4_FILE       *File,
+  OUT EFI_FILE_INFO  *Info,
+  IN OUT UINTN       *BufferSize
   );
 
 /**
@@ -893,8 +921,8 @@ Ext4GetFileInfo (
    @param[in]      File        Pointer to the open directory.
    @param[out]     Buffer      Pointer to the output buffer.
    @param[in]      Offset      Initial directory position.
-   @param[in out] OutLength    Pointer to a UINTN that contains the length of the buffer,
-                               and the length of the actual EFI_FILE_INFO after the call.
+   @param[in out] OutLength    Pointer to a UINTN that contains the length of
+the buffer, and the length of the actual EFI_FILE_INFO after the call.
 
    @return Result of the operation.
 **/
@@ -1025,7 +1053,7 @@ Ext4CalculateBlockGroupDescChecksum (
 
    @return TRUE if all features are supported, else FALSE.
 **/
-#define EXT4_HAS_RO_COMPAT(Partition, RoCompatFeatureSet) \
+#define EXT4_HAS_RO_COMPAT(Partition, RoCompatFeatureSet)                      \
   ((Partition->FeaturesRoCompat & RoCompatFeatureSet) == RoCompatFeatureSet)
 
 /**
@@ -1035,7 +1063,7 @@ Ext4CalculateBlockGroupDescChecksum (
 
    @return TRUE if all features are supported, else FALSE.
 **/
-#define EXT4_HAS_COMPAT(Partition, CompatFeatureSet) \
+#define EXT4_HAS_COMPAT(Partition, CompatFeatureSet)                           \
   ((Partition->FeaturesCompat & CompatFeatureSet) == CompatFeatureSet)
 
 /**
@@ -1045,10 +1073,11 @@ Ext4CalculateBlockGroupDescChecksum (
 
    @return TRUE if all features are supported, else FALSE.
 **/
-#define EXT4_HAS_INCOMPAT(Partition, IncompatFeatureSet) \
+#define EXT4_HAS_INCOMPAT(Partition, IncompatFeatureSet)                       \
   ((Partition->FeaturesIncompat & IncompatFeatureSet) == IncompatFeatureSet)
 
-// Note: Might be a good idea to provide generic Ext4Has$feature() through macros.
+// Note: Might be a good idea to provide generic Ext4Has$feature() through
+// macros.
 
 /**
    Checks if metadata_csum is enabled on the partition.
@@ -1056,8 +1085,8 @@ Ext4CalculateBlockGroupDescChecksum (
 
    @return TRUE if the metadata_csum is supported, else FALSE.
 **/
-#define EXT4_HAS_METADATA_CSUM(Partition) \
-  EXT4_HAS_RO_COMPAT (Partition, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)
+#define EXT4_HAS_METADATA_CSUM(Partition)                                      \
+  EXT4_HAS_RO_COMPAT(Partition, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)
 
 /**
    Checks if gdt_csum is enabled on the partition.
@@ -1065,8 +1094,8 @@ Ext4CalculateBlockGroupDescChecksum (
 
    @return TRUE if the gdt_csum is supported, else FALSE.
 **/
-#define EXT4_HAS_GDT_CSUM(Partition) \
-  EXT4_HAS_RO_COMPAT (Partition, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)
+#define EXT4_HAS_GDT_CSUM(Partition)                                           \
+  EXT4_HAS_RO_COMPAT(Partition, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)
 
 /**
    Retrieves the volume name.
@@ -1106,10 +1135,12 @@ Ext4SuperblockCheckMagic (
 
    @returns True if uninitialized, else false.
 **/
-#define EXT4_EXTENT_IS_UNINITIALIZED(Extent) ((Extent)->ee_len > EXT4_EXTENT_MAX_INITIALIZED)
+#define EXT4_EXTENT_IS_UNINITIALIZED(Extent)                                   \
+  ((Extent)->ee_len > EXT4_EXTENT_MAX_INITIALIZED)
 
 /**
-   Retrieves the extent's length, dealing with uninitialized extents in the process.
+   Retrieves the extent's length, dealing with uninitialized extents in the
+process.
 
    @param[in] Extent      Pointer to the EXT4_EXTENT
 
diff --git a/Features/Ext4Pkg/Ext4Dxe/Extents.c b/Features/Ext4Pkg/Ext4Dxe/Extents.c
index 1ae175f417c9..e920eed090fd 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Extents.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Extents.c
@@ -249,7 +249,7 @@ Ext4GetExtent (
   }
 
   // ext4 does not have support for logical block numbers bigger than UINT32_MAX
-  if (LogicalBlock > (UINT32)- 1) {
+  if (LogicalBlock > (UINT32)-1) {
     return EFI_NO_MAPPING;
   }
 
@@ -332,7 +332,7 @@ Ext4GetExtent (
     return EFI_NO_MAPPING;
   }
 
-  if (!(LogicalBlock >= Ext->ee_block && Ext->ee_block + Ext4GetExtentLength (Ext) > LogicalBlock)) {
+  if (!((LogicalBlock >= Ext->ee_block) && (Ext->ee_block + Ext4GetExtentLength (Ext) > LogicalBlock))) {
     // This extent does not cover the block
     if (Buffer != NULL) {
       FreePool (Buffer);
@@ -378,7 +378,7 @@ Ext4ExtentsMapStructCompare (
   Extent1 = UserStruct1;
   Extent2 = UserStruct2;
 
-  return Extent1->ee_block < Extent2->ee_block ? - 1 :
+  return Extent1->ee_block < Extent2->ee_block ? -1 :
          Extent1->ee_block > Extent2->ee_block ? 1 : 0;
 }
 
@@ -413,11 +413,11 @@ Ext4ExtentsMapKeyCompare (
   Extent = UserStruct;
   Block  = (UINT32)(UINTN)StandaloneKey;
 
-  if (Block >= Extent->ee_block && Block < Extent->ee_block + Ext4GetExtentLength (Extent)) {
+  if ((Block >= Extent->ee_block) && (Block < Extent->ee_block + Ext4GetExtentLength (Extent))) {
     return 0;
   }
 
-  return Block < Extent->ee_block ? - 1 :
+  return Block < Extent->ee_block ? -1 :
          Block > Extent->ee_block ? 1 : 0;
 }
 
diff --git a/Features/Ext4Pkg/Ext4Dxe/File.c b/Features/Ext4Pkg/Ext4Dxe/File.c
index 4ad7cad8dcf5..ff1746d5640a 100644
--- a/Features/Ext4Pkg/Ext4Dxe/File.c
+++ b/Features/Ext4Pkg/Ext4Dxe/File.c
@@ -91,7 +91,8 @@ Ext4IsLastPathSegment (
 STATIC
 BOOLEAN
 Ext4ApplyPermissions (
-  IN OUT EXT4_FILE *File, IN UINT64 OpenMode
+  IN OUT EXT4_FILE  *File,
+  IN UINT64         OpenMode
   )
 {
   UINT16  NeededPerms;
@@ -228,7 +229,7 @@ Ext4Open (
 
     Status = Ext4OpenFile (Current, PathSegment, Partition, EFI_FILE_MODE_READ, &File);
 
-    if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) {
+    if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
       return Status;
     } else if (Status == EFI_NOT_FOUND) {
       // We explicitly ignore the EFI_FILE_MODE_CREATE flag, since we don't have write support
@@ -308,7 +309,7 @@ Ext4CloseInternal (
   IN EXT4_FILE  *File
   )
 {
-  if (File == File->Partition->Root && !File->Partition->Unmounting) {
+  if ((File == File->Partition->Root) && !File->Partition->Unmounting) {
     return EFI_SUCCESS;
   }
 
@@ -374,7 +375,7 @@ Ext4ReadFile (
   EXT4_PARTITION  *Partition;
   EFI_STATUS      Status;
 
-  File = (EXT4_FILE *)This;
+  File      = (EXT4_FILE *)This;
   Partition = File->Partition;
 
   ASSERT (Ext4FileIsOpenable (File));
@@ -491,12 +492,12 @@ Ext4SetPosition (
   File = (EXT4_FILE *)This;
 
   // Only seeks to 0 (so it resets the ReadDir operation) are allowed
-  if (Ext4FileIsDir (File) && Position != 0) {
+  if (Ext4FileIsDir (File) && (Position != 0)) {
     return EFI_UNSUPPORTED;
   }
 
   // -1 (0xffffff.......) seeks to the end of the file
-  if (Position == (UINT64)- 1) {
+  if (Position == (UINT64)-1) {
     Position = EXT4_INODE_SIZE (File->Inode);
   }
 
@@ -549,7 +550,7 @@ Ext4GetFileInfo (
   Ext4FileMTime (File, &Info->ModificationTime);
   Ext4FileCreateTime (File, &Info->LastAccessTime);
   Info->Attribute = 0;
-  Info->Size = NeededLength;
+  Info->Size      = NeededLength;
 
   if (Ext4FileIsDir (File)) {
     Info->Attribute |= EFI_FILE_DIRECTORY;
@@ -659,7 +660,7 @@ Ext4GetFilesystemInfo (
                  Part->SuperBlock.s_free_blocks_count_hi
                  );
 
-  Info->BlockSize = Part->BlockSize;
+  Info->BlockSize  = Part->BlockSize;
   Info->Size       = NeededLength;
   Info->ReadOnly   = Part->ReadOnly;
   Info->VolumeSize = MultU64x32 (TotalBlocks, Part->BlockSize);
@@ -790,7 +791,7 @@ Ext4DuplicateFile (
   EFI_STATUS      Status;
 
   Partition = Original->Partition;
-  File = AllocateZeroPool (sizeof (EXT4_FILE));
+  File      = AllocateZeroPool (sizeof (EXT4_FILE));
 
   if (File == NULL) {
     return NULL;
diff --git a/Features/Ext4Pkg/Ext4Dxe/Inode.c b/Features/Ext4Pkg/Ext4Dxe/Inode.c
index 48bfe026a3c2..f692909edf78 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Inode.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Inode.c
@@ -50,7 +50,7 @@ Ext4CalculateInodeChecksum (
 
   Crc = Ext4CalculateChecksum (Partition, &Dummy, sizeof (Dummy), Crc);
 
-  RestOfInode = &Inode->i_osd2.data_linux.l_i_reserved;
+  RestOfInode       = &Inode->i_osd2.data_linux.l_i_reserved;
   RestOfInodeLength = Partition->InodeSize - OFFSET_OF (EXT4_INODE, i_osd2.data_linux.l_i_reserved);
 
   if (HasSecondChecksumField) {
@@ -61,7 +61,7 @@ Ext4CalculateInodeChecksum (
 
     // 4 is the size of the i_extra_size field + the size of i_checksum_hi
     RestOfInodeLength = Partition->InodeSize - EXT4_GOOD_OLD_INODE_SIZE - 4;
-    RestOfInode = &Inode->i_ctime_extra;
+    RestOfInode       = &Inode->i_ctime_extra;
   }
 
   Crc = Ext4CalculateChecksum (Partition, RestOfInode, RestOfInodeLength, Crc);
@@ -138,14 +138,13 @@ Ext4Read (
                &Extent
                );
 
-    if (Status != EFI_SUCCESS && Status != EFI_NO_MAPPING) {
+    if ((Status != EFI_SUCCESS) && (Status != EFI_NO_MAPPING)) {
       return Status;
     }
 
     HasBackingExtent = Status != EFI_NO_MAPPING;
 
     if (!HasBackingExtent || EXT4_EXTENT_IS_UNINITIALIZED (&Extent)) {
-
       HoleOff = BlockOff;
 
       if (!HasBackingExtent) {
@@ -167,8 +166,8 @@ Ext4Read (
                            );
       ExtentLengthBytes  = Extent.ee_len * Partition->BlockSize;
       ExtentLogicalBytes = (UINT64)Extent.ee_block * Partition->BlockSize;
-      ExtentOffset  = CurrentSeek - ExtentLogicalBytes;
-      ExtentMayRead = (UINTN)(ExtentLengthBytes - ExtentOffset);
+      ExtentOffset       = CurrentSeek - ExtentLogicalBytes;
+      ExtentMayRead      = (UINTN)(ExtentLengthBytes - ExtentOffset);
 
       WasRead = ExtentMayRead > RemainingRead ? RemainingRead : ExtentMayRead;
 
@@ -187,9 +186,9 @@ Ext4Read (
     }
 
     RemainingRead -= WasRead;
-    Buffer       = (VOID *)((CHAR8 *)Buffer + WasRead);
-    BeenRead    += WasRead;
-    CurrentSeek += WasRead;
+    Buffer         = (VOID *)((CHAR8 *)Buffer + WasRead);
+    BeenRead      += WasRead;
+    CurrentSeek   += WasRead;
   }
 
   *Length = BeenRead;
@@ -214,7 +213,7 @@ Ext4AllocateInode (
   EXT4_INODE  *Inode;
 
   NeedsToZeroRest = FALSE;
-  InodeSize = Partition->InodeSize;
+  InodeSize       = Partition->InodeSize;
 
   // We allocate a structure of at least sizeof(EXT4_INODE), but in the future, when
   // write support is added and we need to flush inodes to disk, we could have a bit better
@@ -224,7 +223,7 @@ Ext4AllocateInode (
   // is 160 bytes).
 
   if (InodeSize < sizeof (EXT4_INODE)) {
-    InodeSize = sizeof (EXT4_INODE);
+    InodeSize       = sizeof (EXT4_INODE);
     NeedsToZeroRest = TRUE;
   }
 
@@ -409,7 +408,8 @@ EXT4_FILE_GET_TIME_GENERIC (MTime, i_mtime);
 **/
 STATIC
 EXT4_FILE_GET_TIME_GENERIC (
-  CrTime, i_crtime
+  CrTime,
+  i_crtime
   );
 
 /**
diff --git a/Features/Ext4Pkg/Ext4Dxe/Partition.c b/Features/Ext4Pkg/Ext4Dxe/Partition.c
index afa0392024ec..316807497dd4 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Partition.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Partition.c
@@ -50,12 +50,12 @@ Ext4OpenPartition (
 
   Part->Interface.Revision   = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION;
   Part->Interface.OpenVolume = Ext4OpenVolume;
-  Status = gBS->InstallMultipleProtocolInterfaces (
-                  &DeviceHandle,
-                  &gEfiSimpleFileSystemProtocolGuid,
-                  &Part->Interface,
-                  NULL
-                  );
+  Status                     = gBS->InstallMultipleProtocolInterfaces (
+                                      &DeviceHandle,
+                                      &gEfiSimpleFileSystemProtocolGuid,
+                                      &Part->Interface,
+                                      NULL
+                                      );
 
   if (EFI_ERROR (Status)) {
     FreePool (Part);
diff --git a/Features/Ext4Pkg/Ext4Dxe/Superblock.c b/Features/Ext4Pkg/Ext4Dxe/Superblock.c
index 9c3f7a9e7bfb..a7dbe9bf0fec 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Superblock.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Superblock.c
@@ -85,7 +85,7 @@ Ext4SuperblockValidate (
     return FALSE;
   }
 
-  if (Sb->s_rev_level != EXT4_DYNAMIC_REV && Sb->s_rev_level != EXT4_GOOD_OLD_REV) {
+  if ((Sb->s_rev_level != EXT4_DYNAMIC_REV) && (Sb->s_rev_level != EXT4_GOOD_OLD_REV)) {
     return FALSE;
   }
 
@@ -188,11 +188,11 @@ Ext4OpenSuperblock (
     Partition->FeaturesCompat   = Sb->s_feature_compat;
     Partition->FeaturesIncompat = Sb->s_feature_incompat;
     Partition->FeaturesRoCompat = Sb->s_feature_ro_compat;
-    Partition->InodeSize = Sb->s_inode_size;
+    Partition->InodeSize        = Sb->s_inode_size;
   } else {
     // GOOD_OLD_REV
     Partition->FeaturesCompat = Partition->FeaturesIncompat = Partition->FeaturesRoCompat = 0;
-    Partition->InodeSize = EXT4_GOOD_OLD_INODE_SIZE;
+    Partition->InodeSize      = EXT4_GOOD_OLD_INODE_SIZE;
   }
 
   // Now, check for the feature set of the filesystem
@@ -220,7 +220,8 @@ Ext4OpenSuperblock (
 
   // At the time of writing, it's the only supported checksum.
   if (Partition->FeaturesCompat & EXT4_FEATURE_RO_COMPAT_METADATA_CSUM &&
-      Sb->s_checksum_type != EXT4_CHECKSUM_CRC32C) {
+      (Sb->s_checksum_type != EXT4_CHECKSUM_CRC32C))
+  {
     return EFI_UNSUPPORTED;
   }
 
@@ -250,7 +251,7 @@ Ext4OpenSuperblock (
     return EFI_UNSUPPORTED;
   }
 
-  Partition->NumberBlocks = EXT4_BLOCK_NR_FROM_HALFS (Partition, Sb->s_blocks_count, Sb->s_blocks_count_hi);
+  Partition->NumberBlocks      = EXT4_BLOCK_NR_FROM_HALFS (Partition, Sb->s_blocks_count, Sb->s_blocks_count_hi);
   Partition->NumberBlockGroups = DivU64x32 (Partition->NumberBlocks, Sb->s_blocks_per_group);
 
   DEBUG ((
@@ -266,7 +267,7 @@ Ext4OpenSuperblock (
     Partition->DescSize = EXT4_OLD_BLOCK_DESC_SIZE;
   }
 
-  if (Partition->DescSize < EXT4_64BIT_BLOCK_DESC_SIZE && EXT4_IS_64_BIT (Partition)) {
+  if ((Partition->DescSize < EXT4_64BIT_BLOCK_DESC_SIZE) && EXT4_IS_64_BIT (Partition)) {
     // 64 bit filesystems need DescSize to be 64 bytes
     return EFI_VOLUME_CORRUPTED;
   }
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH edk2-platforms 3/3] Ext4Pkg: Add ext2/3 support
  2022-04-07 22:01 [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib Pedro Falcato
  2022-04-07 22:01 ` [PATCH edk2-platforms 1/3] Ext4Pkg: Replace the CRC implementations with BaseLib Pedro Falcato
  2022-04-07 22:01 ` [PATCH edk2-platforms 2/3] Ext4Pkg: Format using uncrustify Pedro Falcato
@ 2022-04-07 22:01 ` Pedro Falcato
  2022-04-25 17:14 ` [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib Pedro Falcato
       [not found] ` <16E9330A7A87074F.18109@groups.io>
  4 siblings, 0 replies; 11+ messages in thread
From: Pedro Falcato @ 2022-04-07 22:01 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Michael D Kinney

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3745

Adds ext2/3 support by supporting (legacy) block maps.
Also fixes a bug regarding uninitialised extents.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
---
 Features/Ext4Pkg/Ext4Dxe/BlockMap.c   | 279 ++++++++++++++++++++++++++
 Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   |   2 +
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    |  18 ++
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  |   1 +
 Features/Ext4Pkg/Ext4Dxe/Extents.c    |  17 +-
 Features/Ext4Pkg/Ext4Dxe/Inode.c      |   9 +-
 Features/Ext4Pkg/Ext4Dxe/Superblock.c |   7 +-
 7 files changed, 318 insertions(+), 15 deletions(-)
 create mode 100644 Features/Ext4Pkg/Ext4Dxe/BlockMap.c

diff --git a/Features/Ext4Pkg/Ext4Dxe/BlockMap.c b/Features/Ext4Pkg/Ext4Dxe/BlockMap.c
new file mode 100644
index 000000000000..6e8ccaa82437
--- /dev/null
+++ b/Features/Ext4Pkg/Ext4Dxe/BlockMap.c
@@ -0,0 +1,279 @@
+/** @file
+  Implementation of routines that deal with ext2/3 block maps.
+
+  Copyright (c) 2022 Pedro Falcato All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Ext4Dxe.h>
+
+// Note: The largest path we can take uses up 4 indices
+#define EXT4_MAX_BLOCK_PATH  4
+
+typedef enum ext4_logical_block_type {
+  EXT4_TYPE_DIRECT_BLOCK = 0,
+  EXT4_TYPE_SINGLY_BLOCK,
+  EXT4_TYPE_DOUBLY_BLOCK,
+  EXT4_TYPE_TREBLY_BLOCK,
+  EXT4_TYPE_BAD_BLOCK
+} EXT4_LOGICAL_BLOCK_TYPE;
+
+/**
+   @brief Detect the type of path the logical block will follow
+
+   @param[in] LogicalBlock The logical block
+   @param[in] Partition    Pointer to an EXT4_PARTITION
+   @return The type of path the logical block will need to follow
+ */
+STATIC
+EXT4_LOGICAL_BLOCK_TYPE
+Ext4DetectBlockType (
+  IN UINT32                LogicalBlock,
+  IN CONST EXT4_PARTITION  *Partition
+  )
+{
+  UINT32  Entries;
+  UINT32  MinSinglyBlock;
+  UINT32  MinDoublyBlock;
+  UINT32  MinTreblyBlock;
+  UINT32  MinQuadBlock;
+
+  Entries        = (Partition->BlockSize / sizeof (UINT32));
+  MinSinglyBlock = EXT4_DBLOCKS;
+  MinDoublyBlock = Entries + MinSinglyBlock;
+  MinTreblyBlock = Entries * Entries + MinDoublyBlock;
+  MinQuadBlock   = Entries * Entries * Entries + MinTreblyBlock; // Doesn't actually exist
+
+  if (LogicalBlock < MinSinglyBlock) {
+    return EXT4_TYPE_DIRECT_BLOCK;
+  } else if ((LogicalBlock >= MinSinglyBlock) && (LogicalBlock < MinDoublyBlock)) {
+    return EXT4_TYPE_SINGLY_BLOCK;
+  } else if ((LogicalBlock >= MinDoublyBlock) && (LogicalBlock < MinTreblyBlock)) {
+    return EXT4_TYPE_DOUBLY_BLOCK;
+  } else if (((LogicalBlock >= MinTreblyBlock) && (LogicalBlock < MinQuadBlock))) {
+    return EXT4_TYPE_TREBLY_BLOCK;
+  } else {
+    return EXT4_TYPE_BAD_BLOCK;
+  }
+}
+
+/**
+   @brief Get a block's path in indices
+
+   @param[in]  Partition       Pointer to an EXT4_PARTITION
+   @param[in]  LogicalBlock    Logical block
+   @param[out] BlockPath       Pointer to an array of EXT4_MAX_BLOCK_PATH elements, where the
+                               indices we'll need to read are inserted.
+   @return The number of path elements that are required (and were inserted in BlockPath)
+ */
+UINTN
+Ext4GetBlockPath (
+  IN  CONST EXT4_PARTITION  *Partition,
+  IN  UINT32                LogicalBlock,
+  OUT EXT4_BLOCK_NR         BlockPath[EXT4_MAX_BLOCK_PATH]
+  )
+{
+  // The logic behind the block map is very much like a page table
+  // Let's think of blocks with 512 entries (exactly like a page table on x64).
+  // On doubly indirect block paths, we subtract the min doubly blocks from the logical block.
+  // The top 9 bits of the result are the index inside the dind block, the bottom 9 bits are the
+  // index inside the ind block. Since Entries is always a power of 2, entries - 1 will give us
+  // a mask of the BlockMapBits.
+  // Note that all this math could be done with ands and shifts (similar implementations exist
+  // in a bunch of other places), but I'm doing it a simplified way with divs and modulus,
+  // since it's not going to be a bottleneck anyway.
+
+  UINT32  Entries;
+  UINT32  EntriesEntries;
+  UINT32  MinSinglyBlock;
+  UINT32  MinDoublyBlock;
+  UINT32  MinTreblyBlock;
+
+  EXT4_LOGICAL_BLOCK_TYPE  Type;
+
+  Entries        = (Partition->BlockSize / sizeof (UINT32));
+  EntriesEntries = Entries * Entries;
+
+  MinSinglyBlock = EXT4_DBLOCKS;
+  MinDoublyBlock = Entries + MinSinglyBlock;
+  MinTreblyBlock = EntriesEntries + MinDoublyBlock;
+
+  Type = Ext4DetectBlockType (LogicalBlock, Partition);
+
+  switch (Type) {
+    case EXT4_TYPE_DIRECT_BLOCK:
+      BlockPath[0] = LogicalBlock;
+      break;
+    case EXT4_TYPE_SINGLY_BLOCK:
+      BlockPath[0] = EXT4_IND_BLOCK;
+      BlockPath[1] = LogicalBlock - EXT4_DBLOCKS;
+      break;
+    case EXT4_TYPE_DOUBLY_BLOCK:
+      BlockPath[0]  = EXT4_DIND_BLOCK;
+      LogicalBlock -= MinDoublyBlock;
+      BlockPath[1]  = LogicalBlock / Entries;
+      BlockPath[2]  = LogicalBlock % Entries;
+      break;
+    case EXT4_TYPE_TREBLY_BLOCK:
+      BlockPath[0]  = EXT4_DIND_BLOCK;
+      LogicalBlock -= MinTreblyBlock;
+      BlockPath[1]  = LogicalBlock / EntriesEntries;
+      BlockPath[2]  = (LogicalBlock % EntriesEntries) / Entries;
+      BlockPath[3]  = (LogicalBlock % EntriesEntries) % Entries;
+      break;
+    default:
+      // EXT4_TYPE_BAD_BLOCK
+      return -1;
+  }
+
+  return Type + 1;
+}
+
+/**
+   @brief Get an extent from a block map
+   Note: Also parses file holes and creates uninitialised extents from them.
+
+   @param[in]  Buffer          Buffer of block pointers
+   @param[in]  IndEntries      Number of entries in this block pointer table
+   @param[in]  StartIndex      The start index from which we want to find a contiguous extent
+   @param[out] Extent          Pointer to the resulting EXT4_EXTENT
+ */
+VOID
+Ext4GetExtentInBlockMap (
+  IN CONST UINT32  *Buffer,
+  IN CONST UINT32  IndEntries,
+  IN UINT32        StartIndex,
+  OUT EXT4_EXTENT  *Extent
+  )
+{
+  UINT32  Index;
+  UINT32  FirstBlock;
+  UINT32  LastBlock;
+  UINT16  Count;
+
+  Count      = 1;
+  LastBlock  = Buffer[StartIndex];
+  FirstBlock = LastBlock;
+
+  if (FirstBlock == EXT4_BLOCK_FILE_HOLE) {
+    // File hole, let's see how many blocks this hole spans
+    Extent->ee_start_hi = 0;
+    Extent->ee_start_lo = 0;
+
+    for (Index = StartIndex + 1; Index < IndEntries; Index++) {
+      if (Count == EXT4_EXTENT_MAX_INITIALIZED - 1) {
+        // We've reached the max size of an uninit extent, break
+        break;
+      }
+
+      if (Buffer[Index] == EXT4_BLOCK_FILE_HOLE) {
+        Count++;
+      } else {
+        break;
+      }
+    }
+
+    // We mark the extent as uninitialised, although there's a difference between uninit
+    // extents and file holes.
+    Extent->ee_len = EXT4_EXTENT_MAX_INITIALIZED + Count;
+    return;
+  }
+
+  for (Index = StartIndex + 1; Index < IndEntries; Index++) {
+    if (Count == EXT4_EXTENT_MAX_INITIALIZED) {
+      // We've reached the max size of an extent, break
+      break;
+    }
+
+    if ((Buffer[Index] == LastBlock + 1) && (Buffer[Index] != EXT4_BLOCK_FILE_HOLE)) {
+      Count++;
+    } else {
+      break;
+    }
+
+    LastBlock = Buffer[Index];
+  }
+
+  Extent->ee_start_lo = FirstBlock;
+  Extent->ee_start_hi = 0;
+  Extent->ee_len      = Count;
+}
+
+/**
+   Retrieves an extent from an EXT2/3 inode (with a blockmap).
+   @param[in]      Partition     Pointer to the opened EXT4 partition.
+   @param[in]      File          Pointer to the opened file.
+   @param[in]      LogicalBlock  Block number which the returned extent must cover.
+   @param[out]     Extent        Pointer to the output buffer, where the extent will be copied to.
+
+   @retval EFI_SUCCESS        Retrieval was succesful.
+   @retval EFI_NO_MAPPING     Block has no mapping.
+**/
+EFI_STATUS
+Ext4GetBlocks (
+  IN  EXT4_PARTITION  *Partition,
+  IN  EXT4_FILE       *File,
+  IN  EXT4_BLOCK_NR   LogicalBlock,
+  OUT EXT4_EXTENT     *Extent
+  )
+{
+  EXT4_INODE     *Inode;
+  EXT4_BLOCK_NR  BlockPath[EXT4_MAX_BLOCK_PATH];
+  UINTN          BlockPathLength;
+  UINTN          Index;
+  UINT32         *Buffer;
+  EFI_STATUS     Status;
+  UINT32         Block;
+  UINT32         BlockIndex;
+
+  Inode = File->Inode;
+
+  BlockPathLength = Ext4GetBlockPath (Partition, LogicalBlock, BlockPath);
+
+  if (BlockPathLength == (UINTN)-1) {
+    // Bad logical block (out of range)
+    return EFI_NO_MAPPING;
+  }
+
+  Extent->ee_block = LogicalBlock;
+
+  if (BlockPathLength == 1) {
+    // Fast path for blocks 0 - 12 that skips allocations
+    Ext4GetExtentInBlockMap (Inode->i_data, EXT4_DBLOCKS, BlockPath[0], Extent);
+
+    return EFI_SUCCESS;
+  }
+
+  Buffer = AllocatePool (Partition->BlockSize);
+  if (Buffer == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+
+  // Note the BlockPathLength - 1 so we don't end up reading the final block
+  for (Index = 0; Index < BlockPathLength - 1; Index++) {
+    BlockIndex = BlockPath[Index];
+
+    if (Index == 0) {
+      Block = Inode->i_data[BlockIndex];
+    } else {
+      Block = Buffer[BlockIndex];
+    }
+
+    if (Block == EXT4_BLOCK_FILE_HOLE) {
+      FreePool (Buffer);
+      return EFI_NO_MAPPING;
+    }
+
+    Status = Ext4ReadBlocks (Partition, Buffer, 1, Block);
+
+    if (EFI_ERROR (Status)) {
+      FreePool (Buffer);
+      return Status;
+    }
+  }
+
+  Ext4GetExtentInBlockMap (Buffer, Partition->BlockSize / sizeof (UINT32), BlockPath[BlockPathLength - 1], Extent);
+  FreePool (Buffer);
+
+  return EFI_SUCCESS;
+}
diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h b/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h
index 5f812215fbb8..a55cd2fa68ad 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h
+++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h
@@ -468,4 +468,6 @@ typedef UINT32  EXT4_INO_NR;
 // 2 is always the root inode number in ext4
 #define EXT4_ROOT_INODE_NR  2
 
+#define EXT4_BLOCK_FILE_HOLE  0
+
 #endif
diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h
index 03e0586cbb05..b1508482b0a7 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h
+++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h
@@ -1151,4 +1151,22 @@ Ext4GetExtentLength (
   IN CONST EXT4_EXTENT  *Extent
   );
 
+/**
+   Retrieves an extent from an EXT2/3 inode (with a blockmap).
+   @param[in]      Partition     Pointer to the opened EXT4 partition.
+   @param[in]      File          Pointer to the opened file.
+   @param[in]      LogicalBlock  Block number which the returned extent must cover.
+   @param[out]     Extent        Pointer to the output buffer, where the extent will be copied to.
+
+   @retval EFI_SUCCESS        Retrieval was succesful.
+   @retval EFI_NO_MAPPING     Block has no mapping.
+**/
+EFI_STATUS
+Ext4GetBlocks (
+  IN  EXT4_PARTITION  *Partition,
+  IN  EXT4_FILE       *File,
+  IN  EXT4_BLOCK_NR   LogicalBlock,
+  OUT EXT4_EXTENT     *Extent
+  );
+
 #endif
diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf
index 12e89bf1fdfc..deaf89fb3743 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf
+++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf
@@ -111,6 +111,7 @@
   Collation.c
   Ext4Disk.h
   Ext4Dxe.h
+  BlockMap.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/Features/Ext4Pkg/Ext4Dxe/Extents.c b/Features/Ext4Pkg/Ext4Dxe/Extents.c
index e920eed090fd..c3874df71751 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Extents.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Extents.c
@@ -1,7 +1,7 @@
 /** @file
   Extent related routines
 
-  Copyright (c) 2021 Pedro Falcato All rights reserved.
+  Copyright (c) 2021 - 2022 Pedro Falcato All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -244,10 +244,6 @@ Ext4GetExtent (
 
   DEBUG ((DEBUG_FS, "[ext4] Looking up extent for block %lu\n", LogicalBlock));
 
-  if (!(Inode->i_flags & EXT4_EXTENTS_FL)) {
-    return EFI_UNSUPPORTED;
-  }
-
   // ext4 does not have support for logical block numbers bigger than UINT32_MAX
   if (LogicalBlock > (UINT32)-1) {
     return EFI_NO_MAPPING;
@@ -261,6 +257,17 @@ Ext4GetExtent (
     return EFI_SUCCESS;
   }
 
+  if (!(Inode->i_flags & EXT4_EXTENTS_FL)) {
+    // If this is an older ext2/ext3 filesystem, emulate Ext4GetExtent using the block map
+    Status = Ext4GetBlocks (Partition, File, LogicalBlock, Extent);
+
+    if (!EFI_ERROR (Status)) {
+      Ext4CacheExtents (File, Extent, 1);
+    }
+
+    return Status;
+  }
+
   // Slow path, we'll need to read from disk and (try to) cache those extents.
 
   ExtHeader = Ext4GetInoExtentHeader (Inode);
diff --git a/Features/Ext4Pkg/Ext4Dxe/Inode.c b/Features/Ext4Pkg/Ext4Dxe/Inode.c
index f692909edf78..831f5946e870 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Inode.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Inode.c
@@ -1,7 +1,7 @@
 /** @file
   Inode related routines
 
-  Copyright (c) 2021 Pedro Falcato All rights reserved.
+  Copyright (c) 2021 - 2022 Pedro Falcato All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   EpochToEfiTime copied from EmbeddedPkg/Library/TimeBaseLib.c
@@ -150,8 +150,9 @@ Ext4Read (
       if (!HasBackingExtent) {
         HoleLen = Partition->BlockSize - HoleOff;
       } else {
-        // Uninitialized extents behave exactly the same as file holes.
-        HoleLen = Ext4GetExtentLength (&Extent) - HoleOff;
+        // Uninitialized extents behave exactly the same as file holes, except they have
+        // blocks already allocated to them.
+        HoleLen = (Ext4GetExtentLength (&Extent) * Partition->BlockSize) - HoleOff;
       }
 
       WasRead = HoleLen > RemainingRead ? RemainingRead : HoleLen;
@@ -176,7 +177,7 @@ Ext4Read (
       if (EFI_ERROR (Status)) {
         DEBUG ((
           DEBUG_ERROR,
-          "[ext4] Error %x reading [%lu, %lu]\n",
+          "[ext4] Error %r reading [%lu, %lu]\n",
           Status,
           ExtentStartBytes + ExtentOffset,
           ExtentStartBytes + ExtentOffset + WasRead - 1
diff --git a/Features/Ext4Pkg/Ext4Dxe/Superblock.c b/Features/Ext4Pkg/Ext4Dxe/Superblock.c
index a7dbe9bf0fec..47fc3a65507a 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Superblock.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Superblock.c
@@ -1,7 +1,7 @@
 /** @file
   Superblock managing routines
 
-  Copyright (c) 2021 Pedro Falcato All rights reserved.
+  Copyright (c) 2021 - 2022 Pedro Falcato All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -208,11 +208,6 @@ Ext4OpenSuperblock (
     return EFI_UNSUPPORTED;
   }
 
-  // This should be removed once we add ext2/3 support in the future.
-  if ((Partition->FeaturesIncompat & EXT4_FEATURE_INCOMPAT_EXTENTS) == 0) {
-    return EFI_UNSUPPORTED;
-  }
-
   if (EXT4_HAS_INCOMPAT (Partition, EXT4_FEATURE_INCOMPAT_RECOVER)) {
     DEBUG ((DEBUG_WARN, "[ext4] Needs journal recovery, mounting read-only\n"));
     Partition->ReadOnly = TRUE;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib
  2022-04-07 22:01 [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib Pedro Falcato
                   ` (2 preceding siblings ...)
  2022-04-07 22:01 ` [PATCH edk2-platforms 3/3] Ext4Pkg: Add ext2/3 support Pedro Falcato
@ 2022-04-25 17:14 ` Pedro Falcato
       [not found] ` <16E9330A7A87074F.18109@groups.io>
  4 siblings, 0 replies; 11+ messages in thread
From: Pedro Falcato @ 2022-04-25 17:14 UTC (permalink / raw)
  To: edk2-devel-groups-io
  Cc: Leif Lindholm, Michael D Kinney, Liming Gao, Zhiguang Liu

[-- Attachment #1: Type: text/plain, Size: 2496 bytes --]

Ping. If someone could take a look, it would be much appreciated.

On Thu, Apr 7, 2022 at 11:01 PM Pedro Falcato <pedro.falcato@gmail.com>
wrote:

> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3745
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871
>
> Hi all,
>
> This patch-set attempts to address two open feature requests for Ext4Pkg
> by adding ext2/3 support (id 3745) and moving crc16-ansi/crc32c to BaseLib
> (id 3871).
>
> The previous patch-set regarding 3871 attempted to merge the different
> crc16 implementations
> but failed because, contrary to what I thought, there are many, many
> different CRC16s which
> are all slightly different. This one (plus the separate edk2 patch)
> attempts to just merge
> CRC16-ANSI (confusingly, also known as CRC16) into BaseLib.
>
> Since this patch set grew to be considerably different from the original,
> I didn't mark it
> as v2 but rather a separate, new patch-set.
>
> CC'ing the edk2-platforms stewards (as I cannot review my own code) and
> the CC's of the MdePkg
> patch.
>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>
> Pedro Falcato (3):
>   Ext4Pkg: Replace the CRC implementations with BaseLib
>   Ext4Pkg: Format using uncrustify
>   Ext4Pkg: Add ext2/3 support
>
>  Features/Ext4Pkg/Ext4Dxe/BlockGroup.c |  10 +-
>  Features/Ext4Pkg/Ext4Dxe/BlockMap.c   | 279 +++++++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Collation.c  |   4 +-
>  Features/Ext4Pkg/Ext4Dxe/Crc16.c      |  75 -----
>  Features/Ext4Pkg/Ext4Dxe/Crc32c.c     |  84 ------
>  Features/Ext4Pkg/Ext4Dxe/Directory.c  |  13 +-
>  Features/Ext4Pkg/Ext4Dxe/DiskUtil.c   |   6 +-
>  Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   |  30 +-
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c    |  95 +++---
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    | 417 ++++++++++++++------------
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  |   3 +-
>  Features/Ext4Pkg/Ext4Dxe/Extents.c    |  27 +-
>  Features/Ext4Pkg/Ext4Dxe/File.c       |  19 +-
>  Features/Ext4Pkg/Ext4Dxe/Inode.c      |  33 +-
>  Features/Ext4Pkg/Ext4Dxe/Partition.c  |  12 +-
>  Features/Ext4Pkg/Ext4Dxe/Superblock.c |  20 +-
>  16 files changed, 640 insertions(+), 487 deletions(-)
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/BlockMap.c
>  delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc16.c
>  delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc32c.c
>
> --
> 2.35.1
>
>

-- 
Pedro Falcato

[-- Attachment #2: Type: text/html, Size: 3566 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib
       [not found] ` <16E9330A7A87074F.18109@groups.io>
@ 2022-05-11 17:41   ` Pedro Falcato
       [not found]   ` <16EE1DD8FA9A45F3.9448@groups.io>
  1 sibling, 0 replies; 11+ messages in thread
From: Pedro Falcato @ 2022-05-11 17:41 UTC (permalink / raw)
  To: edk2-devel-groups-io, Pedro Falcato
  Cc: Leif Lindholm, Michael D Kinney, Liming Gao, Zhiguang Liu

[-- Attachment #1: Type: text/plain, Size: 2742 bytes --]

Ping. Could someone review these patches?

On Mon, Apr 25, 2022 at 6:14 PM Pedro Falcato via groups.io <pedro.falcato=
gmail.com@groups.io> wrote:

> Ping. If someone could take a look, it would be much appreciated.
>
> On Thu, Apr 7, 2022 at 11:01 PM Pedro Falcato <pedro.falcato@gmail.com>
> wrote:
>
>> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3745
>> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871
>>
>> Hi all,
>>
>> This patch-set attempts to address two open feature requests for Ext4Pkg
>> by adding ext2/3 support (id 3745) and moving crc16-ansi/crc32c to
>> BaseLib (id 3871).
>>
>> The previous patch-set regarding 3871 attempted to merge the different
>> crc16 implementations
>> but failed because, contrary to what I thought, there are many, many
>> different CRC16s which
>> are all slightly different. This one (plus the separate edk2 patch)
>> attempts to just merge
>> CRC16-ANSI (confusingly, also known as CRC16) into BaseLib.
>>
>> Since this patch set grew to be considerably different from the original,
>> I didn't mark it
>> as v2 but rather a separate, new patch-set.
>>
>> CC'ing the edk2-platforms stewards (as I cannot review my own code) and
>> the CC's of the MdePkg
>> patch.
>>
>> Cc: Leif Lindholm <leif@nuviainc.com>
>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>>
>> Pedro Falcato (3):
>>   Ext4Pkg: Replace the CRC implementations with BaseLib
>>   Ext4Pkg: Format using uncrustify
>>   Ext4Pkg: Add ext2/3 support
>>
>>  Features/Ext4Pkg/Ext4Dxe/BlockGroup.c |  10 +-
>>  Features/Ext4Pkg/Ext4Dxe/BlockMap.c   | 279 +++++++++++++++++
>>  Features/Ext4Pkg/Ext4Dxe/Collation.c  |   4 +-
>>  Features/Ext4Pkg/Ext4Dxe/Crc16.c      |  75 -----
>>  Features/Ext4Pkg/Ext4Dxe/Crc32c.c     |  84 ------
>>  Features/Ext4Pkg/Ext4Dxe/Directory.c  |  13 +-
>>  Features/Ext4Pkg/Ext4Dxe/DiskUtil.c   |   6 +-
>>  Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   |  30 +-
>>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c    |  95 +++---
>>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    | 417 ++++++++++++++------------
>>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  |   3 +-
>>  Features/Ext4Pkg/Ext4Dxe/Extents.c    |  27 +-
>>  Features/Ext4Pkg/Ext4Dxe/File.c       |  19 +-
>>  Features/Ext4Pkg/Ext4Dxe/Inode.c      |  33 +-
>>  Features/Ext4Pkg/Ext4Dxe/Partition.c  |  12 +-
>>  Features/Ext4Pkg/Ext4Dxe/Superblock.c |  20 +-
>>  16 files changed, 640 insertions(+), 487 deletions(-)
>>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/BlockMap.c
>>  delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc16.c
>>  delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc32c.c
>>
>> --
>> 2.35.1
>>
>>
>
> --
> Pedro Falcato
> 
>
>

-- 
Pedro Falcato

[-- Attachment #2: Type: text/html, Size: 4149 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib
       [not found]   ` <16EE1DD8FA9A45F3.9448@groups.io>
@ 2022-05-31 21:32     ` Pedro Falcato
  2022-06-02  3:04       ` 回复: " gaoliming
  0 siblings, 1 reply; 11+ messages in thread
From: Pedro Falcato @ 2022-05-31 21:32 UTC (permalink / raw)
  To: edk2-devel-groups-io, Pedro Falcato
  Cc: Leif Lindholm, Michael D Kinney, Liming Gao, Zhiguang Liu

[-- Attachment #1: Type: text/plain, Size: 3008 bytes --]

Ping. Please review now that the stable freeze is over.

On Wed, May 11, 2022 at 6:42 PM Pedro Falcato via groups.io <pedro.falcato=
gmail.com@groups.io> wrote:

> Ping. Could someone review these patches?
>
> On Mon, Apr 25, 2022 at 6:14 PM Pedro Falcato via groups.io
> <pedro.falcato=gmail.com@groups.io> wrote:
>
>> Ping. If someone could take a look, it would be much appreciated.
>>
>> On Thu, Apr 7, 2022 at 11:01 PM Pedro Falcato <pedro.falcato@gmail.com>
>> wrote:
>>
>>> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3745
>>> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871
>>>
>>> Hi all,
>>>
>>> This patch-set attempts to address two open feature requests for Ext4Pkg
>>> by adding ext2/3 support (id 3745) and moving crc16-ansi/crc32c to
>>> BaseLib (id 3871).
>>>
>>> The previous patch-set regarding 3871 attempted to merge the different
>>> crc16 implementations
>>> but failed because, contrary to what I thought, there are many, many
>>> different CRC16s which
>>> are all slightly different. This one (plus the separate edk2 patch)
>>> attempts to just merge
>>> CRC16-ANSI (confusingly, also known as CRC16) into BaseLib.
>>>
>>> Since this patch set grew to be considerably different from the
>>> original, I didn't mark it
>>> as v2 but rather a separate, new patch-set.
>>>
>>> CC'ing the edk2-platforms stewards (as I cannot review my own code) and
>>> the CC's of the MdePkg
>>> patch.
>>>
>>> Cc: Leif Lindholm <leif@nuviainc.com>
>>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>>> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>>>
>>> Pedro Falcato (3):
>>>   Ext4Pkg: Replace the CRC implementations with BaseLib
>>>   Ext4Pkg: Format using uncrustify
>>>   Ext4Pkg: Add ext2/3 support
>>>
>>>  Features/Ext4Pkg/Ext4Dxe/BlockGroup.c |  10 +-
>>>  Features/Ext4Pkg/Ext4Dxe/BlockMap.c   | 279 +++++++++++++++++
>>>  Features/Ext4Pkg/Ext4Dxe/Collation.c  |   4 +-
>>>  Features/Ext4Pkg/Ext4Dxe/Crc16.c      |  75 -----
>>>  Features/Ext4Pkg/Ext4Dxe/Crc32c.c     |  84 ------
>>>  Features/Ext4Pkg/Ext4Dxe/Directory.c  |  13 +-
>>>  Features/Ext4Pkg/Ext4Dxe/DiskUtil.c   |   6 +-
>>>  Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   |  30 +-
>>>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c    |  95 +++---
>>>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    | 417 ++++++++++++++------------
>>>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  |   3 +-
>>>  Features/Ext4Pkg/Ext4Dxe/Extents.c    |  27 +-
>>>  Features/Ext4Pkg/Ext4Dxe/File.c       |  19 +-
>>>  Features/Ext4Pkg/Ext4Dxe/Inode.c      |  33 +-
>>>  Features/Ext4Pkg/Ext4Dxe/Partition.c  |  12 +-
>>>  Features/Ext4Pkg/Ext4Dxe/Superblock.c |  20 +-
>>>  16 files changed, 640 insertions(+), 487 deletions(-)
>>>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/BlockMap.c
>>>  delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc16.c
>>>  delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc32c.c
>>>
>>> --
>>> 2.35.1
>>>
>>>
>>
>> --
>> Pedro Falcato
>>
>>
>
> --
> Pedro Falcato
> 
>
>

-- 
Pedro Falcato

[-- Attachment #2: Type: text/html, Size: 4762 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* 回复: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib
  2022-05-31 21:32     ` Pedro Falcato
@ 2022-06-02  3:04       ` gaoliming
  2022-06-13 14:45         ` Pedro Falcato
  0 siblings, 1 reply; 11+ messages in thread
From: gaoliming @ 2022-06-02  3:04 UTC (permalink / raw)
  To: 'Pedro Falcato', 'edk2-devel-groups-io'
  Cc: 'Leif Lindholm', 'Michael D Kinney',
	'Zhiguang Liu'

[-- Attachment #1: Type: text/plain, Size: 3752 bytes --]

Pedro:

 Thanks for your enhancement to support ext2/3 file system. Acked-by: Liming Gao <gaoliming@byosoft.com.cn> for this patch set. 

 

Thanks

Liming

发件人: Pedro Falcato <pedro.falcato@gmail.com> 
发送时间: 2022年6月1日 5:33
收件人: edk2-devel-groups-io <devel@edk2.groups.io>; Pedro Falcato <pedro.falcato@gmail.com>
抄送: Leif Lindholm <leif@nuviainc.com>; Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>
主题: Re: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib

 

Ping. Please review now that the stable freeze is over.

 

On Wed, May 11, 2022 at 6:42 PM Pedro Falcato via groups.io <http://groups.io>  <pedro.falcato=gmail.com@groups.io <mailto:gmail.com@groups.io> > wrote:

Ping. Could someone review these patches?

 

On Mon, Apr 25, 2022 at 6:14 PM Pedro Falcato via groups.io <http://groups.io>  <pedro.falcato=gmail.com@groups.io <mailto:gmail.com@groups.io> > wrote:

Ping. If someone could take a look, it would be much appreciated.

 

On Thu, Apr 7, 2022 at 11:01 PM Pedro Falcato <pedro.falcato@gmail.com <mailto:pedro.falcato@gmail.com> > wrote:

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3745
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871

Hi all,

This patch-set attempts to address two open feature requests for Ext4Pkg
by adding ext2/3 support (id 3745) and moving crc16-ansi/crc32c to BaseLib (id 3871).

The previous patch-set regarding 3871 attempted to merge the different crc16 implementations
but failed because, contrary to what I thought, there are many, many different CRC16s which
are all slightly different. This one (plus the separate edk2 patch) attempts to just merge
CRC16-ANSI (confusingly, also known as CRC16) into BaseLib.

Since this patch set grew to be considerably different from the original, I didn't mark it
as v2 but rather a separate, new patch-set.

CC'ing the edk2-platforms stewards (as I cannot review my own code) and the CC's of the MdePkg
patch.

Cc: Leif Lindholm <leif@nuviainc.com <mailto:leif@nuviainc.com> >
Cc: Michael D Kinney <michael.d.kinney@intel.com <mailto:michael.d.kinney@intel.com> >
Cc: Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> >
Cc: Zhiguang Liu <zhiguang.liu@intel.com <mailto:zhiguang.liu@intel.com> >

Pedro Falcato (3):
  Ext4Pkg: Replace the CRC implementations with BaseLib
  Ext4Pkg: Format using uncrustify
  Ext4Pkg: Add ext2/3 support

 Features/Ext4Pkg/Ext4Dxe/BlockGroup.c |  10 +-
 Features/Ext4Pkg/Ext4Dxe/BlockMap.c   | 279 +++++++++++++++++
 Features/Ext4Pkg/Ext4Dxe/Collation.c  |   4 +-
 Features/Ext4Pkg/Ext4Dxe/Crc16.c      |  75 -----
 Features/Ext4Pkg/Ext4Dxe/Crc32c.c     |  84 ------
 Features/Ext4Pkg/Ext4Dxe/Directory.c  |  13 +-
 Features/Ext4Pkg/Ext4Dxe/DiskUtil.c   |   6 +-
 Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   |  30 +-
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c    |  95 +++---
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    | 417 ++++++++++++++------------
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  |   3 +-
 Features/Ext4Pkg/Ext4Dxe/Extents.c    |  27 +-
 Features/Ext4Pkg/Ext4Dxe/File.c       |  19 +-
 Features/Ext4Pkg/Ext4Dxe/Inode.c      |  33 +-
 Features/Ext4Pkg/Ext4Dxe/Partition.c  |  12 +-
 Features/Ext4Pkg/Ext4Dxe/Superblock.c |  20 +-
 16 files changed, 640 insertions(+), 487 deletions(-)
 create mode 100644 Features/Ext4Pkg/Ext4Dxe/BlockMap.c
 delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc16.c
 delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc32c.c

-- 
2.35.1



-- 

Pedro Falcato



-- 

Pedro Falcato





-- 

Pedro Falcato


[-- Attachment #2: Type: text/html, Size: 9595 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib
  2022-06-02  3:04       ` 回复: " gaoliming
@ 2022-06-13 14:45         ` Pedro Falcato
  2022-06-14  1:11           ` 回复: " gaoliming
  0 siblings, 1 reply; 11+ messages in thread
From: Pedro Falcato @ 2022-06-13 14:45 UTC (permalink / raw)
  To: gaoliming
  Cc: edk2-devel-groups-io, Leif Lindholm, Michael D Kinney,
	Zhiguang Liu

[-- Attachment #1: Type: text/plain, Size: 4042 bytes --]

Liming,

Sorry for the question, but can I merge this with your Ack and my RB or do
I have to wait for another RB?
I want to solve this as soon as possible since right now Ext4Pkg won't
build with upstream edk2.

Thanks,
Pedro

On Thu, Jun 2, 2022 at 4:05 AM gaoliming <gaoliming@byosoft.com.cn> wrote:

> Pedro:
>
>  Thanks for your enhancement to support ext2/3 file system. Acked-by:
> Liming Gao <gaoliming@byosoft.com.cn> for this patch set.
>
>
>
> Thanks
>
> Liming
>
> *发件人:* Pedro Falcato <pedro.falcato@gmail.com>
> *发送时间:* 2022年6月1日 5:33
> *收件人:* edk2-devel-groups-io <devel@edk2.groups.io>; Pedro Falcato <
> pedro.falcato@gmail.com>
> *抄送:* Leif Lindholm <leif@nuviainc.com>; Michael D Kinney <
> michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
> Zhiguang Liu <zhiguang.liu@intel.com>
> *主题:* Re: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3
> support and move crc16/32c to BaseLib
>
>
>
> Ping. Please review now that the stable freeze is over.
>
>
>
> On Wed, May 11, 2022 at 6:42 PM Pedro Falcato via groups.io
> <pedro.falcato=gmail.com@groups.io> wrote:
>
> Ping. Could someone review these patches?
>
>
>
> On Mon, Apr 25, 2022 at 6:14 PM Pedro Falcato via groups.io
> <pedro.falcato=gmail.com@groups.io> wrote:
>
> Ping. If someone could take a look, it would be much appreciated.
>
>
>
> On Thu, Apr 7, 2022 at 11:01 PM Pedro Falcato <pedro.falcato@gmail.com>
> wrote:
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3745
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871
>
> Hi all,
>
> This patch-set attempts to address two open feature requests for Ext4Pkg
> by adding ext2/3 support (id 3745) and moving crc16-ansi/crc32c to BaseLib
> (id 3871).
>
> The previous patch-set regarding 3871 attempted to merge the different
> crc16 implementations
> but failed because, contrary to what I thought, there are many, many
> different CRC16s which
> are all slightly different. This one (plus the separate edk2 patch)
> attempts to just merge
> CRC16-ANSI (confusingly, also known as CRC16) into BaseLib.
>
> Since this patch set grew to be considerably different from the original,
> I didn't mark it
> as v2 but rather a separate, new patch-set.
>
> CC'ing the edk2-platforms stewards (as I cannot review my own code) and
> the CC's of the MdePkg
> patch.
>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>
> Pedro Falcato (3):
>   Ext4Pkg: Replace the CRC implementations with BaseLib
>   Ext4Pkg: Format using uncrustify
>   Ext4Pkg: Add ext2/3 support
>
>  Features/Ext4Pkg/Ext4Dxe/BlockGroup.c |  10 +-
>  Features/Ext4Pkg/Ext4Dxe/BlockMap.c   | 279 +++++++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Collation.c  |   4 +-
>  Features/Ext4Pkg/Ext4Dxe/Crc16.c      |  75 -----
>  Features/Ext4Pkg/Ext4Dxe/Crc32c.c     |  84 ------
>  Features/Ext4Pkg/Ext4Dxe/Directory.c  |  13 +-
>  Features/Ext4Pkg/Ext4Dxe/DiskUtil.c   |   6 +-
>  Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   |  30 +-
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c    |  95 +++---
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    | 417 ++++++++++++++------------
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  |   3 +-
>  Features/Ext4Pkg/Ext4Dxe/Extents.c    |  27 +-
>  Features/Ext4Pkg/Ext4Dxe/File.c       |  19 +-
>  Features/Ext4Pkg/Ext4Dxe/Inode.c      |  33 +-
>  Features/Ext4Pkg/Ext4Dxe/Partition.c  |  12 +-
>  Features/Ext4Pkg/Ext4Dxe/Superblock.c |  20 +-
>  16 files changed, 640 insertions(+), 487 deletions(-)
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/BlockMap.c
>  delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc16.c
>  delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc32c.c
>
> --
> 2.35.1
>
>
>
> --
>
> Pedro Falcato
>
>
>
> --
>
> Pedro Falcato
>
> 
>
>
>
> --
>
> Pedro Falcato
>


-- 
Pedro Falcato

[-- Attachment #2: Type: text/html, Size: 9518 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* 回复: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib
  2022-06-13 14:45         ` Pedro Falcato
@ 2022-06-14  1:11           ` gaoliming
  2022-06-14 15:58             ` Pedro Falcato
  0 siblings, 1 reply; 11+ messages in thread
From: gaoliming @ 2022-06-14  1:11 UTC (permalink / raw)
  To: 'Pedro Falcato'
  Cc: 'edk2-devel-groups-io', 'Leif Lindholm',
	'Michael D Kinney', 'Zhiguang Liu'

[-- Attachment #1: Type: text/plain, Size: 4929 bytes --]

Pedro:

 Yes. You can merge this patch with my ACK.

 

Thanks

Liming

发件人: Pedro Falcato <pedro.falcato@gmail.com> 
发送时间: 2022年6月13日 22:45
收件人: gaoliming <gaoliming@byosoft.com.cn>
抄送: edk2-devel-groups-io <devel@edk2.groups.io>; Leif Lindholm <leif@nuviainc.com>; Michael D Kinney <michael.d.kinney@intel.com>; Zhiguang Liu <zhiguang.liu@intel.com>
主题: Re: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib

 

Liming,

 

Sorry for the question, but can I merge this with your Ack and my RB or do I have to wait for another RB?

I want to solve this as soon as possible since right now Ext4Pkg won't build with upstream edk2.

 

Thanks,

Pedro

 

On Thu, Jun 2, 2022 at 4:05 AM gaoliming <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> > wrote:

Pedro:

 Thanks for your enhancement to support ext2/3 file system. Acked-by: Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> > for this patch set. 

 

Thanks

Liming

发件人: Pedro Falcato <pedro.falcato@gmail.com <mailto:pedro.falcato@gmail.com> > 
发送时间: 2022年6月1日 5:33
收件人: edk2-devel-groups-io <devel@edk2.groups.io <mailto:devel@edk2.groups.io> >; Pedro Falcato <pedro.falcato@gmail.com <mailto:pedro.falcato@gmail.com> >
抄送: Leif Lindholm <leif@nuviainc.com <mailto:leif@nuviainc.com> >; Michael D Kinney <michael.d.kinney@intel.com <mailto:michael.d.kinney@intel.com> >; Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> >; Zhiguang Liu <zhiguang.liu@intel.com <mailto:zhiguang.liu@intel.com> >
主题: Re: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib

 

Ping. Please review now that the stable freeze is over.

 

On Wed, May 11, 2022 at 6:42 PM Pedro Falcato via groups.io <http://groups.io>  <pedro.falcato=gmail.com@groups.io <mailto:gmail.com@groups.io> > wrote:

Ping. Could someone review these patches?

 

On Mon, Apr 25, 2022 at 6:14 PM Pedro Falcato via groups.io <http://groups.io>  <pedro.falcato=gmail.com@groups.io <mailto:gmail.com@groups.io> > wrote:

Ping. If someone could take a look, it would be much appreciated.

 

On Thu, Apr 7, 2022 at 11:01 PM Pedro Falcato <pedro.falcato@gmail.com <mailto:pedro.falcato@gmail.com> > wrote:

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3745
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871

Hi all,

This patch-set attempts to address two open feature requests for Ext4Pkg
by adding ext2/3 support (id 3745) and moving crc16-ansi/crc32c to BaseLib (id 3871).

The previous patch-set regarding 3871 attempted to merge the different crc16 implementations
but failed because, contrary to what I thought, there are many, many different CRC16s which
are all slightly different. This one (plus the separate edk2 patch) attempts to just merge
CRC16-ANSI (confusingly, also known as CRC16) into BaseLib.

Since this patch set grew to be considerably different from the original, I didn't mark it
as v2 but rather a separate, new patch-set.

CC'ing the edk2-platforms stewards (as I cannot review my own code) and the CC's of the MdePkg
patch.

Cc: Leif Lindholm <leif@nuviainc.com <mailto:leif@nuviainc.com> >
Cc: Michael D Kinney <michael.d.kinney@intel.com <mailto:michael.d.kinney@intel.com> >
Cc: Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> >
Cc: Zhiguang Liu <zhiguang.liu@intel.com <mailto:zhiguang.liu@intel.com> >

Pedro Falcato (3):
  Ext4Pkg: Replace the CRC implementations with BaseLib
  Ext4Pkg: Format using uncrustify
  Ext4Pkg: Add ext2/3 support

 Features/Ext4Pkg/Ext4Dxe/BlockGroup.c |  10 +-
 Features/Ext4Pkg/Ext4Dxe/BlockMap.c   | 279 +++++++++++++++++
 Features/Ext4Pkg/Ext4Dxe/Collation.c  |   4 +-
 Features/Ext4Pkg/Ext4Dxe/Crc16.c      |  75 -----
 Features/Ext4Pkg/Ext4Dxe/Crc32c.c     |  84 ------
 Features/Ext4Pkg/Ext4Dxe/Directory.c  |  13 +-
 Features/Ext4Pkg/Ext4Dxe/DiskUtil.c   |   6 +-
 Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   |  30 +-
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c    |  95 +++---
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    | 417 ++++++++++++++------------
 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  |   3 +-
 Features/Ext4Pkg/Ext4Dxe/Extents.c    |  27 +-
 Features/Ext4Pkg/Ext4Dxe/File.c       |  19 +-
 Features/Ext4Pkg/Ext4Dxe/Inode.c      |  33 +-
 Features/Ext4Pkg/Ext4Dxe/Partition.c  |  12 +-
 Features/Ext4Pkg/Ext4Dxe/Superblock.c |  20 +-
 16 files changed, 640 insertions(+), 487 deletions(-)
 create mode 100644 Features/Ext4Pkg/Ext4Dxe/BlockMap.c
 delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc16.c
 delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc32c.c

-- 
2.35.1



-- 

Pedro Falcato



-- 

Pedro Falcato





-- 

Pedro Falcato



-- 

Pedro Falcato


[-- Attachment #2: Type: text/html, Size: 15111 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib
  2022-06-14  1:11           ` 回复: " gaoliming
@ 2022-06-14 15:58             ` Pedro Falcato
  0 siblings, 0 replies; 11+ messages in thread
From: Pedro Falcato @ 2022-06-14 15:58 UTC (permalink / raw)
  To: gaoliming
  Cc: edk2-devel-groups-io, Leif Lindholm, Michael D Kinney,
	Zhiguang Liu

[-- Attachment #1: Type: text/plain, Size: 4787 bytes --]

Thank you Liming, pushed.

On Tue, Jun 14, 2022 at 2:12 AM gaoliming <gaoliming@byosoft.com.cn> wrote:

> Pedro:
>
>  Yes. You can merge this patch with my ACK.
>
>
>
> Thanks
>
> Liming
>
> *发件人:* Pedro Falcato <pedro.falcato@gmail.com>
> *发送时间:* 2022年6月13日 22:45
> *收件人:* gaoliming <gaoliming@byosoft.com.cn>
> *抄送:* edk2-devel-groups-io <devel@edk2.groups.io>; Leif Lindholm <
> leif@nuviainc.com>; Michael D Kinney <michael.d.kinney@intel.com>;
> Zhiguang Liu <zhiguang.liu@intel.com>
> *主题:* Re: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3
> support and move crc16/32c to BaseLib
>
>
>
> Liming,
>
>
>
> Sorry for the question, but can I merge this with your Ack and my RB or do
> I have to wait for another RB?
>
> I want to solve this as soon as possible since right now Ext4Pkg won't
> build with upstream edk2.
>
>
>
> Thanks,
>
> Pedro
>
>
>
> On Thu, Jun 2, 2022 at 4:05 AM gaoliming <gaoliming@byosoft.com.cn> wrote:
>
> Pedro:
>
>  Thanks for your enhancement to support ext2/3 file system. Acked-by:
> Liming Gao <gaoliming@byosoft.com.cn> for this patch set.
>
>
>
> Thanks
>
> Liming
>
> *发件人:* Pedro Falcato <pedro.falcato@gmail.com>
> *发送时间:* 2022年6月1日 5:33
> *收件人:* edk2-devel-groups-io <devel@edk2.groups.io>; Pedro Falcato <
> pedro.falcato@gmail.com>
> *抄送:* Leif Lindholm <leif@nuviainc.com>; Michael D Kinney <
> michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
> Zhiguang Liu <zhiguang.liu@intel.com>
> *主题:* Re: [edk2-devel] [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3
> support and move crc16/32c to BaseLib
>
>
>
> Ping. Please review now that the stable freeze is over.
>
>
>
> On Wed, May 11, 2022 at 6:42 PM Pedro Falcato via groups.io
> <pedro.falcato=gmail.com@groups.io> wrote:
>
> Ping. Could someone review these patches?
>
>
>
> On Mon, Apr 25, 2022 at 6:14 PM Pedro Falcato via groups.io
> <pedro.falcato=gmail.com@groups.io> wrote:
>
> Ping. If someone could take a look, it would be much appreciated.
>
>
>
> On Thu, Apr 7, 2022 at 11:01 PM Pedro Falcato <pedro.falcato@gmail.com>
> wrote:
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3745
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871
>
> Hi all,
>
> This patch-set attempts to address two open feature requests for Ext4Pkg
> by adding ext2/3 support (id 3745) and moving crc16-ansi/crc32c to BaseLib
> (id 3871).
>
> The previous patch-set regarding 3871 attempted to merge the different
> crc16 implementations
> but failed because, contrary to what I thought, there are many, many
> different CRC16s which
> are all slightly different. This one (plus the separate edk2 patch)
> attempts to just merge
> CRC16-ANSI (confusingly, also known as CRC16) into BaseLib.
>
> Since this patch set grew to be considerably different from the original,
> I didn't mark it
> as v2 but rather a separate, new patch-set.
>
> CC'ing the edk2-platforms stewards (as I cannot review my own code) and
> the CC's of the MdePkg
> patch.
>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>
> Pedro Falcato (3):
>   Ext4Pkg: Replace the CRC implementations with BaseLib
>   Ext4Pkg: Format using uncrustify
>   Ext4Pkg: Add ext2/3 support
>
>  Features/Ext4Pkg/Ext4Dxe/BlockGroup.c |  10 +-
>  Features/Ext4Pkg/Ext4Dxe/BlockMap.c   | 279 +++++++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Collation.c  |   4 +-
>  Features/Ext4Pkg/Ext4Dxe/Crc16.c      |  75 -----
>  Features/Ext4Pkg/Ext4Dxe/Crc32c.c     |  84 ------
>  Features/Ext4Pkg/Ext4Dxe/Directory.c  |  13 +-
>  Features/Ext4Pkg/Ext4Dxe/DiskUtil.c   |   6 +-
>  Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   |  30 +-
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c    |  95 +++---
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    | 417 ++++++++++++++------------
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  |   3 +-
>  Features/Ext4Pkg/Ext4Dxe/Extents.c    |  27 +-
>  Features/Ext4Pkg/Ext4Dxe/File.c       |  19 +-
>  Features/Ext4Pkg/Ext4Dxe/Inode.c      |  33 +-
>  Features/Ext4Pkg/Ext4Dxe/Partition.c  |  12 +-
>  Features/Ext4Pkg/Ext4Dxe/Superblock.c |  20 +-
>  16 files changed, 640 insertions(+), 487 deletions(-)
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/BlockMap.c
>  delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc16.c
>  delete mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc32c.c
>
> --
> 2.35.1
>
>
>
> --
>
> Pedro Falcato
>
>
>
> --
>
> Pedro Falcato
>
> 
>
>
>
> --
>
> Pedro Falcato
>
>
>
> --
>
> Pedro Falcato
>


-- 
Pedro Falcato

[-- Attachment #2: Type: text/html, Size: 13122 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-06-14 15:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-07 22:01 [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib Pedro Falcato
2022-04-07 22:01 ` [PATCH edk2-platforms 1/3] Ext4Pkg: Replace the CRC implementations with BaseLib Pedro Falcato
2022-04-07 22:01 ` [PATCH edk2-platforms 2/3] Ext4Pkg: Format using uncrustify Pedro Falcato
2022-04-07 22:01 ` [PATCH edk2-platforms 3/3] Ext4Pkg: Add ext2/3 support Pedro Falcato
2022-04-25 17:14 ` [PATCH edk2-platforms 0/3] Ext4Pkg: Add ext2/3 support and move crc16/32c to BaseLib Pedro Falcato
     [not found] ` <16E9330A7A87074F.18109@groups.io>
2022-05-11 17:41   ` [edk2-devel] " Pedro Falcato
     [not found]   ` <16EE1DD8FA9A45F3.9448@groups.io>
2022-05-31 21:32     ` Pedro Falcato
2022-06-02  3:04       ` 回复: " gaoliming
2022-06-13 14:45         ` Pedro Falcato
2022-06-14  1:11           ` 回复: " gaoliming
2022-06-14 15:58             ` Pedro Falcato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox