Files
u-boot/include/ext4l.h
Simon Glass 73848983f5 ext4l: Add uuid() support
The filesystem uuid method is not implemented.

Add ext4l_uuid() which returns the filesystem UUID as a string and
wire it into the filesystem operations table. Add a test.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-27 13:35:43 -07:00

114 lines
2.8 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;
struct fs_dir_stream;
struct fs_dirent;
/**
* 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_exists() - Check if a file or directory exists
*
* @filename: Path to check
* Return: 1 if exists, 0 if not
*/
int ext4l_exists(const char *filename);
/**
* ext4l_size() - Get the size of a file
*
* @filename: Path to file
* @sizep: Returns the file size
* Return: 0 on success, negative on error
*/
int ext4l_size(const char *filename, loff_t *sizep);
/**
* ext4l_read() - Read data from a file
*
* @filename: Path to file
* @buf: Buffer to read data into
* @offset: Byte offset to start reading from
* @len: Number of bytes to read (0 = read entire file from offset)
* @actread: Returns actual bytes read
* Return: 0 on success, negative on error
*/
int ext4l_read(const char *filename, void *buf, loff_t offset, loff_t len,
loff_t *actread);
/**
* 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);
/**
* ext4l_uuid() - Get the filesystem UUID as a string
*
* @uuid_str: Buffer to receive the UUID string (must be at least 37 bytes)
* Return: 0 on success, -ENODEV if not mounted
*/
int ext4l_uuid(char *uuid_str);
/**
* ext4l_opendir() - Open a directory for iteration
*
* @filename: Directory path
* @dirsp: Returns directory stream pointer
* Return: 0 on success, -ENODEV if not mounted, -ENOTDIR if not a directory,
* -ENOMEM on allocation failure
*/
int ext4l_opendir(const char *filename, struct fs_dir_stream **dirsp);
/**
* ext4l_readdir() - Read the next directory entry
*
* @dirs: Directory stream from ext4l_opendir
* @dentp: Returns pointer to directory entry
* Return: 0 on success, -ENODEV if not mounted, -ENOENT at end of directory
*/
int ext4l_readdir(struct fs_dir_stream *dirs, struct fs_dirent **dentp);
/**
* ext4l_closedir() - Close a directory stream
*
* @dirs: Directory stream to close
*/
void ext4l_closedir(struct fs_dir_stream *dirs);
#endif /* __EXT4L_H__ */