Files
u-boot/include/ext4l.h
Simon Glass 60788f5431 ext4l: Add ls command support
Implement directory listing (ls) for the ext4l filesystem driver. This
includes path resolution with symlink following (limited to 8 levels to
prevent loops).

Add ext4l_ls() which uses ext4_lookup() for path resolution and
ext4_readdir() for directory enumeration. The dir_context actor callback
formats and prints each directory entry.

Export ext4_lookup() from namei.c and add declarations to ext4.h.

Add test_ls to the Python test suite, which creates a test file using
debugfs and verifies it appears in the directory listing with the
correct size.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>

Cover-letter:
ext4l: Add support for listing directoties (Part H)
This series adds directory-listing support to the ext4l filesystem
driver. It exports a few required functions from the Linux ext4 code,
fixes the dir_emit() stub to properly call the actor callback, and
implements ext4l_ls() with path resolution and symlink following.
END

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-22 16:49:47 -07:00

46 lines
1.0 KiB
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* ext4l filesystem interface
*
* Copyright 2025 Canonical Ltd
* Written by Simon Glass <simon.glass@canonical.com>
*/
#ifndef __EXT4L_H__
#define __EXT4L_H__
struct blk_desc;
struct disk_partition;
/**
* ext4l_probe() - Probe a block device for an ext4 filesystem
*
* @fs_dev_desc: Block device descriptor
* @fs_partition: Partition information
* Return: 0 on success, -EINVAL if no device or invalid magic,
* -ENOMEM on allocation failure, -EIO on read error
*/
int ext4l_probe(struct blk_desc *fs_dev_desc,
struct disk_partition *fs_partition);
/**
* ext4l_close() - Close the ext4 filesystem
*/
void ext4l_close(void);
/**
* ext4l_ls() - List directory contents
* @dirname: Directory path to list
* Return: 0 on success, negative on error
*/
int ext4l_ls(const char *dirname);
/**
* ext4l_get_uuid() - Get the filesystem UUID
* @uuid: Buffer to receive the 16-byte UUID
* Return: 0 on success, -ENODEV if not mounted
*/
int ext4l_get_uuid(u8 *uuid);
#endif /* __EXT4L_H__ */