/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
 */
#ifndef _FS_H
#define _FS_H

#include <rtc.h>

struct cmd_tbl;

#define FS_TYPE_ANY	0
#define FS_TYPE_FAT	1
#define FS_TYPE_EXT	2
#define FS_TYPE_SANDBOX	3
#define FS_TYPE_UBIFS	4
#define FS_TYPE_BTRFS	5
#define FS_TYPE_SQUASHFS 6
#define FS_TYPE_EROFS   7
#define FS_TYPE_SEMIHOSTING 8

struct blk_desc;

/**
 * do_fat_fsload - Run the fatload command
 *
 * @cmdtp: Command information for fatload
 * @flag: Command flags (CMD_FLAG\_...)
 * @argc: Number of arguments
 * @argv: List of arguments
 * Return: result (see enum command_ret_t)
 */
int do_fat_fsload(struct cmd_tbl *cmdtp, int flag, int argc,
		  char *const argv[]);

/**
 * do_ext2load - Run the ext2load command
 *
 * @cmdtp: Command information for ext2load
 * @flag: Command flags (CMD_FLAG\_...)
 * @argc: Number of arguments
 * @argv: List of arguments
 * Return: result (see enum command_ret_t)
 */
int do_ext2load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);

/*
 * Tell the fs layer which block device and partition to use for future
 * commands. This also internally identifies the filesystem that is present
 * within the partition. The identification process may be limited to a
 * specific filesystem type by passing FS_* in the fstype parameter.
 *
 * Returns 0 on success.
 * Returns non-zero if there is an error accessing the disk or partition, or
 * no known filesystem type could be recognized on it.
 */
int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype);

/**
 * fs_set_type() - Tell fs layer which filesystem type is used
 *
 * This is needed when reading from a non-block device such as sandbox. It does
 * a similar job to fs_set_blk_dev() but just sets the filesystem type instead
 * of detecting it and loading it on the block device
 *
 * @type: Filesystem type to use (FS_TYPE...)
 */
void fs_set_type(int type);

/*
 * fs_set_blk_dev_with_part - Set current block device + partition
 *
 * Similar to fs_set_blk_dev(), but useful for cases where you already
 * know the blk_desc and part number.
 *
 * Returns 0 on success.
 * Returns non-zero if invalid partition or error accessing the disk.
 */
int fs_set_blk_dev_with_part(struct blk_desc *desc, int part);

/**
 * fs_close() - Unset current block device and partition
 *
 * fs_close() closes the connection to a file system opened with either
 * fs_set_blk_dev() or fs_set_dev_with_part().
 *
 * Many file functions implicitly call fs_close(), e.g. fs_closedir(),
 * fs_exist(), fs_ln(), fs_ls(), fs_mkdir(), fs_read(), fs_size(), fs_write(),
 * fs_unlink().
 */
void fs_close(void);

/**
 * fs_get_type() - Get type of current filesystem
 *
 * Return: filesystem type
 *
 * Returns filesystem type representing the current filesystem, or
 * FS_TYPE_ANY for any unrecognised filesystem.
 */
int fs_get_type(void);

/**
 * fs_get_type_name() - Get type of current filesystem
 *
 * Return: Pointer to filesystem name
 *
 * Returns a string describing the current filesystem, or the sentinel
 * "unsupported" for any unrecognised filesystem.
 */
const char *fs_get_type_name(void);

/*
 * Print the list of files on the partition previously set by fs_set_blk_dev(),
 * in directory "dirname".
 *
 * Returns 0 on success. Returns non-zero on error.
 */
int fs_ls(const char *dirname);

/*
 * Determine whether a file exists
 *
 * Returns 1 if the file exists, 0 if it doesn't exist.
 */
int fs_exists(const char *filename);

/*
 * fs_size - Determine a file's size
 *
 * @filename: Name of the file
 * @size: Size of file
 * Return: 0 if ok with valid *size, negative on error
 */
int fs_size(const char *filename, loff_t *size);

/**
 * fs_read() - read file from the partition previously set by fs_set_blk_dev()
 *
 * Note that not all filesystem drivers support either or both of offset != 0
 * and len != 0.
 *
 * @filename:	full path of the file to read from
 * @addr:	address of the buffer to write to
 * @offset:	offset in the file from where to start reading
 * @len:	the number of bytes to read. Use 0 to read entire file.
 * @actread:	returns the actual number of bytes read
 * Return:	0 if OK with valid @actread, -1 on error conditions
 */
int fs_read(const char *filename, ulong addr, loff_t offset, loff_t len,
	    loff_t *actread);

/**
 * fs_write() - write file to the partition previously set by fs_set_blk_dev()
 *
 * Note that not all filesystem drivers support offset != 0.
 *
 * @filename:	full path of the file to write to
 * @addr:	address of the buffer to read from
 * @offset:	offset in the file from where to start writing
 * @len:	the number of bytes to write
 * @actwrite:	returns the actual number of bytes written
 * Return:	0 if OK with valid @actwrite, -1 on error conditions
 */
int fs_write(const char *filename, ulong addr, loff_t offset, loff_t len,
	     loff_t *actwrite);

/*
 * Directory entry types, matches the subset of DT_x in posix readdir()
 * which apply to u-boot.
 */
#define FS_DT_DIR  4         /* directory */
#define FS_DT_REG  8         /* regular file */
#define FS_DT_LNK  10        /* symbolic link */

#define FS_DIRENT_NAME_LEN 256

/**
 * struct fs_dirent - directory entry
 *
 * A directory entry, returned by fs_readdir(). Returns information
 * about the file/directory at the current directory entry position.
 */
struct fs_dirent {
	/** @type:		one of FS_DT_x (not a mask) */
	unsigned int type;
	/** @size:		file size */
	loff_t size;
	/** @attr:		attribute flags (FS_ATTR_*) */
	u32 attr;
	/** @create_time:	time of creation */
	struct rtc_time create_time;
	/** @access_time:	time of last access */
	struct rtc_time access_time;
	/** @change_time:	time of last modification */
	struct rtc_time change_time;
	/** @name:		file name */
	char name[FS_DIRENT_NAME_LEN];
};

/**
 * struct fs_dir_stream - Structure representing an opened directory
 *
 * Struct fs_dir_stream should be treated opaque to the user of fs layer.
 * The fields @desc and @part are used by the fs layer.
 * File system drivers pass additional private fields with the pointers
 * to this structure.
 *
 * @desc:	block device descriptor
 * @part:	partition number
 */
struct fs_dir_stream {
	struct blk_desc *desc;
	int part;
};

/**
 * fs_opendir - Open a directory
 *
 * .. note::
 *    The returned struct fs_dir_stream should be treated opaque to the
 *    user of the fs layer.
 *
 * @filename: path to the directory to open
 * Return:
 * A pointer to the directory stream or NULL on error and errno set
 * appropriately
 */
struct fs_dir_stream *fs_opendir(const char *filename);

/**
 * fs_readdir - Read the next directory entry in the directory stream.
 *
 * fs_readir works in an analogous way to posix readdir().
 * The previously returned directory entry is no longer valid after calling
 * fs_readdir() again.
 * After fs_closedir() is called, the returned directory entry is no
 * longer valid.
 *
 * @dirs: the directory stream
 * Return:
 * the next directory entry (only valid until next fs_readdir() or
 * fs_closedir() call, do not attempt to free()) or NULL if the end of
 * the directory is reached.
 */
struct fs_dirent *fs_readdir(struct fs_dir_stream *dirs);

/**
 * fs_closedir - close a directory stream
 *
 * @dirs: the directory stream
 */
void fs_closedir(struct fs_dir_stream *dirs);

/**
 * fs_unlink - delete a file or directory
 *
 * If a given name is a directory, it will be deleted only if it's empty
 *
 * @filename: Name of file or directory to delete
 * Return: 0 on success, -1 on error conditions
 */
int fs_unlink(const char *filename);

/**
 * fs_mkdir - Create a directory
 *
 * @filename: Name of directory to create
 * Return: 0 on success, -1 on error conditions
 */
int fs_mkdir(const char *filename);

/*
 * Common implementation for various filesystem commands, optionally limited
 * to a specific filesystem type via the fstype parameter.
 */
int do_size(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
	    int fstype);
int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
	    int fstype);
int do_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
	  int fstype);
int file_exists(const char *dev_type, const char *dev_part, const char *file,
		int fstype);
int do_save(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
	    int fstype);
int do_rm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
	  int fstype);
int do_mkdir(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
	     int fstype);
int do_ln(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
	  int fstype);

/*
 * Determine the UUID of the specified filesystem and print it. Optionally it is
 * possible to store the UUID directly in env.
 */
int do_fs_uuid(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
	       int fstype);

/*
 * Determine the type of the specified filesystem and print it. Optionally it is
 * possible to store the type directly in env.
 */
int do_fs_type(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);

/**
 * do_fs_types - List supported filesystems.
 *
 * @cmdtp: Command information for fstypes
 * @flag: Command flags (CMD_FLAG\_...)
 * @argc: Number of arguments
 * @argv: List of arguments
 * Return: result (see enum command_ret_t)
 */
int do_fs_types(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]);

/**
 * fs_read_alloc() - Allocate space for a file and read it
 *
 * You must call fs_set_blk_dev() or a similar function before calling this,
 * since that sets up the block device to use.
 *
 * The file is terminated with a nul character
 *
 * @fname: Filename to read
 * @size: Size of file to read (must be correct!)
 * @align: Alignment to use for memory allocation (0 for default)
 * @bufp: On success, returns the allocated buffer with the nul-terminated file
 *	in it
 * Return: 0 if OK, -ENOMEM if out of memory, -EIO if read failed
 */
int fs_read_alloc(const char *fname, ulong size, uint align, void **bufp);

/**
 * fs_load_alloc() - Load a file into allocated space
 *
 * The file is terminated with a nul character
 *
 * @ifname: Interface name to read from (e.g. "mmc")
 * @dev_part_str: Device and partition string (e.g. "1:2")
 * @fname: Filename to read
 * @max_size: Maximum allowed size for the file (use 0 for 1GB)
 * @align: Alignment to use for memory allocation (0 for default)
 * @bufp: On success, returns the allocated buffer with the nul-terminated file
 *	in it
 * @sizep: On success, returns the size of the file
 * Return: 0 if OK, -ENOMEM if out of memory, -ENOENT if the file does not
 * exist, -ENOMEDIUM if the device does not exist, -E2BIG if the file is too
 * large (greater than @max_size), -EIO if read failed
 */
int fs_load_alloc(const char *ifname, const char *dev_part_str,
		  const char *fname, ulong max_size, ulong align, void **bufp,
		  ulong *sizep);

#endif /* _FS_H */
