fs: Create a header file for filesystem-related commands
Most commands access the filesystem through the command-line interface rather than the filesystem API itself. Add a new header file which contains these functions, so we can separate commands from the API. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <command.h>
|
||||
#include <fs_legacy.h>
|
||||
#include <fs_cmd.h>
|
||||
#include <erofs.h>
|
||||
|
||||
static int do_erofs_ls(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* Ext2fs support
|
||||
*/
|
||||
#include <command.h>
|
||||
#include <fs_legacy.h>
|
||||
#include <fs_cmd.h>
|
||||
|
||||
static int do_ext2ls(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <ext4fs.h>
|
||||
#include <linux/stat.h>
|
||||
#include <malloc.h>
|
||||
#include <fs_legacy.h>
|
||||
#include <fs_cmd.h>
|
||||
|
||||
#if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE)
|
||||
#include <usb.h>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <command.h>
|
||||
#include <mapmem.h>
|
||||
#include <fat.h>
|
||||
#include <fs_legacy.h>
|
||||
#include <fs_cmd.h>
|
||||
#include <part.h>
|
||||
#include <asm/cache.h>
|
||||
|
||||
|
||||
2
cmd/fs.c
2
cmd/fs.c
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <command.h>
|
||||
#include <fs_legacy.h>
|
||||
#include <fs_cmd.h>
|
||||
|
||||
static int do_size_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <command.h>
|
||||
#include <fs_cmd.h>
|
||||
#include <fs_legacy.h>
|
||||
|
||||
static int do_fs_uuid_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <command.h>
|
||||
#include <dm.h>
|
||||
#include <fs_legacy.h>
|
||||
#include <fs_cmd.h>
|
||||
#include <part.h>
|
||||
#include <sandbox_host.h>
|
||||
#include <dm/device_compat.h>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <config.h>
|
||||
#include <command.h>
|
||||
#include <fdtdec.h>
|
||||
#include <fs_legacy.h>
|
||||
#include <fs_cmd.h>
|
||||
#include <log.h>
|
||||
#include <mapmem.h>
|
||||
#include <memalign.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <command.h>
|
||||
#include <fs_legacy.h>
|
||||
#include <fs_cmd.h>
|
||||
#include <squashfs.h>
|
||||
|
||||
static int do_sqfs_ls(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <command.h>
|
||||
#include <fs_legacy.h>
|
||||
#include <fs_cmd.h>
|
||||
#include <log.h>
|
||||
#include <vsprintf.h>
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#ifndef _EROFS_H_
|
||||
#define _EROFS_H_
|
||||
|
||||
struct blk_desc;
|
||||
struct disk_partition;
|
||||
struct fs_dirent;
|
||||
struct fs_dir_stream;
|
||||
|
||||
int erofs_opendir(const char *filename, struct fs_dir_stream **dirsp);
|
||||
int erofs_readdir(struct fs_dir_stream *dirs, struct fs_dirent **dentp);
|
||||
|
||||
83
include/fs_cmd.h
Normal file
83
include/fs_cmd.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _FS_CMD_H
|
||||
#define _FS_CMD_H
|
||||
|
||||
#include <fs_common.h>
|
||||
|
||||
struct cmd_tbl;
|
||||
|
||||
/**
|
||||
* 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[]);
|
||||
|
||||
/*
|
||||
* 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);
|
||||
int do_mv(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[]);
|
||||
|
||||
#endif
|
||||
@@ -9,33 +9,9 @@
|
||||
#include <rtc.h>
|
||||
|
||||
struct abuf;
|
||||
struct cmd_tbl;
|
||||
|
||||
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
|
||||
@@ -225,53 +201,6 @@ int fs_mkdir(const char *filename);
|
||||
*/
|
||||
int fs_rename(const char *old_path, const char *new_path);
|
||||
|
||||
/*
|
||||
* 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);
|
||||
int do_mv(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
|
||||
*
|
||||
|
||||
@@ -10,7 +10,10 @@
|
||||
#ifndef _SQFS_H_
|
||||
#define _SQFS_H_
|
||||
|
||||
struct blk_desc;
|
||||
struct disk_partition;
|
||||
struct fs_dirent;
|
||||
struct fs_dir_stream;
|
||||
|
||||
int sqfs_opendir(const char *filename, struct fs_dir_stream **dirsp);
|
||||
int sqfs_readdir(struct fs_dir_stream *dirs, struct fs_dirent **dentp);
|
||||
|
||||
Reference in New Issue
Block a user