nuttx-apps/system/xipfs/Kconfig
Marco Casaroli b695ec057f system/xipfs: Add a command to compact a xipfs volume and report it.
xipfs has a defragmentation ioctl and no way to reach it from a shell.  The
only caller was a demo in examples/nxflatxip, which built its own block map
to show what compaction had done.

  xipfs [-n] [-t <ms>] [<mountpoint>]

-n surveys and reports without moving anything: where each file sits, a map
of the volume, and how much of the free space a single allocation can reach.
That last number is the one a caller facing -ENOSPC actually wants; at 0%
the largest possible file already fits however scattered the map looks.

The compaction is asked for through a descriptor for the mountpoint
directory, so no file inside the volume is open while it runs and a single
pass can reach every extent.

The walk descends into the directories xipfs synthesises from names, and
reports each file by its path relative to the mount, so a volume that uses
them is described in full rather than down to its first level.

Block totals come from statfs rather than XIPFSIOC_EXTENTINFO, because that
one does name a file and an empty volume has none, yet its geometry is still
worth reporting.

Assisted-by: Claude Code:claude-opus-4-8
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-07-28 16:47:49 +08:00

38 lines
972 B
Text

#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config SYSTEM_XIPFS
tristate "xipfs defragmentation command"
default n
depends on FS_XIPFS
---help---
Enable the 'xipfs' command, which compacts a xipfs volume and
reports how its erase blocks are laid out. With -n it only
reports -- block usage, a map of the volume, and how much of the
free space a single allocation can reach -- and moves nothing.
if SYSTEM_XIPFS
config SYSTEM_XIPFS_PROGNAME
string "Program name"
default "xipfs"
---help---
The name of the command as it appears in NSH.
config SYSTEM_XIPFS_MOUNTPOINT
string "Default mountpoint"
default "/mnt/xipfs"
---help---
The volume operated on when none is given on the command line.
config SYSTEM_XIPFS_PRIORITY
int "Task priority"
default 100
config SYSTEM_XIPFS_STACKSIZE
int "Stack size"
default DEFAULT_TASK_STACKSIZE
endif # SYSTEM_XIPFS