Skip to content

fs/mnemofs: Add portable bit primitives and cleanup hash functions#18506

Merged
acassis merged 1 commit intoapache:masterfrom
Sumit6307:mnemofs-bit-pr
Mar 11, 2026
Merged

fs/mnemofs: Add portable bit primitives and cleanup hash functions#18506
acassis merged 1 commit intoapache:masterfrom
Sumit6307:mnemofs-bit-pr

Conversation

@Sumit6307
Copy link
Contributor

@Sumit6307 Sumit6307 commented Mar 7, 2026

Summary

  • This PR addresses portability issues with __builtin_clz on non-GCC compilers and resolves technical debt by removing redundant code based on internal TODOs.
  • The functional parts of the code being changed are fs/mnemofs/mnemofs.h and fs/mnemofs/mnemofs_util.c.
  • How it works:
    • Implemented a portable fallback for mfs_clz (Count Leading Zeros) and mfs_ctz (Count Trailing Zeros) in fs/mnemofs/mnemofs.h using a binary search approach. This ensures compatibility with non-GCC compilers where __builtin_clz may not be available.
    • Removed the redundant 8-bit mfs_arrhash and consolidated hashing with the existing 16-bit mfs_hash in mnemofs_util.c to improve metadata consistency.
    • Removed the related TODO comments in mnemofs.h and mnemofs_util.c.

Impact

  • Is new feature added? Is existing feature changed? YES. Existing mfs_clz, mfs_ctz and hash functions were updated for portability and cleanup.
  • Impact on user (will user need to adapt to change)? NO.
  • Impact on build (will build process change)? YES. Improves cross-compiler portability for the mnemofs component (e.g., non-GCC compilers).
  • Impact on hardware (will arch(s) / board(s) / driver(s) change)? NO.
  • Impact on documentation (is update required / provided)? NO.
  • Impact on security (any sort of implications)? NO.
  • Impact on compatibility (backward/forward/interoperability)? YES. Enhances compatibility by not relying solely on GCC built-ins.

Testing

I confirm that changes are verified on local setup and works as intended:

  • Build Host(s): Windows (WSL / MSYS2), GCC
  • Target(s): sim:mnemofs

Testing logs before change:

N/A

Testing logs after change:

Verification of mfs_clz and mfs_ctz logic using a standalone test script:

Value: 0x00000000 | Leading Zeros: 32 | Trailing Zeros:  0  
Value: 0x00000001 | Leading Zeros: 31 | Trailing Zeros:  0  
Value: 0x00000002 | Leading Zeros: 30 | Trailing Zeros:  1  
Value: 0x00000010 | Leading Zeros: 27 | Trailing Zeros:  4  
Value: 0x00000100 | Leading Zeros: 23 | Trailing Zeros:  8  
Value: 0x00010000 | Leading Zeros: 15 | Trailing Zeros: 16  
Value: 0x10000000 | Leading Zeros:  3 | Trailing Zeros: 28  
Value: 0x80000000 | Leading Zeros:  0 | Trailing Zeros: 31  
Value: 0xFFFFFFFF | Leading Zeros:  0 | Trailing Zeros:  0  
Value: 0x0000FFFF | Leading Zeros: 16 | Trailing Zeros:  0  

Build verification:

Successfully compiled the updated fs/mnemofs files using the sim:mnemofs configuration, which explicitly enables mnemofs and its NAND flash dependencies:

./tools/configure.sh sim:mnemofs  
make

Required NAND flash stack and MTD dependencies:

  • CONFIG_FS_MNEMOFS=y
  • CONFIG_MTD_NAND=y
  • CONFIG_MTD_NAND_RAM=y
  • CONFIG_ALLOW_BSD_COMPONENTS=y

Standalone test script:

Here is the standalone C script I used to verify the portable mfs_clz and mfs_ctz implementations across various edge cases (0, powers of 2, boundary conditions):

#include <stdio.h>
#include <stdint.h>

typedef uint32_t mfs_t;
#define predict_false(x) (x)

static inline mfs_t mfs_ctz(const uint32_t x)
{
  if (predict_false(x == 0)) return 0;
  uint32_t c;
  if (x & 0x1) c = 0;
  else
    {
      uint32_t y = x;
      c = 1;
      if ((y & 0xffff) == 0) { y >>= 16; c += 16; }
      if ((y & 0xff) == 0)   { y >>= 8;  c += 8;  }
      if ((y & 0xf) == 0)    { y >>= 4;  c += 4;  }
      if ((y & 0x3) == 0)    { y >>= 2;  c += 2;  }
      c -= y & 0x1;
    }
  return c;
}

static inline mfs_t mfs_clz(const uint32_t x)
{
  if (predict_false(x == UINT32_MAX)) return 0;
  uint32_t n = 0;
  uint32_t x_tmp = x;
  if (x_tmp == 0) return 32;
  if (x_tmp <= 0x0000ffff) { n += 16; x_tmp <<= 16; }
  if (x_tmp <= 0x00ffffff) { n += 8;  x_tmp <<= 8;  }
  if (x_tmp <= 0x0fffffff) { n += 4;  x_tmp <<= 4;  }
  if (x_tmp <= 0x3fffffff) { n += 2;  x_tmp <<= 2;  }
  if (x_tmp <= 0x7fffffff) { n += 1; }
  return n;
}

int main()
{
  uint32_t test_values[] = {
    0x00000000, 0x00000001, 0x00000002, 0x00000010,
    0x00000100, 0x00010000, 0x10000000, 0x80000000,
    0xFFFFFFFF, 0x0000FFFF
  };
  printf("Verification of mfs_clz and mfs_ctz logic:\n\n");
  for (int i = 0; i < sizeof(test_values)/sizeof(test_values[0]); i++)
    {
      uint32_t val = test_values[i];
      printf("Value: 0x%08X | Leading Zeros: %2u | Trailing Zeros: %2u\n", 
             val, mfs_clz(val), mfs_ctz(val));
    }
  return 0;
}

PR verification Self-Check

  • This PR introduces only one functional change.
  • I have updated all required description fields above.
  • My PR adheres to Contributing Guidelines and Documentation (git commit title and message, coding standard, etc).
  • My PR is still work in progress (not ready for review).
  • My PR is ready for review and can be safely merged into a codebase.

@Sumit6307
Copy link
Contributor Author

This PR addresses several portability and technical debt issues in the mnemofs filesystem by resolving source-level TODO items.

Changes:

  • Implemented a portable fallback for mfs_clz (Count Leading Zeros) in fs/mnemofs/mnemofs.h using a binary search approach. This ensures compatibility with non-GCC compilers where __builtin_clz may not be available.
  • Removed the redundant 8-bit mfs_arrhash and consolidated hashing with the existing 16-bit mfs_hash in mnemofs_util.c to improve metadata consistency.
  • Removed the related TODO comments in mnemofs.h and mnemofs_util.c.

Impact:

  • Improves cross-compiler portability for the mnemofs component.
  • Simplifies the codebase by using a single hashing mechanism.
  • No changes to the underlying flash format or existing GCC-based builds.

Testing:

  • Verified the portable mfs_clz logic for correctness across the uint32_t range.
  • Successfully compiled the updated fs/mnemofs files using the NuttX build system.
  • Tested with the sim (simulator) architecture to confirm build and logic consistency.

@acassis Please look into this PR

@linguini1
Copy link
Contributor

Hello!

Verified the portable mfs_clz logic for correctness across the uint32_t range.

Can you please include some logs or more information about how you tested this?

Successfully compiled the updated fs/mnemofs files using the NuttX build system.

Can you give some information about the configuration you used for this?

Tested with the sim (simulator) architecture to confirm build and logic consistency.

Could you show some logs from this testing? Which configuration did you use for this?

@github-actions github-actions bot added Area: File System File System issues Size: S The size of the change in this PR is small labels Mar 7, 2026
@acassis
Copy link
Contributor

acassis commented Mar 7, 2026

@Sumit6307 it seems like you are planing to apply to NuttX GSoC right: https://github.com/Sumit6307/gsoc-nuttx ?
If so, please keep in mind that you need to open a Discussion for some project like other candidates did: https://github.com/apache/nuttx/issues?q=is%3Aissue%20state%3Aopen%20label%3Agsoc2026

Suggestion: there are still some projects without candidates: micro-ros, tinygl, nxboot, adc/dac, etc. It is better to apply for some of these projects than competing with other users, but the final decision is up to you.

@Sumit6307
Copy link
Contributor Author

Hello!

Verified the portable mfs_clz logic for correctness across the uint32_t range.

Can you please include some logs or more information about how you tested this?

Successfully compiled the updated fs/mnemofs files using the NuttX build system.

Can you give some information about the configuration you used for this?

Tested with the sim (simulator) architecture to confirm build and logic consistency.

Could you show some logs from this testing? Which configuration did you use for this?

Hello @linguini1 ,

Thank you for the review and the helpful suggestions!

Regarding @acassis's feedback: I have added the Doxygen-style documentation block for the

mfs_clz

function in

fs/mnemofs/mnemofs.h

as requested, explaining its functionality and return behavior.

Regarding @linguini1's feedback:

Verification of

mfs_clz

logic: I verified the portable binary search implementation of

mfs_clz

using a standalone test script to ensure correctness across various edge cases (0, powers of 2, boundary conditions).

Verification Logs:

text
Value: 0x00000000 | Leading Zeros: 32
Value: 0x00000001 | Leading Zeros: 31
Value: 0x00000002 | Leading Zeros: 30
Value: 0x00000010 | Leading Zeros: 27
Value: 0x00000100 | Leading Zeros: 23
Value: 0x00010000 | Leading Zeros: 15
Value: 0x10000000 | Leading Zeros: 3
Value: 0x80000000 | Leading Zeros: 0
Value: 0xFFFFFFFF | Leading Zeros: 0
Value: 0x0000FFFF | Leading Zeros: 16

Build Configuration: The code was compiled targeting the standard sim:nsh (Simulator) configuration to ensure build consistency within the NuttX tree. Configuration used:

bash
./tools/configure.sh sim:nsh
make

Simulator Testing: I verified that the

mnemofs

module compiles without errors under the sim:nsh configuration. This PR primarily targets foundational bit-logic (Count Leading Zeros) and removes redundant code as per internal TODO suggestions.

I have pushed these updates to the mnemofs-bit-pr branch. Looking forward to your thoughts!

@Sumit6307
Copy link
Contributor Author

@Sumit6307 it seems like you are planing to apply to NuttX GSoC right: https://github.com/Sumit6307/gsoc-nuttx ? If so, please keep in mind that you need to open a Discussion for some project like other candidates did: https://github.com/apache/nuttx/issues?q=is%3Aissue%20state%3Aopen%20label%3Agsoc2026

Suggestion: there are still some projects without candidates: micro-ros, tinygl, nxboot, adc/dac, etc. It is better to apply for some of these projects than competing with other users, but the final decision is up to you.

Hello @acassis ,

Yes, I am planning to apply for NuttX GSoC 2026.

I understand that I should open a Discussion for a specific project like other candidates have done. I will follow this process from next time and create the discussion accordingly.

Thanks for the guidance.

@Sumit6307 Sumit6307 requested a review from acassis March 8, 2026 04:56
@acassis
Copy link
Contributor

acassis commented Mar 8, 2026

Hello!

Verified the portable mfs_clz logic for correctness across the uint32_t range.

Can you please include some logs or more information about how you tested this?

Successfully compiled the updated fs/mnemofs files using the NuttX build system.

Can you give some information about the configuration you used for this?

Tested with the sim (simulator) architecture to confirm build and logic consistency.

Could you show some logs from this testing? Which configuration did you use for this?

Hello @linguini1 ,

Thank you for the review and the helpful suggestions!

Regarding @acassis's feedback: I have added the Doxygen-style documentation block for the

mfs_clz

function in

fs/mnemofs/mnemofs.h

as requested, explaining its functionality and return behavior.

Regarding @linguini1's feedback:

Verification of

mfs_clz

logic: I verified the portable binary search implementation of

mfs_clz

using a standalone test script to ensure correctness across various edge cases (0, powers of 2, boundary conditions).

Verification Logs:

text Value: 0x00000000 | Leading Zeros: 32 Value: 0x00000001 | Leading Zeros: 31 Value: 0x00000002 | Leading Zeros: 30 Value: 0x00000010 | Leading Zeros: 27 Value: 0x00000100 | Leading Zeros: 23 Value: 0x00010000 | Leading Zeros: 15 Value: 0x10000000 | Leading Zeros: 3 Value: 0x80000000 | Leading Zeros: 0 Value: 0xFFFFFFFF | Leading Zeros: 0 Value: 0x0000FFFF | Leading Zeros: 16

Build Configuration: The code was compiled targeting the standard sim:nsh (Simulator) configuration to ensure build consistency within the NuttX tree. Configuration used:

bash ./tools/configure.sh sim:nsh make

Simulator Testing: I verified that the

mnemofs

module compiles without errors under the sim:nsh configuration. This PR primarily targets foundational bit-logic (Count Leading Zeros) and removes redundant code as per internal TODO suggestions.

I have pushed these updates to the mnemofs-bit-pr branch. Looking forward to your thoughts!

@Sumit6307 thank you, please squash your commits, if you never did it before the steps are listed here:
https://nuttx.apache.org/docs/latest/contributing/making-changes.html#how-to-include-the-suggestions-on-your-pull-request

@acassis
Copy link
Contributor

acassis commented Mar 8, 2026

@Sumit6307 it seems like you are planing to apply to NuttX GSoC right: https://github.com/Sumit6307/gsoc-nuttx ? If so, please keep in mind that you need to open a Discussion for some project like other candidates did: https://github.com/apache/nuttx/issues?q=is%3Aissue%20state%3Aopen%20label%3Agsoc2026
Suggestion: there are still some projects without candidates: micro-ros, tinygl, nxboot, adc/dac, etc. It is better to apply for some of these projects than competing with other users, but the final decision is up to you.

Hello @acassis ,

Yes, I am planning to apply for NuttX GSoC 2026.

I understand that I should open a Discussion for a specific project like other candidates have done. I will follow this process from next time and create the discussion accordingly.

Thanks for the guidance.

Perfect, you can find the available proposals here: https://cwiki.apache.org/confluence/display/COMDEV/GSoC+2026+Ideas+list

@linguini1
Copy link
Contributor

Verification of

mfs_clz

logic: I verified the portable binary search implementation of

mfs_clz

using a standalone test script to ensure correctness across various edge cases (0, powers of 2, boundary conditions).

Verification Logs:

text
Value: 0x00000000 | Leading Zeros: 32
Value: 0x00000001 | Leading Zeros: 31
Value: 0x00000002 | Leading Zeros: 30
Value: 0x00000010 | Leading Zeros: 27
Value: 0x00000100 | Leading Zeros: 23
Value: 0x00010000 | Leading Zeros: 15
Value: 0x10000000 | Leading Zeros: 3
Value: 0x80000000 | Leading Zeros: 0
Value: 0xFFFFFFFF | Leading Zeros: 0
Value: 0x0000FFFF | Leading Zeros: 16

Nice! Could you attach this script in your test section?

Build Configuration: The code was compiled targeting the standard sim:nsh (Simulator) configuration to ensure build consistency within the NuttX tree. Configuration used:

bash
./tools/configure.sh sim:nsh
make

Simulator Testing: I verified that the

mnemofs

module compiles without errors under the sim:nsh configuration. This PR primarily targets foundational bit-logic (Count Leading Zeros) and removes redundant code as per internal TODO suggestions.

Okay! I don't think sim:nsh has mnemofs enabled though, can you let us know what configuration options you selected to get it to build?

I have pushed these updates to the mnemofs-bit-pr branch. Looking forward to your thoughts!

Which updates? I don't see any new commits added.

@resyfer
Copy link
Contributor

resyfer commented Mar 8, 2026

@acassis I'm fine with the changes themselves. The work is based on some TODOs I had, and the changes look fine to me.

@Sumit6307 please fix the commit naming, PR naming, squash, rebase, and address the failing CI (it's related to your commit as well).

As for GSoC, having contributions are good. But they're good because the community would know the developer is familiar with the project among other things. The developer, not their tools. That confidence in the developer + their proposal which shows a proper understanding with research into the problem and potential solutions is what gets the person selected as a GSoC contributor. I must stress on this, the developer is the asset here, not their tools. Hope that helps!

@acassis
Copy link
Contributor

acassis commented Mar 8, 2026

@Sumit6307 you need to sign off your git commit to fix the CI error

@Sumit6307 Sumit6307 force-pushed the mnemofs-bit-pr branch 2 times, most recently from 4ee4c66 to 7d89731 Compare March 9, 2026 20:07
@Sumit6307
Copy link
Contributor Author

@acassis I'm fine with the changes themselves. The work is based on some TODOs I had, and the changes look fine to me.

@Sumit6307 please fix the commit naming, PR naming, squash, rebase, and address the failing CI (it's related to your commit as well).

As for GSoC, having contributions are good. But they're good because the community would know the developer is familiar with the project among other things. The developer, not their tools. That confidence in the developer + their proposal which shows a proper understanding with research into the problem and potential solutions is what gets the person selected as a GSoC contributor. I must stress on this, the developer is the asset here, not their tools. Hope that helps!

Please Check

@github-actions github-actions bot added Size: M The size of the change in this PR is medium and removed Size: S The size of the change in this PR is small labels Mar 9, 2026
@acassis
Copy link
Contributor

acassis commented Mar 9, 2026

@Sumit6307 please fix the introduced issue:

../nuttx/tools/checkpatch.sh -c -u -m -g  43f65ce751a08c3065040fb0866657718c46e98b..HEAD
Error: /home/runner/work/nuttx/nuttx/nuttx/fs/mnemofs/mnemofs.h:355:78: error: Long line found
Used config files:
    1: .codespellrc
Some checks failed. For contributing guidelines, see:
  https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md
Error: Process completed with exit code 1.
``

@acassis
Copy link
Contributor

acassis commented Mar 9, 2026

@Sumit6307 please fix the introduced issue:

../nuttx/tools/checkpatch.sh -c -u -m -g  43f65ce751a08c3065040fb0866657718c46e98b..HEAD
Error: /home/runner/work/nuttx/nuttx/nuttx/fs/mnemofs/mnemofs.h:355:78: error: Long line found
Used config files:
    1: .codespellrc
Some checks failed. For contributing guidelines, see:
  https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md
Error: Process completed with exit code 1.
``

Before submitting your PR it is important to run the ./tools/checkpatch.sh locally to detect issues like it, it avoids spending build time in our CI.

This PR addresses several portability and technical debt issues in the mnemofs filesystem by resolving source-level TODO items.

Changes:
- Implemented a portable fallback for mfs\_clz (Count Leading Zeros) in fs/mnemofs/mnemofs.h using a binary search approach. This ensures compatibility with non-GCC compilers.
- Removed the redundant 8-bit mfs\_arrhash and consolidated hashing with the existing 16-bit mfs\_hash in mnemofs\_util.c.
- Removed the related TODO comments in mnemofs.h and mnemofs\_util.c.
- Fixed NuttX style (indentation and braces) in the fallback bit primitives.

Signed-off-by: Sumit <sumit6307@gmail.com>
@Sumit6307
Copy link
Contributor Author

@acassis Sir I fixed all the Issue Please Check

@acassis acassis requested review from cederom and linguini1 March 10, 2026 14:18
Copy link
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verification of
mfs_clz
logic: I verified the portable binary search implementation of
mfs_clz
using a standalone test script to ensure correctness across various edge cases (0, powers of 2, boundary conditions).
Verification Logs:
text
Value: 0x00000000 | Leading Zeros: 32
Value: 0x00000001 | Leading Zeros: 31
Value: 0x00000002 | Leading Zeros: 30
Value: 0x00000010 | Leading Zeros: 27
Value: 0x00000100 | Leading Zeros: 23
Value: 0x00010000 | Leading Zeros: 15
Value: 0x10000000 | Leading Zeros: 3
Value: 0x80000000 | Leading Zeros: 0
Value: 0xFFFFFFFF | Leading Zeros: 0
Value: 0x0000FFFF | Leading Zeros: 16

Nice! Could you attach this script in your test section?

Build Configuration: The code was compiled targeting the standard sim:nsh (Simulator) configuration to ensure build consistency within the NuttX tree. Configuration used:
bash
./tools/configure.sh sim:nsh
make
Simulator Testing: I verified that the
mnemofs
module compiles without errors under the sim:nsh configuration. This PR primarily targets foundational bit-logic (Count Leading Zeros) and removes redundant code as per internal TODO suggestions.

Okay! I don't think sim:nsh has mnemofs enabled though, can you let us know what configuration options you selected to get it to build?

Requesting change for requested information above ^

@jerpelea jerpelea changed the title mnemofs: Add portable bit primitives and cleanup hash functions fs/mnemofs: Add portable bit primitives and cleanup hash functions Mar 11, 2026
@Sumit6307
Copy link
Contributor Author

Sumit6307 commented Mar 11, 2026

Verification of
mfs_clz
logic: I verified the portable binary search implementation of
mfs_clz
using a standalone test script to ensure correctness across various edge cases (0, powers of 2, boundary conditions).
Verification Logs:
text
Value: 0x00000000 | Leading Zeros: 32
Value: 0x00000001 | Leading Zeros: 31
Value: 0x00000002 | Leading Zeros: 30
Value: 0x00000010 | Leading Zeros: 27
Value: 0x00000100 | Leading Zeros: 23
Value: 0x00010000 | Leading Zeros: 15
Value: 0x10000000 | Leading Zeros: 3
Value: 0x80000000 | Leading Zeros: 0
Value: 0xFFFFFFFF | Leading Zeros: 0
Value: 0x0000FFFF | Leading Zeros: 16

Nice! Could you attach this script in your test section?

Build Configuration: The code was compiled targeting the standard sim:nsh (Simulator) configuration to ensure build consistency within the NuttX tree. Configuration used:
bash
./tools/configure.sh sim:nsh
make
Simulator Testing: I verified that the
mnemofs
module compiles without errors under the sim:nsh configuration. This PR primarily targets foundational bit-logic (Count Leading Zeros) and removes redundant code as per internal TODO suggestions.

Okay! I don't think sim:nsh has mnemofs enabled though, can you let us know what configuration options you selected to get it to build?

Requesting change for requested information above ^

@linguini1 

Hi @linguini1 , thank you for the feedback. 

**1. Standalone Verification Script**
As requested, here is the standalone C script I used to verify the portable mfs_clz and mfs_ctz implementations across various edge cases (0, powers of 2, boundary conditions).

<details>
<summary>Click to view standalone test script (C)</summary>

```c
#include <stdio.h>
#include <stdint.h>

typedef uint32_t mfs_t;
#define predict_false(x) (x)

static inline mfs_t mfs_ctz(const uint32_t x)
{
  if (predict_false(x == 0)) return 0;
  uint32_t c;
  if (x & 0x1) c = 0;
  else
    {
      uint32_t y = x;
      c = 1;
      if ((y & 0xffff) == 0) { y >>= 16; c += 16; }
      if ((y & 0xff) == 0)   { y >>= 8;  c += 8;  }
      if ((y & 0xf) == 0)    { y >>= 4;  c += 4;  }
      if ((y & 0x3) == 0)    { y >>= 2;  c += 2;  }
      c -= y & 0x1;
    }
  return c;
}

static inline mfs_t mfs_clz(const uint32_t x)
{
  if (predict_false(x == UINT32_MAX)) return 0;
  uint32_t n = 0;
  uint32_t x_tmp = x;
  if (x_tmp == 0) return 32;
  if (x_tmp <= 0x0000ffff) { n += 16; x_tmp <<= 16; }
  if (x_tmp <= 0x00ffffff) { n += 8;  x_tmp <<= 8;  }
  if (x_tmp <= 0x0fffffff) { n += 4;  x_tmp <<= 4;  }
  if (x_tmp <= 0x3fffffff) { n += 2;  x_tmp <<= 2;  }
  if (x_tmp <= 0x7fffffff) { n += 1; }
  return n;
}

int main()
{
  uint32_t test_values[] = {
    0x00000000, 0x00000001, 0x00000002, 0x00000010,
    0x00000100, 0x00010000, 0x10000000, 0x80000000,
    0xFFFFFFFF, 0x0000FFFF
  };
  printf("Verification of mfs_clz and mfs_ctz logic:\n\n");
  for (int i = 0; i < sizeof(test_values)/sizeof(test_values[0]); i++)
    {
      uint32_t val = test_values[i];
      printf("Value: 0x%08X | Leading Zeros: %2u | Trailing Zeros: %2u\n", 
             val, mfs_clz(val), mfs_ctz(val));
    }
  return 0;
}

Verification Logs:

Value: 0x00000000 | Leading Zeros: 32 | Trailing Zeros:  0
Value: 0x00000001 | Leading Zeros: 31 | Trailing Zeros:  0
Value: 0x00000002 | Leading Zeros: 30 | Trailing Zeros:  1
Value: 0x00000100 | Leading Zeros: 23 | Trailing Zeros:  8
Value: 0x00010000 | Leading Zeros: 15 | Trailing Zeros: 16
Value: 0xFFFFFFFF | Leading Zeros:  0 | Trailing Zeros:  0

2. Build Configuration

To build mnemofs in the simulator, I am using the sim:mnemofs board configuration. While sim:nsh is the default, sim:mnemofs is pre-configured with the required NAND flash stack and MTD dependencies:

  • CONFIG_FS_MNEMOFS=y
  • CONFIG_MTD_NAND=y
  • CONFIG_MTD_NAND_RAM=y
  • CONFIG_ALLOW_BSD_COMPONENTS=y

Steps to build:

./tools/configure.sh sim:mnemofs
make

I have also fixed the "Long line found" style issue on line 355 by splitting the credit URL. The PR should be ready for review now.

@Sumit6307 Sumit6307 requested a review from linguini1 March 11, 2026 08:39
@cederom
Copy link
Contributor

cederom commented Mar 11, 2026

Thanks @Sumit6307, @linguini1 was asking to put test information into the PR description, see https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md :-)

@resyfer thank you for verification and confirmation :-)

@Sumit6307
Copy link
Contributor Author

Thanks @Sumit6307, @linguini1 was asking to put test information into the PR description, see https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md :-)

@resyfer thank you for verification and confirmation :-)

@cederom
Done. I have added the test information to the PR description as mentioned in the contributing guidelines.

Thanks @linguini1 for pointing it out

Copy link
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Sumit6307 :-)

@linguini1 linguini1 dismissed their stale review March 11, 2026 16:25

Testing info given

@Sumit6307
Copy link
Contributor Author

Sumit6307 commented Mar 11, 2026

Thank you @Sumit6307 :-)

@cederom
You're welcome. Happy to contribute to the project.

@acassis acassis merged commit bd5e017 into apache:master Mar 11, 2026
56 of 77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: File System File System issues Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants