Skip to content

Conversation

@W-M-R
Copy link
Contributor

@W-M-R W-M-R commented Jan 30, 2026

Note: Please adhere to Contributing Guidelines.

Summary

Added lib_lzfinstream (LZF decompression input stream), supporting seek operations on "decompressed data": backward processing is possible, while forward scanning reconstructs the state from the beginning.

Aligned sistream/sostream structures to allow them to reuse the same lib_stream_seek macros/interfaces, avoiding type inconsistency issues.

Fixed errors in the loop read offset/buffer handling of file(s)istream, preventing read errors when there is no buffer offset.

Fixed the handling of lzf-stream in both "compression successful" and "compression failed" header scenarios: preventing decompression errors caused by parsing according to the compressed block format when compression fails, and reducing the risk of potential compression failure/decompression errors.

Impact

Provides stream-based LZF decompression capabilities, facilitating on-demand reading in file/storage scenarios and supporting location-based reading of uncompressed views.

Improves stream system consistency (sistream/sostream alignment) and stability (type errors, read offset errors, LZF header branch handling).

The changes primarily focus on libc/stream and LZF-related implementations and are not expected to affect modules that do not use these streams/algorithms.

Testing

ci test

W-M-R added 6 commits January 30, 2026 17:22
Align sistream and sostream structures so they use the same lib_stream_seek macro

Signed-off-by: wangmingrong1 <[email protected]>
Fixed the issue that loop reading without buffer offset would cause data read errors

Signed-off-by: wangmingrong1 <[email protected]>
This lib_lzfinstream supports seeking uncompressed files. It can seek backward, but if it seeks forward, the internal implementation will search from the beginning.

examples:
struct lib_filesistream_s rawstream;
struct lib_lzfsistream_s lzfstream;

lib_rawoutstream(&rawstream, fd);
lib_lzfoutstream(&lzfstream, &rawstream);

Signed-off-by: wangmingrong1 <[email protected]>
…ession issues with lzf-stream.

LZF compression will have two types of headers: one indicating successful compression and one indicating failed compression.

Signed-off-by: wangmingrong1 <[email protected]>
@github-actions github-actions bot added Area: OS Components OS Components issues Size: M The size of the change in this PR is medium labels Jan 30, 2026
@simbit18
Copy link
Contributor

Hi @W-M-R Please provide more detailed testing information

====================================================================================
Configuration/Tool: nucleo-f411re/nsh,CONFIG_ARM_TOOLCHAIN_GNU_EABI
2026-01-30 09:41:06
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Building NuttX...
In file included from D:/a/nuttx/nuttx/sources/nuttx/include/debug.h:32,
                 from ./nsh_parse.c:34:
D:/a/nuttx/nuttx/sources/nuttx/include/nuttx/streams.h:214: error: unterminated #ifndef
  214 | #ifndef CONFIG_DISABLE_MOUNTPOINT
      | 
D:/a/nuttx/nuttx/sources/nuttx/include/nuttx/streams.h:23: error: unterminated #ifndef
   23 | #ifndef __INCLUDE_NUTTX_STREAMS_H
      | 
ERROR: arm-none-eabi-gcc failed: 1
       command: arm-none-eabi-gcc -MT ./nsh_parse.c.d.a.nuttx.nuttx.sources.apps.nshlib.o  -M '-Wstrict-prototypes' '-Wno-attributes' '-Wno-unknown-pragmas' '-Wno-psabi' '-Os' '-fno-strict-aliasing' '-fomit-frame-pointer' '--param=min-pagesize=0' '-fno-common' '-Wall' '-Wshadow' '-Wundef' '-ffunction-sections' '-fdata-sections' '-mlittle-endian' '-march=armv7e-m' '-mtune=cortex-m4' '-mfloat-abi=soft' '-mthumb' '-Wa,-mthumb' '-Wa,-mimplicit-it=always' '-isystem' '/d/a/nuttx/nuttx/sources/nuttx/include' '-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-Wno-cpp' '-Werror' '-I' '/d/a/nuttx/nuttx/sources/apps/include' ./nsh_parse.c
In file included from D:/a/nuttx/nuttx/sources/nuttx/include/debug.h:32,
                 from ./exec_builtin.c:32:
D:/a/nuttx/nuttx/sources/nuttx/include/nuttx/streams.h:214: error: unterminated #ifndef
  214 | #ifndef CONFIG_DISABLE_MOUNTPOINT
      | 
D:/a/nuttx/nuttx/sources/nuttx/include/nuttx/streams.h:23: error: unterminated #ifndef
   23 | #ifndef __INCLUDE_NUTTX_STREAMS_H
      | 
ERROR: arm-none-eabi-gcc failed: 1
       command: arm-none-eabi-gcc -MT ./exec_builtin.c.d.a.nuttx.nuttx.sources.apps.builtin.o  -M '-Wstrict-prototypes' '-Wno-attributes' '-Wno-unknown-pragmas' '-Wno-psabi' '-Os' '-fno-strict-aliasing' '-fomit-frame-pointer' '--param=min-pagesize=0' '-fno-common' '-Wall' '-Wshadow' '-Wundef' '-ffunction-sections' '-fdata-sections' '-mlittle-endian' '-march=armv7e-m' '-mtune=cortex-m4' '-mfloat-abi=soft' '-mthumb' '-Wa,-mthumb' '-Wa,-mimplicit-it=always' '-isystem' '/d/a/nuttx/nuttx/sources/nuttx/include' '-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-Wno-cpp' '-Werror' '-I' '/d/a/nuttx/nuttx/sources/apps/include' ./exec_builtin.c
In file included from D:/a/nuttx/nuttx/sources/nuttx/include/debug.h:32,
                 from ./dd_main.c:35:
D:/a/nuttx/nuttx/sources/nuttx/include/nuttx/streams.h:214: error: unterminated #ifndef
  214 | #ifndef CONFIG_DISABLE_MOUNTPOINT
      | 
D:/a/nuttx/nuttx/sources/nuttx/include/nuttx/streams.h:23: error: unterminated #ifndef
   23 | #ifndef __INCLUDE_NUTTX_STREAMS_H
      | 
ERROR: arm-none-eabi-gcc failed: 1
       command: arm-none-eabi-gcc -MT ./dd_main.c.d.a.nuttx.nuttx.sources.apps.system.dd.o  -M '-Wstrict-prototypes' '-Wno-attributes' '-Wno-unknown-pragmas' '-Wno-psabi' '-Os' '-fno-strict-aliasing' '-fomit-frame-pointer' '--param=min-pagesize=0' '-fno-common' '-Wall' '-Wshadow' '-Wundef' '-ffunction-sections' '-fdata-sections' '-mlittle-endian' '-march=armv7e-m' '-mtune=cortex-m4' '-mfloat-abi=soft' '-mthumb' '-Wa,-mthumb' '-Wa,-mimplicit-it=always' '-isystem' '/d/a/nuttx/nuttx/sources/nuttx/include' '-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-Wno-cpp' '-Werror' '-I' '/d/a/nuttx/nuttx/sources/apps/include' ./dd_main.c

@simbit18 simbit18 requested review from acassis and linguini1 January 30, 2026 11:53
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.

Requires more than just a CI test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: OS Components OS Components 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.

3 participants